From e251cf95eed73baf2a466e88f6d7ebdb398fb918 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 15:19:24 -0400 Subject: [PATCH 001/521] Initial checkin Initial checkin using new rep --- PySimpleGUI.py | 1666 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1666 insertions(+) create mode 100644 PySimpleGUI.py diff --git a/PySimpleGUI.py b/PySimpleGUI.py new file mode 100644 index 000000000..995c6f5c9 --- /dev/null +++ b/PySimpleGUI.py @@ -0,0 +1,1666 @@ +#!/usr/bin/env Python3 +import tkinter as tk +from tkinter import filedialog +from tkinter import ttk +import tkinter.scrolledtext as tkst +import tkinter.font +from random import randint +import datetime +import sys +import textwrap + + +# ----====----====----==== Constants the use CAN safely change ====----====----====----# +DEFAULT_WINDOW_ICON = '' +DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS +DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term +DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels +DEFAULT_AUTOSIZE_TEXT = False +DEFAULT_FONT = ("Helvetica", 10) + +DEFAULT_BORDER_WIDTH = 7 +DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form +MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 +#################### COLOR STUFF #################### +BLUES = ("#082567","#0A37A3","#00345B") +PURPLES = ("#480656","#4F2398","#380474") +GREENS = ("#01826B","#40A860","#96D2AB", "#00A949","#003532") +YELLOWS = ("#F3FB62", "#F0F595") +TANS = ("#FFF9D5","#F4EFCF","#DDD8BA") +NICE_BUTTON_COLORS = ((GREENS[3], TANS[0]), ('#000000','#FFFFFF'),('#FFFFFF', '#000000'), (YELLOWS[0], PURPLES[1]), + (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) +# DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember +# DEFAULT_BUTTON_COLOR = (GREENS[3], TANS[0]) # Foreground, Background (None, None) == System Default +DEFAULT_BUTTON_COLOR = (YELLOWS[0], GREENS[4]) # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[2]) # Foreground, Background (None, None) == System Default +DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") +DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) +BarColor=() +# DEFAULT_PROGRESS_BAR_COLOR = (GREENS[2], GREENS[0]) # a nice green progress bar +DEFAULT_PROGRESS_BAR_COLOR = (GREENS[3], GREENS[3]) # a nice green progress bar +# DEFAULT_PROGRESS_BAR_COLOR = (BLUES[1], BLUES[1]) # a nice green progress bar +# DEFAULT_PROGRESS_BAR_COLOR = (BLUES[0], BLUES[0]) # a nice green progress bar +# DEFAULT_PROGRESS_BAR_COLOR = (PURPLES[1],PURPLES[0]) # a nice purple progress bar +DEFAULT_PROGRESS_BAR_SIZE = (30,25) # Size of Progress Bar (characters for length, pixels for width) +DEFAULT_PROGRESS_BAR_BORDER_WIDTH=8 +DEFAULT_PROGRESS_BAR_RELIEF = tk.SUNKEN +DEFAULT_PROGRESS_BAR_STYLE = 'default' +DEFAULT_METER_ORIENTATION = 'Horizontal' +# DEFAULT_METER_ORIENTATION = 'Vertical' +# ----====----====----==== Constants the user should NOT f-with ====----====----====----# +ThisRow = 555666777 # magic number +# Progress Bar Relief Choices +# -relief +RAISED='raised' +SUNKEN='sunken' +FLAT='flat' +RIDGE='ridge' +GROOVE='groove' +SOLID = 'solid' + +PROGRESS_BAR_STYLES = ('default','winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative') +# DEFAULT_WINDOW_ICON = '' +MESSAGE_BOX_LINE_WIDTH = 60 + +# a shameful global variable. This represents the top-level window information. Needed because opening a second window is different than opening the first. +class MyWindows(): + def __init__(self): + self.NumOpenWindows = 0 + self.user_defined_icon = None + +_my_windows = MyWindows() # terrible hack using globals... means need a class for collecing windows + +# ====================================================================== # +# One-liner functions that are handy as f_ck # +# ====================================================================== # +def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) + +# ====================================================================== # +# Enums for types # +# ====================================================================== # +# ------------------------- Button types ------------------------- # +#todo Consider removing the Submit, Cancel types... they are just 'RETURN' type in reality +#uncomment this line and indent to go back to using Enums +# class ButtonType(Enum): +BROWSE_FOLDER = 1 +BROWSE_FILE = 2 +CLOSES_WIN = 5 +READ_FORM = 7 + +# ------------------------- Element types ------------------------- # +# class ElementType(Enum): +TEXT = 1 +INPUT_TEXT = 20 +INPUT_COMBO = 21 +INPUT_RADIO = 5 +INPUT_MULTILINE = 7 +INPUT_CHECKBOX = 8 +INPUT_SPIN = 9 +BUTTON = 3 +OUTPUT = 300 +PROGRESS_BAR = 200 +BLANK = 100 + +# ------------------------- MsgBox Buttons Types ------------------------- # +MSG_BOX_YES_NO = 1 +MSG_BOX_CANCELLED = 2 +MSG_BOX_ERROR = 3 +MSG_BOX_OK_CANCEL = 4 +MSG_BOX_OK = 0 + +# ---------------------------------------------------------------------- # +# Cascading structure.... Objects get larger # +# Button # +# Element # +# Row # +# Form # +# ---------------------------------------------------------------------- # +# ------------------------------------------------------------------------- # +# Element CLASS # +# ------------------------------------------------------------------------- # +class Element(): + def __init__(self, Type, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None): + self.Size = Size + self.Type = Type + self.AutoSizeText = AutoSizeText + self.Scale = Scale + self.Pad = DEFAULT_ELEMENT_PADDING + self.Font = Font + + self.TKStringVar = None + self.TKIntVar = None + self.TKText = None + self.TKEntry = None + + self.ParentForm=None + self.TextInputDefault = None + self.Position = (0,0) # Default position Row 0, Col 0 + return + + def __del__(self): + try: + self.TKStringVar.__del__() + except: + pass + try: + self.TKIntVar.__del__() + except: + pass + try: + self.TKText.__del__() + except: + pass + try: + self.TKEntry.__del__() + except: + pass + +# ---------------------------------------------------------------------- # +# Input Class # +# ---------------------------------------------------------------------- # +class InputText(Element): + + def __init__(self, DefaultText = '', Scale=(None, None), Size=(None, None), AutoSizeText=None): + self.DefaultText = DefaultText + super().__init__(INPUT_TEXT, Scale, Size, AutoSizeText) + return + + def ReturnKeyHandler(self, event): + MyForm = self.ParentForm + # search through this form and find the first button that will exit the form + for row in MyForm.Rows: + for element in row.Elements: + if element.Type == BUTTON: + if element.BType == CLOSES_WIN or element.BType == READ_FORM: + element.ButtonCallBack() + return + def __del__(self): + super().__del__() + +# ---------------------------------------------------------------------- # +# Combo # +# ---------------------------------------------------------------------- # +class InputCombo(Element): + + def __init__(self, Values, Scale=(None, None), Size=(None, None), AutoSizeText=None): + self.Values = Values + self.TKComboBox = None + super().__init__(INPUT_COMBO, Scale, Size, AutoSizeText) + return + + def __del__(self): + try: + self.TKComboBox.__del__() + except: + pass + super().__del__() + +# ---------------------------------------------------------------------- # +# Radio # +# ---------------------------------------------------------------------- # +class Radio(Element): + def __init__(self, Text, GroupID, Default=False, Scale=(None, None), Size=(None, None), AutoSizeText=None,Font=None): + self.InitialState = Default + self.Text = Text + self.TKRadio = None + self.GroupID = GroupID + self.Value = None + super().__init__(INPUT_RADIO, Scale, Size, AutoSizeText, Font) + return + + def __del__(self): + try: + self.TKRadio.__del__() + except: + pass + super().__del__() + +# ---------------------------------------------------------------------- # +# Checkbox # +# ---------------------------------------------------------------------- # +class Checkbox(Element): + def __init__(self, Text, Default=False, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None): + self.Text = Text + self.InitialState = Default + self.Value = None + self.TKCheckbox = None + + super().__init__(INPUT_CHECKBOX, Scale, Size, AutoSizeText, Font) + return + + def __del__(self): + try: + self.TKCheckbox.__del__() + except: + pass + super().__del__() + +# ---------------------------------------------------------------------- # +# Spin # +# ---------------------------------------------------------------------- # + +class Spin(Element): + # Values = None + # TKSpinBox = None + def __init__(self, Values, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, InitialValue=None): + self.Values = Values + self.DefaultValue = InitialValue + self.TKSpinBox = None + super().__init__(INPUT_SPIN, Scale, Size, AutoSizeText, Font=Font) + return + + def __del__(self): + try: + self.TKSpinBox.__del__() + except: + pass + super().__del__() + +# ---------------------------------------------------------------------- # +# Multiline # +# ---------------------------------------------------------------------- # +class Multiline(Element): + def __init__(self, DefaultText='', EnterSubmits = False, Scale=(None, None), Size=(None, None), AutoSizeText=None): + self.DefaultText = DefaultText + self.EnterSubmits = EnterSubmits + super().__init__(INPUT_MULTILINE, Scale, Size, AutoSizeText) + return + + def ReturnKeyHandler(self, event): + MyForm = self.ParentForm + # search through this form and find the first button that will exit the form + for row in MyForm.Rows: + for element in row.Elements: + if element.Type == BUTTON: + if element.BType == CLOSES_WIN or element.BType == READ_FORM: + element.ButtonCallBack() + return + + def __del__(self): + super().__del__() + +# ---------------------------------------------------------------------- # +# Text # +# ---------------------------------------------------------------------- # +class Text(Element): + def __init__(self, Text, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, TextColor=None): + self.DisplayText = Text + self.TextColor = TextColor if TextColor else 'black' + # self.Font = Font if Font else DEFAULT_FONT + super().__init__(TEXT, Scale, Size, AutoSizeText, Font=Font if Font else DEFAULT_FONT) + return + + def Update(self, NewValue): + self.DisplayText=NewValue + stringvar = self.TKStringVar + stringvar.set(NewValue) + + def __del__(self): + super().__del__() + + +# ---------------------------------------------------------------------- # +# TKProgressBar # +# Emulate the TK ProgressBar using canvas and rectangles +# ---------------------------------------------------------------------- # + +class TKProgressBar(): + def __init__(self, root, Max, Length=400, Width=20, Highlightt=0, Relief='sunken', Borderwidth=4, Orientation='horizontal', BarColor=DEFAULT_PROGRESS_BAR_COLOR): + self.Length = Length + self.Width = Width + self.Max = Max + self.Orientation = Orientation + self.Count = None + self.PriorCount = 0 + if Orientation[0].lower() == 'h': + self.TKCanvas = tk.Canvas(root, width=Length, height=Width, highlightt=Highlightt, relief=Relief, borderwidth=Borderwidth) + self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(Length * 1.5), Width * 1.5, fill=BarColor[0], tags='bar') + # self.canvas.pack(padx='10') + else: + self.TKCanvas = tk.Canvas(root, width=Width, height=Length, highlightt=Highlightt, relief=Relief, borderwidth=Borderwidth) + self.TKRect = self.TKCanvas.create_rectangle(Width * 1.5, 2 * Length + 40, 0, Length * .5, fill=BarColor[0], tags='bar') + # self.canvas.pack() + + def Update(self,Count): + if Count > self.Max: return + if self.Orientation[0].lower() == 'h': + try: + if Count != self.PriorCount: + delta = Count - self.PriorCount + self.TKCanvas.move(self.TKRect, delta*(self.Length / self.Max), 0) + if 0: self.TKCanvas.update() + except: + return False # the window was closed by the user on us + else: + try: + if Count != self.PriorCount: + delta = Count - self.PriorCount + self.TKCanvas.move(self.TKRect, 0, delta*(-self.Length / self.Max)) + if 0: self.TKCanvas.update() + except: + return False # the window was closed by the user on us + self.PriorCount = Count + return True + + def __del__(self): + try: + self.TKCanvas.__del__() + self.TKRect.__del__() + except: + pass + +# ---------------------------------------------------------------------- # +# Output # +# New Type of Widget that's a Text Widget in disguise # +# ---------------------------------------------------------------------- # +class TKOutput(tk.Frame): + ''' Demonstrate python interpreter output in Tkinter Text widget +type python expression in the entry, hit DoIt and see the results +in the text pane.''' + # previous_stderr = None + # previous_stdout = None + def __init__(self, parent, width, height, bd): + tk.Frame.__init__(self, parent) + self.output = tk.Text(parent, width=width, height=height, bd=bd) + + self.vsb = tk.Scrollbar(parent, orient="vertical", command=self.output.yview) + self.vsb.pack(side="right", fill="y") + self.output.configure(yscrollcommand=self.vsb.set) + self.output.pack(side="left", fill="both", expand=True) + self.previous_stdout = sys.stdout + self.previous_stderr = sys.stderr + + sys.stdout = self + sys.stderr = self + self.pack() + + def write(self, txt): + try: + self.output.insert(tk.END, str(txt)) + self.output.see(tk.END) + except: + pass + + def Close(self): + sys.stdout = self.previous_stdout + sys.stderr = self.previous_stderr + + def flush(self): + sys.stdout = self.previous_stdout + sys.stderr = self.previous_stderr + + def __del__(self): + sys.stdout = self.previous_stdout + +class Output(Element): + def __init__(self, Scale=(None, None), Size=(None, None)): + self.TKOut = None + super().__init__(OUTPUT, Scale, Size) + + def __del__(self): + try: + self.TKOut.__del__() + except: + pass + super().__del__() + +# ---------------------------------------------------------------------- # +# Button Class # +# ---------------------------------------------------------------------- # +class Button(Element): + def __init__(self, ButtonType=CLOSES_WIN, Target=(None, None), Text ='', FileTypes=(("ALL Files", "*.*"),), Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): + self.BType = ButtonType + self.FileTypes = FileTypes + self.TKButton = None + self.Target = Target + self.Text = Text + self.ButtonColor = ButtonColor if ButtonColor else DEFAULT_BUTTON_COLOR + self.UserData = None + super().__init__(BUTTON, Scale, Size, AutoSizeText, Font=Font) + return + + # ------- Button Callback ------- # + def ButtonCallBack(self): + global _my_windows + # Buttons modify targets or return from the form + # If modifying target, get the element object at the target and modify its StrVar + target = self.Target + if target[0] == ThisRow: + target = [self.Position[0], target[1]] + if target[1] < 0: + target[1] = self.Position[1] + target[1] + strvar = None + if target[0] != None: + target_element = self.ParentForm.GetElementAtLocation(target) + try: + strvar = target_element.TKStringVar + except: pass + else: + strvar = None + filetypes = [] if self.FileTypes is None else self.FileTypes + if self.BType == BROWSE_FOLDER: + folder_name = tk.filedialog.askdirectory() # show the 'get folder' dialog box + try: + strvar.set(folder_name) + except: pass + elif self.BType == BROWSE_FILE: + file_name = tk.filedialog.askopenfilename(filetypes=filetypes) # show the 'get file' dialog box + strvar.set(file_name) + elif self.BType == CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window + # first, get the results table built + # modify the Results table in the parent FlexForm object + r,c = self.Position + self.ParentForm.Results[r][c] = True # mark this button's location in results + # if the form is tabbed, must collect all form's results and destroy all forms + if self.ParentForm.IsTabbedForm: + self.ParentForm.UberParent.Close() + else: + self.ParentForm.Close() + self.ParentForm.TKroot.quit() + if self.ParentForm.NonBlocking: + self.ParentForm.TKroot.destroy() + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + elif self.BType == READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE + # first, get the results table built + # modify the Results table in the parent FlexForm object + r,c = self.Position + self.ParentForm.Results[r][c] = True # mark this button's location in results + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + return + + def ReturnKeyHandler(self, event): + MyForm = self.ParentForm + # search through this form and find the first button that will exit the form + for row in MyForm.Rows: + for element in row.Elements: + if element.Type == BUTTON: + if element.BType == CLOSES_WIN or element.BType == READ_FORM: + element.ButtonCallBack() + return + + def __del__(self): + try: + self.TKButton.__del__() + except: + pass + super().__del__() + +# ---------------------------------------------------------------------- # +# ProgreessBar # +# ---------------------------------------------------------------------- # +class ProgressBar(Element): + def __init__(self, MaxValue, Orientation=None, Target=(None,None), Scale=(None, None), Size=(None, None), AutoSizeText=None, BarColor=(None,None), Style=None, BorderWidth=None, Relief=None): + self.MaxValue = MaxValue + self.TKProgressBar = None + self.Cancelled = False + self.NotRunning = True + self.Orientation = Orientation if Orientation else DEFAULT_METER_ORIENTATION + self.BarColor = BarColor + self.BarStyle = Style if Style else DEFAULT_PROGRESS_BAR_STYLE + self.Target = Target + self.BorderWidth = BorderWidth if BorderWidth else DEFAULT_PROGRESS_BAR_BORDER_WIDTH + self.Relief = Relief if Relief else DEFAULT_PROGRESS_BAR_RELIEF + self.BarExpired = False + super().__init__(PROGRESS_BAR, Scale, Size, AutoSizeText) + return + + def UpdateBar(self, CurrentCount): + if self.ParentForm.TKrootDestroyed: + return False + target = self.Target + if target[0] != None: # if there's a target, get it and update the strvar + target_element = self.ParentForm.GetElementAtLocation(target) + strvar = target_element.TKStringVar + rc = strvar.set(self.TextToDisplay) + # update the progress bar counter + # self.TKProgressBar['value'] = self.CurrentValue + + self.TKProgressBar.Update(CurrentCount) + try: + self.ParentForm.TKroot.update() + except: + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + return False + return True + + def __del__(self): + try: + self.TKProgressBar.__del__() + except: + pass + super().__del__() + +# ------------------------------------------------------------------------- # +# Row CLASS # +# ------------------------------------------------------------------------- # +class Row(): + def __init__(self, AutoSizeText = None): + self.AutoSizeText = AutoSizeText # Setting to override the form's policy on autosizing. + self.Elements = [] # List of Elements in this Rrow + return + + # ------------------------- AddElement ------------------------- # + def AddElement(self, element): + self.Elements.append(element) + return + + # ------------------------- Print ------------------------- # + def __str__(self): + outstr = '' + for i, element in enumerate(self.Elements): + outstr += 'Element #%i = %s'%(i,element) + # outstr += f'Element #{i} = {element}' + return outstr + +# ------------------------------------------------------------------------- # +# FlexForm CLASS # +# ------------------------------------------------------------------------- # +class FlexForm: + ''' + Display a user defined for and return the filled in data + ''' + def __init__(self, title, DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), AutoSizeText=DEFAULT_AUTOSIZE_TEXT, Scale=(None, None),Size=(None, None), Location=(None, None), ButtonColor=None, Font=None, ProgressBarColor=(None,None), IsTabbedForm=False,BorderDepth=None, AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Icon=DEFAULT_WINDOW_ICON): + self.AutoSizeText = AutoSizeText + self.Title = title + self.Rows = [] # a list of ELEMENTS for this row + self.DefaultElementSize = DefaultElementSize + self.Size = Size + self.Scale = Scale + self.Location = Location + self.ButtonColor = ButtonColor if ButtonColor else DEFAULT_BUTTON_COLOR + self.IsTabbedForm = IsTabbedForm + self.ParentWindow = None + self.Font = Font if Font else DEFAULT_FONT + self.RadioDict = {} + self.BorderDepth = BorderDepth + self.WindowIcon = Icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon + self.AutoClose = AutoClose + self.NonBlocking = False + self.TKroot = None + self.TKrootDestroyed = False + self.TKAfterID = None + self.ProgressBarColor = ProgressBarColor + self.AutoCloseDuration = AutoCloseDuration + self.UberParent = None + self.RootNeedsDestroying = False + self.Shown = False + self.ReturnValues = None + + # ------------------------- Add ONE Row to Form ------------------------- # + def AddRow(self, *args,AutoSizeText=None): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = Row(AutoSizeText) # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + CurrentRow.Elements.append(element) + CurrentRow.AutoSizeText = AutoSizeText + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + # ------------------------- Add Multiple Rows to Form ------------------------- # + def AddRows(self,rows): + for row in rows: + self.AddRow(*row) + + def LayoutAndShow(self,rows): + self.AddRows(rows) + self.Show() + return self.ReturnValues + + # ------------------------- ShowForm THIS IS IT! ------------------------- # + def Show(self, NonBlocking=False): + self.Shown = True + # Compute num rows & num cols (it'll come in handy debugging) + self.NumRows = len(self.Rows) + self.NumCols = max(len(row.Elements) for row in self.Rows) + self.NonBlocking=NonBlocking + + # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## + StartupTK(self) + return self.ReturnValues + + # ------------------------- SetIcon - set the window's fav icon ------------------------- # + def SetIcon(self, Icon): + self.WindowIcon = Icon + try: + self.TKroot.iconbitmap(Icon) + except: pass + + def GetElementAtLocation(self,Location): + (row_num,col_num) = Location + row = self.Rows[row_num] + element = row.Elements[col_num] + return element + + def GetDefaultElementSize(self): + return self.DefaultElementSize + + def AutoCloseAlarmCallback(self): + try: + if self.UberParent: + window = self.UberParent + else: + window = self + if window: + window.Close() + self.TKroot.quit() + self.RootNeedsDestroying = True + except: + pass + + def Read(self): + if self.TKrootDestroyed: return None + if not self.TKrootDestroyed and not self.Shown: + self.Show() + elif not self.TKrootDestroyed: + self.TKroot.mainloop() + if self.RootNeedsDestroying: + self.TKroot.destroy() + return(BuildResults(self)) + + def OutputFlush(self, Message=''): + if self.TKrootDestroyed: return None + if Message: + print(Message) + try: + self.TKroot.update() + except: + self.TKrootDestroyed = True + return(BuildResults(self)) + + def Close(self): + try: + self.TKroot.update() + except: pass + results = BuildResults(self) + if self.TKrootDestroyed: + return results + self.TKrootDestroyed = True + self.RootNeedsDestroying = True + return results + + def OnClosingCallback(self): + return + + def __enter__(self): + return self + + def __exit__(self, *a): + self.__del__() + return self + + def __del__(self): + for row in self.Rows: + for element in row.Elements: + element.__del__() + try: + del(self.TKroot) + except: + pass + +# ------------------------------------------------------------------------- # +# UberForm CLASS # +# Used to make forms into TABS (it's trick) # +# ------------------------------------------------------------------------- # +class UberForm(): + FormList = None # list of all the forms in this window + FormReturnValues = None + TKroot = None # tk root for the overall window + TKrootDestroyed = False + def __init__(self): + self.FormList = [] + self.FormReturnValues = [] + self.TKroot = None + self.TKrootDestroyed = False + + def AddForm(self, Form): + self.FormList.append(Form) + + def Close(self): + self.FormReturnValues = [] + for form in self.FormList: + form.Close() + self.FormReturnValues.append(form.ReturnValues) + if not self.TKrootDestroyed: + self.TKrootDestroyed = True + self.TKroot.destroy() + + def __del__(self): + return + +# ====================================================================== # +# BUTTON Lazy Functions # +# ====================================================================== # + +# ------------------------- INPUT TEXT Element lazy functions ------------------------- # +def In(DefaultText = '', Scale=(None, None), Size=(None, None), AutoSizeText=None): + return InputText(DefaultText=DefaultText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText) + +def Input(DefaultText = '', Scale=(None, None), Size=(None, None), AutoSizeText=None): + return InputText(DefaultText=DefaultText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText) + +# ------------------------- TEXT Element lazy functions ------------------------- # +def Txt(DisplayText, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, TextColor=None): + return Text(DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, Font=Font, TextColor=TextColor) + +def T(DisplayText, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, TextColor=None): + return Text(DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, Font=Font, TextColor=TextColor) + +# ------------------------- FOLDER BROWSE Element lazy function ------------------------- # +def FolderBrowse(Target=(ThisRow, -1), DisplayText='Browse', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(BROWSE_FOLDER, Target=Target, Text=DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- FILE BROWSE Element lazy function ------------------------- # +def FileBrowse(Target=(ThisRow, -1), FileTypes=(("ALL Files", "*.*"),),ButtonText='Browse',Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(BROWSE_FILE, Target, Text=ButtonText, FileTypes=FileTypes, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # +def Submit(ButtonText='Submit', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- OK BUTTON Element lazy function ------------------------- # +def OK(ButtonText='OK', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- YES BUTTON Element lazy function ------------------------- # +def Ok(ButtonText='Ok', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- CANCEL BUTTON Element lazy function ------------------------- # +def Cancel(ButtonText='Cancel', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): + return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) + +# ------------------------- YES BUTTON Element lazy function ------------------------- # +def Yes(ButtonText='Yes', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- NO BUTTON Element lazy function ------------------------- # +def No(ButtonText='No', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + +# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +# this is the only button that REQUIRES button text field +def SimpleButton(Text, Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): + return Button(CLOSES_WIN, Text=Text, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) + +# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +# this is the only button that REQUIRES button text field +def ReadFormButton(ButtonText, Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): + return Button(READ_FORM, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) + +#------------------------------------------------------------------------------------------------------# +# ------- FUNCTION InitializeResults. Sets up form results matrix ------- # +def InitializeResults(form): + # initial results for elements are: + # TEXT - None + # INPUT - Initial value + # Button - False + results = [] + return_vals = [] + for row_num,row in enumerate(form.Rows): + r = [] + for element in row.Elements: + if element.Type == TEXT: + r.append(None) + elif element.Type == INPUT_TEXT: + r.append(element.TextInputDefault) + return_vals.append(None) + elif element.Type == INPUT_MULTILINE: + r.append(element.TextInputDefault) + return_vals.append(None) + elif element.Type == BUTTON: + r.append(False) + elif element.Type == PROGRESS_BAR: + r.append(None) + elif element.Type == INPUT_CHECKBOX: + r.append(element.InitialState) + return_vals.append(element.InitialState) + elif element.Type == INPUT_RADIO: + r.append(element.InitialState) + return_vals.append(element.InitialState) + elif element.Type == INPUT_COMBO: + r.append(element.TextInputDefault) + return_vals.append(None) + elif element.Type == INPUT_SPIN: + r.append(element.TextInputDefault) + return_vals.append(None) + results.append(r) + form.Results=results + form.ReturnValues = (None, return_vals) + return + +#===== Radio Button RadVar encoding and decoding =====# +#===== The value is simply the row * 1000 + col =====# +def DecodeRadioRowCol(RadValue): + row = RadValue//1000 + col = RadValue%1000 + return row,col + +def EncodeRadioRowCol(Row, Col): + RadValue = Row*1000 + Col + return RadValue + +# ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # +# format of return values is +# (Button Pressed, input_values) +def BuildResults(form): + # Results for elements are: + # TEXT - Nothing + # INPUT - Read value from TK + # Button - Button Text and position as a Tuple + + # Get the initialized results so we don't have to rebuild + results=form.Results + button_pressed_text = None + input_values = [] + for row_num,row in enumerate(form.Rows): + for col_num, element in enumerate(row.Elements): + if element.Type == INPUT_TEXT: + value=element.TKStringVar.get() + results[row_num][col_num] = value + input_values.append(value) + elif element.Type == INPUT_CHECKBOX: + value=element.TKIntVar.get() + results[row_num][col_num] = value + input_values.append(value != 0) + elif element.Type == INPUT_RADIO: + RadVar=element.TKIntVar.get() + this_rowcol = EncodeRadioRowCol(row_num,col_num) + value = RadVar == this_rowcol + results[row_num][col_num] = value + input_values.append(value) + elif element.Type == BUTTON: + if results[row_num][col_num] is True: + button_pressed_text = element.Text + results[row_num][col_num] = False + elif element.Type == INPUT_COMBO: + value=element.TKStringVar.get() + results[row_num][col_num] = value + input_values.append(value) + elif element.Type == INPUT_SPIN: + try: + value=element.TKStringVar.get() + except: + value = 0 + results[row_num][col_num] = value + input_values.append(value) + elif element.Type == INPUT_MULTILINE: + try: + value=element.TKText.get(1.0, tk.END) + element.TKText.delete('1.0', tk.END) + except: + value = None + results[row_num][col_num] = value + input_values.append(value) + + return_value = (button_pressed_text,input_values) + form.ReturnValues = return_value + form.ResultsBuilt = True + return return_value + + +# ------------------------------------------------------------------------------------------------------------------ # +# ===================================== TK CODE STARTS HERE ====================================================== # +# ------------------------------------------------------------------------------------------------------------------ # +def ConvertFlexToTK(MyFlexForm): + master = MyFlexForm.TKroot + # only set title on non-tabbed forms + if not MyFlexForm.IsTabbedForm: + master.title(MyFlexForm.Title) + font = MyFlexForm.Font + InitializeResults(MyFlexForm) + border_depth = MyFlexForm.BorderDepth if MyFlexForm.BorderDepth is not None else DEFAULT_BORDER_WIDTH + # --------------------------------------------------------------------------- # + # **************** Use FlexForm to build the tkinter window ********** ----- # + # Building is done row by row. # + # --------------------------------------------------------------------------- # + focus_set = False + ######################### LOOP THROUGH ROWS ######################### + # *********** ------- Loop through ROWS ------- ***********# + for row_num, flex_row in enumerate(MyFlexForm.Rows): + ######################### LOOP THROUGH ELEMENTS ON ROW ######################### + # *********** ------- Loop through ELEMENTS ------- ***********# + # *********** Make TK Row ***********# + tk_row_frame = tk.Frame(master) + for col_num, element in enumerate(flex_row.Elements): + element.ParentForm = MyFlexForm # save the button's parent form object + if MyFlexForm.Font and (element.Font == DEFAULT_FONT or not element.Font): + font = MyFlexForm.Font + elif element.Font is not None: + font = element.Font + # ------- Determine Auto-Size setting on a cascading basis ------- # + if element.AutoSizeText is not None: # if element overide + auto_size_text = element.AutoSizeText + elif flex_row.AutoSizeText is not None: # if Row override + auto_size_text = flex_row.AutoSizeText + elif MyFlexForm.AutoSizeText is not None: # if form override + auto_size_text = MyFlexForm.AutoSizeText + else: + auto_size_text = DEFAULT_AUTOSIZE_TEXT + # Determine Element size + element_size = element.Size + if (element_size == (None, None)): # user did not specify a size + element_size = MyFlexForm.DefaultElementSize + else: auto_size_text = False # if user has specified a size then it shouldn't autosize + # Apply scaling... Element scaling is higher priority than form level + if element.Scale != (None, None): + element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) + elif MyFlexForm.Scale != (None, None): + element_size = (int(element_size[0] * MyFlexForm.Scale[0]), int(element_size[1] * MyFlexForm.Scale[1])) + # ------------------------- TEXT element ------------------------- # + element_type = element.Type + if element_type == TEXT: + display_text = element.DisplayText # text to display + if auto_size_text is False: + width, height=element_size + else: + lines = display_text.split('\n') + max_line_len = max([len(l) for l in lines]) + num_lines = len(lines) + if max_line_len > element_size[0]: # if text exceeds element size, the will have to wrap + width = element_size[0] + else: + width=max_line_len + height=num_lines + # ---===--- LABEL widget create and place --- # + stringvar = tk.StringVar() + element.TKStringVar = stringvar + stringvar.set(display_text) + tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, textvariable=stringvar, width=width, height=height, justify=tk.LEFT, bd=border_depth, fg=element.TextColor) + # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) + # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS + wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels + tktext_label.configure( anchor=tk.NW, font=font, wraplen=wraplen*2 ) # set wrap to width of widget + tktext_label.pack(side=tk.LEFT) + # ------------------------- BUTTON element ------------------------- # + elif element_type == BUTTON: + element.Location = (row_num, col_num) + btext = element.Text + btype = element.BType + if auto_size_text is False: width=element_size[0] + else: width = 0 + height=element_size[1] + lines = btext.split('\n') + max_line_len = max([len(l) for l in lines]) + num_lines = len(lines) + if element.ButtonColor != (None, None)and element.ButtonColor != DEFAULT_BUTTON_COLOR: + bc = element.ButtonColor + elif MyFlexForm.ButtonColor != (None, None) and MyFlexForm.ButtonColor != DEFAULT_BUTTON_COLOR: + bc = MyFlexForm.ButtonColor + else: + bc = DEFAULT_BUTTON_COLOR + if bc == 'Random' or bc == 'random': + bc = GetRandomColorPair() + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) + element.TKButton = tkbutton # not used yet but save the TK button in case + wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels + tkbutton.configure(wraplength=wraplen, font=font) # set wrap to width of widget + tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if not focus_set and btype == CLOSES_WIN: + focus_set = True + element.TKButton.bind('', element.ReturnKeyHandler) + element.TKButton.focus_set() + MyFlexForm.TKroot.focus_force() + # ------------------------- INPUT (Single Line) element ------------------------- # + elif element_type == INPUT_TEXT: + default_text = element.DefaultText + element.TKStringVar = tk.StringVar() + element.TKStringVar.set(default_text) + element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font) + element.TKEntry.bind('', element.ReturnKeyHandler) + element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if not focus_set: + focus_set = True + element.TKEntry.focus_set() + # ------------------------- COMBO BOX (Drop Down) element ------------------------- # + elif element_type == INPUT_COMBO: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + element.TKStringVar = tk.StringVar() + element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) + element.TKCombo['values'] = element.Values + element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKCombo.current(0) + # ------------------------- INPUT MULTI LINE element ------------------------- # + elif element_type == INPUT_MULTILINE: + default_text = element.DefaultText + width, height = element_size + element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) + element.TKText.insert(1.0, default_text) # set the default text + element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.EnterSubmits: + element.TKText.bind('', element.ReturnKeyHandler) + if not focus_set: + focus_set = True + element.TKText.focus_set() + # ------------------------- INPUT CHECKBOX element ------------------------- # + elif element_type == INPUT_CHECKBOX: + width = 0 if auto_size_text else element_size[0] + default_value = element.InitialState + element.TKIntVar = tk.IntVar() + element.TKIntVar.set(default_value) + element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) + element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- PROGRESS BAR element ------------------------- # + elif element_type == PROGRESS_BAR: + # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar + width = element_size[0] + fnt = tkinter.font.Font() + char_width = fnt.measure('A') # single character width + progress_length = width*char_width + progress_width = element_size[1] + direction = element.Orientation + if element.BarColor == 'Random' or element.BarColor == 'random': + bar_color = GetRandomColorPair() + elif element.BarColor != (None, None): # if element has a bar color, use it + bar_color = element.BarColor + else: + bar_color = DEFAULT_PROGRESS_BAR_COLOR + element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, Orientation=direction, BarColor=bar_color, Borderwidth=element.BorderWidth, Relief=element.Relief) + s = ttk.Style() + element.TKProgressBar.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- INPUT RADIO BUTTON element ------------------------- # + elif element_type == INPUT_RADIO: + width = 0 if auto_size_text else element_size[0] + default_value = element.InitialState + ID = element.GroupID + # see if ID has already been placed + value = EncodeRadioRowCol(row_num, col_num) # value to set intvar to if this radio is selected + if ID in MyFlexForm.RadioDict: + RadVar = MyFlexForm.RadioDict[ID] + else: + RadVar = tk.IntVar() + MyFlexForm.RadioDict[ID] = RadVar + element.TKIntVar = RadVar # store the RadVar in Radio object + if default_value: # if this radio is the one selected, set RadVar to match + element.TKIntVar.set(value) + element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, + variable=element.TKIntVar, value=value, bd=border_depth, font=font) + element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- INPUT SPIN Box element ------------------------- # + elif element_type == INPUT_SPIN: + width, height = element_size + width = 0 if auto_size_text else element_size[0] + element.TKStringVar = tk.StringVar() + element.TKSpinBox = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth) + element.TKStringVar.set(element.DefaultValue) + element.TKSpinBox.configure(font=font) # set wrap to width of widget + element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- OUTPUT element ------------------------- # + elif element_type == OUTPUT: + width, height = element_size + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth) + #............................DONE WITH ROW pack the row of widgets ..........................# + # done with row, pack the row of widgets + tk_row_frame.grid(row=row_num+2, sticky=tk.W, padx=DEFAULT_MARGINS[0]) + if not MyFlexForm.IsTabbedForm: + MyFlexForm.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + else: MyFlexForm.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + #....................................... DONE creating and laying out window ..........................# + if MyFlexForm.IsTabbedForm: + master = MyFlexForm.ParentWindow + screen_width = master.winfo_screenwidth() # get window info to move to middle of screen + screen_height = master.winfo_screenheight() + if MyFlexForm.Location != (None, None): + loc = MyFlexForm.Location + x,y = MyFlexForm.Location + else: + master.update_idletasks() # don't forget + win_width = master.winfo_width() + win_height = master.winfo_height() + x = screen_width/2 -win_width/2 + y = screen_height/2 - win_height/2 + if y+win_height > screen_height: + y = screen_height-win_height + if x+win_width > screen_width: + x = screen_width-win_width + + move_string = '+%i+%i'%(int(x),int(y)) + master.geometry(move_string) + master.update_idletasks() # don't forget + return + +# ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# +def ShowTabbedForm(Title, *args,AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME,FavIcon=DEFAULT_WINDOW_ICON): + global _my_windows + + uber = UberForm() + root = tk.Tk() + uber.TKroot = root + if Title is not None: + root.title(Title) + if not len(args): + ('******************* SHOW TABBED FORMS ERROR .... no arguments') + return + tab_control = ttk.Notebook(root) + for num,x in enumerate(args): + form, rows, tab_name = x + form.AddRows(rows) + tab = ttk.Frame(tab_control) # Create tab 1 + tab_control.add(tab, text=tab_name) # Add tab 1 + # tab_control.configure(text='new text') + tab_control.grid(row=0, sticky=tk.W) + form.TKTabControl = tab_control + form.TKroot = tab + form.IsTabbedForm = True + form.ParentWindow = root + ConvertFlexToTK(form) + form.UberParent = uber + uber.AddForm(form) + uber.FormReturnValues.append(form.ReturnValues) + + # dangerous?? or clever? use the final form as a callback for autoclose + id = root.after(AutoCloseDuration*1000, form.AutoCloseAlarmCallback) if AutoClose else 0 + icon = FavIcon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon + try: uber.TKroot.iconbitmap(icon) + except: pass + + root.mainloop() + + if id: root.after_cancel(id) + uber.TKrootDestroyed = True + return uber.FormReturnValues + +# ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# +def StartupTK(MyFlexForm): + global _my_windows + + ow = _my_windows.NumOpenWindows + root = tk.Tk() if not ow else tk.Toplevel() + _my_windows.NumOpenWindows += 1 + + MyFlexForm.TKroot = root + # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) + # root.bind('', MyFlexForm.DestroyedCallback()) + ConvertFlexToTK(MyFlexForm) + MyFlexForm.SetIcon(MyFlexForm.WindowIcon) + + if MyFlexForm.AutoClose: + duration = DEFAULT_AUTOCLOSE_TIME if MyFlexForm.AutoCloseDuration is None else MyFlexForm.AutoCloseDuration + MyFlexForm.TKAfterID = root.after(duration*1000, MyFlexForm.AutoCloseAlarmCallback) + if MyFlexForm.NonBlocking: + MyFlexForm.TKroot.protocol("WM_WINDOW_DESTROYED", MyFlexForm.OnClosingCallback()) + pass + else: # it's a blocking form + MyFlexForm.TKroot.mainloop() + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + if MyFlexForm.RootNeedsDestroying: + MyFlexForm.TKroot.destroy() + MyFlexForm.RootNeedsDestroying = False + + return + +# ==============================_GetNumLinesNeeded ==# +# Helper function for determining how to wrap text # +# ===================================================# +def _GetNumLinesNeeded(text, max_line_width): + if max_line_width == 0: + return 1 + lines = text.split('\n') + num_lines = len(lines) # number of original lines of text + max_line_len = max([len(l) for l in lines]) # longest line + lines_used = [] + for L in lines: + lines_used.append(len(L)//max_line_width + (len(L) % max_line_width > 0)) # fancy math to round up + total_lines_needed = sum(lines_used) + return total_lines_needed + +# ------------------------------------------------------------------------------------------------------------------ # +# ===================================== Upper PySimpleGUI ============================================================== # +# Pre-built dialog boxes for all your needs # +# ------------------------------------------------------------------------------------------------------------------ # + +# ==================================== MSG BOX =====# +# Display a message wrapping at 60 characters # +# Exits via an OK button2 press # +# Returns nothing # +# ===================================================# +def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, AutoCloseDuration=None, Icon=DEFAULT_WINDOW_ICON, LineWidth=MESSAGE_BOX_LINE_WIDTH, Font=None): + ''' + + :param args: + :param ButtonColor: + :param ButtonType: + :param AutoClose: + :param AutoCloseDuration: + :param Icon: + :param LineWidth: + :param Font: + :return: + ''' + if not args: return + with FlexForm(args[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Icon=Icon, Font=Font) as form: + max_line_total, total_lines = 0,0 + for message in args: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + message_wrapped = textwrap.fill(message, LineWidth) + message_wrapped_lines = message_wrapped.count('\n')+1 + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, LineWidth) + max_line_total = max(max_line_total, width_used) + # height = _GetNumLinesNeeded(message, width_used) + height = message_wrapped_lines + form.AddRow(Text(message_wrapped, Size=(width_used, height), AutoSizeText=True),) + total_lines += height + + pad = max_line_total-15 if max_line_total > 15 else 1 + pad =1 + # show either an OK or Yes/No depending on paramater + if ButtonType is MSG_BOX_YES_NO: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), Yes(ButtonColor=ButtonColor), No(ButtonColor=ButtonColor)) + (button_text, values) = form.Show() + return button_text == 'Yes' + elif ButtonType is MSG_BOX_CANCELLED: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('Cancelled', ButtonColor=ButtonColor)) + elif ButtonType is MSG_BOX_ERROR: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('ERROR', Size=(5,1), ButtonColor=ButtonColor)) + elif ButtonType is MSG_BOX_OK_CANCEL: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('OK', Size=(5,1), ButtonColor=ButtonColor), + SimpleButton('Cancel', Size=(5, 1), ButtonColor=ButtonColor)) + else: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('OK', Size=(5,1), ButtonColor=ButtonColor)) + + button, values = form.Show() + return button + +# ============================== MsgBoxAutoClose====# +# Lazy function. Same as calling MsgBox with parms # +# ===================================================# +def MsgBoxAutoClose(*args, ButtonColor=None,AutoClose=True, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Font=None): + MsgBox(*args, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + return + + +# ============================== MsgBoxError =====# +# Like MsgBox but presents RED BUTTONS # +# ===================================================# +def MsgBoxError(*args, ButtonColor=DEFAULT_ERROR_BUTTON_COLOR,AutoClose=False, AutoCloseDuration=None, Font=None): + MsgBox(*args, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + return + +# ============================== MsgBoxCancel =====# +# Like MsgBox but presents RED BUTTONS # +# ===================================================# +def MsgBoxCancel(*args,ButtonColor=DEFAULT_CANCEL_BUTTON_COLOR,AutoClose=False, AutoCloseDuration=None, Font=None): + MsgBox(*args, ButtonType=MSG_BOX_CANCELLED, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + return + +# ============================== MsgBoxOK =====# +# Like MsgBox but only 1 button # +# ===================================================# +def MsgBoxOK(*args,ButtonColor=('white', 'black'),AutoClose=False, AutoCloseDuration=None, Font=None): + MsgBox(*args, ButtonType=MSG_BOX_OK, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + return + +# ============================== MsgBoxCancel =====# +# Like MsgBox but presents RED BUTTONS # +# ===================================================# +def MsgBoxOKCancel(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): + result = MsgBox(*args, ButtonType=MSG_BOX_OK_CANCEL, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + return result + +# ==================================== YesNoBox=====# +# Like MsgBox but presents Yes and No buttons # +# Returns True if Yes was pressed else False # +# ===================================================# +def YesNoBox(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): + result = MsgBox(*args,ButtonType=MSG_BOX_YES_NO, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + return result + +# ============================== PROGRESS METER ========================================== # + +def ConvertArgsToSingleString(*args): + max_line_total, width_used , total_lines, = 0,0,0 + single_line_message = '' + # loop through args and built a SINGLE string from them + for message in args: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, MESSAGE_BOX_LINE_WIDTH) + max_line_total = max(max_line_total, width_used) + lines_needed = _GetNumLinesNeeded(message, width_used) + total_lines += lines_needed + single_line_message += message + '\n' + return single_line_message, width_used, total_lines + + +# ============================== ProgressMeter =====# +# ===================================================# +def ProgressMeter(Title, MaxValue, *args, Orientation=None, BarColor=DEFAULT_PROGRESS_BAR_COLOR, ButtonColor=None,Size=DEFAULT_PROGRESS_BAR_SIZE, Scale=(None, None), BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + ''' + Create and show a form on tbe caller's behalf. + :param Title: + :param MaxValue: + :param args: ANY number of arguments the caller wants to display + :param Orientation: + :param BarColor: + :param Size: + :param Scale: + :param Style: + :param StyleOffset: + :return: ProgressBar object that is in the form + ''' + orientation = DEFAULT_METER_ORIENTATION if Orientation is None else Orientation + target = (0,0) if orientation[0].lower() == 'h' else (0,1) + bar2 = ProgressBar(MaxValue, Orientation=orientation, Size=Size, BarColor=BarColor, Scale=Scale, Target=target, BorderWidth=BorderWidth) + form = FlexForm(Title, AutoSizeText=True) + + # Form using a horizontal bar + if orientation[0].lower() == 'h': + single_line_message, width, height = ConvertArgsToSingleString(*args) + bar2.TextToDisplay = single_line_message + bar2.MaxValue = MaxValue + bar2.CurrentValue = 0 + form.AddRow(Text(single_line_message,Size=(width+20, height+3), AutoSizeText=True)) + form.AddRow((bar2)) + form.AddRow((Cancel(ButtonColor=ButtonColor))) + else: + single_line_message, width, height = ConvertArgsToSingleString(*args) + bar2.TextToDisplay = single_line_message + bar2.MaxValue = MaxValue + bar2.CurrentValue = 0 + form.AddRow(bar2, Text(single_line_message,Size=(width+20, height+3), AutoSizeText=True)) + form.AddRow((Cancel(ButtonColor=ButtonColor))) + + form.NonBlocking = True + form.Show(NonBlocking = True) + return bar2 + +# ============================== ProgressMeterUpdate =====# +def ProgressMeterUpdate(bar, Value, *args): + ''' + Update the progress meter for a form + :param form: class ProgressBar + :param Value: int + :return: True if not cancelled, OK....False if Error + ''' + global _my_windows + if bar == None: return False + if bar.BarExpired: return False + message, w, h = ConvertArgsToSingleString(*args) + + + bar.TextToDisplay = message + bar.CurrentValue = Value + rc = bar.UpdateBar(Value) + if Value >= bar.MaxValue or not rc: + bar.BarExpired = True + bar.ParentForm.Close() + if bar.ParentForm.RootNeedsDestroying: + try: + bar.ParentForm.TKroot.destroy() + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + except: pass + bar.ParentForm.RootNeedsDestroying = False + bar.ParentForm.__del__() + return False + + return rc + +# ============================== EASY PROGRESS METER ========================================== # +# class to hold the easy meter info (a global variable essentialy) +class EasyProgressMeterDataClass(): + def __init__(self, Title='', CurrentValue=1, MaxValue=10, StartTime=None, StatMessages=()): + self.Title = Title + self.CurrentValue = CurrentValue + self.MaxValue = MaxValue + self.StartTime = StartTime + self.StatMessages = StatMessages + self.ParentForm = None + self.MeterID = None + + # =========================== COMPUTE PROGRESS STATS ======================# + def ComputeProgressStats(self): + utc = datetime.datetime.utcnow() + time_delta = utc - self.StartTime + total_seconds = time_delta.total_seconds() + if not total_seconds: + total_seconds = 1 + try: + time_per_item = total_seconds / self.CurrentValue + except: + time_per_item = 1 + seconds_remaining = (self.MaxValue - self.CurrentValue) * time_per_item + time_remaining = str(datetime.timedelta(seconds=seconds_remaining)) + time_remaining_short = (time_remaining).split(".")[0] + time_delta_short = str(time_delta).split(".")[0] + total_time = time_delta + datetime.timedelta(seconds=seconds_remaining) + total_time_short = str(total_time).split(".")[0] + self.StatMessages = [ + '{} of {}'.format(self.CurrentValue, self.MaxValue), + '{} %'.format(100*self.CurrentValue//self.MaxValue), + '', + ' {:6.2f} Iterations per Second'.format(self.CurrentValue/total_seconds), + ' {:6.2f} Seconds per Iteration'.format(total_seconds/(self.CurrentValue if self.CurrentValue else 1)), + '', + '{} Elapsed Time'.format(time_delta_short), + '{} Time Remaining'.format(time_remaining_short), + '{} Estimated Total Time'.format(total_time_short)] + return + + +# ============================== EasyProgressMeter =====# +def EasyProgressMeter(Title, CurrentValue, MaxValue,*args, Orientation=None, BarColor=DEFAULT_PROGRESS_BAR_COLOR, ButtonColor=None, Size=DEFAULT_PROGRESS_BAR_SIZE, Scale=(None, None),BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + ''' + A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second + function call before your loop. You've got enough code to write! + :param Title: Title will be shown on the window + :param CurrentValue: Current count of your items + :param MaxValue: Max value your count will ever reach. This indicates it should be closed + :param args: VARIABLE number of arguements... you request it, we'll print it no matter what the item! + :param Orientation: + :param BarColor: + :param Size: + :param Scale: + :param Style: + :param StyleOffset: + :return: False if should stop the meter + ''' + # STATIC VARIABLE! + # This is a very clever form of static variable using a function attribute + # If the variable doesn't yet exist, then it will create it and initialize with the 3rd parameter + EasyProgressMeter.EasyProgressMeterData = getattr(EasyProgressMeter, 'EasyProgressMeterData', EasyProgressMeterDataClass()) + # if no meter currently running + if EasyProgressMeter.EasyProgressMeterData.MeterID is None: # Starting a new meter + if int(CurrentValue) >= int(MaxValue): + return False + del(EasyProgressMeter.EasyProgressMeterData) + EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass(Title, 1, int(MaxValue), datetime.datetime.utcnow(), []) + EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() + message = "\n".join([line for line in EasyProgressMeter.EasyProgressMeterData.StatMessages]) + EasyProgressMeter.EasyProgressMeterData.MeterID = ProgressMeter(Title, int(MaxValue), message, *args, Orientation=Orientation, BarColor=BarColor, Size=Size, Scale=Scale, ButtonColor=ButtonColor,BorderWidth=BorderWidth) + EasyProgressMeter.EasyProgressMeterData.ParentForm = EasyProgressMeter.EasyProgressMeterData.MeterID.ParentForm + return True + # if exactly the same values as before, then ignore. + if EasyProgressMeter.EasyProgressMeterData.MaxValue == MaxValue and EasyProgressMeter.EasyProgressMeterData.CurrentValue == CurrentValue: + return True + if EasyProgressMeter.EasyProgressMeterData.MaxValue != int(MaxValue): + EasyProgressMeter.EasyProgressMeterData.MeterID = None + EasyProgressMeter.EasyProgressMeterData.ParentForm = None + del(EasyProgressMeter.EasyProgressMeterData) + EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass() # setup a new progress meter + return True # HAVE to return TRUE or else the new meter will thing IT is failing when it hasn't + EasyProgressMeter.EasyProgressMeterData.CurrentValue = int(CurrentValue) + EasyProgressMeter.EasyProgressMeterData.MaxValue = int(MaxValue) + EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() + message = '' + for line in EasyProgressMeter.EasyProgressMeterData.StatMessages: + message = message + str(line) + '\n' + message = "\n".join(EasyProgressMeter.EasyProgressMeterData.StatMessages) + rc = ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, CurrentValue,*args, message ) + # if counter >= max then the progress meter is all done. Indicate none running + if CurrentValue >= EasyProgressMeter.EasyProgressMeterData.MaxValue or not rc: + EasyProgressMeter.EasyProgressMeterData.MeterID = None + del(EasyProgressMeter.EasyProgressMeterData) + EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass() # setup a new progress meter + return False # even though at the end, return True so don't cause error with the app + return rc # return whatever the update told us + + +def EasyProgressMeterCancel(Title, *args): + EasyProgressMeter.EasyProgressMeterData = getattr(EasyProgressMeter, 'EasyProgressMeterData', EasyProgressMeterDataClass()) + if EasyProgressMeter.EasyProgressMeterData.MeterID is not None: + # tell the normal meter update that we're at max value which will close the meter + rc = EasyProgressMeter(Title, EasyProgressMeter.EasyProgressMeterData.MaxValue, EasyProgressMeter.EasyProgressMeterData.MaxValue, ' *** CANCELLING ***', 'Caller requested a cancel', *args) + return rc + return True + + +def GetRandomColor(): + nums = randint(0,255), randint(0,255), randint(0,255) + color_code ='#' + ''.join('{:02X}'.format(a) for a in nums) + return color_code + + +def GetRandomColorPair(): + fg = GetRandomColor() + bg = GetComplimentaryHex(fg) + color_code = (fg, bg) + return color_code + +# input is #RRGGBB +# output is #RRGGBB +def GetComplimentaryHex(color): + # strip the # from the beginning + color = color[1:] + # convert the string into hex + color = int(color, 16) + # invert the three bytes + # as good as substracting each of RGB component by 255(FF) + comp_color = 0xFFFFFF ^ color + # convert the color back to hex by prefixing a # + comp_color = "#%06X" % comp_color + # return the result + return comp_color + +# ======================== Scrolled Text Box =====# +# ===================================================# +def ScrolledTextBox(*args, ButtonColor=None, YesNo=False, AutoClose=False, AutoCloseDuration=None, Height=None): + if not args: return + with FlexForm(args[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration) as form: + max_line_total, max_line_width, total_lines, height = 0,0,0,0 + complete_output = '' + for message in args: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, MESSAGE_BOX_LINE_WIDTH) + max_line_total = max(max_line_total, width_used) + max_line_width = MESSAGE_BOX_LINE_WIDTH + lines_needed = _GetNumLinesNeeded(message, width_used) + height += lines_needed + complete_output += message + '\n' + total_lines += lines_needed + height = MAX_SCROLLED_TEXT_BOX_HEIGHT if height > MAX_SCROLLED_TEXT_BOX_HEIGHT else height + if Height: + height = Height + form.AddRow(Multiline(complete_output, Size=(max_line_width, height)), AutoSizeText=True) + pad = max_line_total-15 if max_line_total > 15 else 1 + # show either an OK or Yes/No depending on paramater + if YesNo: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), Yes(), No()) + (button_text, values) = form.Show() + return button_text == 'Yes' + else: + form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('OK', Size=(5,1), ButtonColor=ButtonColor)) + form.Show() + + +# ---------------------------------------------------------------------- # +# GetPathBox # +# Pre-made dialog that looks like this roughly # +# MESSAGE # +# __________________________ # +# |__________________________| (BROWSE) # +# (SUBMIT) (CANCEL) # +# RETURNS two values: # +# True/False, path # +# (True if Submit was pressed, false otherwise) # +# ---------------------------------------------------------------------- # +def GetPathBox(Title, Message, DefaultPath='', ButtonColor=None, Size=DEFAULT_ELEMENT_SIZE): + with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: + layout = [[Text(Message,AutoSizeText=True)], + [InputText(DefaultText=DefaultPath, Size=Size), FolderBrowse()], + [Submit(), Cancel()]] + + (button, input_values) = form.LayoutAndShow(layout) + if button != 'Submit': + return False,None + else: + path = input_values[0] + return True, path + +# ============================== GetFileBox =========# +# Like the Get folder box but for files # +# ===================================================# +def GetFileBox(Title, Message, DefaultPath='',FileTypes=(("ALL Files", "*.*"),), ButtonColor=None): + with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: + layout = [[Text(Message,AutoSizeText=True)], + [InputText(DefaultText=DefaultPath), FileBrowse(FileTypes=FileTypes)], + [Submit(), Cancel()]] + + (button, input_values) = form.LayoutAndShow(layout) + if button != 'Submit': + return False,None + else: + path = input_values[0] + return True, path + + + +# ============================== GetTextBox =========# +# Get a single line of text # +# ===================================================# +def GetTextBox(Title, Message, Default='', ButtonColor=None): + with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: + layout = [[Text(Message,AutoSizeText=True)], + [InputText(DefaultText=Default)], + [Submit(), Cancel()]] + + (button, input_values) = form.LayoutAndShow(layout) + if button != 'Submit': + return False,None + else: + return True, input_values[0] + + +# ============================== SetGlobalIcon ======# +# Sets the icon to be used by default # +# ===================================================# +def SetGlobalIcon(Icon): + global _my_windows + + try: + with open(Icon, 'r') as icon_file: + pass + except: + raise FileNotFoundError + + _my_windows.user_defined_icon = Icon + return True + + +# ============================== SetGlobalIcon ======# +# Sets the icon to be used by default # +# ===================================================# +def SetButtonColor(foreground, background): + global DEFAULT_BUTTON_COLOR + + DEFAULT_BUTTON_COLOR = (foreground, background) + + +# ============================== sprint ======# +# Is identical to the Scrolled Text Box # +# Provides a crude 'print' mechanism but in a # +# GUI environment # +# ============================================# +sprint=ScrolledTextBox From 258939af56622ebfba0af60a2918c8fa4f740d39 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 15:25:04 -0400 Subject: [PATCH 002/521] readme checkin Initial readme checkin --- readme.md | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 000000000..d00912653 --- /dev/null +++ b/readme.md @@ -0,0 +1,130 @@ +# PySimpleGUI + +... is a simple GUI, but also powerfully customizable. It's simple from the programmer's view point. The idea is to make adding a GUI to a Python program be a simple and trivial task. + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +Python itself doesn't have a SIMPLE solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages. + +The PySimpleGUI solution is focused on the developer. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + +You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully custom designed GUI. + +The customization power comes from the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. + +Features include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scrollable Output + Progress Bar + Async/Non-Blocking Windows + Persistent Windows + Redirect Python Output/Errors to scrolling Window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +## Getting Started with PySimpleGUI + +To use `import PySimpleGUI as SG` + +For examples download + + DisplayHash.py - Shows you how to use the most basic functionality + ColorDemo.py - COLORS are a big part of the fun of a GUI, right? + + HowDoI.py - More advanced 'Chat-style' windows that don't close with button clicks + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + +## Running the tests + + +## Deployment + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +**High Level API Calls** + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) + + +**Custom Form API Calls** +Here is a complete form - design, display, return information straight into caller's variables + + # ------- Form design ------- # + layout = [[Text('The SHA-1 Hash for the file')], + [InputText(), FileBrowse()], + [Submit(), Cancel()]] + # ------- Form show ------- # + (button, (source_filename,)) = FlexForm('Display A Hash in GooeyGUI', AutoSizeText=True).LayoutAndShow(layout) + +Important initial concepts + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + + (button, (value1,)) + +Forgetting the comma will mess you up but good + +## Built With + + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release + + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence From f35fa97dfe0a7eaf1ee46f7ddad7e62cf1f516b8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 19:18:34 -0400 Subject: [PATCH 003/521] Uploaded to PyPi --- PySimpleGUI.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 995c6f5c9..333ab230a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1309,7 +1309,7 @@ def MsgBoxOKCancel(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=Non # Like MsgBox but presents Yes and No buttons # # Returns True if Yes was pressed else False # # ===================================================# -def YesNoBox(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): +def MsgBoxYesNo(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): result = MsgBox(*args,ButtonType=MSG_BOX_YES_NO, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return result @@ -1586,7 +1586,7 @@ def ScrolledTextBox(*args, ButtonColor=None, YesNo=False, AutoClose=False, AutoC # True/False, path # # (True if Submit was pressed, false otherwise) # # ---------------------------------------------------------------------- # -def GetPathBox(Title, Message, DefaultPath='', ButtonColor=None, Size=DEFAULT_ELEMENT_SIZE): +def GetPathBox(Title, Message, DefaultPath='', ButtonColor=None, Size=(None,None)): with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: layout = [[Text(Message,AutoSizeText=True)], [InputText(DefaultText=DefaultPath, Size=Size), FolderBrowse()], @@ -1602,10 +1602,10 @@ def GetPathBox(Title, Message, DefaultPath='', ButtonColor=None, Size=DEFAULT_EL # ============================== GetFileBox =========# # Like the Get folder box but for files # # ===================================================# -def GetFileBox(Title, Message, DefaultPath='',FileTypes=(("ALL Files", "*.*"),), ButtonColor=None): +def GetFileBox(Title, Message, DefaultPath='',FileTypes=(("ALL Files", "*.*"),), ButtonColor=None, Size=(None,None)): with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: layout = [[Text(Message,AutoSizeText=True)], - [InputText(DefaultText=DefaultPath), FileBrowse(FileTypes=FileTypes)], + [InputText(DefaultText=DefaultPath, Size=Size), FileBrowse(FileTypes=FileTypes)], [Submit(), Cancel()]] (button, input_values) = form.LayoutAndShow(layout) @@ -1616,14 +1616,13 @@ def GetFileBox(Title, Message, DefaultPath='',FileTypes=(("ALL Files", "*.*"),), return True, path - # ============================== GetTextBox =========# # Get a single line of text # # ===================================================# -def GetTextBox(Title, Message, Default='', ButtonColor=None): +def GetTextBox(Title, Message, Default='', ButtonColor=None, Size=(None, None)): with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: layout = [[Text(Message,AutoSizeText=True)], - [InputText(DefaultText=Default)], + [InputText(DefaultText=Default, Size=Size)], [Submit(), Cancel()]] (button, input_values) = form.LayoutAndShow(layout) From 4aa9d6299c892f2e0ac11d413fa93a82aab0a387 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 19:20:35 -0400 Subject: [PATCH 004/521] Readme update Big update --- readme.md | 295 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 211 insertions(+), 84 deletions(-) diff --git a/readme.md b/readme.md index d00912653..26a375385 100644 --- a/readme.md +++ b/readme.md @@ -1,130 +1,257 @@ -# PySimpleGUI -... is a simple GUI, but also powerfully customizable. It's simple from the programmer's view point. The idea is to make adding a GUI to a Python program be a simple and trivial task. +# PySimpleGUI + +This really is a simple GUI, but also powerfully customizable. -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) -Python itself doesn't have a SIMPLE solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages. +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +Python itself doesn't have a simple solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. + +The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + +You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. + +The customization power comes from the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. + +Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + +### Using + +To us in your code, simply import.... + `import PySimpleGUI as SG` + +Then use either "high level" API calls or build your own forms. + + SG.MsgBox('This is my first message box') +![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) + +Yes, it's just that easy to have a window appear on the screen using Python. + +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments -The PySimpleGUI solution is focused on the developer. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully custom designed GUI. +Each new item begins on a new line in the Message Box + ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and part of forms. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -The customization power comes from the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. -Features include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scrollable Output - Progress Bar - Async/Non-Blocking Windows - Persistent Windows - Redirect Python Output/Errors to scrolling Window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + def MsgBox(*args, + ButtonColor=None, + ButtonType=MSG_BOX_OK, + AutoClose=False, + AutoCloseDuration=None, + Icon=DEFAULT_WINDOW_ICON, + LineWidth=MESSAGE_BOX_LINE_WIDTH, + Font=None): +If the caller wanted to change the button color to be black on yellow, the call would look something like this: -## Getting Started with PySimpleGUI + SG.MsgBox('This box has a custom button color', + ButtonColor=('black', 'yellow')) -To use `import PySimpleGUI as SG` +![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) -For examples download - - DisplayHash.py - Shows you how to use the most basic functionality - ColorDemo.py - COLORS are a big part of the fun of a GUI, right? - - HowDoI.py - More advanced 'Chat-style' windows that don't close with button clicks - +### High Level API Calls -### Prerequisites +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. -Python 3 -tkinter +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + import PySimpleGUI as SG -### Installing + `SG.MsgBoxOK('This is an OK MsgBox')` + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code + SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') -## Running the tests +![msgboxokcancel](https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg) + SG.MsgBoxCancel('This is a Cancel MsgBox') +![msgboxcancel](https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg) -## Deployment + SG.MsgBoxYesNo('This is a Yes No MsgBox') +![msgboxyesno](https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg) -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + SG.MsgBoxError('This is an error MsgBox') +![msgbox error](https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg) -**High Level API Calls** + SG.MsgBoxAutoClose('This is an autoclose MsgBox') -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: +![msgbox autoclose](https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg) - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + SG.ScrolledTextBox(my_text, Height=10) -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) +![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. + +#### High Level User Input -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. + - GetTextBox + - GetFileBox + - GetFolderBox + `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` -**Custom Form API Calls** -Here is a complete form - design, display, return information straight into caller's variables +![gettextbox](https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg) - # ------- Form design ------- # - layout = [[Text('The SHA-1 Hash for the file')], - [InputText(), FileBrowse()], - [Submit(), Cancel()]] - # ------- Form show ------- # - (button, (source_filename,)) = FlexForm('Display A Hash in GooeyGUI', AutoSizeText=True).LayoutAndShow(layout) + submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') -Important initial concepts - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) +![getfilebox](https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg) -Don't forget all those ()'s of your values won't be coreectly assigned. + submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') -If you have a SINGLE value being returned, it is written this way: +![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) - (button, (value1,)) -Forgetting the comma will mess you up but good -## Built With +### Custom Form API Calls +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -## Contributing +# COPY THIS DESIGN PATTERN! -A MikeTheWatchGuy production... entirely responsible for this code + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename, )) = form.LayoutAndShow(form_rows) -## Versioning +This context manager contains all of the code needed to specify, show and retrieve results for this form: +![sha hash](https://user-images.githubusercontent.com/13696193/42603149-a56acf3a-853a-11e8-91de-771efd3a65a8.jpg) -1.0.9 - July 10, 2018 - Initial Release - +It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -## Authors +You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. +PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. -## License +Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller simply writes `Submit`. -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details +Going through each line of code -## Acknowledgments + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: +This creates a new form, storing it in the variable `form`. + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [SG.InputText(), SG.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [SG.Submit(), SG.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its valueso the caller. + + (button, (source_filename, )) = form.LayoutAndShow(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. + +# Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + + (button, (value1,)) + +Forgetting the comma will mess you up but good + +## Built With + + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release + + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence From 1c00e051effb0f4f84894b7c7214356fdb380a56 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 19:27:49 -0400 Subject: [PATCH 005/521] Demo Hash a File --- DemoDisplayHash1and256.py | 103 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 DemoDisplayHash1and256.py diff --git a/DemoDisplayHash1and256.py b/DemoDisplayHash1and256.py new file mode 100644 index 000000000..1aa0f902f --- /dev/null +++ b/DemoDisplayHash1and256.py @@ -0,0 +1,103 @@ +#!Python 3 +import hashlib +import PySimpleGUI as SG + + ######################################################################### +# DisplayHash # +# A PySimpleGUI demo app that displays SHA1 hash for user browsed file # +# Useful and a recipe for GUI success # + ######################################################################### + +# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # +# Reads a file, computes the Hash # +# ---------------------------------------------------------------------------------- # +def compute_sha1_hash_for_file(filename): + try: + x = open(filename, "rb").read() + except: + return 0 + + m = hashlib.sha1() + m.update(x) + f_sha = m.hexdigest() + + return f_sha + + +# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # +# Reads a file, computes the Hash # +# ---------------------------------------------------------------------------------- # +def compute_sha256_hash_for_file(filename): + try: + f = open(filename, "rb") + x = f.read() + except: + return 0 + + m = hashlib.sha256() + m.update(x) + f_sha = m.hexdigest() + + return f_sha + + + # ====____====____==== Uses A GooeyGUI GUI ====____====____== # +# Get the filename, display the hash, dirt simple all around # + # ----------------------------------------------------------- # + +# ---------------------------------------------------------------------- # +# Compute and display SHA1 hash # +# Builds and displays the form using the most basic building blocks # +# ---------------------------------------------------------------------- # +def HashManuallyBuiltGUI(): + # ------- Form design ------- # + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename, )) = form.LayoutAndShow(form_rows) + + if button == 'Submit': + if source_filename != '': + hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() + hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() + SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, LineWidth=75) + else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') + else: + SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') + + +# ---------------------------------------------------------------------- # +# Compute and display SHA1 hash # +# This one cheats and uses the higher-level Get A File pre-made func # +# Hey, it's a really common operation so why not? # +# ---------------------------------------------------------------------- # +def HashMostCompactGUI(): + # ------- INPUT GUI portion ------- # + + rc, source_filename = SG.GetFileBox('Display A Hash Using PySimpleGUI', + 'Display a Hash code for file of your choice') + + # ------- OUTPUT GUI results portion ------- # + if rc == True: + hash = compute_sha1_hash_for_file(source_filename).upper() + SG.MsgBox('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) + else: + SG.MsgBox('Display Hash - Compact GUI', '* Cancelled *') + + +# ---------------------------------------------------------------------- # +# Our main calls two GUIs that act identically but use different calls # +# ---------------------------------------------------------------------- # +def main(): + # HashMostCompactGUI() + HashManuallyBuiltGUI() + +# ====____====____==== Pseudo-MAIN program ====____====____==== # +# This is our main-alike piece of code # +# + Starts up the GUI # +# + Gets values from GUI # +# + Runs DeDupe_folder based on GUI inputs # +# ------------------------------------------------------------- # +if __name__ == '__main__': + main() From a372c955624daf3bab3495e34afc355bbc35a8fe Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 19:50:59 -0400 Subject: [PATCH 006/521] More readme --- readme.md | 103 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 34 deletions(-) diff --git a/readme.md b/readme.md index 26a375385..c7743cffc 100644 --- a/readme.md +++ b/readme.md @@ -219,39 +219,74 @@ The last line of the `form_rows` variable assignment contains a Submit and a Can (button, (source_filename, )) = form.LayoutAndShow(form_rows) This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. -# Return values +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + + (button, (value1,)) + +Forgetting the comma will mess you up but good + +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], + [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], + [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [Text('_' * 90, Size=(60, 1))], + [Text('Choose Source and Destination Folders', Size=(35,1))], + [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [Submit(), Cancel()]] + + (button, (values)) = form.LayoutAndShow(layout) + + + + + MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , Font = ("Helvetica", 15)) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) + +Clicking Submit caused the form call to return and the call to MsgBox is made to display the results. +![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) + + +## Built With + + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release + + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Don't forget all those ()'s of your values won't be coreectly assigned. - -If you have a SINGLE value being returned, it is written this way: - - (button, (value1,)) - -Forgetting the comma will mess you up but good - -## Built With - - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - -1.0.9 - July 10, 2018 - Initial Release - - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + From 96cf4fc9fc86c15e10159d707ee26c5db0706a9c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 22:31:28 -0400 Subject: [PATCH 007/521] Update readme.md --- readme.md | 97 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/readme.md b/readme.md index c7743cffc..bb8d48a79 100644 --- a/readme.md +++ b/readme.md @@ -84,6 +84,7 @@ PySimpleGUI can be broken down into 2 types of API's: SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") Each new item begins on a new line in the Message Box + ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) #### Optional Parameters to a Function Call @@ -221,37 +222,37 @@ This is the code that **displays** the form, collects the information and return ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Don't forget all those ()'s of your values won't be coreectly assigned. - -If you have a SINGLE value being returned, it is written this way: - - (button, (value1,)) - -Forgetting the comma will mess you up but good + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + + (button, (value1,)) + +Forgetting the comma will mess you up but good ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: - layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], - [Text('Here is some text with font sizing', Font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], - [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [Text('_' * 90, Size=(60, 1))], - [Text('Choose Source and Destination Folders', Size=(35,1))], - [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], - [Submit(), Cancel()]] - + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], + [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], + [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [Text('_' * 90, Size=(60, 1))], + [Text('Choose Source and Destination Folders', Size=(35,1))], + [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [Submit(), Cancel()]] + (button, (values)) = form.LayoutAndShow(layout) @@ -267,26 +268,26 @@ Clicking Submit caused the form call to return and the call to MsgBox is made to ![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) -## Built With - - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - -1.0.9 - July 10, 2018 - Initial Release - - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - +## Built With + + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release + + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence From 0b28fa3a917c83d2101bee375a0aadd816948156 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 22:32:26 -0400 Subject: [PATCH 008/521] Update readme.md --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index bb8d48a79..26d529c63 100644 --- a/readme.md +++ b/readme.md @@ -132,6 +132,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') From 713557e7346b6282510e0a95142d9aaad1c1d102 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 11 Jul 2018 22:35:08 -0400 Subject: [PATCH 009/521] Fix formatting --- readme.md | 74 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/readme.md b/readme.md index c7743cffc..7fe614dbe 100644 --- a/readme.md +++ b/readme.md @@ -84,45 +84,46 @@ PySimpleGUI can be broken down into 2 types of API's: SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") Each new item begins on a new line in the Message Box + ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) - + #### Optional Parameters to a Function Call - + This feature of the Python language is utilized ***heavily*** as a method of customizing forms and part of forms. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. - def MsgBox(*args, - ButtonColor=None, - ButtonType=MSG_BOX_OK, - AutoClose=False, - AutoCloseDuration=None, - Icon=DEFAULT_WINDOW_ICON, + def MsgBox(*args, + ButtonColor=None, + ButtonType=MSG_BOX_OK, + AutoClose=False, + AutoCloseDuration=None, + Icon=DEFAULT_WINDOW_ICON, LineWidth=MESSAGE_BOX_LINE_WIDTH, Font=None): If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', + SG.MsgBox('This box has a custom button color', ButtonColor=('black', 'yellow')) ![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) -### High Level API Calls +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. @@ -131,6 +132,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -158,9 +160,9 @@ Take a moment to look at that last one. It's such a simple API call and yet the #### High Level User Input -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. - GetTextBox - - GetFileBox + - GetFileBox - GetFolderBox `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` @@ -184,10 +186,10 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e # COPY THIS DESIGN PATTERN! - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] (button, (source_filename, )) = form.LayoutAndShow(form_rows) This context manager contains all of the code needed to specify, show and retrieve results for this form: @@ -195,21 +197,21 @@ This context manager contains all of the code needed to specify, show and retrie It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. +You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. -PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. +PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller simply writes `Submit`. Going through each line of code - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: -This creates a new form, storing it in the variable `form`. + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: +This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. [SG.Submit(), SG.Cancel()]] From bc9857887515cf60f427100b113cb005ffa7f28c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 12 Jul 2018 12:57:28 -0400 Subject: [PATCH 010/521] Update readme.md --- readme.md | 139 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 110 insertions(+), 29 deletions(-) diff --git a/readme.md b/readme.md index 26d529c63..65f85c176 100644 --- a/readme.md +++ b/readme.md @@ -6,8 +6,10 @@ This really is a simple GUI, but also powerfully customizable. ![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a much more pleasant experience than opening a dos Window. -Python itself doesn't have a simple solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. +Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. @@ -15,26 +17,29 @@ You can add a GUI to your command line with a single line of code. With 3 or 4 The customization power comes from the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. -Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - + +> Features of PySimpleGUI include: +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Icons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows +> Tabbed forms +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window +> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. +![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) + + + ## Getting Started with PySimpleGUI @@ -156,11 +161,11 @@ The differences tend to be the number and types of buttons. Here are the calls ![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. #### High Level User Input -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - GetFileBox - GetFolderBox @@ -179,12 +184,13 @@ There are 3 very basic user input high-level function calls. It's expected that -### Custom Form API Calls +# Custom Form API Calls + This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# COPY THIS DESIGN PATTERN! +## COPY THIS DESIGN PATTERN! with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], @@ -231,9 +237,14 @@ Don't forget all those ()'s of your values won't be coreectly assigned. If you have a SINGLE value being returned, it is written this way: - (button, (value1,)) - -Forgetting the comma will mess you up but good + (button, (value1,)) = form.LayoutAndShow(form_rows) + Another way of parsing the return values is to store the list of values into a variable that is then referenced. + + (button, (value)) = form.LayoutAndShow(form_rows) + value1 = values[0] + value2 = values[1] + ... + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. @@ -265,9 +276,75 @@ This is a somewhat complex form with quite a bit of custom sizing to make things ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) -Clicking Submit caused the form call to return and the call to MsgBox is made to display the results. +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. ![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) +One important aspect of this example is the return codes: + + (button, (values)) = form.LayoutAndShow(layout) +The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes. These return `bool`. + + + +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. + +> Control-Q (when cursor is on function name) brings up a box with the +> function definition +> Control-P (when cursor inside function call "()") +> shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(NonBlocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: +Let's go through the options available when creating a form. + + def __init__(self, title, + DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + AutoSizeText=DEFAULT_AUTOSIZE_TEXT, + Scale=(None, None), + Size=(None, None), + Location=(None, None), + ButtonColor=None,Font=None, + ProgressBarColor=(None,None), + IsTabbedForm=False, + BorderDepth=None, + AutoClose=False, + AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, + Icon=DEFAULT_WINDOW_ICON): + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `Size=(20,1)` in the form creation call will set all elements in the form to that size. +In addition to `size` there is a `scale` option. Scale will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + +> DefaultElementSize - set default size for all elements in the form +> AutoSizeText - true/false autosizing turned on / off +> Scale - set scale value for all elements +> ButtonColor - default button color (foreground, background) +> Font - font name and size for all text items +> ProgressBarColor - progress bar colors +> IsTabbedForm - true/false indicates form is a tabbed or normal form +> BorderDepth - style setting for buttons, input fields +> AutoClose - true/false indicates if form will automatically close +> AutoCloseDuration - how long in seconds before closing form +> Icon - filename for icon that's displayed on the window on taskbar ## Built With @@ -292,3 +369,7 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + + + From 2be7824fcdc98923407ec1f4b05d3c750b61a961 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 12 Jul 2018 12:58:48 -0400 Subject: [PATCH 011/521] Update readme.md --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 65f85c176..b12d8f844 100644 --- a/readme.md +++ b/readme.md @@ -36,6 +36,7 @@ The customization power comes from the form/dialog box builder that enables user An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. + ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) From 2449e0527e9c583ac350c589dea28d46e3de9818 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 12 Jul 2018 13:27:34 -0400 Subject: [PATCH 012/521] Update readme.md --- readme.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/readme.md b/readme.md index b12d8f844..b08b0a0b7 100644 --- a/readme.md +++ b/readme.md @@ -369,8 +369,3 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence - - - - - From 4f0c4e171fb759364b37fdc338f3b95e93dbc71d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 09:18:47 -0400 Subject: [PATCH 013/521] Update readme.md --- readme.md | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index b08b0a0b7..8e0947066 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ This really is a simple GUI, but also powerfully customizable. I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a much more pleasant experience than opening a dos Window. +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. @@ -329,9 +329,13 @@ Let's go through the options available when creating a form. #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. +The default Element size for PySimpleGUI is `(45,1)`. + Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `Size=(20,1)` in the form creation call will set all elements in the form to that size. + In addition to `size` there is a `scale` option. Scale will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + #### FlexForm - form-level variables overview A summary of the variables that can be changed when a FlexForm is created @@ -347,9 +351,96 @@ A summary of the variables that can be changed when a FlexForm is created > AutoCloseDuration - how long in seconds before closing form > Icon - filename for icon that's displayed on the window on taskbar -## Built With - - + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows +> Tabbed forms +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window +> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[SG.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + Font=None, + TextColor=None) + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Colos** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +#### Multiline Text Element + + layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', Size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(DefaultText='', + EnterSubmits = False, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None) + +> DefaultText - Text to display in the text box +>EnterSubmits - Bool. If True, pressing Enter key submits form +>Scale - Element's scale +>Size - Element's size +>AutoSizeText - Bool. Change width to match size of text + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). +#### Text Input Element + + layout = [[SG.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(DefaultText = '', + Scale=(None, None), + Size=(None, None), + AutoSizeText=None) + ## Contributing A MikeTheWatchGuy production... entirely responsible for this code @@ -369,3 +460,6 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + + From fe2a5b1dba000ca81d46f310b9bf503a22160f89 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 10:24:35 -0400 Subject: [PATCH 014/521] More Readme --- readme.md | 436 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 321 insertions(+), 115 deletions(-) diff --git a/readme.md b/readme.md index 5c20f75cd..cfb44a7b3 100644 --- a/readme.md +++ b/readme.md @@ -6,58 +6,65 @@ This really is a simple GUI, but also powerfully customizable. ![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -Python itself doesn't have a simple solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. - -The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. - -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. - -The customization power comes from the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. - -Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - - -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. + +The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + +You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop. + +![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) + + + The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. + + +> Features of PySimpleGUI include: +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Icons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows +> Tabbed forms +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window +> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. + +![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) + + +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + ### Using To us in your code, simply import.... - `import PySimpleGUI as SG` + `import PySimpleGUI as SG` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) @@ -65,22 +72,22 @@ Then use either "high level" API calls or build your own forms. Yes, it's just that easy to have a window appear on the screen using Python. ## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + ### Python Language Features There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call + * Variable number of arguments to a function call * Optional parameters to a function call - + #### Variable Number of Arguments The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - + SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") Each new item begins on a new line in the Message Box @@ -132,11 +139,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` -<<<<<<< HEAD -======= - ->>>>>>> 0b28fa3a917c83d2101bee375a0aadd816948156 ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -160,11 +163,11 @@ The differences tend to be the number and types of buttons. Here are the calls ![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. #### High Level User Input -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - GetFileBox - GetFolderBox @@ -181,14 +184,28 @@ There are 3 very basic user input high-level function calls. It's expected that ![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? +![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) + + EasyProgressMeter(Title, + CurrentValue, + MaxValue, + *args, + Orientation=None, + BarColor=DEFAULT_PROGRESS_BAR_COLOR, + ButtonColor=None, + Size=DEFAULT_PROGRESS_BAR_SIZE, + Scale=(None, None), + BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +# Custom Form API Calls -### Custom Form API Calls This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# COPY THIS DESIGN PATTERN! +## COPY THIS DESIGN PATTERN! with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], @@ -201,7 +218,9 @@ This context manager contains all of the code needed to specify, show and retrie It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. +You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. + +> Copy, Paste, Run. PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. @@ -220,44 +239,49 @@ Now we're on the second row of the form. On this row there are 2 elements. The [SG.Submit(), SG.Cancel()]] -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its valueso the caller. +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. (button, (source_filename, )) = form.LayoutAndShow(form_rows) This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Don't forget all those ()'s of your values won't be coreectly assigned. - -If you have a SINGLE value being returned, it is written this way: - - (button, (value1,)) - -Forgetting the comma will mess you up but good + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + + (button, (value1,)) = form.LayoutAndShow(form_rows) + Another way of parsing the return values is to store the list of values into a variable that is then referenced. + + (button, (value)) = form.LayoutAndShow(form_rows) + value1 = values[0] + value2 = values[1] + ... + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: - layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], - [Text('Here is some text with font sizing', Font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], - [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [Text('_' * 90, Size=(60, 1))], - [Text('Choose Source and Destination Folders', Size=(35,1))], - [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], - [Submit(), Cancel()]] - + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], + [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], + [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [Text('_' * 90, Size=(60, 1))], + [Text('Choose Source and Destination Folders', Size=(35,1))], + [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [Submit(), Cancel()]] + (button, (values)) = form.LayoutAndShow(layout) @@ -269,30 +293,212 @@ This is a somewhat complex form with quite a bit of custom sizing to make things ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) -Clicking Submit caused the form call to return and the call to MsgBox is made to display the results. +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. ![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) +One important aspect of this example is the return codes: + + (button, (values)) = form.LayoutAndShow(layout) +The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + + + +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. + +> Control-Q (when cursor is on function name) brings up a box with the +> function definition +> Control-P (when cursor inside function call "()") +> shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(NonBlocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: +Let's go through the options available when creating a form. + + def __init__(self, title, + DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + AutoSizeText=DEFAULT_AUTOSIZE_TEXT, + Scale=(None, None), + Size=(None, None), + Location=(None, None), + ButtonColor=None,Font=None, + ProgressBarColor=(None,None), + IsTabbedForm=False, + BorderDepth=None, + AutoClose=False, + AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, + Icon=DEFAULT_WINDOW_ICON): + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `Size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. Scale will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + +> DefaultElementSize - set default size for all elements in the form +> AutoSizeText - true/false autosizing turned on / off +> Scale - set scale value for all elements +> ButtonColor - default button color (foreground, background) +> Font - font name and size for all text items +> ProgressBarColor - progress bar colors +> IsTabbedForm - true/false indicates form is a tabbed or normal form +> BorderDepth - style setting for buttons, input fields +> AutoClose - true/false indicates if form will automatically close +> AutoCloseDuration - how long in seconds before closing form +> Icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows +> Tabbed forms +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window +> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[SG.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + Font=None, + TextColor=None) + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Colos** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +#### Multiline Text Element + + layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', Size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(DefaultText='', + EnterSubmits = False, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None) + +> DefaultText - Text to display in the text box +>EnterSubmits - Bool. If True, pressing Enter key submits form +>Scale - Element's scale +>Size - Element's size +>AutoSizeText - Bool. Change width to match size of text + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[SG.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(DefaultText = '', + Scale=(None, None), + Size=(None, None), + AutoSizeText=None) +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(Values, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None) + + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release + + ## Code Condition +> Make it run +> Make it right +> Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor on hiding implementation details, naming conventions, PEP 8. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments -## Built With - - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - -1.0.9 - July 10, 2018 - Initial Release - - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + + + From 46e56434a39bcd98d4683aa3da3a3126999e6f13 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 10:45:55 -0400 Subject: [PATCH 015/521] Update readme.md --- readme.md | 367 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 227 insertions(+), 140 deletions(-) diff --git a/readme.md b/readme.md index 8e0947066..d8cf3cebf 100644 --- a/readme.md +++ b/readme.md @@ -8,20 +8,28 @@ This really is a simple GUI, but also powerfully customizable. I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - + Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. - -The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. - -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. - -The customization power comes from the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. - + +The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + +You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop. + +![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) + + + The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. + + > Features of PySimpleGUI include: > Text > Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Buttons including these types: +> File Browse +> Folder Browse +> Non-closing return +> Close form > Checkboxes > Radio Buttons > Icons @@ -35,35 +43,50 @@ The customization power comes from the form/dialog box builder that enables user > 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) +> Features of PySimpleGUI include: +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Icons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows +> Tabbed forms +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window +> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - ### Using To us in your code, simply import.... - `import PySimpleGUI as SG` + `import PySimpleGUI as SG` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) @@ -71,65 +94,79 @@ Then use either "high level" API calls or build your own forms. Yes, it's just that easy to have a window appear on the screen using Python. ## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + ### Python Language Features There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call + * Variable number of arguments to a function call * Optional parameters to a function call - + #### Variable Number of Arguments The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - + SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") Each new item begins on a new line in the Message Box ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) - + #### Optional Parameters to a Function Call - + This feature of the Python language is utilized ***heavily*** as a method of customizing forms and part of forms. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. - def MsgBox(*args, - ButtonColor=None, - ButtonType=MSG_BOX_OK, - AutoClose=False, - AutoCloseDuration=None, - Icon=DEFAULT_WINDOW_ICON, - LineWidth=MESSAGE_BOX_LINE_WIDTH, - Font=None): + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', + SG.MsgBox('This box has a custom button color', ButtonColor=('black', 'yellow')) ![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) -### High Level API Calls +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. @@ -138,7 +175,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` - + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -162,13 +199,13 @@ The differences tend to be the number and types of buttons. Here are the calls ![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. #### High Level User Input There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - - GetFileBox + - GetFileBox - GetFolderBox `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` @@ -183,7 +220,30 @@ There are 3 very basic user input high-level function calls. It's expected that ![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? +![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) + + EasyProgressMeter(Title, + CurrentValue, + MaxValue, + *args, + Orientation=None, + BarColor=DEFAULT_PROGRESS_BAR_COLOR, + ButtonColor=None, + Size=DEFAULT_PROGRESS_BAR_SIZE, + Scale=(None, None), + BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +That line of code resulted in this window popping up and updating. +![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. # Custom Form API Calls @@ -193,10 +253,10 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e ## COPY THIS DESIGN PATTERN! - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] (button, (source_filename, )) = form.LayoutAndShow(form_rows) This context manager contains all of the code needed to specify, show and retrieve results for this form: @@ -204,68 +264,70 @@ This context manager contains all of the code needed to specify, show and retrie It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. +You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. + +> Copy, Paste, Run. -PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. +PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller simply writes `Submit`. Going through each line of code - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: -This creates a new form, storing it in the variable `form`. + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: +This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. [SG.Submit(), SG.Cancel()]] -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its valueso the caller. +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. (button, (source_filename, )) = form.LayoutAndShow(form_rows) This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Don't forget all those ()'s of your values won't be coreectly assigned. - -If you have a SINGLE value being returned, it is written this way: - + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + (button, (value1,)) = form.LayoutAndShow(form_rows) Another way of parsing the return values is to store the list of values into a variable that is then referenced. - (button, (value)) = form.LayoutAndShow(form_rows) + (button, (value)) = form.LayoutAndShow(form_rows) value1 = values[0] value2 = values[1] ... - + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: - layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], - [Text('Here is some text with font sizing', Font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], - [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [Text('_' * 90, Size=(60, 1))], - [Text('Choose Source and Destination Folders', Size=(35,1))], - [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], - [Submit(), Cancel()]] - + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], + [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], + [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [Text('_' * 90, Size=(60, 1))], + [Text('Choose Source and Destination Folders', Size=(35,1))], + [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [Submit(), Cancel()]] + (button, (values)) = form.LayoutAndShow(layout) @@ -285,7 +347,7 @@ One important aspect of this example is the return codes: (button, (values)) = form.LayoutAndShow(layout) The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes. These return `bool`. +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. @@ -293,7 +355,7 @@ You can see in the MsgBox that the values returned are a list. Each input field You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. > Control-Q (when cursor is on function name) brings up a box with the -> function definition +> function definition > Control-P (when cursor inside function call "()") > shows a list of parameters and their default values @@ -308,10 +370,10 @@ NON-BLOCKING form call: ### Beginning a Form The first step is to create the form object using the desired form customization. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: Let's go through the options available when creating a form. - def __init__(self, title, + def __init__(self, title, DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), AutoSizeText=DEFAULT_AUTOSIZE_TEXT, Scale=(None, None), @@ -324,7 +386,7 @@ Let's go through the options available when creating a form. AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Icon=DEFAULT_WINDOW_ICON): - + #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. @@ -355,18 +417,18 @@ A summary of the variables that can be changed when a FlexForm is created ## Elements "Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. -> Text -> Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form -> Checkboxes -> Radio Buttons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows > Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window > 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) @@ -378,15 +440,15 @@ Building a form is simply making lists of Elements. Each list is a row in the o The code is a crude representation of the GUI, laid out in text. #### Text Element - layout = [[SG.Text('This is what a Text Element looks like')]] + layout = [[SG.Text('This is what a Text Element looks like')]] + - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - Text(Text, + Text(Text, Scale=(None, None), Size=(None, None), AutoSizeText=None, @@ -430,7 +492,8 @@ This Element doubles as both an input and output Element. The `DefaultText` opt >AutoSizeText - Bool. Change width to match size of text ### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + #### Text Input Element layout = [[SG.InputText('Default text')]] @@ -440,26 +503,50 @@ This Element doubles as both an input and output Element. The `DefaultText` opt Scale=(None, None), Size=(None, None), AutoSizeText=None) +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(Values, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None) + + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + + +1.0.9 - July 10, 2018 - Initial Release +1.0.20 - July 13, 2018 - Readme file updates + + ## Code Condition +> Make it run +> Make it right +> Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor on hiding implementation details, naming conventions, PEP 8. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - -1.0.9 - July 10, 2018 - Initial Release - - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + From a430c86ad2f1d2a4915d155c60ef259fac982b21 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 10:53:50 -0400 Subject: [PATCH 016/521] Readme updates. Button color Still working on completing the Readme. Changed the global button colors to white on black, the new signature for PySimpleGUI. --- Demo High Level APIs.py | 10 ++++++ PySimpleGUI.py | 74 ++++++++++++++++++++++++++++++++++++----- readme.md | 55 ++++++++++++++++++------------ 3 files changed, 110 insertions(+), 29 deletions(-) create mode 100644 Demo High Level APIs.py diff --git a/Demo High Level APIs.py b/Demo High Level APIs.py new file mode 100644 index 000000000..2f9c3bec7 --- /dev/null +++ b/Demo High Level APIs.py @@ -0,0 +1,10 @@ +import PySimpleGUI as sg + +rc, number = sg.GetTextBox('Title goes here', 'Enter a number') +if not rc: + sg.MsgBoxError('You have cancelled') + exit(0) + +msg = '\n'.join([f'{i}' for i in range(0,int(number))]) + +sg.ScrolledTextBox(msg, Height=10) \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 333ab230a..89464f28f 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -31,7 +31,8 @@ (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember # DEFAULT_BUTTON_COLOR = (GREENS[3], TANS[0]) # Foreground, Background (None, None) == System Default -DEFAULT_BUTTON_COLOR = (YELLOWS[0], GREENS[4]) # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = (YELLOWS[0], GREENS[4]) # Foreground, Background (None, None) == System Default +DEFAULT_BUTTON_COLOR = ('white', 'black') # Foreground, Background (None, None) == System Default # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[2]) # Foreground, Background (None, None) == System Default DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) @@ -1221,7 +1222,7 @@ def _GetNumLinesNeeded(text, max_line_width): # ===================================================# def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, AutoCloseDuration=None, Icon=DEFAULT_WINDOW_ICON, LineWidth=MESSAGE_BOX_LINE_WIDTH, Font=None): ''' - + Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: :param ButtonColor: :param ButtonType: @@ -1232,10 +1233,13 @@ def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, Aut :param Font: :return: ''' - if not args: return - with FlexForm(args[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Icon=Icon, Font=Font) as form: + if not args: + args_to_print = [''] + else: + args_to_print = args + with FlexForm(args_to_print[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Icon=Icon, Font=Font) as form: max_line_total, total_lines = 0,0 - for message in args: + for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) # if not isinstance(message, str): message = str(message) message = str(message) @@ -1273,6 +1277,15 @@ def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, Aut # Lazy function. Same as calling MsgBox with parms # # ===================================================# def MsgBoxAutoClose(*args, ButtonColor=None,AutoClose=True, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Font=None): + ''' + Display a standard MsgBox that will automatically close after a specified amount of time + :param args: + :param ButtonColor: + :param AutoClose: + :param AutoCloseDuration: + :param Font: + :return: + ''' MsgBox(*args, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return @@ -1281,13 +1294,31 @@ def MsgBoxAutoClose(*args, ButtonColor=None,AutoClose=True, AutoCloseDuration=DE # Like MsgBox but presents RED BUTTONS # # ===================================================# def MsgBoxError(*args, ButtonColor=DEFAULT_ERROR_BUTTON_COLOR,AutoClose=False, AutoCloseDuration=None, Font=None): + ''' + Display a MsgBox with a red button + :param args: + :param ButtonColor: + :param AutoClose: + :param AutoCloseDuration: + :param Font: + :return: + ''' MsgBox(*args, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return # ============================== MsgBoxCancel =====# -# Like MsgBox but presents RED BUTTONS # +# # # ===================================================# def MsgBoxCancel(*args,ButtonColor=DEFAULT_CANCEL_BUTTON_COLOR,AutoClose=False, AutoCloseDuration=None, Font=None): + ''' + Display a MsgBox with a single "Cancel" button. + :param args: + :param ButtonColor: + :param AutoClose: + :param AutoCloseDuration: + :param Font: + :return: + ''' MsgBox(*args, ButtonType=MSG_BOX_CANCELLED, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return @@ -1295,13 +1326,31 @@ def MsgBoxCancel(*args,ButtonColor=DEFAULT_CANCEL_BUTTON_COLOR,AutoClose=False, # Like MsgBox but only 1 button # # ===================================================# def MsgBoxOK(*args,ButtonColor=('white', 'black'),AutoClose=False, AutoCloseDuration=None, Font=None): + ''' + Display a MsgBox with a single buttoned labelled "OK" + :param args: + :param ButtonColor: + :param AutoClose: + :param AutoCloseDuration: + :param Font: + :return: + ''' MsgBox(*args, ButtonType=MSG_BOX_OK, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return -# ============================== MsgBoxCancel =====# -# Like MsgBox but presents RED BUTTONS # +# ============================== MsgBoxOKCancel ====# +# Like MsgBox but presents OK and Cancel buttons # # ===================================================# def MsgBoxOKCancel(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): + ''' + Display MsgBox with 2 buttons, "OK" and "Cancel" + :param args: + :param ButtonColor: + :param AutoClose: + :param AutoCloseDuration: + :param Font: + :return: + ''' result = MsgBox(*args, ButtonType=MSG_BOX_OK_CANCEL, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return result @@ -1310,6 +1359,15 @@ def MsgBoxOKCancel(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=Non # Returns True if Yes was pressed else False # # ===================================================# def MsgBoxYesNo(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): + ''' + Display MsgBox with 2 buttons, "Yes" and "No" + :param args: + :param ButtonColor: + :param AutoClose: + :param AutoCloseDuration: + :param Font: + :return: + ''' result = MsgBox(*args,ButtonType=MSG_BOX_YES_NO, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) return result diff --git a/readme.md b/readme.md index cfb44a7b3..f41477af9 100644 --- a/readme.md +++ b/readme.md @@ -21,21 +21,25 @@ You can add a GUI to your command line with a single line of code. With 3 or 4 The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. -> Features of PySimpleGUI include: -> Text -> Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form -> Checkboxes -> Radio Buttons -> Icons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows -> Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window -> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. @@ -199,6 +203,19 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Scale=(None, None), BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +That line of code resulted in this window popping up and updating. +![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): break + # Custom Form API Calls This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. @@ -478,7 +495,8 @@ A MikeTheWatchGuy production... entirely responsible for this code ## Versioning -1.0.9 - July 10, 2018 - Initial Release +1.0.9 - July 10, 2018 - Initial Release +1.0.21 - July 13, 2018 - Readme updates ## Code Condition > Make it run @@ -497,8 +515,3 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence - - - - - From cb3f2a500712a3b03f856fe5d29b401128a20bce Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 11:02:21 -0400 Subject: [PATCH 017/521] Initial checkin Demonstrates using custom forms to generate a 3 forms. Two are synchronous forms and one is async. Excellent design templates. --- Demo Recipes.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Demo Recipes.py diff --git a/Demo Recipes.py b/Demo Recipes.py new file mode 100644 index 000000000..a19bdeeba --- /dev/null +++ b/Demo Recipes.py @@ -0,0 +1,63 @@ +import PySimpleGUI as g + +def SourceDestFolders(): + with g.FlexForm('Demo Source / Destination Folders', AutoSizeText=True) as form: + form_rows = [[g.Text('Enter the Source and Destination folders')], + [g.Text('Choose Source and Destination Folders')], + [g.Text('Source Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Source'), + g.FolderBrowse()], + [g.Text('Destination Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Dest'), + g.FolderBrowse()], + [g.Submit(), g.Cancel()]] + + (button, (source, dest)) = form.LayoutAndShow(form_rows) + if button == 'Submit': + # do something useful with the inputs + g.MsgBox('Submitted', 'The user entered source folder', source, 'And destination folder', dest) + else: + g.MsgBoxError('Cancelled', 'User Cancelled') + +def Everything(): + with g.FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(40,1)) as form: + layout = [[g.Text('All graphic widgets in one form!', Size=(30,1), Font=("Helvetica", 25))], + [g.Text('Here is some text.... and a place to enter text')], + [g.InputText()], + [g.Checkbox('My first checkbox!'), g.Checkbox('My second checkbox!', Default=True)], + [g.Radio('My first Radio!', "RADIO1", Default=True), g.Radio('My second Radio!', "RADIO1")], + [g.Multiline(DefaultText='This is the DEFAULT Text should you decide not to type anything', Scale=(2, 10))], + [g.InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [g.Text('_' * 100, Size=(90, 1))], + [g.Text('Choose Source and Destination Folders', Size=(35,1))], + [g.Text('Source Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Source'), g.FolderBrowse()], + [g.Text('Destination Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Dest'), g.FolderBrowse()], + [g.SimpleButton('Your very own button')], + [g.Submit(), g.Cancel()]] + + (button, (values)) = form.LayoutAndShow(layout) + + g.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + +# example of an Asynchronous form +def ChatBot(): + with g.FlexForm('Chat Window', AutoSizeText=True, DefaultElementSize=(30, 2)) as form: + form.AddRow(g.Text('This is where standard out is being routed', Size=[40,1])) + form.AddRow(g.Output(Size=(80, 20))) + form.AddRow(g.Multiline(Size=(70, 5), EnterSubmits=True), g.ReadFormButton('SEND', ButtonColor=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', ButtonColor=(g.YELLOWS[0], g.GREENS[0]))) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + (button, value) = form.Read() + if button == 'SEND': + print(value) + else: + print('Exiting the form now') + break + print('Exiting the chatbot....') + +def main(): + SourceDestFolders() + Everything() + ChatBot() + +if __name__ == '__main__': + main() From 61b9ccb2283a9cc36f92657c5153245e3bea3489 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 11:03:20 -0400 Subject: [PATCH 018/521] Update readme.md --- readme.md | 603 ++++++++++++++---------------------------------------- 1 file changed, 155 insertions(+), 448 deletions(-) diff --git a/readme.md b/readme.md index 13ec0a13d..8f2765bc1 100644 --- a/readme.md +++ b/readme.md @@ -8,107 +8,67 @@ This really is a simple GUI, but also powerfully customizable. I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - + Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. - -The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. - + +The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop. ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) - The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. - + The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. + -<<<<<<< HEAD - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: File Browse Folder Browse Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window + Persistent Windows + Redirect Python Output/Errors to scrolling Window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) -======= - -> Features of PySimpleGUI include: -> Text -> Single Line Input -> Buttons including these types: -> File Browse -> Folder Browse -> Non-closing return -> Close form -> Checkboxes -> Radio Buttons -> Icons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows -> Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window -> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) -> Features of PySimpleGUI include: -> Text -> Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form -> Checkboxes -> Radio Buttons -> Icons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows -> Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window -> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) ->>>>>>> 46e56434a39bcd98d4683aa3da3a3126999e6f13 - - An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - + +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + ### Using To us in your code, simply import.... - `import PySimpleGUI as SG` + `import PySimpleGUI as SG` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) @@ -116,90 +76,65 @@ Then use either "high level" API calls or build your own forms. Yes, it's just that easy to have a window appear on the screen using Python. ## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + ### Python Language Features There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call + * Variable number of arguments to a function call * Optional parameters to a function call - + #### Variable Number of Arguments The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - + SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") Each new item begins on a new line in the Message Box ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) - + #### Optional Parameters to a Function Call - + This feature of the Python language is utilized ***heavily*** as a method of customizing forms and part of forms. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. -<<<<<<< HEAD - def MsgBox(*args, - ButtonColor=None, - ButtonType=MSG_BOX_OK, - AutoClose=False, - AutoCloseDuration=None, - Icon=DEFAULT_WINDOW_ICON, + def MsgBox(*args, + ButtonColor=None, + ButtonType=MSG_BOX_OK, + AutoClose=False, + AutoCloseDuration=None, + Icon=DEFAULT_WINDOW_ICON, LineWidth=MESSAGE_BOX_LINE_WIDTH, Font=None): -======= - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - - ->>>>>>> 46e56434a39bcd98d4683aa3da3a3126999e6f13 If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', + SG.MsgBox('This box has a custom button color', ButtonColor=('black', 'yellow')) ![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) +### High Level API Calls +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) + #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. @@ -208,7 +143,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` - + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -232,13 +167,13 @@ The differences tend to be the number and types of buttons. Here are the calls ![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. #### High Level User Input There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - - GetFileBox + - GetFileBox - GetFolderBox `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` @@ -256,7 +191,6 @@ There are 3 very basic user input high-level function calls. It's expected that #### Progress Meter! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? ![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) -<<<<<<< HEAD EasyProgressMeter(Title, CurrentValue, @@ -269,35 +203,18 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Scale=(None, None), BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): -======= - - EasyProgressMeter(Title, - CurrentValue, - MaxValue, - *args, - Orientation=None, - BarColor=DEFAULT_PROGRESS_BAR_COLOR, - ButtonColor=None, - Size=DEFAULT_PROGRESS_BAR_SIZE, - Scale=(None, None), - BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - ->>>>>>> 46e56434a39bcd98d4683aa3da3a3126999e6f13 Here's the one-line Progress Meter in action! - for i in range(1,10000): + for i in range(1,10000): SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') That line of code resulted in this window popping up and updating. ![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -<<<<<<< HEAD -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): break -======= ->>>>>>> 46e56434a39bcd98d4683aa3da3a3126999e6f13 # Custom Form API Calls @@ -307,10 +224,10 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e ## COPY THIS DESIGN PATTERN! - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] (button, (source_filename, )) = form.LayoutAndShow(form_rows) This context manager contains all of the code needed to specify, show and retrieve results for this form: @@ -318,23 +235,23 @@ This context manager contains all of the code needed to specify, show and retrie It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. +You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. > Copy, Paste, Run. -PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. +PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller simply writes `Submit`. Going through each line of code - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: -This creates a new form, storing it in the variable `form`. + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: +This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. [SG.Submit(), SG.Cancel()]] @@ -346,42 +263,42 @@ This is the code that **displays** the form, collects the information and return ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Don't forget all those ()'s of your values won't be coreectly assigned. - -If you have a SINGLE value being returned, it is written this way: - + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + (button, (value1,)) = form.LayoutAndShow(form_rows) Another way of parsing the return values is to store the list of values into a variable that is then referenced. - (button, (value)) = form.LayoutAndShow(form_rows) + (button, (value)) = form.LayoutAndShow(form_rows) value1 = values[0] value2 = values[1] ... - + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: - layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], - [Text('Here is some text with font sizing', Font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], - [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [Text('_' * 90, Size=(60, 1))], - [Text('Choose Source and Destination Folders', Size=(35,1))], - [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], - [Submit(), Cancel()]] - + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], + [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], + [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [Text('_' * 90, Size=(60, 1))], + [Text('Choose Source and Destination Folders', Size=(35,1))], + [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [Submit(), Cancel()]] + (button, (values)) = form.LayoutAndShow(layout) @@ -397,214 +314,11 @@ Clicking the Submit button caused the form call to return. The call to MsgBox r ![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) One important aspect of this example is the return codes: -<<<<<<< HEAD - - (button, (values)) = form.LayoutAndShow(layout) -The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - - - -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. - -> Control-Q (when cursor is on function name) brings up a box with the -> function definition -> Control-P (when cursor inside function call "()") -> shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(NonBlocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: -Let's go through the options available when creating a form. - - def __init__(self, title, - DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - AutoSizeText=DEFAULT_AUTOSIZE_TEXT, - Scale=(None, None), - Size=(None, None), - Location=(None, None), - ButtonColor=None,Font=None, - ProgressBarColor=(None,None), - IsTabbedForm=False, - BorderDepth=None, - AutoClose=False, - AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, - Icon=DEFAULT_WINDOW_ICON): - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `Size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. Scale will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - -> DefaultElementSize - set default size for all elements in the form -> AutoSizeText - true/false autosizing turned on / off -> Scale - set scale value for all elements -> ButtonColor - default button color (foreground, background) -> Font - font name and size for all text items -> ProgressBarColor - progress bar colors -> IsTabbedForm - true/false indicates form is a tabbed or normal form -> BorderDepth - style setting for buttons, input fields -> AutoClose - true/false indicates if form will automatically close -> AutoCloseDuration - how long in seconds before closing form -> Icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - -> Text -> Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form -> Checkboxes -> Radio Buttons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows -> Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window -> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[SG.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None, - Font=None, - TextColor=None) - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Colos** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -#### Multiline Text Element - - layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', Size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(DefaultText='', - EnterSubmits = False, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None) - -> DefaultText - Text to display in the text box ->EnterSubmits - Bool. If True, pressing Enter key submits form ->Scale - Element's scale ->Size - Element's size ->AutoSizeText - Bool. Change width to match size of text - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[SG.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(DefaultText = '', - Scale=(None, None), - Size=(None, None), - AutoSizeText=None) -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(Values, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None) - - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - -1.0.9 - July 10, 2018 - Initial Release -1.0.21 - July 13, 2018 - Readme updates - - ## Code Condition -> Make it run -> Make it right -> Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor on hiding implementation details, naming conventions, PEP 8. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -======= (button, (values)) = form.LayoutAndShow(layout) The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. @@ -612,7 +326,7 @@ You can see in the MsgBox that the values returned are a list. Each input field You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. > Control-Q (when cursor is on function name) brings up a box with the -> function definition +> function definition > Control-P (when cursor inside function call "()") > shows a list of parameters and their default values @@ -627,10 +341,10 @@ NON-BLOCKING form call: ### Beginning a Form The first step is to create the form object using the desired form customization. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: Let's go through the options available when creating a form. - def __init__(self, title, + def __init__(self, title, DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), AutoSizeText=DEFAULT_AUTOSIZE_TEXT, Scale=(None, None), @@ -643,7 +357,7 @@ Let's go through the options available when creating a form. AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Icon=DEFAULT_WINDOW_ICON): - + #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. @@ -674,18 +388,18 @@ A summary of the variables that can be changed when a FlexForm is created ## Elements "Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. -> Text -> Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form -> Checkboxes -> Radio Buttons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows +> Text +> Single Line Input +> Buttons including these types: File Browse Folder Browse Non-closing return Close form +> Checkboxes +> Radio Buttons +> Multi-line Text Input +> Scroll-able Output +> Progress Bar +> Async/Non-Blocking Windows > Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window +> Persistent Windows +> Redirect Python Output/Errors to scrolling Window > 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) @@ -697,15 +411,15 @@ Building a form is simply making lists of Elements. Each list is a row in the o The code is a crude representation of the GUI, laid out in text. #### Text Element - layout = [[SG.Text('This is what a Text Element looks like')]] - + layout = [[SG.Text('This is what a Text Element looks like')]] + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - Text(Text, + Text(Text, Scale=(None, None), Size=(None, None), AutoSizeText=None, @@ -750,7 +464,7 @@ This Element doubles as both an input and output Element. The `DefaultText` opt ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - + #### Text Input Element layout = [[SG.InputText('Default text')]] @@ -766,45 +480,38 @@ Shorthand functions that are equivalent to `InputText` are `Input` and `In` Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - + ![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - InputCombo(Values, + InputCombo(Values, Scale=(None, None), Size=(None, None), AutoSizeText=None) -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - - -1.0.9 - July 10, 2018 - Initial Release -1.0.20 - July 13, 2018 - Readme file updates - - ## Code Condition -> Make it run +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release +1.0.21 - July 13, 2018 - Readme updates + + ## Code Condition +> Make it run > Make it right > Make it fast It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor on hiding implementation details, naming conventions, PEP 8. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence - - - - - ->>>>>>> 46e56434a39bcd98d4683aa3da3a3126999e6f13 From d15b199d4e50125368319ce467bedb60ba4c47b4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 13:24:22 -0400 Subject: [PATCH 019/521] Update readme.md --- readme.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 8f2765bc1..ef139cdb2 100644 --- a/readme.md +++ b/readme.md @@ -15,6 +15,7 @@ The PySimpleGUI solution is focused on the ***developer***. How can the desired You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop. + ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) @@ -209,6 +210,7 @@ Here's the one-line Progress Meter in action! SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') That line of code resulted in this window popping up and updating. + ![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. @@ -436,7 +438,7 @@ The default font setting is ("Helvetica", 10) -**Colos** in PySimpleGUI are always in this format: +**Color** in PySimpleGUI are always in this format: (foreground, background) @@ -444,6 +446,10 @@ The values foreground and background can be the color names or the hex value for "#RRGGBB" +**AutoSizeText** +A `True` value for `AutoSizeText`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + + #### Multiline Text Element layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', Size=(45,5))]] @@ -462,6 +468,16 @@ This Element doubles as both an input and output Element. The `DefaultText` opt >Size - Element's size >AutoSizeText - Bool. Change width to match size of text +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(Size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(Scale=(None, None), + Size=(None, None)) + ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. @@ -488,6 +504,17 @@ Also known as a drop-down list. Only required parameter is the list of choices. Size=(None, None), AutoSizeText=None) +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + + +#### Checkbox Element +#### Spin Element +#### Button Element +#### ProgressBar +#### Output +#### UberForm ## Contributing @@ -515,3 +542,4 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + From 4438bac4399a2dce333b518b3e81427cbe3c3545 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 13:42:43 -0400 Subject: [PATCH 020/521] Button color --- Demo Recipes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo Recipes.py b/Demo Recipes.py index a19bdeeba..0d57c15de 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -19,7 +19,7 @@ def SourceDestFolders(): def Everything(): with g.FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(40,1)) as form: - layout = [[g.Text('All graphic widgets in one form!', Size=(30,1), Font=("Helvetica", 25))], + layout = [[g.Text('All graphic widgets in one form!', Size=(30,1), Font=("Helvetica", 25), TextColor='blue')], [g.Text('Here is some text.... and a place to enter text')], [g.InputText()], [g.Checkbox('My first checkbox!'), g.Checkbox('My second checkbox!', Default=True)], @@ -30,7 +30,7 @@ def Everything(): [g.Text('Choose Source and Destination Folders', Size=(35,1))], [g.Text('Source Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Source'), g.FolderBrowse()], [g.Text('Destination Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Dest'), g.FolderBrowse()], - [g.SimpleButton('Your very own button')], + [g.SimpleButton('Your very own button', ButtonColor=('white', 'green'))], [g.Submit(), g.Cancel()]] (button, (values)) = form.LayoutAndShow(layout) From caad84a674b8248c518e707c8f8cc87a7b30664e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 13:52:49 -0400 Subject: [PATCH 021/521] Update readme.md --- readme.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/readme.md b/readme.md index ef139cdb2..f146bbab1 100644 --- a/readme.md +++ b/readme.md @@ -478,6 +478,9 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. Output(Scale=(None, None), Size=(None, None)) +> Scale - How much to scale size of element +> Size - Size of element (width, height) in characters + ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. @@ -490,8 +493,15 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. Scale=(None, None), Size=(None, None), AutoSizeText=None) + +> DefaultText - Text initially shown in the input box +> Scale - Amount size is scaled by +> Size - (width, height) of element in characters +> AutoSizeText - Bool. True is element should be sized to fit text + Shorthand functions that are equivalent to `InputText` are `Input` and `In` + #### Combo Element Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. @@ -504,10 +514,34 @@ Also known as a drop-down list. Only required parameter is the list of choices. Size=(None, None), AutoSizeText=None) +> Values Choices to be displayed. List of strings +> Scale - Amount to scale size by +> Size - (width, height) of element in characters +> AutoSizeText - Bool. True if size should fit the text length + #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + layout = [[SG.Radio('My first Radio!', "RADIO1", Default=True), SG.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(Text, + GroupID, + Default=False, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + Font=None) + +> Text - Text to display next to button +> GroupID - Variable to groups together multiple Radio Buttons. Can be any value +> Default - Bool. Initial state +> Scale - Amount to scale size of element +> Size - (width, height) size of element in characters +> AutoSizeText - Bool. True if should size width to fit text +> Font - Font type and size for text display #### Checkbox Element #### Spin Element From 3c8ea90692243ab6991e8415a379e33dcc2dd330 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 16:53:03 -0400 Subject: [PATCH 022/521] More readme updates --- Demo Recipes.py | 8 +-- readme.md | 178 ++++++++++++++++++++++++++++++------------------ 2 files changed, 117 insertions(+), 69 deletions(-) diff --git a/Demo Recipes.py b/Demo Recipes.py index 0d57c15de..890454c9a 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI_local as g def SourceDestFolders(): with g.FlexForm('Demo Source / Destination Folders', AutoSizeText=True) as form: @@ -35,7 +35,7 @@ def Everything(): (button, (values)) = form.LayoutAndShow(layout) - g.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + g.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values, AutoClose=True) # example of an Asynchronous form def ChatBot(): @@ -55,9 +55,9 @@ def ChatBot(): print('Exiting the chatbot....') def main(): - SourceDestFolders() + # SourceDestFolders() Everything() - ChatBot() + # ChatBot() if __name__ == '__main__': main() diff --git a/readme.md b/readme.md index ef139cdb2..00ea65fa1 100644 --- a/readme.md +++ b/readme.md @@ -327,10 +327,8 @@ You can see in the MsgBox that the values returned are a list. Each input field # Building Custom Forms You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. -> Control-Q (when cursor is on function name) brings up a box with the -> function definition -> Control-P (when cursor inside function call "()") -> shows a list of parameters and their default values + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values ## Synchronous Forms The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. @@ -343,10 +341,10 @@ NON-BLOCKING form call: ### Beginning a Form The first step is to create the form object using the desired form customization. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: Let's go through the options available when creating a form. - def __init__(self, title, + def __init__(self, title, DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), AutoSizeText=DEFAULT_AUTOSIZE_TEXT, Scale=(None, None), @@ -359,7 +357,7 @@ Let's go through the options available when creating a form. AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Icon=DEFAULT_WINDOW_ICON): - + #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. @@ -374,35 +372,39 @@ In addition to `size` there is a `scale` option. Scale will take the Element's #### FlexForm - form-level variables overview A summary of the variables that can be changed when a FlexForm is created -> DefaultElementSize - set default size for all elements in the form -> AutoSizeText - true/false autosizing turned on / off -> Scale - set scale value for all elements -> ButtonColor - default button color (foreground, background) -> Font - font name and size for all text items -> ProgressBarColor - progress bar colors -> IsTabbedForm - true/false indicates form is a tabbed or normal form -> BorderDepth - style setting for buttons, input fields -> AutoClose - true/false indicates if form will automatically close -> AutoCloseDuration - how long in seconds before closing form -> Icon - filename for icon that's displayed on the window on taskbar + DefaultElementSize - set default size for all elements in the form + AutoSizeText - true/false autosizing turned on / off + Scale - set scale value for all elements + ButtonColor - default button color (foreground, background) + Font - font name and size for all text items + ProgressBarColor - progress bar colors + IsTabbedForm - true/false indicates form is a tabbed or normal form + BorderDepth - style setting for buttons, input fields + AutoClose - true/false indicates if form will automatically close + AutoCloseDuration - how long in seconds before closing form + Icon - filename for icon that's displayed on the window on taskbar ## Elements "Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. -> Text -> Single Line Input -> Buttons including these types: File Browse Folder Browse Non-closing return Close form -> Checkboxes -> Radio Buttons -> Multi-line Text Input -> Scroll-able Output -> Progress Bar -> Async/Non-Blocking Windows -> Tabbed forms -> Persistent Windows -> Redirect Python Output/Errors to scrolling Window -> 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) ### Output Elements @@ -413,15 +415,15 @@ Building a form is simply making lists of Elements. Each list is a row in the o The code is a crude representation of the GUI, laid out in text. #### Text Element - layout = [[SG.Text('This is what a Text Element looks like')]] + layout = [[SG.Text('This is what a Text Element looks like')]] + - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - Text(Text, + Text(Text, Scale=(None, None), Size=(None, None), AutoSizeText=None, @@ -462,11 +464,13 @@ This Element doubles as both an input and output Element. The `DefaultText` opt Size=(None, None), AutoSizeText=None) -> DefaultText - Text to display in the text box ->EnterSubmits - Bool. If True, pressing Enter key submits form ->Scale - Element's scale ->Size - Element's size ->AutoSizeText - Bool. Change width to match size of text +. + + DefaultText - Text to display in the text box + EnterSubmits - Bool. If True, pressing Enter key submits form + Scale - Element's scale + Size - Element's size + AutoSizeText - Bool. Change width to match size of text #### Output Element Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. @@ -477,10 +481,14 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. Output(Scale=(None, None), Size=(None, None)) +. + + Scale - How much to scale size of element + Size - Size of element (width, height) in characters ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - + #### Text Input Element layout = [[SG.InputText('Default text')]] @@ -490,23 +498,60 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. Scale=(None, None), Size=(None, None), AutoSizeText=None) +. + + DefaultText - Text initially shown in the input box + Scale - Amount size is scaled by + Size - (width, height) of element in characters + AutoSizeText - Bool. True is element should be sized to fit text + Shorthand functions that are equivalent to `InputText` are `Input` and `In` + #### Combo Element Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - + ![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - InputCombo(Values, + InputCombo(Values, Scale=(None, None), Size=(None, None), AutoSizeText=None) +. + + Values Choices to be displayed. List of strings + Scale - Amount to scale size by + Size - (width, height) of element in characters + AutoSizeText - Bool. True if size should fit the text length #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + layout = [[SG.Radio('My first Radio!', "RADIO1", Default=True), SG.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(Text, + GroupID, + Default=False, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + Font=None) + +. + + Text - Text to display next to button + GroupID - Groups together multiple Radio Buttons. Can be any value + Default - Bool. Initial state + Scale - Amount to scale size of element + Size - (width, height) size of element in characters + AutoSizeText - Bool. True if should size width to fit text + Font - Font type and size for text display + + #### Checkbox Element @@ -516,30 +561,33 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o #### Output #### UberForm -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code - -## Versioning - -1.0.9 - July 10, 2018 - Initial Release -1.0.21 - July 13, 2018 - Readme updates - - ## Code Condition -> Make it run -> Make it right -> Make it fast +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code + +## Versioning + +1.0.9 - July 10, 2018 - Initial Release +1.0.21 - July 13, 2018 - Readme updates + + ## Code Condition + + Make it run + Make it right + Make it fast It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor on hiding implementation details, naming conventions, PEP 8. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -## Authors - - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - + +## Authors + + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details + +## Acknowledgments + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + From 099f20c62847bf913116e5d3b6112c12a3d8303e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 16:56:04 -0400 Subject: [PATCH 023/521] More readme --- readme.md | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/readme.md b/readme.md index 74ac898ed..00ea65fa1 100644 --- a/readme.md +++ b/readme.md @@ -486,9 +486,6 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. Scale - How much to scale size of element Size - Size of element (width, height) in characters -> Scale - How much to scale size of element -> Size - Size of element (width, height) in characters - ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. @@ -501,20 +498,12 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. Scale=(None, None), Size=(None, None), AutoSizeText=None) -<<<<<<< HEAD . DefaultText - Text initially shown in the input box Scale - Amount size is scaled by Size - (width, height) of element in characters AutoSizeText - Bool. True is element should be sized to fit text -======= - -> DefaultText - Text initially shown in the input box -> Scale - Amount size is scaled by -> Size - (width, height) of element in characters -> AutoSizeText - Bool. True is element should be sized to fit text ->>>>>>> caad84a674b8248c518e707c8f8cc87a7b30664e Shorthand functions that are equivalent to `InputText` are `Input` and `In` @@ -537,11 +526,6 @@ Also known as a drop-down list. Only required parameter is the list of choices. Size - (width, height) of element in characters AutoSizeText - Bool. True if size should fit the text length -> Values Choices to be displayed. List of strings -> Scale - Amount to scale size by -> Size - (width, height) of element in characters -> AutoSizeText - Bool. True if size should fit the text length - #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. @@ -557,7 +541,6 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o AutoSizeText=None, Font=None) -<<<<<<< HEAD . Text - Text to display next to button @@ -569,16 +552,7 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o Font - Font type and size for text display -======= ->>>>>>> caad84a674b8248c518e707c8f8cc87a7b30664e -> Text - Text to display next to button -> GroupID - Variable to groups together multiple Radio Buttons. Can be any value -> Default - Bool. Initial state -> Scale - Amount to scale size of element -> Size - (width, height) size of element in characters -> AutoSizeText - Bool. True if should size width to fit text -> Font - Font type and size for text display #### Checkbox Element #### Spin Element From b2d144bde8923627b972dc60383bd3daf9d7ba9a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 20:11:50 -0400 Subject: [PATCH 024/521] More Readme --- readme.md | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 128 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 00ea65fa1..a84428c1f 100644 --- a/readme.md +++ b/readme.md @@ -451,6 +451,9 @@ The values foreground and background can be the color names or the hex value for **AutoSizeText** A `True` value for `AutoSizeText`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + #### Multiline Text Element @@ -463,7 +466,6 @@ This Element doubles as both an input and output Element. The `DefaultText` opt Scale=(None, None), Size=(None, None), AutoSizeText=None) - . DefaultText - Text to display in the text box @@ -552,11 +554,135 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o Font - Font type and size for text display +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[SG.Checkbox('My first Checkbox!', Default=True), SG.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(Text, + Default=False, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + Font=None): +. + + Text - Text to display next to checkbox + Default - Bool. Initial state + Scale - Amount to scale size of element + Size - (width, height) size of element in characters + AutoSizeText - Bool. True if should size width to fit text + Font - Font type and size for text display -#### Checkbox Element #### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[SG.Spin([i for i in range(1,11)], InitialValue=1), SG.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(Values, + InitialValue=None, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + Font=None) +. + + Values - List of valid values + InitialValue - String with initial value + Scale - Amount to scale size of element + Size - (width, height) size of element in characters + AutoSizeText - Bool. True if should size width to fit text + Font - Font type and size for text display + #### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(Text, + Scale=(None, None), + Size=(None, None), + AutoSizeText=None, + ButtonColor=None, + Font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +' + layout = [[SG.OK(), SG.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[SG.T('Source Folder')], + [SG.In()], + [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] + +**Custom Buttons** +If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. + +layout = [[SG.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `ButtonText` variable. + +**File Types** +The `FileBrowse` button has an additional setting named `FileTypes`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[SG.In() ,SG.FileBrowse(FileTypes=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. Keep this in mind when designing forms. + + + #### ProgressBar #### Output #### UberForm @@ -588,6 +714,3 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence - - - From e9cbc4856f9bf06cf640ff836388f34b78c8e546 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 21:39:28 -0400 Subject: [PATCH 025/521] More readme --- readme.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index a84428c1f..1d43c4825 100644 --- a/readme.md +++ b/readme.md @@ -637,7 +637,7 @@ Pre-made buttons include: No FileBrowse FolderBrowse -' +. layout = [[SG.OK(), SG.Cancel()]] ![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) @@ -681,11 +681,78 @@ This code produces a form where the Browse button only shows files of type .TXT ***The ENTER key*** The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. Keep this in mind when designing forms. +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The "easiest" way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate` + +You setup the progress meter by calling + + my_meter = ProgressMeter(Title, + MaxValue, + *args, + Orientation=None, + BarColor=DEFAULT_PROGRESS_BAR_COLOR, + ButtonColor=None, + Size=DEFAULT_PROGRESS_BAR_SIZE, + Scale=(None, None), + BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + Value, + *args): +Putting it all together you get this design pattern + + my_meter = SG.ProgressMeter('Meter Title', 100000, Orientation='Vert') + + for i in range(0, 100000): + SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. -#### ProgressBar #### Output -#### UberForm +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(Scale=(None, None), + Size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as g + + with g.FlexForm('Chat Window', AutoSizeText=True, DefaultElementSize=(30, 2)) as form: + form.AddRow(g.Text('This is where standard out is being routed', Size=[40,1])) + form.AddRow(g.Output(Size=(80, 20))) + form.AddRow(g.Multiline(Size=(70, 5), EnterSubmits=True), g.ReadFormButton('SEND', ButtonColor=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', ButtonColor=(g.YELLOWS[0], g.GREENS[0]))) + + # ---===--- Loop taking in user input and printing it --- # + while True: + (button, value) = form.Read() + if button == 'SEND': + print(value) + else: + print('Exiting the form now') + break + + +#### Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label')) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` + +## Asynchronous (Non-Blocking) Forms + ## Contributing @@ -714,3 +781,5 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + From 338bf78b5474d62d6e279a803cff1b0c0b34cb58 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 13 Jul 2018 21:43:01 -0400 Subject: [PATCH 026/521] Renamed Text to ButtonText Fixed up the API naming a little to be more clear when it came to button text. --- PySimpleGUI.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 89464f28f..28469b3c2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -243,7 +243,7 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, Values, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, InitialValue=None): + def __init__(self, Values, InitialValue=None, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None): self.Values = Values self.DefaultValue = InitialValue self.TKSpinBox = None @@ -288,6 +288,7 @@ def __init__(self, Text, Scale=(None, None), Size=(None, None), AutoSizeText=Non self.DisplayText = Text self.TextColor = TextColor if TextColor else 'black' # self.Font = Font if Font else DEFAULT_FONT + # i=1/0 super().__init__(TEXT, Scale, Size, AutoSizeText, Font=Font if Font else DEFAULT_FONT) return @@ -409,12 +410,12 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, ButtonType=CLOSES_WIN, Target=(None, None), Text ='', FileTypes=(("ALL Files", "*.*"),), Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): + def __init__(self, ButtonType=CLOSES_WIN, Target=(None, None), ButtonText='', FileTypes=(("ALL Files", "*.*"),), Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): self.BType = ButtonType self.FileTypes = FileTypes self.TKButton = None self.Target = Target - self.Text = Text + self.ButtonText = ButtonText self.ButtonColor = ButtonColor if ButtonColor else DEFAULT_BUTTON_COLOR self.UserData = None super().__init__(BUTTON, Scale, Size, AutoSizeText, Font=Font) @@ -432,6 +433,8 @@ def ButtonCallBack(self): target[1] = self.Position[1] + target[1] strvar = None if target[0] != None: + if target[0] < 0: + target = [self.Position[0] + target[0], target[1]] target_element = self.ParentForm.GetElementAtLocation(target) try: strvar = target_element.TKStringVar @@ -751,46 +754,46 @@ def T(DisplayText, Scale=(None, None), Size=(None, None), AutoSizeText=None, Fon return Text(DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, Font=Font, TextColor=TextColor) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(Target=(ThisRow, -1), DisplayText='Browse', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(BROWSE_FOLDER, Target=Target, Text=DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def FolderBrowse(Target=(ThisRow, -1), ButtonText='Browse', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): + return Button(BROWSE_FOLDER, Target=Target, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- FILE BROWSE Element lazy function ------------------------- # def FileBrowse(Target=(ThisRow, -1), FileTypes=(("ALL Files", "*.*"),),ButtonText='Browse',Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(BROWSE_FILE, Target, Text=ButtonText, FileTypes=FileTypes, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + return Button(BROWSE_FILE, Target, ButtonText=ButtonText, FileTypes=FileTypes, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # def Submit(ButtonText='Submit', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- OK BUTTON Element lazy function ------------------------- # def OK(ButtonText='OK', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- YES BUTTON Element lazy function ------------------------- # def Ok(ButtonText='Ok', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # def Cancel(ButtonText='Cancel', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) # ------------------------- YES BUTTON Element lazy function ------------------------- # def Yes(ButtonText='Yes', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- NO BUTTON Element lazy function ------------------------- # def No(ButtonText='No', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(Text, Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - return Button(CLOSES_WIN, Text=Text, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) +def SimpleButton(ButtonText, Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): + return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field def ReadFormButton(ButtonText, Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - return Button(READ_FORM, Text=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) + return Button(READ_FORM, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -875,7 +878,7 @@ def BuildResults(form): input_values.append(value) elif element.Type == BUTTON: if results[row_num][col_num] is True: - button_pressed_text = element.Text + button_pressed_text = element.ButtonText results[row_num][col_num] = False elif element.Type == INPUT_COMBO: value=element.TKStringVar.get() @@ -979,7 +982,7 @@ def ConvertFlexToTK(MyFlexForm): # ------------------------- BUTTON element ------------------------- # elif element_type == BUTTON: element.Location = (row_num, col_num) - btext = element.Text + btext = element.ButtonText btype = element.BType if auto_size_text is False: width=element_size[0] else: width = 0 From d2f538cd82e5ecef067f20d2118f0ffc371096fd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 14 Jul 2018 13:19:51 -0400 Subject: [PATCH 027/521] HowDoI demo checkin An EXCELLENT program... I use it daily to find answers of all types --- Demo HowDoI.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Demo HowDoI.py diff --git a/Demo HowDoI.py b/Demo HowDoI.py new file mode 100644 index 000000000..2fb20c989 --- /dev/null +++ b/Demo HowDoI.py @@ -0,0 +1,55 @@ +import PySimpleGUI as SG +import subprocess + +# CHANGE THIS LINE OF CODE! Point it to the howdoi.py file that is in the howdoi code you download from github +HOW_DO_I_COMMAND = 'python C:\\Python\\PycharmProjects\\GitHub\\howdoi\\howdoi\\howdoi.py' +# if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file +DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' + +def HowDoI(): + ''' + Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle + Excellent example of 2 GUI concepts + 1. Output Element that will show text in a scrolled window + 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but doesn't close the form + :return: never returns + ''' + # ------- Make a new FlexForm ------- # + form = SG.FlexForm('How Do I ??', AutoSizeText=True, DefaultElementSize=(30, 2), Icon=DEFAULT_ICON) + form.AddRow(SG.Text('Ask and your answer will appear here....', Size=(40, 1))) + form.AddRow(SG.Output(Size=(90, 20))) + form.AddRow(SG.Multiline(Size=(90, 5), EnterSubmits=True), + SG.ReadFormButton('SEND', ButtonColor=(SG.YELLOWS[0], SG.BLUES[0])), + SG.SimpleButton('EXIT', ButtonColor=(SG.YELLOWS[0], SG.GREENS[0]))) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + (button, value) = form.Read() + if button == 'SEND': + command = value[0][:-1] + QueryHowDoI(command) + else: + print(button, 'pressed') + break + + print('Exiting the app now') + exit(69) + +def QueryHowDoI(Query): + ''' + Kicks off a subprocess to send the 'Query' to HowDoI + Prints the result, which in this program will route to a gooeyGUI window + :param Query: text english question to ask the HowDoI web engine + :return: nothing + ''' + howdoi_command = HOW_DO_I_COMMAND + t = subprocess.Popen(howdoi_command + ' '+ Query, stdout=subprocess.PIPE) + (output, err) = t.communicate() + print('You asked: '+ Query) + print('_______________________________________') + print(output.decode("utf-8") ) + exit_code = t.wait() + +if __name__ == '__main__': + HowDoI() + From a77dc1c724c7980b94050c6549f402336c750de7 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 15 Jul 2018 19:21:06 -0400 Subject: [PATCH 028/521] Fixed message box text width, renamed Display Hash, added Duplicate file finder FINALLY got the message box text width sizing correct. Required change to Text Elements so watch out for possible side effects. Added a new Duplicate File Finder demo program that uses an input form an a progress meter --- ...sh1and256.py => Demo DisplayHash1and256.py | 26 ++++++++- Demo DuplicateFileFinder.py | 58 +++++++++++++++++++ PySimpleGUI.py | 15 +++-- 3 files changed, 91 insertions(+), 8 deletions(-) rename DemoDisplayHash1and256.py => Demo DisplayHash1and256.py (80%) create mode 100644 Demo DuplicateFileFinder.py diff --git a/DemoDisplayHash1and256.py b/Demo DisplayHash1and256.py similarity index 80% rename from DemoDisplayHash1and256.py rename to Demo DisplayHash1and256.py index 1aa0f902f..fa4545cc5 100644 --- a/DemoDisplayHash1and256.py +++ b/Demo DisplayHash1and256.py @@ -66,6 +66,25 @@ def HashManuallyBuiltGUI(): else: SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') +def HashManuallyBuiltGUINonContext(): + # ------- Form design ------- # + form = SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename, )) = form.LayoutAndShow(form_rows) + + if button == 'Submit': + if source_filename != '': + hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() + hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() + SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, LineWidth=75) + else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') + else: + SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') + + + # ---------------------------------------------------------------------- # # Compute and display SHA1 hash # @@ -80,7 +99,7 @@ def HashMostCompactGUI(): # ------- OUTPUT GUI results portion ------- # if rc == True: - hash = compute_sha1_hash_for_file(source_filename).upper() + hash = compute_sha1_hash_for_file(source_filename) SG.MsgBox('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) else: SG.MsgBox('Display Hash - Compact GUI', '* Cancelled *') @@ -90,8 +109,9 @@ def HashMostCompactGUI(): # Our main calls two GUIs that act identically but use different calls # # ---------------------------------------------------------------------- # def main(): - # HashMostCompactGUI() - HashManuallyBuiltGUI() + HashManuallyBuiltGUINonContext() + HashMostCompactGUI() + # ====____====____==== Pseudo-MAIN program ====____====____==== # # This is our main-alike piece of code # diff --git a/Demo DuplicateFileFinder.py b/Demo DuplicateFileFinder.py new file mode 100644 index 000000000..b32f8cf12 --- /dev/null +++ b/Demo DuplicateFileFinder.py @@ -0,0 +1,58 @@ +import hashlib +import os +import win32clipboard +import PySimpleGUI as gg + + +# ====____====____==== FUNCTION DeDuplicate_folder(path) ====____====____==== # +# Function to de-duplicate the folder passed in # +# --------------------------------------------------------------------------- # +def FindDuplicatesFilesInFolder(path): + shatab = [] + total = 0 + small = (1024) + small_count, dup_count, error_count = 0,0,0 + pngdir = path + if not os.path.exists(path): + gg.MsgBox('De-Dupe', '** Folder doesn\'t exist***', path) + return + pngfiles = os.listdir(pngdir) + total_files = len(pngfiles) + not_cancelled = True + for idx, f in enumerate(pngfiles): + if not gg.EasyProgressMeter('Counting Duplicates', idx+1, total_files, 'Counting Duplicate Files'): + break + total += 1 + fname = os.path.join(pngdir, f) + if os.path.isdir(fname): + continue + x = open(fname, "rb").read() + + m = hashlib.sha256() + m.update(x) + f_sha = m.digest() + if f_sha in shatab: + # os.remove(fname) + dup_count += 1 + continue + shatab.append(f_sha) + + msg = f'{total} Files processed\n'\ + f'{dup_count} Duplicates found\n' + gg.MsgBox('Duplicate Finder Ended', msg) + +# ====____====____==== Pseudo-MAIN program ====____====____==== # +# This is our main-alike piece of code # +# + Starts up the GUI # +# + Gets values from GUI # +# + Runs DeDupe_folder based on GUI inputs # +# ------------------------------------------------------------- # +if __name__ == '__main__': + + source_folder = None + rc, source_folder = gg.GetPathBox('DeDuplicate a Folder\'s image files', 'Enter path to folder you wish to find duplicates in') + if rc is True and source_folder is not None: + FindDuplicatesFilesInFolder(source_folder) + else: + gg.MsgBox('Cancelling', '*** Cancelling ***') + exit(0) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 28469b3c2..1e45abc48 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -18,7 +18,7 @@ DEFAULT_AUTOSIZE_TEXT = False DEFAULT_FONT = ("Helvetica", 10) -DEFAULT_BORDER_WIDTH = 7 +DEFAULT_BORDER_WIDTH = 6 DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 #################### COLOR STUFF #################### @@ -973,11 +973,13 @@ def ConvertFlexToTK(MyFlexForm): stringvar = tk.StringVar() element.TKStringVar = stringvar stringvar.set(display_text) + if auto_size_text: + width = 0 tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, textvariable=stringvar, width=width, height=height, justify=tk.LEFT, bd=border_depth, fg=element.TextColor) # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure( anchor=tk.NW, font=font, wraplen=wraplen*2 ) # set wrap to width of widget + tktext_label.configure(anchor=tk.NW, font=font, wraplen=wraplen*2 ) # set wrap to width of widget tktext_label.pack(side=tk.LEFT) # ------------------------- BUTTON element ------------------------- # elif element_type == BUTTON: @@ -1240,20 +1242,23 @@ def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, Aut args_to_print = [''] else: args_to_print = args - with FlexForm(args_to_print[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Icon=Icon, Font=Font) as form: + with FlexForm(args_to_print[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Icon=Icon, Font=Font) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) # if not isinstance(message, str): message = str(message) message = str(message) - message_wrapped = textwrap.fill(message, LineWidth) + if message.count('\n'): + message_wrapped = message + else: + message_wrapped = textwrap.fill(message, LineWidth) message_wrapped_lines = message_wrapped.count('\n')+1 longest_line_len = max([len(l) for l in message.split('\n')]) width_used = min(longest_line_len, LineWidth) max_line_total = max(max_line_total, width_used) # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines - form.AddRow(Text(message_wrapped, Size=(width_used, height), AutoSizeText=True),) + form.AddRow(Text(message_wrapped, AutoSizeText=True)) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 From c3ee62f29f31d9883a6cec969ba4641dd696008a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 15 Jul 2018 20:13:41 -0400 Subject: [PATCH 029/521] Readme update --- readme.md | 170 +++++++++++++++++++++++++++++------------------------- 1 file changed, 92 insertions(+), 78 deletions(-) diff --git a/readme.md b/readme.md index 1d43c4825..9f139bf7b 100644 --- a/readme.md +++ b/readme.md @@ -66,10 +66,10 @@ Should run on all Python platforms that have tkinter running on them. Has been ### Using -To us in your code, simply import.... - `import PySimpleGUI as SG` +To use in your code, simply import.... + `import PySimpleGUI as SG` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) @@ -77,65 +77,65 @@ Then use either "high level" API calls or build your own forms. Yes, it's just that easy to have a window appear on the screen using Python. ## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + ### Python Language Features There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call + * Variable number of arguments to a function call * Optional parameters to a function call - + #### Variable Number of Arguments The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - + SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") Each new item begins on a new line in the Message Box ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) - + #### Optional Parameters to a Function Call - + This feature of the Python language is utilized ***heavily*** as a method of customizing forms and part of forms. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. - def MsgBox(*args, - ButtonColor=None, - ButtonType=MSG_BOX_OK, - AutoClose=False, - AutoCloseDuration=None, - Icon=DEFAULT_WINDOW_ICON, + def MsgBox(*args, + ButtonColor=None, + ButtonType=MSG_BOX_OK, + AutoClose=False, + AutoCloseDuration=None, + Icon=DEFAULT_WINDOW_ICON, LineWidth=MESSAGE_BOX_LINE_WIDTH, Font=None): If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', + SG.MsgBox('This box has a custom button color', ButtonColor=('black', 'yellow')) ![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) -### High Level API Calls +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. @@ -144,7 +144,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` - + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -168,13 +168,13 @@ The differences tend to be the number and types of buttons. Here are the calls ![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. #### High Level User Input There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - - GetFileBox + - GetFileBox - GetFolderBox `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` @@ -206,7 +206,7 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! - for i in range(1,10000): + for i in range(1,10000): SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') That line of code resulted in this window popping up and updating. @@ -214,7 +214,7 @@ That line of code resulted in this window popping up and updating. ![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): break @@ -226,10 +226,10 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e ## COPY THIS DESIGN PATTERN! - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] (button, (source_filename, )) = form.LayoutAndShow(form_rows) This context manager contains all of the code needed to specify, show and retrieve results for this form: @@ -237,23 +237,23 @@ This context manager contains all of the code needed to specify, show and retrie It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. +You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. > Copy, Paste, Run. -PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. +PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller simply writes `Submit`. Going through each line of code - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: -This creates a new form, storing it in the variable `form`. + with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: +This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. [SG.Submit(), SG.Cancel()]] @@ -265,42 +265,42 @@ This is the code that **displays** the form, collects the information and return ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Don't forget all those ()'s of your values won't be coreectly assigned. - -If you have a SINGLE value being returned, it is written this way: - + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Don't forget all those ()'s of your values won't be coreectly assigned. + +If you have a SINGLE value being returned, it is written this way: + (button, (value1,)) = form.LayoutAndShow(form_rows) Another way of parsing the return values is to store the list of values into a variable that is then referenced. - (button, (value)) = form.LayoutAndShow(form_rows) + (button, (value)) = form.LayoutAndShow(form_rows) value1 = values[0] value2 = values[1] ... - + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: - layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], - [Text('Here is some text with font sizing', Font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], - [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [Text('_' * 90, Size=(60, 1))], - [Text('Choose Source and Destination Folders', Size=(35,1))], - [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], - [Submit(), Cancel()]] - + with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], + [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], + [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], + [Text('_' * 90, Size=(60, 1))], + [Text('Choose Source and Destination Folders', Size=(35,1))], + [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [Submit(), Cancel()]] + (button, (values)) = form.LayoutAndShow(layout) @@ -320,7 +320,7 @@ One important aspect of this example is the return codes: (button, (values)) = form.LayoutAndShow(layout) The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. @@ -753,10 +753,24 @@ Each of the tabs of the form is in fact a form. The same steps are taken to cre ## Asynchronous (Non-Blocking) Forms +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning +`Demo Recipes.py` - Three sample forms including an asynchronous form +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. + +## Fun Stuff + +## Known Issues +While not an "issue" this is a *stern warning* +**Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. ## Contributing -A MikeTheWatchGuy production... entirely responsible for this code +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. ## Versioning From 0ec43ac11264815f4240e1d221994e921e205cd2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 16 Jul 2018 14:52:16 -0400 Subject: [PATCH 030/521] Renamed ALL oprtional parameters Switched from CamelCase to all_lower_case --- Demo DisplayHash1and256.py | 8 +- Demo DuplicateFileFinder.py | 10 +- Demo High Level APIs.py | 3 +- Demo HowDoI.py | 21 +- Demo Recipes.py | 48 ++-- PySimpleGUI.py | 557 ++++++++++++++++++------------------ readme.md | 420 +++++++++++++-------------- 7 files changed, 532 insertions(+), 535 deletions(-) diff --git a/Demo DisplayHash1and256.py b/Demo DisplayHash1and256.py index fa4545cc5..dbc47afcc 100644 --- a/Demo DisplayHash1and256.py +++ b/Demo DisplayHash1and256.py @@ -51,7 +51,7 @@ def compute_sha256_hash_for_file(filename): # ---------------------------------------------------------------------- # def HashManuallyBuiltGUI(): # ------- Form design ------- # - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] @@ -61,14 +61,14 @@ def HashManuallyBuiltGUI(): if source_filename != '': hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, LineWidth=75) + SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') else: SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') def HashManuallyBuiltGUINonContext(): # ------- Form design ------- # - form = SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] @@ -78,7 +78,7 @@ def HashManuallyBuiltGUINonContext(): if source_filename != '': hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, LineWidth=75) + SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') else: SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') diff --git a/Demo DuplicateFileFinder.py b/Demo DuplicateFileFinder.py index b32f8cf12..49b061bbc 100644 --- a/Demo DuplicateFileFinder.py +++ b/Demo DuplicateFileFinder.py @@ -1,6 +1,5 @@ import hashlib import os -import win32clipboard import PySimpleGUI as gg @@ -10,15 +9,13 @@ def FindDuplicatesFilesInFolder(path): shatab = [] total = 0 - small = (1024) small_count, dup_count, error_count = 0,0,0 pngdir = path if not os.path.exists(path): - gg.MsgBox('De-Dupe', '** Folder doesn\'t exist***', path) + gg.MsgBox('Duplicate Finder', '** Folder doesn\'t exist***', path) return pngfiles = os.listdir(pngdir) total_files = len(pngfiles) - not_cancelled = True for idx, f in enumerate(pngfiles): if not gg.EasyProgressMeter('Counting Duplicates', idx+1, total_files, 'Counting Duplicate Files'): break @@ -32,6 +29,7 @@ def FindDuplicatesFilesInFolder(path): m.update(x) f_sha = m.digest() if f_sha in shatab: + # uncomment next line to remove duplicate files # os.remove(fname) dup_count += 1 continue @@ -50,9 +48,9 @@ def FindDuplicatesFilesInFolder(path): if __name__ == '__main__': source_folder = None - rc, source_folder = gg.GetPathBox('DeDuplicate a Folder\'s image files', 'Enter path to folder you wish to find duplicates in') + rc, source_folder = gg.GetPathBox('Duplicate Finder - Count number of duplicate files', 'Enter path to folder you wish to find duplicates in') if rc is True and source_folder is not None: FindDuplicatesFilesInFolder(source_folder) else: - gg.MsgBox('Cancelling', '*** Cancelling ***') + gg.MsgBoxCancel('Cancelling', '*** Cancelling ***') exit(0) diff --git a/Demo High Level APIs.py b/Demo High Level APIs.py index 2f9c3bec7..92bd53edc 100644 --- a/Demo High Level APIs.py +++ b/Demo High Level APIs.py @@ -1,5 +1,6 @@ import PySimpleGUI as sg +sg.MsgBox('Title', 'My first message... Is the length the same?') rc, number = sg.GetTextBox('Title goes here', 'Enter a number') if not rc: sg.MsgBoxError('You have cancelled') @@ -7,4 +8,4 @@ msg = '\n'.join([f'{i}' for i in range(0,int(number))]) -sg.ScrolledTextBox(msg, Height=10) \ No newline at end of file +sg.ScrolledTextBox(msg, height=10) \ No newline at end of file diff --git a/Demo HowDoI.py b/Demo HowDoI.py index 2fb20c989..3565b1a67 100644 --- a/Demo HowDoI.py +++ b/Demo HowDoI.py @@ -15,24 +15,21 @@ def HowDoI(): :return: never returns ''' # ------- Make a new FlexForm ------- # - form = SG.FlexForm('How Do I ??', AutoSizeText=True, DefaultElementSize=(30, 2), Icon=DEFAULT_ICON) - form.AddRow(SG.Text('Ask and your answer will appear here....', Size=(40, 1))) - form.AddRow(SG.Output(Size=(90, 20))) - form.AddRow(SG.Multiline(Size=(90, 5), EnterSubmits=True), - SG.ReadFormButton('SEND', ButtonColor=(SG.YELLOWS[0], SG.BLUES[0])), - SG.SimpleButton('EXIT', ButtonColor=(SG.YELLOWS[0], SG.GREENS[0]))) + form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) + form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) + form.AddRow(SG.Output(size=(90, 20))) + form.AddRow(SG.Multiline(size=(90, 5), enter_submits=True), + SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), + SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + # ---===--- Loop taking in user input and using it to query HowDoI --- # while True: (button, value) = form.Read() if button == 'SEND': - command = value[0][:-1] - QueryHowDoI(command) + QueryHowDoI(value[0][:-1]) # send string without carriage return on end else: - print(button, 'pressed') - break + break # exit button clicked - print('Exiting the app now') exit(69) def QueryHowDoI(Query): diff --git a/Demo Recipes.py b/Demo Recipes.py index 890454c9a..170eea731 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -1,12 +1,12 @@ -import PySimpleGUI_local as g +import PySimpleGUI as g def SourceDestFolders(): - with g.FlexForm('Demo Source / Destination Folders', AutoSizeText=True) as form: + with g.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: form_rows = [[g.Text('Enter the Source and Destination folders')], [g.Text('Choose Source and Destination Folders')], - [g.Text('Source Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Source'), + [g.Text('Source Folder', size=(15, 1), auto_size_text=False), g.InputText('Source'), g.FolderBrowse()], - [g.Text('Destination Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Dest'), + [g.Text('Destination Folder', size=(15, 1), auto_size_text=False), g.InputText('Dest'), g.FolderBrowse()], [g.Submit(), g.Cancel()]] @@ -18,46 +18,44 @@ def SourceDestFolders(): g.MsgBoxError('Cancelled', 'User Cancelled') def Everything(): - with g.FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(40,1)) as form: - layout = [[g.Text('All graphic widgets in one form!', Size=(30,1), Font=("Helvetica", 25), TextColor='blue')], + with g.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40,1)) as form: + layout = [[g.Text('All graphic widgets in one form!', size=(30,1), font=("Helvetica", 25), text_color='blue')], [g.Text('Here is some text.... and a place to enter text')], [g.InputText()], - [g.Checkbox('My first checkbox!'), g.Checkbox('My second checkbox!', Default=True)], - [g.Radio('My first Radio!', "RADIO1", Default=True), g.Radio('My second Radio!', "RADIO1")], - [g.Multiline(DefaultText='This is the DEFAULT Text should you decide not to type anything', Scale=(2, 10))], - [g.InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [g.Text('_' * 100, Size=(90, 1))], - [g.Text('Choose Source and Destination Folders', Size=(35,1))], - [g.Text('Source Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Source'), g.FolderBrowse()], - [g.Text('Destination Folder', Size=(15, 1), AutoSizeText=False), g.InputText('Dest'), g.FolderBrowse()], - [g.SimpleButton('Your very own button', ButtonColor=('white', 'green'))], + [g.Checkbox('My first checkbox!'), g.Checkbox('My second checkbox!', default=True)], + [g.Radio('My first Radio!', "RADIO1", default=True), g.Radio('My second Radio!', "RADIO1")], + [g.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2,10))], + [g.InputCombo(['choice 1', 'choice 2'], size=(20,3))], + [g.Text('_' * 100, size=(70,1))], + [g.Text('Choose Source and Destination Folders', size=(35,1))], + [g.Text('Source Folder', size=(15,1), auto_size_text=False), g.InputText('Source'), g.FolderBrowse()], + [g.Text('Destination Folder', size=(15,1), auto_size_text=False), g.InputText('Dest'), g.FolderBrowse()], + [g.SimpleButton('Your very own button', button_color=('white', 'green'))], [g.Submit(), g.Cancel()]] (button, (values)) = form.LayoutAndShow(layout) - g.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values, AutoClose=True) + g.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values, auto_close=True) # example of an Asynchronous form def ChatBot(): - with g.FlexForm('Chat Window', AutoSizeText=True, DefaultElementSize=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', Size=[40,1])) - form.AddRow(g.Output(Size=(80, 20))) - form.AddRow(g.Multiline(Size=(70, 5), EnterSubmits=True), g.ReadFormButton('SEND', ButtonColor=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', ButtonColor=(g.YELLOWS[0], g.GREENS[0]))) + with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) + form.AddRow(g.Output(size=(80, 20))) + form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: (button, value) = form.Read() if button == 'SEND': - print(value) + print(value, end="") else: - print('Exiting the form now') break - print('Exiting the chatbot....') def main(): - # SourceDestFolders() + SourceDestFolders() Everything() - # ChatBot() + ChatBot() if __name__ == '__main__': main() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1e45abc48..aaf030a01 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -120,13 +120,13 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # Element CLASS # # ------------------------------------------------------------------------- # class Element(): - def __init__(self, Type, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None): - self.Size = Size - self.Type = Type - self.AutoSizeText = AutoSizeText - self.Scale = Scale + def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + self.Size = size + self.Type = type + self.AutoSizeText = auto_size_text + self.Scale = scale self.Pad = DEFAULT_ELEMENT_PADDING - self.Font = Font + self.Font = font self.TKStringVar = None self.TKIntVar = None @@ -161,9 +161,9 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, DefaultText = '', Scale=(None, None), Size=(None, None), AutoSizeText=None): - self.DefaultText = DefaultText - super().__init__(INPUT_TEXT, Scale, Size, AutoSizeText) + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): + self.DefaultText = default_text + super().__init__(INPUT_TEXT, scale, size, auto_size_text) return def ReturnKeyHandler(self, event): @@ -183,10 +183,10 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, Values, Scale=(None, None), Size=(None, None), AutoSizeText=None): - self.Values = Values + def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None): + self.Values = values self.TKComboBox = None - super().__init__(INPUT_COMBO, Scale, Size, AutoSizeText) + super().__init__(INPUT_COMBO, scale, size, auto_size_text) return def __del__(self): @@ -200,13 +200,13 @@ def __del__(self): # Radio # # ---------------------------------------------------------------------- # class Radio(Element): - def __init__(self, Text, GroupID, Default=False, Scale=(None, None), Size=(None, None), AutoSizeText=None,Font=None): - self.InitialState = Default - self.Text = Text + def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + self.InitialState = default + self.Text = text self.TKRadio = None - self.GroupID = GroupID + self.GroupID = group_id self.Value = None - super().__init__(INPUT_RADIO, Scale, Size, AutoSizeText, Font) + super().__init__(INPUT_RADIO, scale, size, auto_size_text, font) return def __del__(self): @@ -220,13 +220,13 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, Text, Default=False, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None): - self.Text = Text - self.InitialState = Default + def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + self.Text = text + self.InitialState = default self.Value = None self.TKCheckbox = None - super().__init__(INPUT_CHECKBOX, Scale, Size, AutoSizeText, Font) + super().__init__(INPUT_CHECKBOX, scale, size, auto_size_text, font) return def __del__(self): @@ -243,11 +243,11 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, Values, InitialValue=None, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None): - self.Values = Values - self.DefaultValue = InitialValue + def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + self.Values = values + self.DefaultValue = initial_value self.TKSpinBox = None - super().__init__(INPUT_SPIN, Scale, Size, AutoSizeText, Font=Font) + super().__init__(INPUT_SPIN, scale, size, auto_size_text, font=font) return def __del__(self): @@ -261,10 +261,10 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, DefaultText='', EnterSubmits = False, Scale=(None, None), Size=(None, None), AutoSizeText=None): - self.DefaultText = DefaultText - self.EnterSubmits = EnterSubmits - super().__init__(INPUT_MULTILINE, Scale, Size, AutoSizeText) + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None): + self.DefaultText = default_text + self.EnterSubmits = enter_submits + super().__init__(INPUT_MULTILINE, scale, size, auto_size_text) return def ReturnKeyHandler(self, event): @@ -284,12 +284,12 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, Text, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, TextColor=None): - self.DisplayText = Text - self.TextColor = TextColor if TextColor else 'black' + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None): + self.DisplayText = text + self.TextColor = text_color if text_color else 'black' # self.Font = Font if Font else DEFAULT_FONT # i=1/0 - super().__init__(TEXT, Scale, Size, AutoSizeText, Font=Font if Font else DEFAULT_FONT) + super().__init__(TEXT, scale, size, auto_size_text, font=font if font else DEFAULT_FONT) return def Update(self, NewValue): @@ -307,41 +307,41 @@ def __del__(self): # ---------------------------------------------------------------------- # class TKProgressBar(): - def __init__(self, root, Max, Length=400, Width=20, Highlightt=0, Relief='sunken', Borderwidth=4, Orientation='horizontal', BarColor=DEFAULT_PROGRESS_BAR_COLOR): - self.Length = Length - self.Width = Width - self.Max = Max - self.Orientation = Orientation + def __init__(self, root, max, length=400, width=20, highlightt=0, relief='sunken', border_width=4, orientation='horizontal', BarColor=DEFAULT_PROGRESS_BAR_COLOR): + self.Length = length + self.Width = width + self.Max = max + self.Orientation = orientation self.Count = None self.PriorCount = 0 - if Orientation[0].lower() == 'h': - self.TKCanvas = tk.Canvas(root, width=Length, height=Width, highlightt=Highlightt, relief=Relief, borderwidth=Borderwidth) - self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(Length * 1.5), Width * 1.5, fill=BarColor[0], tags='bar') + if orientation[0].lower() == 'h': + self.TKCanvas = tk.Canvas(root, width=length, height=width, highlightt=highlightt, relief=relief, borderwidth=border_width) + self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(length * 1.5), width * 1.5, fill=BarColor[0], tags='bar') # self.canvas.pack(padx='10') else: - self.TKCanvas = tk.Canvas(root, width=Width, height=Length, highlightt=Highlightt, relief=Relief, borderwidth=Borderwidth) - self.TKRect = self.TKCanvas.create_rectangle(Width * 1.5, 2 * Length + 40, 0, Length * .5, fill=BarColor[0], tags='bar') + self.TKCanvas = tk.Canvas(root, width=width, height=length, highlightt=highlightt, relief=relief, borderwidth=border_width) + self.TKRect = self.TKCanvas.create_rectangle(width * 1.5, 2 * length + 40, 0, length * .5, fill=BarColor[0], tags='bar') # self.canvas.pack() - def Update(self,Count): - if Count > self.Max: return + def Update(self, count): + if count > self.Max: return if self.Orientation[0].lower() == 'h': try: - if Count != self.PriorCount: - delta = Count - self.PriorCount + if count != self.PriorCount: + delta = count - self.PriorCount self.TKCanvas.move(self.TKRect, delta*(self.Length / self.Max), 0) if 0: self.TKCanvas.update() except: return False # the window was closed by the user on us else: try: - if Count != self.PriorCount: - delta = Count - self.PriorCount + if count != self.PriorCount: + delta = count - self.PriorCount self.TKCanvas.move(self.TKRect, 0, delta*(-self.Length / self.Max)) if 0: self.TKCanvas.update() except: return False # the window was closed by the user on us - self.PriorCount = Count + self.PriorCount = count return True def __del__(self): @@ -395,9 +395,9 @@ def __del__(self): sys.stdout = self.previous_stdout class Output(Element): - def __init__(self, Scale=(None, None), Size=(None, None)): + def __init__(self, scale=(None, None), size=(None, None)): self.TKOut = None - super().__init__(OUTPUT, Scale, Size) + super().__init__(OUTPUT, scale, size) def __del__(self): try: @@ -410,15 +410,15 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, ButtonType=CLOSES_WIN, Target=(None, None), ButtonText='', FileTypes=(("ALL Files", "*.*"),), Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - self.BType = ButtonType - self.FileTypes = FileTypes + def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + self.BType = button_type + self.FileTypes = file_types self.TKButton = None - self.Target = Target - self.ButtonText = ButtonText - self.ButtonColor = ButtonColor if ButtonColor else DEFAULT_BUTTON_COLOR + self.Target = target + self.ButtonText = button_text + self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR self.UserData = None - super().__init__(BUTTON, Scale, Size, AutoSizeText, Font=Font) + super().__init__(BUTTON, scale, size, auto_size_text, font=font) return # ------- Button Callback ------- # @@ -493,22 +493,22 @@ def __del__(self): # ProgreessBar # # ---------------------------------------------------------------------- # class ProgressBar(Element): - def __init__(self, MaxValue, Orientation=None, Target=(None,None), Scale=(None, None), Size=(None, None), AutoSizeText=None, BarColor=(None,None), Style=None, BorderWidth=None, Relief=None): - self.MaxValue = MaxValue + def __init__(self, max_value, orientation=None, target=(None, None), scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, broder_width=None, relief=None): + self.MaxValue = max_value self.TKProgressBar = None self.Cancelled = False self.NotRunning = True - self.Orientation = Orientation if Orientation else DEFAULT_METER_ORIENTATION - self.BarColor = BarColor - self.BarStyle = Style if Style else DEFAULT_PROGRESS_BAR_STYLE - self.Target = Target - self.BorderWidth = BorderWidth if BorderWidth else DEFAULT_PROGRESS_BAR_BORDER_WIDTH - self.Relief = Relief if Relief else DEFAULT_PROGRESS_BAR_RELIEF + self.Orientation = orientation if orientation else DEFAULT_METER_ORIENTATION + self.BarColor = bar_color + self.BarStyle = style if style else DEFAULT_PROGRESS_BAR_STYLE + self.Target = target + self.BorderWidth = broder_width if broder_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH + self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False - super().__init__(PROGRESS_BAR, Scale, Size, AutoSizeText) + super().__init__(PROGRESS_BAR, scale, size, auto_size_text) return - def UpdateBar(self, CurrentCount): + def UpdateBar(self, current_count): if self.ParentForm.TKrootDestroyed: return False target = self.Target @@ -519,7 +519,7 @@ def UpdateBar(self, CurrentCount): # update the progress bar counter # self.TKProgressBar['value'] = self.CurrentValue - self.TKProgressBar.Update(CurrentCount) + self.TKProgressBar.Update(current_count) try: self.ParentForm.TKroot.update() except: @@ -538,8 +538,8 @@ def __del__(self): # Row CLASS # # ------------------------------------------------------------------------- # class Row(): - def __init__(self, AutoSizeText = None): - self.AutoSizeText = AutoSizeText # Setting to override the form's policy on autosizing. + def __init__(self, auto_size_text = None): + self.AutoSizeText = auto_size_text # Setting to override the form's policy on autosizing. self.Elements = [] # List of Elements in this Rrow return @@ -563,44 +563,44 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), AutoSizeText=DEFAULT_AUTOSIZE_TEXT, Scale=(None, None),Size=(None, None), Location=(None, None), ButtonColor=None, Font=None, ProgressBarColor=(None,None), IsTabbedForm=False,BorderDepth=None, AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Icon=DEFAULT_WINDOW_ICON): - self.AutoSizeText = AutoSizeText + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), size=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + self.AutoSizeText = auto_size_text self.Title = title self.Rows = [] # a list of ELEMENTS for this row - self.DefaultElementSize = DefaultElementSize - self.Size = Size - self.Scale = Scale - self.Location = Location - self.ButtonColor = ButtonColor if ButtonColor else DEFAULT_BUTTON_COLOR - self.IsTabbedForm = IsTabbedForm + self.DefaultElementSize = default_element_size + self.Size = size + self.Scale = scale + self.Location = location + self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR + self.IsTabbedForm = is_tabbed_form self.ParentWindow = None - self.Font = Font if Font else DEFAULT_FONT + self.Font = font if font else DEFAULT_FONT self.RadioDict = {} - self.BorderDepth = BorderDepth - self.WindowIcon = Icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon - self.AutoClose = AutoClose + self.BorderDepth = border_depth + self.WindowIcon = icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon + self.AutoClose = auto_close self.NonBlocking = False self.TKroot = None self.TKrootDestroyed = False self.TKAfterID = None - self.ProgressBarColor = ProgressBarColor - self.AutoCloseDuration = AutoCloseDuration + self.ProgressBarColor = progress_bar_color + self.AutoCloseDuration = auto_close_duration self.UberParent = None self.RootNeedsDestroying = False self.Shown = False self.ReturnValues = None # ------------------------- Add ONE Row to Form ------------------------- # - def AddRow(self, *args,AutoSizeText=None): + def AddRow(self, *args, auto_size_text=None): ''' Parms are a variable number of Elements ''' NumRows = len(self.Rows) # number of existing rows is our row number CurrentRowNumber = NumRows # this row's number - CurrentRow = Row(AutoSizeText) # start with a blank row and build up + CurrentRow = Row(auto_size_text) # start with a blank row and build up # ------------------------- Add the elements to a row ------------------------- # for i, element in enumerate(args): # Loop through list of elements and add them to the row element.Position = (CurrentRowNumber, i) CurrentRow.Elements.append(element) - CurrentRow.AutoSizeText = AutoSizeText + CurrentRow.AutoSizeText = auto_size_text # ------------------------- Append the row to list of Rows ------------------------- # self.Rows.append(CurrentRow) @@ -615,26 +615,26 @@ def LayoutAndShow(self,rows): return self.ReturnValues # ------------------------- ShowForm THIS IS IT! ------------------------- # - def Show(self, NonBlocking=False): + def Show(self, non_blocking=False): self.Shown = True # Compute num rows & num cols (it'll come in handy debugging) self.NumRows = len(self.Rows) self.NumCols = max(len(row.Elements) for row in self.Rows) - self.NonBlocking=NonBlocking + self.NonBlocking=non_blocking # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## StartupTK(self) return self.ReturnValues # ------------------------- SetIcon - set the window's fav icon ------------------------- # - def SetIcon(self, Icon): - self.WindowIcon = Icon + def SetIcon(self, icon): + self.WindowIcon = icon try: - self.TKroot.iconbitmap(Icon) + self.TKroot.iconbitmap(icon) except: pass - def GetElementAtLocation(self,Location): - (row_num,col_num) = Location + def GetElementAtLocation(self, location): + (row_num,col_num) = location row = self.Rows[row_num] element = row.Elements[col_num] return element @@ -720,8 +720,8 @@ def __init__(self): self.TKroot = None self.TKrootDestroyed = False - def AddForm(self, Form): - self.FormList.append(Form) + def AddForm(self, form): + self.FormList.append(form) def Close(self): self.FormReturnValues = [] @@ -740,60 +740,60 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(DefaultText = '', Scale=(None, None), Size=(None, None), AutoSizeText=None): - return InputText(DefaultText=DefaultText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText) +def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text) -def Input(DefaultText = '', Scale=(None, None), Size=(None, None), AutoSizeText=None): - return InputText(DefaultText=DefaultText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText) +def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text) # ------------------------- TEXT Element lazy functions ------------------------- # -def Txt(DisplayText, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, TextColor=None): - return Text(DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, Font=Font, TextColor=TextColor) +def Txt(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None): + return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color) -def T(DisplayText, Scale=(None, None), Size=(None, None), AutoSizeText=None, Font=None, TextColor=None): - return Text(DisplayText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, Font=Font, TextColor=TextColor) +def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None): + return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(Target=(ThisRow, -1), ButtonText='Browse', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(BROWSE_FOLDER, Target=Target, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(Target=(ThisRow, -1), FileTypes=(("ALL Files", "*.*"),),ButtonText='Browse',Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(BROWSE_FILE, Target, ButtonText=ButtonText, FileTypes=FileTypes, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(ButtonText='Submit', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(ButtonText='OK', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(ButtonText='Ok', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # -def Cancel(ButtonText='Cancel', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) +def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(ButtonText='Yes', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(ButtonText='No', Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor) +def No(button_text='No', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(ButtonText, Scale=(None, None), Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - return Button(CLOSES_WIN, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) +def SimpleButton(button_text, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(ButtonText, Scale=(None, None),Size=(None, None), AutoSizeText=None, ButtonColor=None, Font=None): - return Button(READ_FORM, ButtonText=ButtonText, Scale=Scale, Size=Size, AutoSizeText=AutoSizeText, ButtonColor=ButtonColor, Font=Font) +def ReadFormButton(button_text, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, Font=None): + return Button(READ_FORM, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=Font) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -843,8 +843,8 @@ def DecodeRadioRowCol(RadValue): col = RadValue%1000 return row,col -def EncodeRadioRowCol(Row, Col): - RadValue = Row*1000 + Col +def EncodeRadioRowCol(row, col): + RadValue = row * 1000 + col return RadValue # ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # @@ -1066,7 +1066,7 @@ def ConvertFlexToTK(MyFlexForm): bar_color = element.BarColor else: bar_color = DEFAULT_PROGRESS_BAR_COLOR - element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, Orientation=direction, BarColor=bar_color, Borderwidth=element.BorderWidth, Relief=element.Relief) + element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) s = ttk.Style() element.TKProgressBar.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT RADIO BUTTON element ------------------------- # @@ -1131,14 +1131,14 @@ def ConvertFlexToTK(MyFlexForm): return # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# -def ShowTabbedForm(Title, *args,AutoClose=False, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME,FavIcon=DEFAULT_WINDOW_ICON): +def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON): global _my_windows uber = UberForm() root = tk.Tk() uber.TKroot = root - if Title is not None: - root.title(Title) + if title is not None: + root.title(title) if not len(args): ('******************* SHOW TABBED FORMS ERROR .... no arguments') return @@ -1160,8 +1160,8 @@ def ShowTabbedForm(Title, *args,AutoClose=False, AutoCloseDuration=DEFAULT_AUTOC uber.FormReturnValues.append(form.ReturnValues) # dangerous?? or clever? use the final form as a callback for autoclose - id = root.after(AutoCloseDuration*1000, form.AutoCloseAlarmCallback) if AutoClose else 0 - icon = FavIcon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon + id = root.after(auto_close_duration * 1000, form.AutoCloseAlarmCallback) if auto_close else 0 + icon = fav_icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon try: uber.TKroot.iconbitmap(icon) except: pass @@ -1172,31 +1172,31 @@ def ShowTabbedForm(Title, *args,AutoClose=False, AutoCloseDuration=DEFAULT_AUTOC return uber.FormReturnValues # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# -def StartupTK(MyFlexForm): +def StartupTK(my_flex_form): global _my_windows ow = _my_windows.NumOpenWindows root = tk.Tk() if not ow else tk.Toplevel() _my_windows.NumOpenWindows += 1 - MyFlexForm.TKroot = root + my_flex_form.TKroot = root # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) # root.bind('', MyFlexForm.DestroyedCallback()) - ConvertFlexToTK(MyFlexForm) - MyFlexForm.SetIcon(MyFlexForm.WindowIcon) - - if MyFlexForm.AutoClose: - duration = DEFAULT_AUTOCLOSE_TIME if MyFlexForm.AutoCloseDuration is None else MyFlexForm.AutoCloseDuration - MyFlexForm.TKAfterID = root.after(duration*1000, MyFlexForm.AutoCloseAlarmCallback) - if MyFlexForm.NonBlocking: - MyFlexForm.TKroot.protocol("WM_WINDOW_DESTROYED", MyFlexForm.OnClosingCallback()) + ConvertFlexToTK(my_flex_form) + my_flex_form.SetIcon(my_flex_form.WindowIcon) + + if my_flex_form.AutoClose: + duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration + my_flex_form.TKAfterID = root.after(duration * 1000, my_flex_form.AutoCloseAlarmCallback) + if my_flex_form.NonBlocking: + my_flex_form.TKroot.protocol("WM_WINDOW_DESTROYED", my_flex_form.OnClosingCallback()) pass else: # it's a blocking form - MyFlexForm.TKroot.mainloop() + my_flex_form.TKroot.mainloop() _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - if MyFlexForm.RootNeedsDestroying: - MyFlexForm.TKroot.destroy() - MyFlexForm.RootNeedsDestroying = False + if my_flex_form.RootNeedsDestroying: + my_flex_form.TKroot.destroy() + my_flex_form.RootNeedsDestroying = False return @@ -1225,24 +1225,24 @@ def _GetNumLinesNeeded(text, max_line_width): # Exits via an OK button2 press # # Returns nothing # # ===================================================# -def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, AutoCloseDuration=None, Icon=DEFAULT_WINDOW_ICON, LineWidth=MESSAGE_BOX_LINE_WIDTH, Font=None): +def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, icon=DEFAULT_WINDOW_ICON, line_width=MESSAGE_BOX_LINE_WIDTH, font=None): ''' Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: - :param ButtonColor: - :param ButtonType: - :param AutoClose: - :param AutoCloseDuration: - :param Icon: - :param LineWidth: - :param Font: + :param button_color: + :param button_type: + :param auto_close: + :param auto_close_duration: + :param icon: + :param line_width: + :param font: :return: ''' if not args: args_to_print = [''] else: args_to_print = args - with FlexForm(args_to_print[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Icon=Icon, Font=Font) as form: + with FlexForm(args_to_print[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -1251,32 +1251,33 @@ def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, Aut if message.count('\n'): message_wrapped = message else: - message_wrapped = textwrap.fill(message, LineWidth) + message_wrapped = textwrap.fill(message, line_width) message_wrapped_lines = message_wrapped.count('\n')+1 longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, LineWidth) + width_used = min(longest_line_len, line_width) max_line_total = max(max_line_total, width_used) # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines - form.AddRow(Text(message_wrapped, AutoSizeText=True)) + form.AddRow(Text(message_wrapped, auto_size_text=True)) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 pad =1 # show either an OK or Yes/No depending on paramater - if ButtonType is MSG_BOX_YES_NO: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), Yes(ButtonColor=ButtonColor), No(ButtonColor=ButtonColor)) + if button_type is MSG_BOX_YES_NO: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(button_color=button_color), No( + button_color=button_color)) (button_text, values) = form.Show() return button_text == 'Yes' - elif ButtonType is MSG_BOX_CANCELLED: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('Cancelled', ButtonColor=ButtonColor)) - elif ButtonType is MSG_BOX_ERROR: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('ERROR', Size=(5,1), ButtonColor=ButtonColor)) - elif ButtonType is MSG_BOX_OK_CANCEL: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('OK', Size=(5,1), ButtonColor=ButtonColor), - SimpleButton('Cancel', Size=(5, 1), ButtonColor=ButtonColor)) + elif button_type is MSG_BOX_CANCELLED: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('Cancelled', button_color=button_color)) + elif button_type is MSG_BOX_ERROR: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('ERROR', size=(5, 1), button_color=button_color)) + elif button_type is MSG_BOX_OK_CANCEL: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color), + SimpleButton('Cancel', size=(5, 1), button_color=button_color)) else: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('OK', Size=(5,1), ButtonColor=ButtonColor)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color)) button, values = form.Show() return button @@ -1284,99 +1285,99 @@ def MsgBox(*args, ButtonColor=None, ButtonType=MSG_BOX_OK, AutoClose=False, Aut # ============================== MsgBoxAutoClose====# # Lazy function. Same as calling MsgBox with parms # # ===================================================# -def MsgBoxAutoClose(*args, ButtonColor=None,AutoClose=True, AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, Font=None): +def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, font=None): ''' Display a standard MsgBox that will automatically close after a specified amount of time :param args: - :param ButtonColor: - :param AutoClose: - :param AutoCloseDuration: - :param Font: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: :return: ''' - MsgBox(*args, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return # ============================== MsgBoxError =====# # Like MsgBox but presents RED BUTTONS # # ===================================================# -def MsgBoxError(*args, ButtonColor=DEFAULT_ERROR_BUTTON_COLOR,AutoClose=False, AutoCloseDuration=None, Font=None): +def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, Font=None): ''' Display a MsgBox with a red button :param args: - :param ButtonColor: - :param AutoClose: - :param AutoCloseDuration: + :param button_color: + :param auto_close: + :param auto_close_duration: :param Font: :return: ''' - MsgBox(*args, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=Font) return # ============================== MsgBoxCancel =====# # # # ===================================================# -def MsgBoxCancel(*args,ButtonColor=DEFAULT_CANCEL_BUTTON_COLOR,AutoClose=False, AutoCloseDuration=None, Font=None): +def MsgBoxCancel(*args, button_color=DEFAULT_CANCEL_BUTTON_COLOR, auto_close=False, auto_close_duration=None, font=None): ''' Display a MsgBox with a single "Cancel" button. :param args: - :param ButtonColor: - :param AutoClose: - :param AutoCloseDuration: - :param Font: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: :return: ''' - MsgBox(*args, ButtonType=MSG_BOX_CANCELLED, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return # ============================== MsgBoxOK =====# # Like MsgBox but only 1 button # # ===================================================# -def MsgBoxOK(*args,ButtonColor=('white', 'black'),AutoClose=False, AutoCloseDuration=None, Font=None): +def MsgBoxOK(*args, button_color=('white', 'black'), auto_close=False, auto_close_duration=None, font=None): ''' Display a MsgBox with a single buttoned labelled "OK" :param args: - :param ButtonColor: - :param AutoClose: - :param AutoCloseDuration: - :param Font: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: :return: ''' - MsgBox(*args, ButtonType=MSG_BOX_OK, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return # ============================== MsgBoxOKCancel ====# # Like MsgBox but presents OK and Cancel buttons # # ===================================================# -def MsgBoxOKCancel(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): +def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): ''' Display MsgBox with 2 buttons, "OK" and "Cancel" :param args: - :param ButtonColor: - :param AutoClose: - :param AutoCloseDuration: - :param Font: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: :return: ''' - result = MsgBox(*args, ButtonType=MSG_BOX_OK_CANCEL, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + result = MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return result # ==================================== YesNoBox=====# # Like MsgBox but presents Yes and No buttons # # Returns True if Yes was pressed else False # # ===================================================# -def MsgBoxYesNo(*args,ButtonColor=None,AutoClose=False, AutoCloseDuration=None, Font=None): +def MsgBoxYesNo(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): ''' Display MsgBox with 2 buttons, "Yes" and "No" :param args: - :param ButtonColor: - :param AutoClose: - :param AutoCloseDuration: - :param Font: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: :return: ''' - result = MsgBox(*args,ButtonType=MSG_BOX_YES_NO, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration, Font=Font) + result = MsgBox(*args, button_type=MSG_BOX_YES_NO, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return result # ============================== PROGRESS METER ========================================== # @@ -1400,52 +1401,52 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def ProgressMeter(Title, MaxValue, *args, Orientation=None, BarColor=DEFAULT_PROGRESS_BAR_COLOR, ButtonColor=None,Size=DEFAULT_PROGRESS_BAR_SIZE, Scale=(None, None), BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +def ProgressMeter(title, max_value, *args, Orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): ''' Create and show a form on tbe caller's behalf. - :param Title: - :param MaxValue: + :param title: + :param max_value: :param args: ANY number of arguments the caller wants to display :param Orientation: - :param BarColor: - :param Size: - :param Scale: + :param bar_color: + :param size: + :param scale: :param Style: :param StyleOffset: :return: ProgressBar object that is in the form ''' orientation = DEFAULT_METER_ORIENTATION if Orientation is None else Orientation target = (0,0) if orientation[0].lower() == 'h' else (0,1) - bar2 = ProgressBar(MaxValue, Orientation=orientation, Size=Size, BarColor=BarColor, Scale=Scale, Target=target, BorderWidth=BorderWidth) - form = FlexForm(Title, AutoSizeText=True) + bar2 = ProgressBar(max_value, orientation=orientation, size=size, bar_color=bar_color, scale=scale, target=target, broder_width=border_width) + form = FlexForm(title, auto_size_text=True) # Form using a horizontal bar if orientation[0].lower() == 'h': single_line_message, width, height = ConvertArgsToSingleString(*args) bar2.TextToDisplay = single_line_message - bar2.MaxValue = MaxValue + bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(Text(single_line_message,Size=(width+20, height+3), AutoSizeText=True)) + form.AddRow(Text(single_line_message, size=(width + 20, height + 3), auto_size_text=True)) form.AddRow((bar2)) - form.AddRow((Cancel(ButtonColor=ButtonColor))) + form.AddRow((Cancel(button_color=button_color))) else: single_line_message, width, height = ConvertArgsToSingleString(*args) bar2.TextToDisplay = single_line_message - bar2.MaxValue = MaxValue + bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(bar2, Text(single_line_message,Size=(width+20, height+3), AutoSizeText=True)) - form.AddRow((Cancel(ButtonColor=ButtonColor))) + form.AddRow(bar2, Text(single_line_message, size=(width + 20, height + 3), auto_size_text=True)) + form.AddRow((Cancel(button_color=button_color))) form.NonBlocking = True - form.Show(NonBlocking = True) + form.Show(non_blocking= True) return bar2 # ============================== ProgressMeterUpdate =====# -def ProgressMeterUpdate(bar, Value, *args): +def ProgressMeterUpdate(bar, value, *args): ''' Update the progress meter for a form :param form: class ProgressBar - :param Value: int + :param value: int :return: True if not cancelled, OK....False if Error ''' global _my_windows @@ -1455,9 +1456,9 @@ def ProgressMeterUpdate(bar, Value, *args): bar.TextToDisplay = message - bar.CurrentValue = Value - rc = bar.UpdateBar(Value) - if Value >= bar.MaxValue or not rc: + bar.CurrentValue = value + rc = bar.UpdateBar(value) + if value >= bar.MaxValue or not rc: bar.BarExpired = True bar.ParentForm.Close() if bar.ParentForm.RootNeedsDestroying: @@ -1474,12 +1475,12 @@ def ProgressMeterUpdate(bar, Value, *args): # ============================== EASY PROGRESS METER ========================================== # # class to hold the easy meter info (a global variable essentialy) class EasyProgressMeterDataClass(): - def __init__(self, Title='', CurrentValue=1, MaxValue=10, StartTime=None, StatMessages=()): - self.Title = Title - self.CurrentValue = CurrentValue - self.MaxValue = MaxValue - self.StartTime = StartTime - self.StatMessages = StatMessages + def __init__(self, title='', current_value=1, max_value=10, start_time=None, stat_messages=()): + self.Title = title + self.CurrentValue = current_value + self.MaxValue = max_value + self.StartTime = start_time + self.StatMessages = stat_messages self.ParentForm = None self.MeterID = None @@ -1514,18 +1515,18 @@ def ComputeProgressStats(self): # ============================== EasyProgressMeter =====# -def EasyProgressMeter(Title, CurrentValue, MaxValue,*args, Orientation=None, BarColor=DEFAULT_PROGRESS_BAR_COLOR, ButtonColor=None, Size=DEFAULT_PROGRESS_BAR_SIZE, Scale=(None, None),BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): ''' A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call before your loop. You've got enough code to write! - :param Title: Title will be shown on the window - :param CurrentValue: Current count of your items - :param MaxValue: Max value your count will ever reach. This indicates it should be closed + :param title: Title will be shown on the window + :param current_value: Current count of your items + :param max_value: Max value your count will ever reach. This indicates it should be closed :param args: VARIABLE number of arguements... you request it, we'll print it no matter what the item! - :param Orientation: - :param BarColor: - :param Size: - :param Scale: + :param orientation: + :param bar_color: + :param size: + :param scale: :param Style: :param StyleOffset: :return: False if should stop the meter @@ -1536,34 +1537,34 @@ def EasyProgressMeter(Title, CurrentValue, MaxValue,*args, Orientation=None, Bar EasyProgressMeter.EasyProgressMeterData = getattr(EasyProgressMeter, 'EasyProgressMeterData', EasyProgressMeterDataClass()) # if no meter currently running if EasyProgressMeter.EasyProgressMeterData.MeterID is None: # Starting a new meter - if int(CurrentValue) >= int(MaxValue): + if int(current_value) >= int(max_value): return False del(EasyProgressMeter.EasyProgressMeterData) - EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass(Title, 1, int(MaxValue), datetime.datetime.utcnow(), []) + EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() message = "\n".join([line for line in EasyProgressMeter.EasyProgressMeterData.StatMessages]) - EasyProgressMeter.EasyProgressMeterData.MeterID = ProgressMeter(Title, int(MaxValue), message, *args, Orientation=Orientation, BarColor=BarColor, Size=Size, Scale=Scale, ButtonColor=ButtonColor,BorderWidth=BorderWidth) + EasyProgressMeter.EasyProgressMeterData.MeterID = ProgressMeter(title, int(max_value), message, *args, Orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=border_width) EasyProgressMeter.EasyProgressMeterData.ParentForm = EasyProgressMeter.EasyProgressMeterData.MeterID.ParentForm return True # if exactly the same values as before, then ignore. - if EasyProgressMeter.EasyProgressMeterData.MaxValue == MaxValue and EasyProgressMeter.EasyProgressMeterData.CurrentValue == CurrentValue: + if EasyProgressMeter.EasyProgressMeterData.MaxValue == max_value and EasyProgressMeter.EasyProgressMeterData.CurrentValue == current_value: return True - if EasyProgressMeter.EasyProgressMeterData.MaxValue != int(MaxValue): + if EasyProgressMeter.EasyProgressMeterData.MaxValue != int(max_value): EasyProgressMeter.EasyProgressMeterData.MeterID = None EasyProgressMeter.EasyProgressMeterData.ParentForm = None del(EasyProgressMeter.EasyProgressMeterData) EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass() # setup a new progress meter return True # HAVE to return TRUE or else the new meter will thing IT is failing when it hasn't - EasyProgressMeter.EasyProgressMeterData.CurrentValue = int(CurrentValue) - EasyProgressMeter.EasyProgressMeterData.MaxValue = int(MaxValue) + EasyProgressMeter.EasyProgressMeterData.CurrentValue = int(current_value) + EasyProgressMeter.EasyProgressMeterData.MaxValue = int(max_value) EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() message = '' for line in EasyProgressMeter.EasyProgressMeterData.StatMessages: message = message + str(line) + '\n' message = "\n".join(EasyProgressMeter.EasyProgressMeterData.StatMessages) - rc = ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, CurrentValue,*args, message ) + rc = ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, current_value, *args, message) # if counter >= max then the progress meter is all done. Indicate none running - if CurrentValue >= EasyProgressMeter.EasyProgressMeterData.MaxValue or not rc: + if current_value >= EasyProgressMeter.EasyProgressMeterData.MaxValue or not rc: EasyProgressMeter.EasyProgressMeterData.MeterID = None del(EasyProgressMeter.EasyProgressMeterData) EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass() # setup a new progress meter @@ -1571,11 +1572,11 @@ def EasyProgressMeter(Title, CurrentValue, MaxValue,*args, Orientation=None, Bar return rc # return whatever the update told us -def EasyProgressMeterCancel(Title, *args): +def EasyProgressMeterCancel(title, *args): EasyProgressMeter.EasyProgressMeterData = getattr(EasyProgressMeter, 'EasyProgressMeterData', EasyProgressMeterDataClass()) if EasyProgressMeter.EasyProgressMeterData.MeterID is not None: # tell the normal meter update that we're at max value which will close the meter - rc = EasyProgressMeter(Title, EasyProgressMeter.EasyProgressMeterData.MaxValue, EasyProgressMeter.EasyProgressMeterData.MaxValue, ' *** CANCELLING ***', 'Caller requested a cancel', *args) + rc = EasyProgressMeter(title, EasyProgressMeter.EasyProgressMeterData.MaxValue, EasyProgressMeter.EasyProgressMeterData.MaxValue, ' *** CANCELLING ***', 'Caller requested a cancel', *args) return rc return True @@ -1609,10 +1610,10 @@ def GetComplimentaryHex(color): # ======================== Scrolled Text Box =====# # ===================================================# -def ScrolledTextBox(*args, ButtonColor=None, YesNo=False, AutoClose=False, AutoCloseDuration=None, Height=None): +def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, auto_close_duration=None, height=None): if not args: return - with FlexForm(args[0], AutoSizeText=True, ButtonColor=ButtonColor, AutoClose=AutoClose, AutoCloseDuration=AutoCloseDuration) as form: - max_line_total, max_line_width, total_lines, height = 0,0,0,0 + with FlexForm(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: + max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 complete_output = '' for message in args: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -1623,21 +1624,21 @@ def ScrolledTextBox(*args, ButtonColor=None, YesNo=False, AutoClose=False, AutoC max_line_total = max(max_line_total, width_used) max_line_width = MESSAGE_BOX_LINE_WIDTH lines_needed = _GetNumLinesNeeded(message, width_used) - height += lines_needed + height_computed += lines_needed complete_output += message + '\n' total_lines += lines_needed - height = MAX_SCROLLED_TEXT_BOX_HEIGHT if height > MAX_SCROLLED_TEXT_BOX_HEIGHT else height - if Height: - height = Height - form.AddRow(Multiline(complete_output, Size=(max_line_width, height)), AutoSizeText=True) + height_computed = MAX_SCROLLED_TEXT_BOX_HEIGHT if height_computed > MAX_SCROLLED_TEXT_BOX_HEIGHT else height_computed + if height: + height_computed = height + form.AddRow(Multiline(complete_output, size=(max_line_width, height_computed)), auto_size_text=True) pad = max_line_total-15 if max_line_total > 15 else 1 # show either an OK or Yes/No depending on paramater - if YesNo: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), Yes(), No()) + if yes_no: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(), No()) (button_text, values) = form.Show() return button_text == 'Yes' else: - form.AddRow(Text('', Size=(pad,1), AutoSizeText=False), SimpleButton('OK', Size=(5,1), ButtonColor=ButtonColor)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color)) form.Show() @@ -1652,10 +1653,10 @@ def ScrolledTextBox(*args, ButtonColor=None, YesNo=False, AutoClose=False, AutoC # True/False, path # # (True if Submit was pressed, false otherwise) # # ---------------------------------------------------------------------- # -def GetPathBox(Title, Message, DefaultPath='', ButtonColor=None, Size=(None,None)): - with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: - layout = [[Text(Message,AutoSizeText=True)], - [InputText(DefaultText=DefaultPath, Size=Size), FolderBrowse()], +def GetPathBox(title, message, default_path='', button_color=None, size=(None, None)): + with FlexForm(title, auto_size_text=True, button_color=button_color) as form: + layout = [[Text(message, auto_size_text=True)], + [InputText(default_text=default_path, size=size), FolderBrowse()], [Submit(), Cancel()]] (button, input_values) = form.LayoutAndShow(layout) @@ -1668,10 +1669,10 @@ def GetPathBox(Title, Message, DefaultPath='', ButtonColor=None, Size=(None,None # ============================== GetFileBox =========# # Like the Get folder box but for files # # ===================================================# -def GetFileBox(Title, Message, DefaultPath='',FileTypes=(("ALL Files", "*.*"),), ButtonColor=None, Size=(None,None)): - with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: - layout = [[Text(Message,AutoSizeText=True)], - [InputText(DefaultText=DefaultPath, Size=Size), FileBrowse(FileTypes=FileTypes)], +def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)): + with FlexForm(title, auto_size_text=True, button_color=button_color) as form: + layout = [[Text(message, auto_size_text=True)], + [InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)], [Submit(), Cancel()]] (button, input_values) = form.LayoutAndShow(layout) @@ -1685,10 +1686,10 @@ def GetFileBox(Title, Message, DefaultPath='',FileTypes=(("ALL Files", "*.*"),), # ============================== GetTextBox =========# # Get a single line of text # # ===================================================# -def GetTextBox(Title, Message, Default='', ButtonColor=None, Size=(None, None)): - with FlexForm(Title, AutoSizeText=True, ButtonColor=ButtonColor) as form: - layout = [[Text(Message,AutoSizeText=True)], - [InputText(DefaultText=Default, Size=Size)], +def GetTextBox(title, message, Default='', button_color=None, size=(None, None)): + with FlexForm(title, auto_size_text=True, button_color=button_color) as form: + layout = [[Text(message, auto_size_text=True)], + [InputText(default_text=Default, size=size)], [Submit(), Cancel()]] (button, input_values) = form.LayoutAndShow(layout) @@ -1701,21 +1702,21 @@ def GetTextBox(Title, Message, Default='', ButtonColor=None, Size=(None, None)): # ============================== SetGlobalIcon ======# # Sets the icon to be used by default # # ===================================================# -def SetGlobalIcon(Icon): +def SetGlobalIcon(icon): global _my_windows try: - with open(Icon, 'r') as icon_file: + with open(icon, 'r') as icon_file: pass except: raise FileNotFoundError - _my_windows.user_defined_icon = Icon + _my_windows.user_defined_icon = icon return True -# ============================== SetGlobalIcon ======# -# Sets the icon to be used by default # +# ============================== SetButtonColor =====# +# Sets the defaul button color # # ===================================================# def SetButtonColor(foreground, background): global DEFAULT_BUTTON_COLOR diff --git a/readme.md b/readme.md index 9f139bf7b..2926d40da 100644 --- a/readme.md +++ b/readme.md @@ -1,69 +1,69 @@ -# PySimpleGUI - -This really is a simple GUI, but also powerfully customizable. +# PySimpleGUI + +This really is a simple GUI, but also powerfully customizable. ![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - + Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. - -The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. - + +The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. + You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop. ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) - The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. - + The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: File Browse Folder Browse Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window + Persistent Windows + Redirect Python Output/Errors to scrolling Window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - + An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - + +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + ### Using To use in your code, simply import.... @@ -106,18 +106,18 @@ This feature of the Python language is utilized ***heavily*** as a method of cus Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. def MsgBox(*args, - ButtonColor=None, - ButtonType=MSG_BOX_OK, - AutoClose=False, - AutoCloseDuration=None, - Icon=DEFAULT_WINDOW_ICON, - LineWidth=MESSAGE_BOX_LINE_WIDTH, - Font=None): + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): If the caller wanted to change the button color to be black on yellow, the call would look something like this: SG.MsgBox('This box has a custom button color', - ButtonColor=('black', 'yellow')) + button_color=('black', 'yellow')) ![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) @@ -194,15 +194,15 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr ![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) EasyProgressMeter(Title, - CurrentValue, - MaxValue, + current_value, + max_value, *args, - Orientation=None, - BarColor=DEFAULT_PROGRESS_BAR_COLOR, - ButtonColor=None, - Size=DEFAULT_PROGRESS_BAR_SIZE, - Scale=(None, None), - BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): Here's the one-line Progress Meter in action! @@ -226,7 +226,7 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e ## COPY THIS DESIGN PATTERN! - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] @@ -247,7 +247,7 @@ Some elements are shortcuts, again meant to make it easy on the programmer. Rat Going through each line of code - with SG.FlexForm('SHA-1 & 256 Hash', AutoSizeText=True) as form: + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: This creates a new form, storing it in the variable `form`. form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], @@ -285,20 +285,20 @@ If you have a SINGLE value being returned, it is written this way: ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: - layout = [[Text('Here they all are!', Size=(30,1), Font=("Helvetica", 25), TextColor='red')], - [Text('Here is some text with font sizing', Font=("Helvetica", 15))], + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], + [Text('Here is some text with font sizing', font=("Helvetica", 15))], [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', Default=True)], - [Radio('My first Radio!', "RADIO1", Default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', Scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], Size=(20, 3))], - [Text('_' * 90, Size=(60, 1))], - [Text('Choose Source and Destination Folders', Size=(35,1))], - [Text('Source Folder', Size=(15, 1), AutoSizeText=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', Size=(15, 1), AutoSizeText=False), InputText('Dest'), FolderBrowse()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], + [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], + [Text('_' * 90, size=(60, 1))], + [Text('Choose Source and Destination Folders', size=(35,1))], + [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', Size=(12,1), Font=("Helvetica", 20))], + [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], [Submit(), Cancel()]] (button, (values)) = form.LayoutAndShow(layout) @@ -306,7 +306,7 @@ This code utilizes as many of the elements in one form as possible. - MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , Font = ("Helvetica", 15)) + MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. @@ -336,27 +336,27 @@ You've already seen a number of examples above that use blocking forms. Anytime NON-BLOCKING form call: - form.Show(NonBlocking=True) + form.Show(non_blocking=True) ### Beginning a Form The first step is to create the form object using the desired form customization. - with FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(30,1)) as form: + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: Let's go through the options available when creating a form. def __init__(self, title, - DefaultElementSize=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - AutoSizeText=DEFAULT_AUTOSIZE_TEXT, - Scale=(None, None), - Size=(None, None), - Location=(None, None), - ButtonColor=None,Font=None, - ProgressBarColor=(None,None), - IsTabbedForm=False, - BorderDepth=None, - AutoClose=False, - AutoCloseDuration=DEFAULT_AUTOCLOSE_TIME, - Icon=DEFAULT_WINDOW_ICON): + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=DEFAULT_AUTOSIZE_TEXT, + scale=(None, None), + size=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): #### Sizes @@ -364,25 +364,25 @@ Note several variables that deal with "size". Element sizes are measured in cha The default Element size for PySimpleGUI is `(45,1)`. -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `Size=(20,1)` in the form creation call will set all elements in the form to that size. +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. -In addition to `size` there is a `scale` option. Scale will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. #### FlexForm - form-level variables overview A summary of the variables that can be changed when a FlexForm is created - DefaultElementSize - set default size for all elements in the form - AutoSizeText - true/false autosizing turned on / off - Scale - set scale value for all elements - ButtonColor - default button color (foreground, background) - Font - font name and size for all text items - ProgressBarColor - progress bar colors - IsTabbedForm - true/false indicates form is a tabbed or normal form - BorderDepth - style setting for buttons, input fields - AutoClose - true/false indicates if form will automatically close - AutoCloseDuration - how long in seconds before closing form - Icon - filename for icon that's displayed on the window on taskbar + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar ## Elements @@ -424,11 +424,11 @@ The code is a crude representation of the GUI, laid out in text. The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. Text(Text, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None, - Font=None, - TextColor=None) + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None) Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. @@ -448,8 +448,8 @@ The values foreground and background can be the color names or the hex value for "#RRGGBB" -**AutoSizeText** -A `True` value for `AutoSizeText`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. **Shorthand functions** The shorthand functions for `Text` are `Txt` and `T` @@ -457,55 +457,55 @@ The shorthand functions for `Text` are `Txt` and `T` #### Multiline Text Element - layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', Size=(45,5))]] + layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] ![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - Multiline(DefaultText='', - EnterSubmits = False, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None) + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) . - DefaultText - Text to display in the text box - EnterSubmits - Bool. If True, pressing Enter key submits form - Scale - Element's scale - Size - Element's size - AutoSizeText - Bool. Change width to match size of text + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text #### Output Element Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - form.AddRow(gg.Output(Size=(100,20))) + form.AddRow(gg.Output(size=(100,20))) ![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - Output(Scale=(None, None), - Size=(None, None)) + Output(scale=(None, None), + size=(None, None)) . - Scale - How much to scale size of element - Size - Size of element (width, height) in characters + scale - How much to scale size of element + size - Size of element (width, height) in characters ### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `Size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. #### Text Input Element layout = [[SG.InputText('Default text')]] ![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - def InputText(DefaultText = '', - Scale=(None, None), - Size=(None, None), - AutoSizeText=None) + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None) . - DefaultText - Text initially shown in the input box - Scale - Amount size is scaled by - Size - (width, height) of element in characters - AutoSizeText - Bool. True is element should be sized to fit text + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text Shorthand functions that are equivalent to `InputText` are `Input` and `In` @@ -517,88 +517,88 @@ Also known as a drop-down list. Only required parameter is the list of choices. ![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - InputCombo(Values, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None) + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) . - Values Choices to be displayed. List of strings - Scale - Amount to scale size by - Size - (width, height) of element in characters - AutoSizeText - Bool. True if size should fit the text length + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - layout = [[SG.Radio('My first Radio!', "RADIO1", Default=True), SG.Radio('My second radio!', "RADIO1")]] + layout = [[SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second radio!', "RADIO1")]] ![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - Radio(Text, - GroupID, - Default=False, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None, - Font=None) + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) . - Text - Text to display next to button - GroupID - Groups together multiple Radio Buttons. Can be any value - Default - Bool. Initial state - Scale - Amount to scale size of element - Size - (width, height) size of element in characters - AutoSizeText - Bool. True if should size width to fit text - Font - Font type and size for text display + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display #### Checkbox Element Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - layout = [[SG.Checkbox('My first Checkbox!', Default=True), SG.Checkbox('My second Checkbox!')]] + layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] ![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - Checkbox(Text, - Default=False, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None, - Font=None): + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): . - Text - Text to display next to checkbox - Default - Bool. Initial state - Scale - Amount to scale size of element - Size - (width, height) size of element in characters - AutoSizeText - Bool. True if should size width to fit text - Font - Font type and size for text display + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display #### Spin Element An up/down spinner control. The valid values are passed in as a list. - layout = [[SG.Spin([i for i in range(1,11)], InitialValue=1), SG.Text('Volume level')]] + layout = [[SG.Spin([i for i in range(1,11)], initial_value=1), SG.Text('Volume level')]] ![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - Spin(Values, - InitialValue=None, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None, - Font=None) + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) . - Values - List of valid values - InitialValue - String with initial value - Scale - Amount to scale size of element - Size - (width, height) size of element in characters - AutoSizeText - Bool. True if should size width to fit text - Font - Font type and size for text display + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display #### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. @@ -620,12 +620,12 @@ Read Form - This is an async form button that will read a snapshot of all of the While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - SimpleButton(Text, - Scale=(None, None), - Size=(None, None), - AutoSizeText=None, - ButtonColor=None, - Font=None) + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + button_color=None, + font=None) Pre-made buttons include: @@ -667,16 +667,16 @@ layout = [[SG.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) -All buttons can have their text changed by changing the `ButtonText` variable. +All buttons can have their text changed by changing the `button_text` variable. **File Types** -The `FileBrowse` button has an additional setting named `FileTypes`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) This code produces a form where the Browse button only shows files of type .TXT - layout = [[SG.In() ,SG.FileBrowse(FileTypes=(("Text Files", "*.txt"),))]] + layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. Keep this in mind when designing forms. @@ -693,23 +693,23 @@ If you want a bit more customization of your meter, then you can go up 1 level a You setup the progress meter by calling - my_meter = ProgressMeter(Title, - MaxValue, + my_meter = ProgressMeter(title, + max_value, *args, - Orientation=None, - BarColor=DEFAULT_PROGRESS_BAR_COLOR, - ButtonColor=None, - Size=DEFAULT_PROGRESS_BAR_SIZE, - Scale=(None, None), - BorderWidth=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) Then to update the bar within your loop return_code = ProgressMeterUpdate(my_meter, - Value, + value, *args): Putting it all together you get this design pattern - my_meter = SG.ProgressMeter('Meter Title', 100000, Orientation='Vert') + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') for i in range(0, 100000): SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') @@ -720,17 +720,17 @@ The final way of using a Progress Meter with PySimpleGUI is to build a custom fo #### Output The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - Output(Scale=(None, None), - Size=(None, None)) + Output(scale=(None, None), + size=(None, None)) Here's a complete solution for a chat-window using an Async form with an Output Element import PySimpleGUI as g - with g.FlexForm('Chat Window', AutoSizeText=True, DefaultElementSize=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', Size=[40,1])) - form.AddRow(g.Output(Size=(80, 20))) - form.AddRow(g.Multiline(Size=(70, 5), EnterSubmits=True), g.ReadFormButton('SEND', ButtonColor=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', ButtonColor=(g.YELLOWS[0], g.GREENS[0]))) + with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) + form.AddRow(g.Output(size=(80, 20))) + form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) # ---===--- Loop taking in user input and printing it --- # while True: @@ -773,9 +773,11 @@ While not an "issue" this is a *stern warning* A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. ## Versioning - -1.0.9 - July 10, 2018 - Initial Release -1.0.21 - July 13, 2018 - Readme updates +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case ## Code Condition From 7668681af32a0ac03eb6ba677ce21ed7f47a448f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 16 Jul 2018 16:10:28 -0400 Subject: [PATCH 031/521] Update readme.md --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 2926d40da..848228613 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,8 @@ # PySimpleGUI +[note - if you are using version 1.x, you'll need to change all of your options variables in the SDK calls so that they are lower case. Sorry for this change, but this change was required] + This really is a simple GUI, but also powerfully customizable. ![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) From ed79ffca939711c0ae5abd553cffe837ea0dfa68 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 16 Jul 2018 18:36:17 -0400 Subject: [PATCH 032/521] Fixed Font variable, new Quit lazy function Forgot a couple of variables named Font that should be font. Added a new Lazy function Quit() which adds a SimpleButton with text 'Quit'. --- PySimpleGUI.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index aaf030a01..17e039e41 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -777,6 +777,10 @@ def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_text=N def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +# ------------------------- QUIT BUTTON Element lazy function ------------------------- # +def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) + # ------------------------- YES BUTTON Element lazy function ------------------------- # def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) @@ -792,8 +796,8 @@ def SimpleButton(button_text, scale=(None, None), size=(None, None), auto_size_t # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, Font=None): - return Button(READ_FORM, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=Font) +def ReadFormButton(button_text, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + return Button(READ_FORM, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -1302,17 +1306,17 @@ def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_durati # ============================== MsgBoxError =====# # Like MsgBox but presents RED BUTTONS # # ===================================================# -def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, Font=None): +def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, font=None): ''' Display a MsgBox with a red button :param args: :param button_color: :param auto_close: :param auto_close_duration: - :param Font: + :param font: :return: ''' - MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=Font) + MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return # ============================== MsgBoxCancel =====# From d6c80477702e134e209e0abeb9a465e1e08999ab Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 16 Jul 2018 19:22:03 -0400 Subject: [PATCH 033/521] Readme updates --- readme.md | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/readme.md b/readme.md index 848228613..70ab9875c 100644 --- a/readme.md +++ b/readme.md @@ -1,11 +1,13 @@ # PySimpleGUI -[note - if you are using version 1.x, you'll need to change all of your options variables in the SDK calls so that they are lower case. Sorry for this change, but this change was required] - This really is a simple GUI, but also powerfully customizable. -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + import PySimpleGUI as SG + + SG.MsgBox('My Message Box', 'This is the shortest GUI program ever!') + +![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? @@ -13,15 +15,14 @@ With a simple GUI, it becomes practical to "associate" .py files with the python Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. -The PySimpleGUI solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. +The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop. +You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop to get a graphic like this one: ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) - The customization is via the form/dialog box builder that enables users to experience all of the normal GUI widgets without having to write a lot of code. Features of PySimpleGUI include: @@ -76,7 +77,7 @@ Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) -Yes, it's just that easy to have a window appear on the screen using Python. +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. ## APIs @@ -166,11 +167,15 @@ The differences tend to be the number and types of buttons. Here are the calls ![msgbox autoclose](https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg) - SG.ScrolledTextBox(my_text, Height=10) + SG.ScrolledTextBox(my_text, height=10) ![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. #### High Level User Input @@ -195,7 +200,7 @@ There are 3 very basic user input high-level function calls. It's expected that We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? ![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) - EasyProgressMeter(Title, + EasyProgressMeter(title, current_value, max_value, *args, @@ -218,7 +223,8 @@ That line of code resulted in this window popping up and updating. A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): break + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): + break # Custom Form API Calls @@ -243,11 +249,13 @@ You will use this design pattern or code template for all of your "normal" (bloc > Copy, Paste, Run. -PySimpleGUI's goal with the API is to be easy on the programmer. An attempt was made to make the program's code visually match the window on the screen. The way this is done is that a GUI is broken up into "Rows". Then each row is broke up into "Elements" or "Widgets". Each element is specified by names such as Text, Button, Checkbox, etc. +PySimpleGUI's goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. + +Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. -Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller simply writes `Submit`. +Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. -Going through each line of code +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: This creates a new form, storing it in the variable `form`. @@ -327,7 +335,7 @@ You can see in the MsgBox that the values returned are a list. Each input field # Building Custom Forms -You will find it much easier to write code using PySimpleGUI is you use features that show you documentation about the API call you are making. In PyCharm 2 commands are helpful. +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values @@ -344,9 +352,10 @@ NON-BLOCKING form call: The first step is to create the form object using the desired form customization. with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: -Let's go through the options available when creating a form. - def __init__(self, title, +This is the definition of the FlexForm object: + + def FlexForm(title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), @@ -764,6 +773,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify ## Fun Stuff + ## Known Issues While not an "issue" this is a *stern warning* **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads @@ -801,3 +811,5 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + From e2ee6bd9af8a77e19519b18f79bb9edc8c218066 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 17 Jul 2018 11:50:37 -0400 Subject: [PATCH 034/521] More readme changes --- readme.md | 101 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 30 deletions(-) diff --git a/readme.md b/readme.md index 70ab9875c..a1d078d24 100644 --- a/readme.md +++ b/readme.md @@ -50,7 +50,7 @@ An example of many widgets used on a single form. A little further down you'll ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - + ----- ## Getting Started with PySimpleGUI ### Installing @@ -79,6 +79,7 @@ Then use either "high level" API calls or build your own forms. Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +--- ## APIs PySimpleGUI can be broken down into 2 types of API's: @@ -123,6 +124,7 @@ If the caller wanted to change the button color to be black on yellow, the call button_color=('black', 'yellow')) ![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) +--- ### High Level API Calls @@ -214,7 +216,7 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') That line of code resulted in this window popping up and updating. @@ -226,6 +228,9 @@ With a little trickery you can provide a way to break out of your loop using the if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): break +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +--- # Custom Form API Calls This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. @@ -240,20 +245,26 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e [SG.Submit(), SG.Cancel()]] (button, (source_filename, )) = form.LayoutAndShow(form_rows) -This context manager contains all of the code needed to specify, show and retrieve results for this form: -![sha hash](https://user-images.githubusercontent.com/13696193/42603149-a56acf3a-853a-11e8-91de-771efd3a65a8.jpg) +## COPY this non-context manager design pattern TOO + + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename,)) = form.LayoutAndShow(form_rows) -It's important to use the "with" context manager. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -You will use this design pattern or code template for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. +These 2 design patters both produce this custom form: -> Copy, Paste, Run. +![sha hash](https://user-images.githubusercontent.com/13696193/42603149-a56acf3a-853a-11e8-91de-771efd3a65a8.jpg) -PySimpleGUI's goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. +The second design pattern is not context manager based. There are times when the context manager hides errors. If you are struggling with an unknown error, try modifying the code to run without a context manager. -Some elements are shortcuts, again meant to make it easy on the programmer. Rather than writing a `Button`, with name = "Submit", etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### Line by line explanation Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! @@ -271,7 +282,20 @@ Now we're on the second row of the form. On this row there are 2 elements. The The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. (button, (source_filename, )) = form.LayoutAndShow(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. + +Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. + +Some elements are shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing a `Button`, with `button_name = "Submit"`, etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. + + +--- ## Return values @@ -279,19 +303,22 @@ This is the code that **displays** the form, collects the information and return (button, (value1, value2, ...)) -Don't forget all those ()'s of your values won't be coreectly assigned. +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) + If you have a SINGLE value being returned, it is written this way: (button, (value1,)) = form.LayoutAndShow(form_rows) - Another way of parsing the return values is to store the list of values into a variable that is then referenced. + Another way of parsing the return values is to store the list of values into a variable representing the list of values. - (button, (value)) = form.LayoutAndShow(form_rows) - value1 = values[0] - value2 = values[1] + (button, (value_list)) = form.LayoutAndShow(form_rows) + value1 = value_list[0] + value2 = value_list[1] ... - +--- ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. @@ -313,9 +340,6 @@ This code utilizes as many of the elements in one form as possible. (button, (values)) = form.LayoutAndShow(layout) - - - MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. @@ -325,15 +349,13 @@ This is a somewhat complex form with quite a bit of custom sizing to make things Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. ![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) -One important aspect of this example is the return codes: (button, (values)) = form.LayoutAndShow(layout) -The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - - +--- # Building Custom Forms You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. @@ -690,24 +712,30 @@ This code produces a form where the Browse button only shows files of type .TXT layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. Keep this in mind when designing forms. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + +--- #### ProgressBar The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. -The "easiest" way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen EasyProgressMeter calls presented earlier in this readme. SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate` +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. You setup the progress meter by calling my_meter = ProgressMeter(title, max_value, *args, - orientantion=None, + d orientantion=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, @@ -725,6 +753,7 @@ Putting it all together you get this design pattern for i in range(0, 100000): SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. @@ -772,7 +801,19 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify `Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. ## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Random colors** +To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. +To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and that color's compliment. +sprint +Call `PySimpleGUI.sprint` to "print" to a scrolled Text Box. This is simply a function pointing to + +**Task Bar Icon** +Call `PySimpleGUI.SetGlobalIcon` to change the icon shown on the Windows Task Bar and on the program's Task Bar in the upper left corner. +**Button Color** +To change the button color globally call `PySimpleGUI.SetButtonColor`. Removes need to specify in every form or button call if you have a single button color for all buttons. ## Known Issues While not an "issue" this is a *stern warning* @@ -789,7 +830,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it |--|--| | 1.0.9 | July 10, 2018 - Initial Release | | 1.0.21 | July 13, 2018 - Readme updates | -| 2.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case ## Code Condition @@ -804,7 +845,7 @@ It's a recipe for success if done right. PySimpleGUI has completed the "Make it ## License -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details +This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. ## Acknowledgments From 951f3f1a6dd3a6b82661ff1c356c13a1feaa2f86 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 17 Jul 2018 13:43:58 -0400 Subject: [PATCH 035/521] New Form Function - CloseNonBlockingForm, fix for context managers Previously an exception within the "with" block was not correctly passing along exceptions. New function to help with non-blocking forms. For forms that need to be closed that haven't been closed by a button, a new function was needed. CloseNonBlockingForm is the new function. --- PySimpleGUI.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 17e039e41..d3724cd7c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -686,6 +686,10 @@ def Close(self): self.RootNeedsDestroying = True return results + def CloseNonBlockingForm(self): + self.TKroot.destroy() + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + def OnClosingCallback(self): return @@ -694,7 +698,7 @@ def __enter__(self): def __exit__(self, *a): self.__del__() - return self + return False def __del__(self): for row in self.Rows: From bd42d2410dc6a083f5a5e72f7d74839ef601971a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 17 Jul 2018 16:47:19 -0400 Subject: [PATCH 036/521] More readme updates! --- readme.md | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index a1d078d24..d666a286d 100644 --- a/readme.md +++ b/readme.md @@ -11,9 +11,11 @@ This really is a simple GUI, but also powerfully customizable. I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. +There are a number of 'easy to use' Python GUIs, but they're quite limiting. PySimpleGUI tried to take the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but was too limited for my application). `PySimpleGUI` provides similar single-call-message-box solutions as you'll see. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. -Python itself doesn't have a simple GUI solution... nor did the *many* GUI packages I tried. Most tried to do TOO MUCH, making it impossible for users to get started quickly. Others were just plain broken, requiring multiple files or other packages that were missing. +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? @@ -236,8 +238,8 @@ With a little trickery you can provide a way to break out of your loop using the This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. - -## COPY THIS DESIGN PATTERN! +# Copy these design patterns! +## Pattern 1 - With Context Manager with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], @@ -245,12 +247,12 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e [SG.Submit(), SG.Cancel()]] (button, (source_filename, )) = form.LayoutAndShow(form_rows) -## COPY this non-context manager design pattern TOO +## Pattern 2 - No Context Manager - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] (button, (source_filename,)) = form.LayoutAndShow(form_rows) @@ -792,6 +794,10 @@ Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` ## Asynchronous (Non-Blocking) Forms +While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. + + +## ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: @@ -832,20 +838,23 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 1.0.21 | July 13, 2018 - Readme updates | | 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case - ## Code Condition +## Code Condition Make it run Make it right Make it fast -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor on hiding implementation details, naming conventions, PEP 8. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. -## Authors +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. +## Authors +MikeTheWatchGuy ## License This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. +For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. ## Acknowledgments From e1ce8d591b26be97da5f3f2dc66a04ebe8ec3571 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 17 Jul 2018 22:08:11 -0400 Subject: [PATCH 037/521] password_char option. SetOptions function Added a new "password_char" option to the InputText Element . Set to "*" to hide characters entered. SetOptions function - sets global defaults. --- PySimpleGUI.py | 65 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d3724cd7c..6bf261425 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -157,12 +157,13 @@ def __del__(self): pass # ---------------------------------------------------------------------- # -# Input Class # +# Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char=''): self.DefaultText = default_text + self.PasswordCharacter = password_char super().__init__(INPUT_TEXT, scale, size, auto_size_text) return @@ -175,6 +176,7 @@ def ReturnKeyHandler(self, event): if element.BType == CLOSES_WIN or element.BType == READ_FORM: element.ButtonCallBack() return + def __del__(self): super().__del__() @@ -1011,7 +1013,7 @@ def ConvertFlexToTK(MyFlexForm): tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels - tkbutton.configure(wraplength=wraplen, font=font) # set wrap to width of widget + tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if not focus_set and btype == CLOSES_WIN: focus_set = True @@ -1023,7 +1025,8 @@ def ConvertFlexToTK(MyFlexForm): default_text = element.DefaultText element.TKStringVar = tk.StringVar() element.TKStringVar.set(default_text) - element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font) + show = element.PasswordCharacter if element.PasswordCharacter else "" + element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show) element.TKEntry.bind('', element.ReturnKeyHandler) element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) if not focus_set: @@ -1718,11 +1721,63 @@ def SetGlobalIcon(icon): pass except: raise FileNotFoundError - _my_windows.user_defined_icon = icon return True +# ============================== SetOptions =========# +# Sets the icon to be used by default # +# ===================================================# +def SetOptions(icon=None, default_button_color=(None,None), default_element_size=(None,None), default_margins=(None,None), default_element_padding=(None,None), + default_auto_size_text=None, default_font=None, default_border_width=None, default_autoclose_time=None): + global DEFAULT_ELEMENT_SIZE + global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term + global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels + global DEFAULT_AUTOSIZE_TEXT + global DEFAULT_FONT + global DEFAULT_BORDER_WIDTH + global DEFAULT_AUTOCLOSE_TIME + global DEFAULT_BUTTON_COLOR + + global _my_windows + + if icon: + try: + with open(icon, 'r') as icon_file: + pass + except: + raise FileNotFoundError + _my_windows.user_defined_icon = icon + + if default_button_color != (None,None): + DEFAULT_BUTTON_COLOR = (default_button_color[0], default_button_color[1]) + + if default_element_size != (None,None): + DEFAULT_ELEMENT_SIZE = default_element_size + + if default_margins != (None,None): + DEFAULT_MARGINS = default_margins + + if default_element_padding != (None,None): + DEFAULT_ELEMENT_PADDING = default_element_padding + + if default_auto_size_text: + DEFAULT_AUTOSIZE_TEXT = default_auto_size_text + + if default_font !=None: + DEFAULT_FONT = default_font + + if default_border_width != None: + DEFAULT_BORDER_WIDTH = default_border_width + + if default_autoclose_time != None: + DEFAULT_AUTOCLOSE_TIME = default_autoclose_time + + + + return True + + # ============================== SetButtonColor =====# # Sets the defaul button color # # ===================================================# From 7a3352946e790b6a2f500df00ae851fa4bedb493 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 17 Jul 2018 22:49:16 -0400 Subject: [PATCH 038/521] More readme changes --- readme.md | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/readme.md b/readme.md index d666a286d..4d0cecad8 100644 --- a/readme.md +++ b/readme.md @@ -77,7 +77,7 @@ To use in your code, simply import.... Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') -![simple msgbox](https://user-images.githubusercontent.com/13696193/42597824-1749b160-8528-11e8-9114-374bf9731b30.jpg) +![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. @@ -99,17 +99,18 @@ PySimpleGUI can be broken down into 2 types of API's: The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - SG.MsgBox('Variable number of parameters example', my_variable, second_variable, "etc") + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") Each new item begins on a new line in the Message Box - ![variablearguments](https://user-images.githubusercontent.com/13696193/42598375-022bc51e-852a-11e8-8f77-4d664ae1a560.jpg) + ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) + #### Optional Parameters to a Function Call -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and part of forms. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't have to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. def MsgBox(*args, button_color=None, @@ -125,7 +126,10 @@ If the caller wanted to change the button color to be black on yellow, the call SG.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) -![custombuttoncolor](https://user-images.githubusercontent.com/13696193/42599212-84f3fe2e-852c-11e8-8a60-4aad669a1fd6.jpg) + +![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) + + --- ### High Level API Calls @@ -534,13 +538,15 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. def InputText(default_text = '', scale=(None, None), size=(None, None), - auto_size_text=None) + auto_size_text=None, + password_char='') . default_text - Text initially shown in the input box scale - Amount size is scaled by size - (width, height) of element in characters auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field Shorthand functions that are equivalent to `InputText` are `Input` and `In` @@ -811,9 +817,28 @@ Here are some things to try if you're bored or want to further customize **Random colors** To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and that color's compliment. +To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and +that color's compliment. sprint -Call `PySimpleGUI.sprint` to "print" to a scrolled Text Box. This is simply a function pointing to + +**sprint** +Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. + +**Global Settings** +You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None, + default_button_color=(None,None), + default_element_size=(None,None), + default_margins=(None,None), + default_element_padding=(None,None), + default_auto_size_text=None, + default_font=None, + default_border_width=None, + default_autoclose_time=None) + +These settings apply to all forms following the call to `SetOptions`. + **Task Bar Icon** Call `PySimpleGUI.SetGlobalIcon` to change the icon shown on the Windows Task Bar and on the program's Task Bar in the upper left corner. @@ -821,7 +846,7 @@ Call `PySimpleGUI.SetGlobalIcon` to change the icon shown on the Windows Task Ba **Button Color** To change the button color globally call `PySimpleGUI.SetButtonColor`. Removes need to specify in every form or button call if you have a single button color for all buttons. -## Known Issues + ## Known Issues While not an "issue" this is a *stern warning* **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads @@ -848,7 +873,7 @@ It's a recipe for success if done right. PySimpleGUI has completed the "Make it While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. -## Authors +## Authors MikeTheWatchGuy ## License @@ -863,3 +888,4 @@ For non-commercial individual, the GNU Lesser General Public License (LGPL 3) a + From 41a35675017be2e7f6279f9610de4a7a38df1621 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 15:11:22 -0400 Subject: [PATCH 039/521] Changed default border widths, global options, color charts Added ability to get a ton of global options. Also made the defaults look a little more "flat". The super-raised look was dated. Changes made to Progress Meters optional parms. Checking in 3 color naming guides --- Color-Guide.png | Bin 0 -> 97113 bytes Color-names.png | Bin 0 -> 304696 bytes Colours.gif | Bin 0 -> 41396 bytes PySimpleGUI.py | 89 ++++++++++++++++++++++++++---------------------- 4 files changed, 49 insertions(+), 40 deletions(-) create mode 100644 Color-Guide.png create mode 100644 Color-names.png create mode 100644 Colours.gif diff --git a/Color-Guide.png b/Color-Guide.png new file mode 100644 index 0000000000000000000000000000000000000000..bd9edbe4a077c699e81b4f5ae8c9de750e54cbf5 GIT binary patch literal 97113 zcmbTec{r5s|NkwNeV1kI1`*jWYbo0pLW2s~cZOsaS+WyjFH020GAc_UTedKES;mr5 z_N>{%e|8^D6Ca}ojz0c2UJgX6_77|wc(w1_ zI5`+P*w_bn_BdQ6Iv2R6t)Y7R;nez{N6B}LpDj_WN<0lG*GS>ErziE2Vw=BWCtPz8 zF9~DxPH4+x!`vPl9WXJ|VAOxoMny_|3w7?w)qLxRn1**E@@wZv=R`V=OLJg|tE99F zblMNu@93a3}V-%OTn+!eH{Lcjf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W3QkIVegUejAR0bMDGW_@2;MgXSF2N7o|Z27~|ZmEo=TXY9e{Vk1q7Sf&wEI zX7c{$WV20iSihu1Wqpg+gf~K+Z)vZmuh<{!73q>{pu2DH9c_mN2NYm4Y%{X7b}*ku zEoVKvd^moV?uk{1NaRz50BZtdev$v}XzmvHQcu z?-*R2=>S=N64m)g@B9B}Ei-?9ijBXP7m zZbUd6IecxAyXeK6KApN)QOhrJn!S4E(XVR0GYO9yMNpYUTOr^&f1(`t$reEV8)&i? z=G|#4t^e$Y>Xutvrta9LWVRWPxz`x8^tL4lhmSO&U!kxN z2ZU66zrQ>p&)IyuRq>}HUp%Q*$M^zNJ`Lk68WS;R^neZjGo}wbIIU5gpbCC;oq}`m+p&{P{fczikI~Px-U;$@X{UfL5-_-}lXbDBl0pukworEcpM~uY6cj YYy9nh%}iEmu2$fS+1-W-2DWSe4{LzSdjJ3c literal 0 HcmV?d00001 diff --git a/Colours.gif b/Colours.gif new file mode 100644 index 0000000000000000000000000000000000000000..e730fd303a68dcfa5842ec28b8150eb970bfaf59 GIT binary patch literal 41396 zcmdpd1y3bB*X@D92X}XOcNpB=-QC?`aCdh-xVyW%ySwWE0}LGQ^L{_$uCz_F+pfKK z+B7>&Dk&|&&0~B3o(k>>0Fb;x0R9L1|26-!Mf|S=kOBbQ0DwRMAO--K1pvMQQc?h^ zT!7hsW;cLa|Nlk;0|7BHfc|g5+#=v3`@boG@85v$ZyX#a!o+XlrYh1HQpOlfCPhWo zSyujLXQ6`yVe3PQ;FkZW|KpMZxJe1b{Ezj2$d$@HkXoFP1q7?xG8yIZme3QEc$b*sw4DlA&it2|#X6Hc%bF_%$o-#` z|FP!w=jI;t=N=s79()(7FqG2LR#sNlZk*MAGu7YSHH_>v9Go?gl6Hju>{4IuNl55z zx9xWW^yfuC3%8|%et7u)eg+!7 z>@~l|Lwzn+kl?(Ee`lLmHf7D`Tni+9Sis_ z^!Y9Ye76mL_q%-$Onc)lfJX0)s}YH_=cu9Dz(GlPlF&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jkL4Lg~4gOjtT+SF;!P)=2{=u~ha)apO5aJ$HGDzLD;CIYiS3cs`<=4&@MD=+GtVtv>FM4;PUU8_^LT5fUR&5+{)o VE71}!5fd{}6E~3)H6kDY06Rea6Da@y literal 0 HcmV?d00001 diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 6bf261425..99252d115 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -9,7 +9,6 @@ import sys import textwrap - # ----====----====----==== Constants the use CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = '' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS @@ -18,7 +17,7 @@ DEFAULT_AUTOSIZE_TEXT = False DEFAULT_FONT = ("Helvetica", 10) -DEFAULT_BORDER_WIDTH = 6 +DEFAULT_BORDER_WIDTH = 4 DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 #################### COLOR STUFF #################### @@ -42,8 +41,8 @@ # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[1], BLUES[1]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[0], BLUES[0]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (PURPLES[1],PURPLES[0]) # a nice purple progress bar -DEFAULT_PROGRESS_BAR_SIZE = (30,25) # Size of Progress Bar (characters for length, pixels for width) -DEFAULT_PROGRESS_BAR_BORDER_WIDTH=8 +DEFAULT_PROGRESS_BAR_SIZE = (35,25) # Size of Progress Bar (characters for length, pixels for width) +DEFAULT_PROGRESS_BAR_BORDER_WIDTH=2 DEFAULT_PROGRESS_BAR_RELIEF = tk.SUNKEN DEFAULT_PROGRESS_BAR_STYLE = 'default' DEFAULT_METER_ORIENTATION = 'Horizontal' @@ -495,7 +494,7 @@ def __del__(self): # ProgreessBar # # ---------------------------------------------------------------------- # class ProgressBar(Element): - def __init__(self, max_value, orientation=None, target=(None, None), scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, broder_width=None, relief=None): + def __init__(self, max_value, orientation=None, target=(None, None), scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None): self.MaxValue = max_value self.TKProgressBar = None self.Cancelled = False @@ -504,7 +503,7 @@ def __init__(self, max_value, orientation=None, target=(None, None), scale=(None self.BarColor = bar_color self.BarStyle = style if style else DEFAULT_PROGRESS_BAR_STYLE self.Target = target - self.BorderWidth = broder_width if broder_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH + self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False super().__init__(PROGRESS_BAR, scale, size, auto_size_text) @@ -565,12 +564,11 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), size=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): self.AutoSizeText = auto_size_text self.Title = title self.Rows = [] # a list of ELEMENTS for this row self.DefaultElementSize = default_element_size - self.Size = size self.Scale = scale self.Location = location self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR @@ -1123,7 +1121,6 @@ def ConvertFlexToTK(MyFlexForm): screen_width = master.winfo_screenwidth() # get window info to move to middle of screen screen_height = master.winfo_screenheight() if MyFlexForm.Location != (None, None): - loc = MyFlexForm.Location x,y = MyFlexForm.Location else: master.update_idletasks() # don't forget @@ -1236,7 +1233,7 @@ def _GetNumLinesNeeded(text, max_line_width): # Exits via an OK button2 press # # Returns nothing # # ===================================================# -def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, icon=DEFAULT_WINDOW_ICON, line_width=MESSAGE_BOX_LINE_WIDTH, font=None): +def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None): ''' Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: @@ -1253,6 +1250,10 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a args_to_print = [''] else: args_to_print = args + if line_width != None: + local_line_width = line_width + else: + local_line_width = MESSAGE_BOX_LINE_WIDTH with FlexForm(args_to_print[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font) as form: max_line_total, total_lines = 0,0 for message in args_to_print: @@ -1262,10 +1263,10 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a if message.count('\n'): message_wrapped = message else: - message_wrapped = textwrap.fill(message, line_width) + message_wrapped = textwrap.fill(message, local_line_width) message_wrapped_lines = message_wrapped.count('\n')+1 longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, line_width) + width_used = min(longest_line_len, local_line_width) max_line_total = max(max_line_total, width_used) # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines @@ -1412,13 +1413,13 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def ProgressMeter(title, max_value, *args, Orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +def ProgressMeter(title, max_value, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): ''' Create and show a form on tbe caller's behalf. :param title: :param max_value: :param args: ANY number of arguments the caller wants to display - :param Orientation: + :param orientation: :param bar_color: :param size: :param scale: @@ -1426,13 +1427,14 @@ def ProgressMeter(title, max_value, *args, Orientation=None, bar_color=DEFAULT_P :param StyleOffset: :return: ProgressBar object that is in the form ''' - orientation = DEFAULT_METER_ORIENTATION if Orientation is None else Orientation - target = (0,0) if orientation[0].lower() == 'h' else (0,1) - bar2 = ProgressBar(max_value, orientation=orientation, size=size, bar_color=bar_color, scale=scale, target=target, broder_width=border_width) + local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation + local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width + target = (0,0) if local_orientation[0].lower() == 'h' else (0,1) + bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, target=target, border_width=local_border_width) form = FlexForm(title, auto_size_text=True) # Form using a horizontal bar - if orientation[0].lower() == 'h': + if local_orientation[0].lower() == 'h': single_line_message, width, height = ConvertArgsToSingleString(*args) bar2.TextToDisplay = single_line_message bar2.MaxValue = max_value @@ -1445,7 +1447,7 @@ def ProgressMeter(title, max_value, *args, Orientation=None, bar_color=DEFAULT_P bar2.TextToDisplay = single_line_message bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(bar2, Text(single_line_message, size=(width + 20, height + 3), auto_size_text=True)) + form.AddRow(bar2, Text(single_line_message, size=(width +20, height + 3), auto_size_text=True)) form.AddRow((Cancel(button_color=button_color))) form.NonBlocking = True @@ -1526,7 +1528,7 @@ def ComputeProgressStats(self): # ============================== EasyProgressMeter =====# -def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): +def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): ''' A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call before your loop. You've got enough code to write! @@ -1542,6 +1544,7 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, :param StyleOffset: :return: False if should stop the meter ''' + local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if not border_width else border_width # STATIC VARIABLE! # This is a very clever form of static variable using a function attribute # If the variable doesn't yet exist, then it will create it and initialize with the 3rd parameter @@ -1554,7 +1557,7 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() message = "\n".join([line for line in EasyProgressMeter.EasyProgressMeterData.StatMessages]) - EasyProgressMeter.EasyProgressMeterData.MeterID = ProgressMeter(title, int(max_value), message, *args, Orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=border_width) + EasyProgressMeter.EasyProgressMeterData.MeterID = ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) EasyProgressMeter.EasyProgressMeterData.ParentForm = EasyProgressMeter.EasyProgressMeterData.MeterID.ParentForm return True # if exactly the same values as before, then ignore. @@ -1728,8 +1731,9 @@ def SetGlobalIcon(icon): # ============================== SetOptions =========# # Sets the icon to be used by default # # ===================================================# -def SetOptions(icon=None, default_button_color=(None,None), default_element_size=(None,None), default_margins=(None,None), default_element_padding=(None,None), - default_auto_size_text=None, default_font=None, default_border_width=None, default_autoclose_time=None): +def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), margins=(None,None), element_padding=(None,None), + auto_size_text=None, font=None, border_width=None, autoclose_time=None, message_box_line_width=None, + progress_meter_border_depth=None): global DEFAULT_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels @@ -1738,7 +1742,8 @@ def SetOptions(icon=None, default_button_color=(None,None), default_element_size global DEFAULT_BORDER_WIDTH global DEFAULT_AUTOCLOSE_TIME global DEFAULT_BUTTON_COLOR - + global MESSAGE_BOX_LINE_WIDTH + global DEFAULT_PROGRESS_BAR_BORDER_WIDTH global _my_windows if icon: @@ -1749,31 +1754,35 @@ def SetOptions(icon=None, default_button_color=(None,None), default_element_size raise FileNotFoundError _my_windows.user_defined_icon = icon - if default_button_color != (None,None): - DEFAULT_BUTTON_COLOR = (default_button_color[0], default_button_color[1]) + if button_color != (None,None): + DEFAULT_BUTTON_COLOR = (button_color[0], button_color[1]) - if default_element_size != (None,None): - DEFAULT_ELEMENT_SIZE = default_element_size + if element_size != (None,None): + DEFAULT_ELEMENT_SIZE = element_size - if default_margins != (None,None): - DEFAULT_MARGINS = default_margins + if margins != (None,None): + DEFAULT_MARGINS = margins - if default_element_padding != (None,None): - DEFAULT_ELEMENT_PADDING = default_element_padding + if element_padding != (None,None): + DEFAULT_ELEMENT_PADDING = element_padding - if default_auto_size_text: - DEFAULT_AUTOSIZE_TEXT = default_auto_size_text + if auto_size_text: + DEFAULT_AUTOSIZE_TEXT = auto_size_text - if default_font !=None: - DEFAULT_FONT = default_font + if font !=None: + DEFAULT_FONT = font - if default_border_width != None: - DEFAULT_BORDER_WIDTH = default_border_width + if border_width != None: + DEFAULT_BORDER_WIDTH = border_width - if default_autoclose_time != None: - DEFAULT_AUTOCLOSE_TIME = default_autoclose_time + if autoclose_time != None: + DEFAULT_AUTOCLOSE_TIME = autoclose_time + if message_box_line_width != None: + MESSAGE_BOX_LINE_WIDTH = message_box_line_width + if progress_meter_border_depth != None: + DEFAULT_PROGRESS_BAR_BORDER_WIDTH = progress_meter_border_depth return True From b48d9c9755641045860adcefd5f0eceee1503a1c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 15:13:11 -0400 Subject: [PATCH 040/521] More readme changes --- readme.md | 87 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/readme.md b/readme.md index 4d0cecad8..218343e0d 100644 --- a/readme.md +++ b/readme.md @@ -387,7 +387,6 @@ This is the definition of the FlexForm object: default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), - size=(None, None), location=(None, None), button_color=None,Font=None, progress_bar_color=(None,None), @@ -397,6 +396,20 @@ This is the definition of the FlexForm object: auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True is elements should size themselves according to contents + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. @@ -790,7 +803,7 @@ Here's a complete solution for a chat-window using an Async form with an Output break -#### Tabbed Forms +## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format results = ShowTabbedForm('Title for the form', @@ -799,12 +812,48 @@ Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` +## Global Settings +**Global Settings** +You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None, + button_color=(None,None), + element_size=(None,None), + margins=(None,None), + element_padding=(None,None), + auto_size_text=None, + font=None, border_width=None, + autoclose_time=None, + message_box_line_width=None, + progress_meter_border_depth=None): + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level + ## Asynchronous (Non-Blocking) Forms While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. -## - ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: `Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename @@ -824,31 +873,11 @@ sprint **sprint** Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. -**Global Settings** -You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None, - default_button_color=(None,None), - default_element_size=(None,None), - default_margins=(None,None), - default_element_padding=(None,None), - default_auto_size_text=None, - default_font=None, - default_border_width=None, - default_autoclose_time=None) - -These settings apply to all forms following the call to `SetOptions`. - - -**Task Bar Icon** -Call `PySimpleGUI.SetGlobalIcon` to change the icon shown on the Windows Task Bar and on the program's Task Bar in the upper left corner. - -**Button Color** -To change the button color globally call `PySimpleGUI.SetButtonColor`. Removes need to specify in every form or button call if you have a single button color for all buttons. +--- +## Known Issues +While not an "issue" this is a ***stern warning*** - ## Known Issues -While not an "issue" this is a *stern warning* -**Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. @@ -873,7 +902,7 @@ It's a recipe for success if done right. PySimpleGUI has completed the "Make it While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. -## Authors +## Authors MikeTheWatchGuy ## License From fe6d44a4655e79a8f3b037d07d546f796474946e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 15:26:31 -0400 Subject: [PATCH 041/521] Trying to get auto docs working --- readme.rst | 920 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 920 insertions(+) create mode 100644 readme.rst diff --git a/readme.rst b/readme.rst new file mode 100644 index 000000000..218343e0d --- /dev/null +++ b/readme.rst @@ -0,0 +1,920 @@ + +# PySimpleGUI + +This really is a simple GUI, but also powerfully customizable. + + import PySimpleGUI as SG + + SG.MsgBox('My Message Box', 'This is the shortest GUI program ever!') + +![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're quite limiting. PySimpleGUI tried to take the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but was too limited for my application). `PySimpleGUI` provides similar single-call-message-box solutions as you'll see. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? + +You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop to get a graphic like this one: + + +![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) + + + + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + + +An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. + +![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) + + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + +### Using + +To use in your code, simply import.... + `import PySimpleGUI as SG` + +Then use either "high level" API calls or build your own forms. + + SG.MsgBox('This is my first message box') +![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + + ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + SG.MsgBox('This box has a custom button color', + button_color=('black', 'yellow')) + + +![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) + + +--- + +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. + + import PySimpleGUI as SG + + `SG.MsgBoxOK('This is an OK MsgBox')` + + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) + + SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +![msgboxokcancel](https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg) + + SG.MsgBoxCancel('This is a Cancel MsgBox') +![msgboxcancel](https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg) + + SG.MsgBoxYesNo('This is a Yes No MsgBox') +![msgboxyesno](https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg) + + SG.MsgBoxError('This is an error MsgBox') +![msgbox error](https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg) + + SG.MsgBoxAutoClose('This is an autoclose MsgBox') + +![msgbox autoclose](https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg) + + SG.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. + +#### High Level User Input + +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. + - GetTextBox + - GetFileBox + - GetFolderBox + + `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` + +![gettextbox](https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg) + + submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') + +![getfilebox](https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg) + + submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') + +![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) + +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? +![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): + break + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +--- +# Custom Form API Calls + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +# Copy these design patterns! +## Pattern 1 - With Context Manager + + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename, )) = form.LayoutAndShow(form_rows) + +## Pattern 2 - No Context Manager + + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename,)) = form.LayoutAndShow(form_rows) + + +These 2 design patters both produce this custom form: + +![sha hash](https://user-images.githubusercontent.com/13696193/42603149-a56acf3a-853a-11e8-91de-771efd3a65a8.jpg) + +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + +The second design pattern is not context manager based. There are times when the context manager hides errors. If you are struggling with an unknown error, try modifying the code to run without a context manager. + +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### Line by line explanation + +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! + + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. + + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [SG.InputText(), SG.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [SG.Submit(), SG.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. + + (button, (source_filename, )) = form.LayoutAndShow(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. + +Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. + +Some elements are shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing a `Button`, with `button_name = "Submit"`, etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. + + +--- + +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) + + +If you have a SINGLE value being returned, it is written this way: + + (button, (value1,)) = form.LayoutAndShow(form_rows) + Another way of parsing the return values is to store the list of values into a variable representing the list of values. + + (button, (value_list)) = form.LayoutAndShow(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... + +--- +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], + [Text('Here is some text with font sizing', font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], + [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], + [Text('_' * 90, size=(60, 1))], + [Text('Choose Source and Destination Folders', size=(35,1))], + [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], + [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], + [Submit(), Cancel()]] + + (button, (values)) = form.LayoutAndShow(layout) + + MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) + +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) + + + (button, (values)) = form.LayoutAndShow(layout) +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the FlexForm object: + + def FlexForm(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=DEFAULT_AUTOSIZE_TEXT, + scale=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True is elements should size themselves according to contents + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Checkboxes + Radio Buttons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[SG.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None) + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + + +#### Multiline Text Element + + layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(scale=(None, None), + size=(None, None)) +. + + scale - How much to scale size of element + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[SG.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None, + password_char='') +. + + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): +. + + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display + + +#### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[SG.Spin([i for i in range(1,11)], initial_value=1), SG.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + +#### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + button_color=None, + font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +. + layout = [[SG.OK(), SG.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[SG.T('Source Folder')], + [SG.In()], + [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] + +**Custom Buttons** +If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. + +layout = [[SG.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `button_text` variable. + +**File Types** +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + +--- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + +You setup the progress meter by calling + + my_meter = ProgressMeter(title, + max_value, + *args, + d orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): +Putting it all together you get this design pattern + + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as g + + with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) + form.AddRow(g.Output(size=(80, 20))) + form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) + + # ---===--- Loop taking in user input and printing it --- # + while True: + (button, value) = form.Read() + if button == 'SEND': + print(value) + else: + print('Exiting the form now') + break + + +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label')) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` + +## Global Settings +**Global Settings** +You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None, + button_color=(None,None), + element_size=(None,None), + margins=(None,None), + element_padding=(None,None), + auto_size_text=None, + font=None, border_width=None, + autoclose_time=None, + message_box_line_width=None, + progress_meter_border_depth=None): + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level + +## Asynchronous (Non-Blocking) Forms +While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning +`Demo Recipes.py` - Three sample forms including an asynchronous form +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. + +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Random colors** +To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. +To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and +that color's compliment. +sprint + +**sprint** +Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. + +--- +## Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versioning +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +## Authors +MikeTheWatchGuy + +## License + +This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. +For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence + + + + + From 5d1f3ab71b6f22722f1c79d2d5b60e4aa6c60de7 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 15:28:52 -0400 Subject: [PATCH 042/521] Rename readme.rst to README.rst --- readme.rst => README.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename readme.rst => README.rst (100%) diff --git a/readme.rst b/README.rst similarity index 100% rename from readme.rst rename to README.rst From 1e5a86f56dc106bae86eac5cf94e0e93a95c470e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 15:35:02 -0400 Subject: [PATCH 043/521] Delete README.rst --- README.rst | 920 ----------------------------------------------------- 1 file changed, 920 deletions(-) delete mode 100644 README.rst diff --git a/README.rst b/README.rst deleted file mode 100644 index 218343e0d..000000000 --- a/README.rst +++ /dev/null @@ -1,920 +0,0 @@ - -# PySimpleGUI - -This really is a simple GUI, but also powerfully customizable. - - import PySimpleGUI as SG - - SG.MsgBox('My Message Box', 'This is the shortest GUI program ever!') - -![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) - -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're quite limiting. PySimpleGUI tried to take the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but was too limited for my application). `PySimpleGUI` provides similar single-call-message-box solutions as you'll see. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop to get a graphic like this one: - - -![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) - - - - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - - -An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. - -![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - -### Using - -To use in your code, simply import.... - `import PySimpleGUI as SG` - -Then use either "high level" API calls or build your own forms. - - SG.MsgBox('This is my first message box') -![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - - -### Python Language Features - - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call - * Optional parameters to a function call - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - - ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) - - -![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) - - ---- - -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - - import PySimpleGUI as SG - - `SG.MsgBoxOK('This is an OK MsgBox')` - - ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) - - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -![msgboxokcancel](https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg) - - SG.MsgBoxCancel('This is a Cancel MsgBox') -![msgboxcancel](https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg) - - SG.MsgBoxYesNo('This is a Yes No MsgBox') -![msgboxyesno](https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg) - - SG.MsgBoxError('This is an error MsgBox') -![msgbox error](https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg) - - SG.MsgBoxAutoClose('This is an autoclose MsgBox') - -![msgbox autoclose](https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg) - - SG.ScrolledTextBox(my_text, height=10) - -![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) - -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled window. - -#### High Level User Input - -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox - - `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` - -![gettextbox](https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg) - - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') - -![getfilebox](https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg) - - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') - -![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) - -#### Progress Meter! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? -![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - ---- -# Custom Form API Calls - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# Copy these design patterns! -## Pattern 1 - With Context Manager - - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] - (button, (source_filename, )) = form.LayoutAndShow(form_rows) - -## Pattern 2 - No Context Manager - - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] - (button, (source_filename,)) = form.LayoutAndShow(form_rows) - - -These 2 design patters both produce this custom form: - -![sha hash](https://user-images.githubusercontent.com/13696193/42603149-a56acf3a-853a-11e8-91de-771efd3a65a8.jpg) - -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. - -The second design pattern is not context manager based. There are times when the context manager hides errors. If you are struggling with an unknown error, try modifying the code to run without a context manager. - -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [SG.InputText(), SG.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [SG.Submit(), SG.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - (button, (source_filename, )) = form.LayoutAndShow(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. - -Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. - -Some elements are shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing a `Button`, with `button_name = "Submit"`, etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. - - ---- - -## Return values - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) - - -If you have a SINGLE value being returned, it is written this way: - - (button, (value1,)) = form.LayoutAndShow(form_rows) - Another way of parsing the return values is to store the list of values into a variable representing the list of values. - - (button, (value_list)) = form.LayoutAndShow(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... - ---- -## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], - [Text('Here is some text with font sizing', font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], - [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], - [Text('_' * 90, size=(60, 1))], - [Text('Choose Source and Destination Folders', size=(35,1))], - [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], - [Submit(), Cancel()]] - - (button, (values)) = form.LayoutAndShow(layout) - - MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - -![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) - - - (button, (values)) = form.LayoutAndShow(layout) -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=DEFAULT_AUTOSIZE_TEXT, - scale=(None, None), - location=(None, None), - button_color=None,Font=None, - progress_bar_color=(None,None), - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True is elements should size themselves according to contents - scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[SG.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None) - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -**auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. - -**Shorthand functions** -The shorthand functions for `Text` are `Txt` and `T` - - -#### Multiline Text Element - - layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - - Output(scale=(None, None), - size=(None, None)) -. - - scale - How much to scale size of element - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[SG.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(default_text = '', - scale=(None, None), - size=(None, None), - auto_size_text=None, - password_char='') -. - - default_text - Text initially shown in the input box - scale - Amount size is scaled by - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(values, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - values - Choices to be displayed. List of strings - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -#### Radio Button Element -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second radio!', "RADIO1")]] - -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - - Radio(text, - group_id, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - scale - Amount to scale size of element - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] - -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - - - Checkbox(text, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None): -. - - text - Text to display next to checkbox - default- Bool. Initial state - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display - - -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[SG.Spin([i for i in range(1,11)], initial_value=1), SG.Text('Volume level')]] - -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - - Spin(values, - intiial_value=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - List of valid values - initial_value - String with initial value - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - -#### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse -* Close Form -* Read Form - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. - -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - button_color=None, - font=None) - -Pre-made buttons include: - - OK - Ok - Submit - Cancel - Yes - No - FileBrowse - FolderBrowse -. - layout = [[SG.OK(), SG.Cancel()]] - -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) - -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. - -Let's examine this form as an example: - -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) -The code for the entire form could be: - - layout = [[SG.T('Source Folder')], - [SG.In()], - [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] - -**Custom Buttons** -If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. - -layout = [[SG.SimpleButton('My Button')]] - -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) - -All buttons can have their text changed by changing the `button_text` variable. - -**File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - ---- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. - - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for `EasyProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - d orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as g - - with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) - form.AddRow(g.Output(size=(80, 20))) - form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) - - # ---===--- Loop taking in user input and printing it --- # - while True: - (button, value) = form.Read() - if button == 'SEND': - print(value) - else: - print('Exiting the form now') - break - - -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label')) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` - -## Global Settings -**Global Settings** -You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None, - button_color=(None,None), - element_size=(None,None), - margins=(None,None), - element_padding=(None,None), - auto_size_text=None, - font=None, border_width=None, - autoclose_time=None, - message_box_line_width=None, - progress_meter_border_depth=None): - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level - -## Asynchronous (Non-Blocking) Forms -While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. - - -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning -`Demo Recipes.py` - Three sample forms including an asynchronous form -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. - -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Random colors** -To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and -that color's compliment. -sprint - -**sprint** -Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. - ---- -## Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versioning -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -## Authors -MikeTheWatchGuy - -## License - -This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. -For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence - - - - - From 4f67953d6d562134640979fc4ce3aef030397305 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 16:51:29 -0400 Subject: [PATCH 044/521] RELEASE 2.1.1 --- Demo Recipes.py | 175 +++++++-- readme.md | 3 +- readme.rst | 920 ------------------------------------------------ 3 files changed, 143 insertions(+), 955 deletions(-) delete mode 100644 readme.rst diff --git a/Demo Recipes.py b/Demo Recipes.py index 170eea731..b5877fcbd 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -1,61 +1,168 @@ -import PySimpleGUI as g +import time +import PySimpleGUI as SG + def SourceDestFolders(): - with g.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: - form_rows = [[g.Text('Enter the Source and Destination folders')], - [g.Text('Choose Source and Destination Folders')], - [g.Text('Source Folder', size=(15, 1), auto_size_text=False), g.InputText('Source'), - g.FolderBrowse()], - [g.Text('Destination Folder', size=(15, 1), auto_size_text=False), g.InputText('Dest'), - g.FolderBrowse()], - [g.Submit(), g.Cancel()]] + with SG.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: + form_rows = [[SG.Text('Enter the Source and Destination folders')], + [SG.Text('Choose Source and Destination Folders')], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], + [SG.Submit(), SG.Cancel()]] (button, (source, dest)) = form.LayoutAndShow(form_rows) if button == 'Submit': # do something useful with the inputs - g.MsgBox('Submitted', 'The user entered source folder', source, 'And destination folder', dest) + SG.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest) else: - g.MsgBoxError('Cancelled', 'User Cancelled') + SG.MsgBoxError('Cancelled', 'User Cancelled') + +def Everything_NoContextManager(): + form = SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) + layout = [[SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2, 10))], + [SG.InputCombo(['choice 1', 'choice 2'], size=(20, 3))], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], + [SG.SimpleButton('Your very own button', button_color=('white', 'green'))], + [SG.Submit(), SG.Cancel()]] + + (button, (values)) = form.LayoutAndShow(layout) + + SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + def Everything(): - with g.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40,1)) as form: - layout = [[g.Text('All graphic widgets in one form!', size=(30,1), font=("Helvetica", 25), text_color='blue')], - [g.Text('Here is some text.... and a place to enter text')], - [g.InputText()], - [g.Checkbox('My first checkbox!'), g.Checkbox('My second checkbox!', default=True)], - [g.Radio('My first Radio!', "RADIO1", default=True), g.Radio('My second Radio!', "RADIO1")], - [g.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2,10))], - [g.InputCombo(['choice 1', 'choice 2'], size=(20,3))], - [g.Text('_' * 100, size=(70,1))], - [g.Text('Choose Source and Destination Folders', size=(35,1))], - [g.Text('Source Folder', size=(15,1), auto_size_text=False), g.InputText('Source'), g.FolderBrowse()], - [g.Text('Destination Folder', size=(15,1), auto_size_text=False), g.InputText('Dest'), g.FolderBrowse()], - [g.SimpleButton('Your very own button', button_color=('white', 'green'))], - [g.Submit(), g.Cancel()]] + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [[SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2, 10))], + [SG.InputCombo(['choice 1', 'choice 2'], size=(20, 3))], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], + [SG.SimpleButton('Your very own button', button_color=('white', 'green'))], + [SG.Submit(), SG.Cancel()]] (button, (values)) = form.LayoutAndShow(layout) - g.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values, auto_close=True) + SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + +def ProgressMeter(): + for i in range(1,10000): + if not SG.EasyProgressMeter('My Meter', i+1, 10000): break + -# example of an Asynchronous form +# Persistant form. Does not close when Send button is clicked. +# Normally all Simple Buttons cause forms to close def ChatBot(): - with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) - form.AddRow(g.Output(size=(80, 20))) - form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) + with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + form.AddRow(SG.Text('This is where standard out is being routed', size=[40, 1])) + form.AddRow(SG.Output(size=(80, 20))) + form.AddRow(SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) + (button, value) = form.Read() # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: - (button, value) = form.Read() if button == 'SEND': - print(value, end="") + print(value) else: break + (button, value) = form.Read() + + +def NonBlockingPeriodicUpdateForm_ContextManager(): + # Show a form that's a running counter + with SG.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = SG.Text('',size=(8,2), font=('Helvetica', 20), text_color='red') + form_rows = [[SG.Text('None blocking GUI with updates')], + [output_element], + [SG.Quit()]] + form.AddRows(form_rows) + form.Show(non_blocking=True) + + for i in range(1,500): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + rc = form.OutputFlush() + if rc is None: # if user closed the window using X + break + button, values = rc + if button == 'Quit': + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + + +def NonBlockingPeriodicUpdateForm(): + # Show a form that's a running counter + form = SG.FlexForm('Running Timer', auto_size_text=True) + output_element = SG.Text('',size=(8,2), font=('Helvetica', 20)) + form_rows = [[SG.Text('Non blocking GUI with updates')], + [output_element], + [SG.Quit()]] + form.AddRows(form_rows) + form.Show(non_blocking=True) + + for i in range(1,50000): + output_element.Update(f'{(i/100)/60:02d}:{(i/100)%60:02d}.{i%100:02d}') + rc = form.OutputFlush() + if rc is None: # if user closed the window using X + break + button, values = rc + if button == 'Quit': + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + + +def NonBlockingScrolledPrintForm(): + # Show a form that's a running counter + form = SG.FlexForm('Scrolled Print', auto_size_text=True, font=('Courier New', 12)) + output_element = SG.Output(size=(42,10)) + form_rows = [[SG.Text('Scrolled print output')], + [output_element], + [SG.Quit()]] + form.AddRows(form_rows) + form.Show(non_blocking=True) # Show a ;non-blocking form, returns immediately + + for i in range(1,50000): + print(f'{i} ', end="") # all print output will go to the scrolled text box + # must call OutputFlush on a periodic basis to keep GUI alive + rc = form.OutputFlush() + if rc is None: # if user closed the window using X + break + button, values = rc + if button == 'Quit': # if user cliced Quit button + break + else: # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + + def main(): + SG.SetOptions(border_width=4, element_padding=(4,6), font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), + progress_meter_border_depth=4) SourceDestFolders() - Everything() + ProgressMeter() ChatBot() + NonBlockingScrolledPrintForm() + NonBlockingPeriodicUpdateForm_ContextManager() + Everything_NoContextManager() + Everything() if __name__ == '__main__': main() diff --git a/readme.md b/readme.md index 218343e0d..d389d8f86 100644 --- a/readme.md +++ b/readme.md @@ -891,6 +891,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 1.0.9 | July 10, 2018 - Initial Release | | 1.0.21 | July 13, 2018 - Readme updates | | 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes ## Code Condition @@ -906,7 +907,7 @@ While the internals to PySimpleGUI are a tad sketchy, the public interfaces into MikeTheWatchGuy ## License - + This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. diff --git a/readme.rst b/readme.rst deleted file mode 100644 index 218343e0d..000000000 --- a/readme.rst +++ /dev/null @@ -1,920 +0,0 @@ - -# PySimpleGUI - -This really is a simple GUI, but also powerfully customizable. - - import PySimpleGUI as SG - - SG.MsgBox('My Message Box', 'This is the shortest GUI program ever!') - -![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) - -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're quite limiting. PySimpleGUI tried to take the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but was too limited for my application). `PySimpleGUI` provides similar single-call-message-box solutions as you'll see. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop to get a graphic like this one: - - -![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) - - - - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - - -An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. - -![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - -### Using - -To use in your code, simply import.... - `import PySimpleGUI as SG` - -Then use either "high level" API calls or build your own forms. - - SG.MsgBox('This is my first message box') -![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - - -### Python Language Features - - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call - * Optional parameters to a function call - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - - ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) - - -![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) - - ---- - -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - - import PySimpleGUI as SG - - `SG.MsgBoxOK('This is an OK MsgBox')` - - ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) - - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -![msgboxokcancel](https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg) - - SG.MsgBoxCancel('This is a Cancel MsgBox') -![msgboxcancel](https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg) - - SG.MsgBoxYesNo('This is a Yes No MsgBox') -![msgboxyesno](https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg) - - SG.MsgBoxError('This is an error MsgBox') -![msgbox error](https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg) - - SG.MsgBoxAutoClose('This is an autoclose MsgBox') - -![msgbox autoclose](https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg) - - SG.ScrolledTextBox(my_text, height=10) - -![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) - -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled window. - -#### High Level User Input - -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox - - `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` - -![gettextbox](https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg) - - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') - -![getfilebox](https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg) - - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') - -![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) - -#### Progress Meter! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? -![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - ---- -# Custom Form API Calls - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# Copy these design patterns! -## Pattern 1 - With Context Manager - - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] - (button, (source_filename, )) = form.LayoutAndShow(form_rows) - -## Pattern 2 - No Context Manager - - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] - (button, (source_filename,)) = form.LayoutAndShow(form_rows) - - -These 2 design patters both produce this custom form: - -![sha hash](https://user-images.githubusercontent.com/13696193/42603149-a56acf3a-853a-11e8-91de-771efd3a65a8.jpg) - -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. - -The second design pattern is not context manager based. There are times when the context manager hides errors. If you are struggling with an unknown error, try modifying the code to run without a context manager. - -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [SG.InputText(), SG.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [SG.Submit(), SG.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - (button, (source_filename, )) = form.LayoutAndShow(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. - -Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. - -Some elements are shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing a `Button`, with `button_name = "Submit"`, etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. - - ---- - -## Return values - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) - - -If you have a SINGLE value being returned, it is written this way: - - (button, (value1,)) = form.LayoutAndShow(form_rows) - Another way of parsing the return values is to store the list of values into a variable representing the list of values. - - (button, (value_list)) = form.LayoutAndShow(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... - ---- -## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], - [Text('Here is some text with font sizing', font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], - [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], - [Text('_' * 90, size=(60, 1))], - [Text('Choose Source and Destination Folders', size=(35,1))], - [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], - [Submit(), Cancel()]] - - (button, (values)) = form.LayoutAndShow(layout) - - MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - -![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) - -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) - - - (button, (values)) = form.LayoutAndShow(layout) -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=DEFAULT_AUTOSIZE_TEXT, - scale=(None, None), - location=(None, None), - button_color=None,Font=None, - progress_bar_color=(None,None), - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True is elements should size themselves according to contents - scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Checkboxes - Radio Buttons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[SG.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None) - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -**auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. - -**Shorthand functions** -The shorthand functions for `Text` are `Txt` and `T` - - -#### Multiline Text Element - - layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - - Output(scale=(None, None), - size=(None, None)) -. - - scale - How much to scale size of element - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[SG.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(default_text = '', - scale=(None, None), - size=(None, None), - auto_size_text=None, - password_char='') -. - - default_text - Text initially shown in the input box - scale - Amount size is scaled by - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(values, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - values - Choices to be displayed. List of strings - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -#### Radio Button Element -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second radio!', "RADIO1")]] - -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - - Radio(text, - group_id, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - scale - Amount to scale size of element - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] - -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - - - Checkbox(text, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None): -. - - text - Text to display next to checkbox - default- Bool. Initial state - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display - - -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[SG.Spin([i for i in range(1,11)], initial_value=1), SG.Text('Volume level')]] - -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - - Spin(values, - intiial_value=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - List of valid values - initial_value - String with initial value - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - -#### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse -* Close Form -* Read Form - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. - -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - button_color=None, - font=None) - -Pre-made buttons include: - - OK - Ok - Submit - Cancel - Yes - No - FileBrowse - FolderBrowse -. - layout = [[SG.OK(), SG.Cancel()]] - -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) - -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. - -Let's examine this form as an example: - -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) -The code for the entire form could be: - - layout = [[SG.T('Source Folder')], - [SG.In()], - [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] - -**Custom Buttons** -If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. - -layout = [[SG.SimpleButton('My Button')]] - -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) - -All buttons can have their text changed by changing the `button_text` variable. - -**File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - ---- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. - - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for `EasyProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - d orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as g - - with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) - form.AddRow(g.Output(size=(80, 20))) - form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) - - # ---===--- Loop taking in user input and printing it --- # - while True: - (button, value) = form.Read() - if button == 'SEND': - print(value) - else: - print('Exiting the form now') - break - - -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label')) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` - -## Global Settings -**Global Settings** -You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None, - button_color=(None,None), - element_size=(None,None), - margins=(None,None), - element_padding=(None,None), - auto_size_text=None, - font=None, border_width=None, - autoclose_time=None, - message_box_line_width=None, - progress_meter_border_depth=None): - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level - -## Asynchronous (Non-Blocking) Forms -While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. - - -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning -`Demo Recipes.py` - Three sample forms including an asynchronous form -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. - -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Random colors** -To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and -that color's compliment. -sprint - -**sprint** -Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. - ---- -## Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versioning -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -## Authors -MikeTheWatchGuy - -## License - -This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. -For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence - - - - - From 8a2456ce20ba52b531c5fa77ea3e7f4b804fe225 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 18:02:27 -0400 Subject: [PATCH 045/521] Demo updated --- Demo GoodColors.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Demo GoodColors.py diff --git a/Demo GoodColors.py b/Demo GoodColors.py new file mode 100644 index 000000000..7d0402f8d --- /dev/null +++ b/Demo GoodColors.py @@ -0,0 +1,50 @@ +import PySimpleGUI as gg +import time + +def main(): + # ------- Make a new FlexForm ------- # + form = gg.FlexForm('GoodColors', auto_size_text=True, default_element_size=(30,2)) + form.AddRow(gg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) + form.AddRow(gg.Text('Here come the good colors as defined by PySimpleGUI')) + + #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# + text_color = gg.YELLOWS[0] + buttons = (gg.SimpleButton(f'BLUES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# + buttons = (gg.SimpleButton(f'PURPLES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# + buttons = (gg.SimpleButton(f'GREENS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# + text_color = gg.GREENS[0] # let's use GREEN text on the tan + buttons = (gg.SimpleButton(f'TANS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# + text_color = 'black' # let's use black text on the tan + buttons = (gg.SimpleButton(f'YELLOWS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + + #===== Add a click me button for fun and SHOW the form ===== ===== ===== ===== ===== ===== =====# + form.AddRow(gg.SimpleButton('Click ME!')) + (button, value) = form.Show() # show it! + + +if __name__ == '__main__': + main() From fb2fe90d373e13cac061b46e47ea2465a23016c2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 18 Jul 2018 21:32:28 -0400 Subject: [PATCH 046/521] Command line change Changed how the script is launched. No longer using hard coded paths. Also uses the pip installed version. --- Demo HowDoI.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Demo HowDoI.py b/Demo HowDoI.py index 3565b1a67..26858ed3f 100644 --- a/Demo HowDoI.py +++ b/Demo HowDoI.py @@ -1,8 +1,10 @@ import PySimpleGUI as SG import subprocess +import howdoi + +# Test this command in a dos window if you are having trouble. +HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' -# CHANGE THIS LINE OF CODE! Point it to the howdoi.py file that is in the howdoi code you download from github -HOW_DO_I_COMMAND = 'python C:\\Python\\PycharmProjects\\GitHub\\howdoi\\howdoi\\howdoi.py' # if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' @@ -18,7 +20,7 @@ def HowDoI(): form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) form.AddRow(SG.Output(size=(90, 20))) - form.AddRow(SG.Multiline(size=(90, 5), enter_submits=True), + form.AddRow(SG.Multiline(size=(85, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) From f331661a3a38bf82a7cb46e513839e98a86b9382 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 20 Jul 2018 20:07:04 -0400 Subject: [PATCH 047/521] LOTS of changes and new additions Text justification for Text Elems NEW Image Element OutputFlush renamed to Refresh More shorthand functions - Combo, Dropdown, Drop, EasyPrint - output of stdout, stderr to a window --- Demo Recipes.py | 99 +++++++++--------- PySimpleGUI.py | 261 ++++++++++++++++++++++++++++++++++-------------- readme.md | 135 ++++++++++++++++++++----- 3 files changed, 350 insertions(+), 145 deletions(-) diff --git a/Demo Recipes.py b/Demo Recipes.py index b5877fcbd..f9e957e7d 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -1,19 +1,21 @@ import time +from random import randint +import random +import string import PySimpleGUI as SG def SourceDestFolders(): with SG.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: form_rows = [[SG.Text('Enter the Source and Destination folders')], - [SG.Text('Choose Source and Destination Folders')], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source')], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), SG.FolderBrowse()], [SG.Submit(), SG.Cancel()]] - (button, (source, dest)) = form.LayoutAndShow(form_rows) + button, (source, dest) = form.LayoutAndShow(form_rows) if button == 'Submit': # do something useful with the inputs - SG.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest) + SG.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) else: SG.MsgBoxError('Cancelled', 'User Cancelled') @@ -33,9 +35,9 @@ def Everything_NoContextManager(): [SG.SimpleButton('Your very own button', button_color=('white', 'green'))], [SG.Submit(), SG.Cancel()]] - (button, (values)) = form.LayoutAndShow(layout) + button, (values) = form.LayoutAndShow(layout) - SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + SG.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) def Everything(): @@ -45,16 +47,18 @@ def Everything(): [SG.InputText()], [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], [SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Spin(values=(1,2,3), initial_value=1, size=(2,1)), SG.T('Spinner 1', size=(20,1)), + SG.Spin(values=(1,2,3), initial_value=1, size=(2,1)),SG.T('Spinner 2')], [SG.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2, 10))], [SG.InputCombo(['choice 1', 'choice 2'], size=(20, 3))], [SG.Text('_' * 100, size=(70, 1))], [SG.Text('Choose Source and Destination Folders', size=(35, 1))], [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], - [SG.SimpleButton('Your very own button', button_color=('white', 'green'))], + [SG.SimpleButton('Custom Button', button_color=('white', 'green'))], [SG.Submit(), SG.Cancel()]] - (button, (values)) = form.LayoutAndShow(layout) + button, (values) = form.LayoutAndShow(layout) SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) @@ -62,6 +66,26 @@ def ProgressMeter(): for i in range(1,10000): if not SG.EasyProgressMeter('My Meter', i+1, 10000): break +def RunningTimer(): + with SG.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[SG.Text('Non-blocking GUI with updates')], + [output_element], + [SG.SimpleButton('Quit')]] + + form.AddRows(form_rows) + form.Show(non_blocking=True) + for i in range(1, 100): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + rc = form.Refresh() + if rc is None or rc[0] == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + # Persistant form. Does not close when Send button is clicked. # Normally all Simple Buttons cause forms to close @@ -70,7 +94,7 @@ def ChatBot(): form.AddRow(SG.Text('This is where standard out is being routed', size=[40, 1])) form.AddRow(SG.Output(size=(80, 20))) form.AddRow(SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) - (button, value) = form.Read() + button, value = form.Read() # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: @@ -78,22 +102,22 @@ def ChatBot(): print(value) else: break - (button, value) = form.Read() + button, value = form.Read() def NonBlockingPeriodicUpdateForm_ContextManager(): # Show a form that's a running counter with SG.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = SG.Text('',size=(8,2), font=('Helvetica', 20), text_color='red') - form_rows = [[SG.Text('None blocking GUI with updates')], + output_element = SG.Text('',size=(10,2), font=('Helvetica', 20), text_color='red', justification='center') + form_rows = [[SG.Text('Non blocking GUI with updates', justification='center')], [output_element], - [SG.Quit()]] + [SG.T(' '*15), SG.Quit()]] form.AddRows(form_rows) form.Show(non_blocking=True) for i in range(1,500): output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - rc = form.OutputFlush() + rc = form.Refresh() if rc is None: # if user closed the window using X break button, values = rc @@ -117,11 +141,8 @@ def NonBlockingPeriodicUpdateForm(): for i in range(1,50000): output_element.Update(f'{(i/100)/60:02d}:{(i/100)%60:02d}.{i%100:02d}') - rc = form.OutputFlush() - if rc is None: # if user closed the window using X - break - button, values = rc - if button == 'Quit': + rc = form.Refresh() + if rc is None or rc[0] == 'Quit': # if user closed the window using X or clicked Quit button break time.sleep(.01) else: @@ -129,40 +150,24 @@ def NonBlockingPeriodicUpdateForm(): form.CloseNonBlockingForm() -def NonBlockingScrolledPrintForm(): - # Show a form that's a running counter - form = SG.FlexForm('Scrolled Print', auto_size_text=True, font=('Courier New', 12)) - output_element = SG.Output(size=(42,10)) - form_rows = [[SG.Text('Scrolled print output')], - [output_element], - [SG.Quit()]] - form.AddRows(form_rows) - form.Show(non_blocking=True) # Show a ;non-blocking form, returns immediately - - for i in range(1,50000): - print(f'{i} ', end="") # all print output will go to the scrolled text box - # must call OutputFlush on a periodic basis to keep GUI alive - rc = form.OutputFlush() - if rc is None: # if user closed the window using X - break - button, values = rc - if button == 'Quit': # if user cliced Quit button - break - else: # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() +def DebugTest(): + # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) + for i in range (1,300): + SG.Print(i, randint(1, 1000), end='', sep='-') + # SG.PrintClose() def main(): - SG.SetOptions(border_width=4, element_padding=(4,6), font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), - progress_meter_border_depth=4) + SG.SetOptions(border_width=1, element_padding=(4,6), font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), + progress_meter_border_depth=0) SourceDestFolders() + Everything() + NonBlockingPeriodicUpdateForm_ContextManager() ProgressMeter() ChatBot() - NonBlockingScrolledPrintForm() - NonBlockingPeriodicUpdateForm_ContextManager() - Everything_NoContextManager() - Everything() + DebugTest() if __name__ == '__main__': main() + exit(69) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 99252d115..bcc082fbd 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -16,9 +16,10 @@ DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels DEFAULT_AUTOSIZE_TEXT = False DEFAULT_FONT = ("Helvetica", 10) - +DEFAULT_TEXT_JUSTIFICATION = 'left' DEFAULT_BORDER_WIDTH = 4 DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form +DEFAULT_DEBUG_WINDOW_SIZE = (80,20) MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 #################### COLOR STUFF #################### BLUES = ("#082567","#0A37A3","#00345B") @@ -89,17 +90,18 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # ------------------------- Element types ------------------------- # # class ElementType(Enum): -TEXT = 1 -INPUT_TEXT = 20 -INPUT_COMBO = 21 -INPUT_RADIO = 5 -INPUT_MULTILINE = 7 -INPUT_CHECKBOX = 8 -INPUT_SPIN = 9 -BUTTON = 3 -OUTPUT = 300 -PROGRESS_BAR = 200 -BLANK = 100 +ELEM_TYPE_TEXT = 1 +ELEM_TYPE_INPUT_TEXT = 20 +ELEM_TYPE_INPUT_COMBO = 21 +ELEM_TYPE_INPUT_RADIO = 5 +ELEM_TYPE_INPUT_MULTILINE = 7 +ELEM_TYPE_INPUT_CHECKBOX = 8 +ELEM_TYPE_INPUT_SPIN = 9 +ELEM_TYPE_BUTTON = 3 +ELEM_TYPE_IMAGE = 30 +ELEM_TYPE_OUTPUT = 300 +ELEM_TYPE_PROGRESS_BAR = 200 +ELEM_TYPE_BLANK = 100 # ------------------------- MsgBox Buttons Types ------------------------- # MSG_BOX_YES_NO = 1 @@ -131,6 +133,7 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.TKIntVar = None self.TKText = None self.TKEntry = None + self.TKImage = None self.ParentForm=None self.TextInputDefault = None @@ -163,7 +166,7 @@ class InputText(Element): def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char=''): self.DefaultText = default_text self.PasswordCharacter = password_char - super().__init__(INPUT_TEXT, scale, size, auto_size_text) + super().__init__(ELEM_TYPE_INPUT_TEXT, scale, size, auto_size_text) return def ReturnKeyHandler(self, event): @@ -171,7 +174,7 @@ def ReturnKeyHandler(self, event): # search through this form and find the first button that will exit the form for row in MyForm.Rows: for element in row.Elements: - if element.Type == BUTTON: + if element.Type == ELEM_TYPE_BUTTON: if element.BType == CLOSES_WIN or element.BType == READ_FORM: element.ButtonCallBack() return @@ -187,7 +190,7 @@ class InputCombo(Element): def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None): self.Values = values self.TKComboBox = None - super().__init__(INPUT_COMBO, scale, size, auto_size_text) + super().__init__(ELEM_TYPE_INPUT_COMBO, scale, size, auto_size_text) return def __del__(self): @@ -207,7 +210,7 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None self.TKRadio = None self.GroupID = group_id self.Value = None - super().__init__(INPUT_RADIO, scale, size, auto_size_text, font) + super().__init__(ELEM_TYPE_INPUT_RADIO, scale, size, auto_size_text, font) return def __del__(self): @@ -227,7 +230,7 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.Value = None self.TKCheckbox = None - super().__init__(INPUT_CHECKBOX, scale, size, auto_size_text, font) + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale, size, auto_size_text, font) return def __del__(self): @@ -248,7 +251,7 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N self.Values = values self.DefaultValue = initial_value self.TKSpinBox = None - super().__init__(INPUT_SPIN, scale, size, auto_size_text, font=font) + super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font) return def __del__(self): @@ -265,7 +268,7 @@ class Multiline(Element): def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None): self.DefaultText = default_text self.EnterSubmits = enter_submits - super().__init__(INPUT_MULTILINE, scale, size, auto_size_text) + super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale, size, auto_size_text) return def ReturnKeyHandler(self, event): @@ -273,7 +276,7 @@ def ReturnKeyHandler(self, event): # search through this form and find the first button that will exit the form for row in MyForm.Rows: for element in row.Elements: - if element.Type == BUTTON: + if element.Type == ELEM_TYPE_BUTTON: if element.BType == CLOSES_WIN or element.BType == READ_FORM: element.ButtonCallBack() return @@ -285,12 +288,13 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None): + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): self.DisplayText = text self.TextColor = text_color if text_color else 'black' + self.Justification = justification if justification else DEFAULT_TEXT_JUSTIFICATION # self.Font = Font if Font else DEFAULT_FONT # i=1/0 - super().__init__(TEXT, scale, size, auto_size_text, font=font if font else DEFAULT_FONT) + super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, font=font if font else DEFAULT_FONT) return def Update(self, NewValue): @@ -394,11 +398,12 @@ def flush(self): def __del__(self): sys.stdout = self.previous_stdout + sys.stderr = self.previous_stderr class Output(Element): def __init__(self, scale=(None, None), size=(None, None)): self.TKOut = None - super().__init__(OUTPUT, scale, size) + super().__init__(ELEM_TYPE_OUTPUT, scale, size) def __del__(self): try: @@ -419,7 +424,7 @@ def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', self.ButtonText = button_text self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR self.UserData = None - super().__init__(BUTTON, scale, size, auto_size_text, font=font) + super().__init__(ELEM_TYPE_BUTTON, scale, size, auto_size_text, font=font) return # ------- Button Callback ------- # @@ -478,7 +483,7 @@ def ReturnKeyHandler(self, event): # search through this form and find the first button that will exit the form for row in MyForm.Rows: for element in row.Elements: - if element.Type == BUTTON: + if element.Type == ELEM_TYPE_BUTTON: if element.BType == CLOSES_WIN or element.BType == READ_FORM: element.ButtonCallBack() return @@ -506,7 +511,7 @@ def __init__(self, max_value, orientation=None, target=(None, None), scale=(None self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False - super().__init__(PROGRESS_BAR, scale, size, auto_size_text) + super().__init__(ELEM_TYPE_PROGRESS_BAR, scale, size, auto_size_text) return def UpdateBar(self, current_count): @@ -524,7 +529,7 @@ def UpdateBar(self, current_count): try: self.ParentForm.TKroot.update() except: - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + # _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 return False return True @@ -535,6 +540,20 @@ def __del__(self): pass super().__del__() +# ---------------------------------------------------------------------- # +# Image # +# ---------------------------------------------------------------------- # +class Image(Element): + def __init__(self, filename, scale=(None, None), size=(None, None), auto_size_text=None): + self.Filename = filename + super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, auto_size_text=auto_size_text) + return + + def __del__(self): + super().__del__() + + + # ------------------------------------------------------------------------- # # Row CLASS # # ------------------------------------------------------------------------- # @@ -589,6 +608,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.RootNeedsDestroying = False self.Shown = False self.ReturnValues = None + self.ResultsBuilt = False # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args, auto_size_text=None): @@ -663,31 +683,37 @@ def Read(self): self.TKroot.mainloop() if self.RootNeedsDestroying: self.TKroot.destroy() + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 return(BuildResults(self)) - def OutputFlush(self, Message=''): - if self.TKrootDestroyed: return None + def Refresh(self, Message=''): + if self.TKrootDestroyed: + return None if Message: print(Message) try: self.TKroot.update() except: self.TKrootDestroyed = True + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 return(BuildResults(self)) def Close(self): try: self.TKroot.update() except: pass - results = BuildResults(self) + if not self.NonBlocking: + results = BuildResults(self) if self.TKrootDestroyed: - return results + return None self.TKrootDestroyed = True self.RootNeedsDestroying = True - return results + return None def CloseNonBlockingForm(self): - self.TKroot.destroy() + try: + self.TKroot.destroy() + except: pass _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 def OnClosingCallback(self): @@ -735,6 +761,7 @@ def Close(self): if not self.TKrootDestroyed: self.TKrootDestroyed = True self.TKroot.destroy() + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 def __del__(self): return @@ -750,12 +777,21 @@ def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=N def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text) +# ------------------------- INPUT COMBO Element lazy functions ------------------------- # +def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None): + return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) + +def DropDown(values, scale=(None, None), size=(None, None), auto_size_text=None): + return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) + +def Drop(values, scale=(None, None), size=(None, None), auto_size_text=None): + return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) # ------------------------- TEXT Element lazy functions ------------------------- # -def Txt(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None): - return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color) +def Txt(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): + return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) -def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None): - return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color) +def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): + return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): @@ -815,28 +851,30 @@ def InitializeResults(form): for row_num,row in enumerate(form.Rows): r = [] for element in row.Elements: - if element.Type == TEXT: + if element.Type == ELEM_TYPE_TEXT: r.append(None) - elif element.Type == INPUT_TEXT: + if element.Type == ELEM_TYPE_IMAGE: + r.append(None) + elif element.Type == ELEM_TYPE_INPUT_TEXT: r.append(element.TextInputDefault) return_vals.append(None) - elif element.Type == INPUT_MULTILINE: + elif element.Type == ELEM_TYPE_INPUT_MULTILINE: r.append(element.TextInputDefault) return_vals.append(None) - elif element.Type == BUTTON: + elif element.Type == ELEM_TYPE_BUTTON: r.append(False) - elif element.Type == PROGRESS_BAR: + elif element.Type == ELEM_TYPE_PROGRESS_BAR: r.append(None) - elif element.Type == INPUT_CHECKBOX: + elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: r.append(element.InitialState) return_vals.append(element.InitialState) - elif element.Type == INPUT_RADIO: + elif element.Type == ELEM_TYPE_INPUT_RADIO: r.append(element.InitialState) return_vals.append(element.InitialState) - elif element.Type == INPUT_COMBO: + elif element.Type == ELEM_TYPE_INPUT_COMBO: r.append(element.TextInputDefault) return_vals.append(None) - elif element.Type == INPUT_SPIN: + elif element.Type == ELEM_TYPE_INPUT_SPIN: r.append(element.TextInputDefault) return_vals.append(None) results.append(r) @@ -870,39 +908,40 @@ def BuildResults(form): input_values = [] for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row.Elements): - if element.Type == INPUT_TEXT: + if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) - elif element.Type == INPUT_CHECKBOX: + elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: value=element.TKIntVar.get() results[row_num][col_num] = value input_values.append(value != 0) - elif element.Type == INPUT_RADIO: + elif element.Type == ELEM_TYPE_INPUT_RADIO: RadVar=element.TKIntVar.get() this_rowcol = EncodeRadioRowCol(row_num,col_num) value = RadVar == this_rowcol results[row_num][col_num] = value input_values.append(value) - elif element.Type == BUTTON: + elif element.Type == ELEM_TYPE_BUTTON: if results[row_num][col_num] is True: button_pressed_text = element.ButtonText results[row_num][col_num] = False - elif element.Type == INPUT_COMBO: + elif element.Type == ELEM_TYPE_INPUT_COMBO: value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) - elif element.Type == INPUT_SPIN: + elif element.Type == ELEM_TYPE_INPUT_SPIN: try: value=element.TKStringVar.get() except: value = 0 results[row_num][col_num] = value input_values.append(value) - elif element.Type == INPUT_MULTILINE: + elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) - element.TKText.delete('1.0', tk.END) + if not form.NonBlocking: + element.TKText.delete('1.0', tk.END) except: value = None results[row_num][col_num] = value @@ -964,7 +1003,7 @@ def ConvertFlexToTK(MyFlexForm): element_size = (int(element_size[0] * MyFlexForm.Scale[0]), int(element_size[1] * MyFlexForm.Scale[1])) # ------------------------- TEXT element ------------------------- # element_type = element.Type - if element_type == TEXT: + if element_type == ELEM_TYPE_TEXT: display_text = element.DisplayText # text to display if auto_size_text is False: width, height=element_size @@ -983,14 +1022,16 @@ def ConvertFlexToTK(MyFlexForm): stringvar.set(display_text) if auto_size_text: width = 0 - tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, textvariable=stringvar, width=width, height=height, justify=tk.LEFT, bd=border_depth, fg=element.TextColor) + justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT + anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE + tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth, fg=element.TextColor) # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=tk.NW, font=font, wraplen=wraplen*2 ) # set wrap to width of widget + tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget tktext_label.pack(side=tk.LEFT) # ------------------------- BUTTON element ------------------------- # - elif element_type == BUTTON: + elif element_type == ELEM_TYPE_BUTTON: element.Location = (row_num, col_num) btext = element.ButtonText btype = element.BType @@ -1019,7 +1060,7 @@ def ConvertFlexToTK(MyFlexForm): element.TKButton.focus_set() MyFlexForm.TKroot.focus_force() # ------------------------- INPUT (Single Line) element ------------------------- # - elif element_type == INPUT_TEXT: + elif element_type == ELEM_TYPE_INPUT_TEXT: default_text = element.DefaultText element.TKStringVar = tk.StringVar() element.TKStringVar.set(default_text) @@ -1031,7 +1072,7 @@ def ConvertFlexToTK(MyFlexForm): focus_set = True element.TKEntry.focus_set() # ------------------------- COMBO BOX (Drop Down) element ------------------------- # - elif element_type == INPUT_COMBO: + elif element_type == ELEM_TYPE_INPUT_COMBO: max_line_len = max([len(str(l)) for l in element.Values]) if auto_size_text is False: width=element_size[0] else: width = max_line_len @@ -1041,7 +1082,7 @@ def ConvertFlexToTK(MyFlexForm): element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) element.TKCombo.current(0) # ------------------------- INPUT MULTI LINE element ------------------------- # - elif element_type == INPUT_MULTILINE: + elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText width, height = element_size element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) @@ -1053,7 +1094,7 @@ def ConvertFlexToTK(MyFlexForm): focus_set = True element.TKText.focus_set() # ------------------------- INPUT CHECKBOX element ------------------------- # - elif element_type == INPUT_CHECKBOX: + elif element_type == ELEM_TYPE_INPUT_CHECKBOX: width = 0 if auto_size_text else element_size[0] default_value = element.InitialState element.TKIntVar = tk.IntVar() @@ -1061,7 +1102,7 @@ def ConvertFlexToTK(MyFlexForm): element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- PROGRESS BAR element ------------------------- # - elif element_type == PROGRESS_BAR: + elif element_type == ELEM_TYPE_PROGRESS_BAR: # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar width = element_size[0] fnt = tkinter.font.Font() @@ -1079,7 +1120,7 @@ def ConvertFlexToTK(MyFlexForm): s = ttk.Style() element.TKProgressBar.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT RADIO BUTTON element ------------------------- # - elif element_type == INPUT_RADIO: + elif element_type == ELEM_TYPE_INPUT_RADIO: width = 0 if auto_size_text else element_size[0] default_value = element.InitialState ID = element.GroupID @@ -1097,7 +1138,7 @@ def ConvertFlexToTK(MyFlexForm): variable=element.TKIntVar, value=value, bd=border_depth, font=font) element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT SPIN Box element ------------------------- # - elif element_type == INPUT_SPIN: + elif element_type == ELEM_TYPE_INPUT_SPIN: width, height = element_size width = 0 if auto_size_text else element_size[0] element.TKStringVar = tk.StringVar() @@ -1106,9 +1147,21 @@ def ConvertFlexToTK(MyFlexForm): element.TKSpinBox.configure(font=font) # set wrap to width of widget element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- OUTPUT element ------------------------- # - elif element_type == OUTPUT: + elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth) + element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- IMAGE Box element ------------------------- # + elif element_type == ELEM_TYPE_IMAGE: + photo = tk.PhotoImage(file=element.Filename) + if element_size == (None, None) or element_size == None or element_size == MyFlexForm.DefaultElementSize: + width, height = photo.width(), photo.height() + else: + width, height = element_size + tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) + tktext_label.image = photo + # tktext_label.configure(anchor=tk.NW, image=photo) + tktext_label.pack(side=tk.LEFT) #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets tk_row_frame.grid(row=row_num+2, sticky=tk.W, padx=DEFAULT_MARGINS[0]) @@ -1619,9 +1672,66 @@ def GetComplimentaryHex(color): comp_color = 0xFFFFFF ^ color # convert the color back to hex by prefixing a # comp_color = "#%06X" % comp_color - # return the result return comp_color + + +# ======================== EasyPrint =====# +# ===================================================# +_easy_print_data = None # global variable... I'm cheating + +class DebugWin(): + def __init__(self, size=(None, None)): + # Show a form that's a running counter + win_size = size if size !=(None, None) else DEFAULT_DEBUG_WINDOW_SIZE + self.form = FlexForm('Debug Window', auto_size_text=True, font=('Courier New', 12)) + self.output_element = Output(size=win_size) + self.form_rows = [[Text('EasyPrint Output')], + [self.output_element], + [Quit()]] + self.form.AddRows(self.form_rows) + self.form.Show(non_blocking=True) # Show a ;non-blocking form, returns immediately + return + + def Print(self, *args, end=None, sep=None): + sepchar = sep if sep is not None else ' ' + endchar = end if end is not None else '\n' + print(*args, sep=sepchar, end=endchar) + # for a in args: + # msg = str(a) + # print(msg, end="", sep=sepchar) + # print(1, 2, 3, sep='-') + # if end is None: + # print("") + self.form.Refresh() + + def Close(self): + self.form.CloseNonBlockingForm() + self.form.__del__() + +def Print(*args, size=(None,None), end=None, sep=None): + EasyPrint(*args, size=size, end=end, sep=sep) + +def PrintClose(): + EasyPrintClose() + +def eprint(*args, size=(None,None), end=None, sep=None): + EasyPrint(*args, size=size, end=end, sep=sep) + +def EasyPrint(*args, size=(None,None), end=None, sep=None): + if 'easy_print_data' not in EasyPrint.__dict__: # use a function property to save DebugWin object (static variable) + EasyPrint.easy_print_data = DebugWin(size=size) + if EasyPrint.easy_print_data is None: + EasyPrint.easy_print_data = DebugWin(size=size) + EasyPrint.easy_print_data.Print(*args, end=end, sep=sep) + +def EasyPrintClose(): + if 'easy_print_data' in EasyPrint.__dict__: + if EasyPrint.easy_print_data is not None: + EasyPrint.easy_print_data.Close() + EasyPrint.easy_print_data = None + # del EasyPrint.easy_print_data + # ======================== Scrolled Text Box =====# # ===================================================# def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, auto_close_duration=None, height=None): @@ -1733,7 +1843,7 @@ def SetGlobalIcon(icon): # ===================================================# def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), margins=(None,None), element_padding=(None,None), auto_size_text=None, font=None, border_width=None, autoclose_time=None, message_box_line_width=None, - progress_meter_border_depth=None): + progress_meter_border_depth=None, text_justification=None, debug_win_size=(None,None)): global DEFAULT_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels @@ -1744,6 +1854,8 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma global DEFAULT_BUTTON_COLOR global MESSAGE_BOX_LINE_WIDTH global DEFAULT_PROGRESS_BAR_BORDER_WIDTH + global DEFAULT_TEXT_JUSTIFICATION + global DEFAULT_DEBUG_WINDOW_SIZE global _my_windows if icon: @@ -1784,16 +1896,15 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma if progress_meter_border_depth != None: DEFAULT_PROGRESS_BAR_BORDER_WIDTH = progress_meter_border_depth - return True + if text_justification != None: + DEFAULT_TEXT_JUSTIFICATION = text_justification + if debug_win_size != (None,None): + DEFAULT_DEBUG_WINDOW_SIZE = debug_win_size + + return True -# ============================== SetButtonColor =====# -# Sets the defaul button color # -# ===================================================# -def SetButtonColor(foreground, background): - global DEFAULT_BUTTON_COLOR - DEFAULT_BUTTON_COLOR = (foreground, background) # ============================== sprint ======# diff --git a/readme.md b/readme.md index d389d8f86..d277d6db5 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ - +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) # PySimpleGUI This really is a simple GUI, but also powerfully customizable. @@ -9,23 +9,23 @@ This really is a simple GUI, but also powerfully customizable. ![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're quite limiting. PySimpleGUI tried to take the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but was too limited for my application). `PySimpleGUI` provides similar single-call-message-box solutions as you'll see. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. +Add a Progress Meter to your code with ONE LINE of code -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + EasyProgressMeter('My meter title', current_value, max value) -The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? +![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) -You can add a GUI to your command line with a single line of code. With 3 or 4 lines of code you can add a fully customized GUI. And for you Machine Learning folks out there, a **single line** progress meter call that you can drop into any loop to get a graphic like this one: +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but limited). The difference between these and PySimpleGUI is that in addition to getting those simple Message Boxes you also get the ability to make your own forms that are highly customizeable. -![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. +The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? Features of PySimpleGUI include: Text @@ -241,6 +241,12 @@ With a little trickery you can provide a way to break out of your loop using the This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. # Copy these design patterns! ## Pattern 1 - With Context Manager @@ -249,7 +255,7 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] - (button, (source_filename, )) = form.LayoutAndShow(form_rows) + button, (source_filename, ) = form.LayoutAndShow(form_rows) ## Pattern 2 - No Context Manager @@ -257,7 +263,7 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] - (button, (source_filename,)) = form.LayoutAndShow(form_rows) + button, (source_filename,) = form.LayoutAndShow(form_rows) These 2 design patters both produce this custom form: @@ -266,7 +272,7 @@ These 2 design patters both produce this custom form: It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. -The second design pattern is not context manager based. There are times when the context manager hides errors. If you are struggling with an unknown error, try modifying the code to run without a context manager. +The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. @@ -277,17 +283,17 @@ Going through each line of code in the above form will help explain how to use t with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - [SG.Submit(), SG.Cancel()]] + [SG.Submit(), SG.Cancel()]] The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - (button, (source_filename, )) = form.LayoutAndShow(form_rows) + (button, (source_filename, )) = form.LayoutAndShow(form_rows) This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field --- @@ -480,7 +486,16 @@ The most basic element is the Text element. It simply displays text. Many of t size=(None, None), auto_size_text=None, font=None, - text_color=None) + text_color=None, + justification=None) +. + + Text - The text that's displayed + size - Element's size + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color + justification - Justification for the text. String - 'left', 'right', 'center' Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. @@ -814,7 +829,7 @@ Each of the tabs of the form is in fact a form. The same steps are taken to cre ## Global Settings **Global Settings** -You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. SetOptions(icon=None, button_color=(None,None), @@ -825,7 +840,8 @@ You can set the global settings using the function `PySimpleGUI.SetOptions`. Ea font=None, border_width=None, autoclose_time=None, message_box_line_width=None, - progress_meter_border_depth=None): + progress_meter_border_depth=None, + text_justification=None): Explanation of parameters @@ -840,6 +856,7 @@ Explanation of parameters autoclose_time - time in seconds for autoclose boxes message_box_line_width - number of characers in a line of text in message boxes progress_meter_border_depth - amount of border around raised or lowered progress meters + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: @@ -851,7 +868,55 @@ These settings apply to all forms `SetOptions`. The Row options and Element opt Each lower level overrides the settings of the higher level ## Asynchronous (Non-Blocking) Forms -While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.refresh` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. +When do you use a non-blocking form? A couple of examples are +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + form = FlexForm() + form.AddRows(form_rows) + form.Show(non_blocking = True) + +Periodic refresh + + form.Refresh() +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndShow()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.Refresh()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + with SG.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[SG.Text('Non-blocking GUI with updates')], + [output_element], + [SG.SimpleButton('Quit')]] + + form.AddRows(form_rows) + form.Show(non_blocking=True) + for i in range(1, 100): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + rc = form.Refresh() + if rc is None or rc[0] == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.Refreshu()` is called. That's it... this example follows the async design pattern well. + ## Sample Applications @@ -874,12 +939,14 @@ sprint Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. --- -## Known Issues +# Known Issues While not an "issue" this is a ***stern warning*** ## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. ## Contributing @@ -892,6 +959,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 1.0.21 | July 13, 2018 - Readme updates | | 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case | 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output ## Code Condition @@ -907,7 +975,7 @@ While the internals to PySimpleGUI are a tad sketchy, the public interfaces into MikeTheWatchGuy ## License - + This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. @@ -915,7 +983,28 @@ For non-commercial individual, the GNU Lesser General Public License (LGPL 3) a * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. +![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. From 42440da04887e37b87dc0d95e85034967a493ff8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 20 Jul 2018 20:56:37 -0400 Subject: [PATCH 048/521] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index d277d6db5..2f8b6066c 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI This really is a simple GUI, but also powerfully customizable. From 8270fde1edf45001fb4bfb1589f3feca4675f248 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 10:13:26 -0400 Subject: [PATCH 049/521] Logo Logo, --- readme.md | 74 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/readme.md b/readme.md index 2f8b6066c..05d9bc22f 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,6 @@ -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +![logo01 2](https://user-images.githubusercontent.com/13696193/43081788-6b373d42-8e60-11e8-8f86-3ef0f01e54b5.png) + +](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI This really is a simple GUI, but also powerfully customizable. @@ -17,7 +19,7 @@ Add a Progress Meter to your code with ONE LINE of code I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but limited). The difference between these and PySimpleGUI is that in addition to getting those simple Message Boxes you also get the ability to make your own forms that are highly customizeable. +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but limited). The primary difference between these and PySimpleGUI is that in addition to getting those simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. @@ -40,18 +42,36 @@ The `PySimpleGUI` solution is focused on the ***developer***. How can the desir Icons Multi-line Text Input Scroll-able Output + Images Progress Bar Async/Non-Blocking Windows Tabbed forms Persistent Windows - Redirect Python Output/Errors to scrolling Window + Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. + + Be Pythonic... Python's lists in particular worked out really well: + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list + + Each Elements is specified by names such as Text, Button, Checkbox, etc. + +Some elements have shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing calling `Button`, with `button_name = "Submit"` will create a button with the text 'Submit' on it, Other examples include shortening the name of the function. `Text` is shorted to `Txt` or `T`. See each API call for the shortcuts. + ----- ## Getting Started with PySimpleGUI @@ -296,15 +316,6 @@ The last line of the `form_rows` variable assignment contains a Submit and a Can (button, (source_filename, )) = form.LayoutAndShow(form_rows) This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. - -Forms are represented as Python lists. There are 2 lists in particular. One is a list of rows that form up a GUI screen. The other is a list of Elements (or Widgets) on each row. Each Elements is specified by names such as Text, Button, Checkbox, etc. - -Some elements are shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing a `Button`, with `button_name = "Submit"`, etc, the caller can simply writes `Submit`. Some examples include: `Text` has a short-cut function named `T`. `TextInput` has `In`. See each API call for the shortcuts. --- @@ -347,7 +358,7 @@ This code utilizes as many of the elements in one form as possible. [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], + [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], [Submit(), Cancel()]] (button, (values)) = form.LayoutAndShow(layout) @@ -771,7 +782,7 @@ You setup the progress meter by calling my_meter = ProgressMeter(title, max_value, *args, - d orientantion=None, + orientantion=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, @@ -869,12 +880,21 @@ Each lower level overrides the settings of the higher level ## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.refresh` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + When do you use a non-blocking form? A couple of examples are * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `Refresh` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that Refresh always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.Refresh() + if values is None or button == 'Quit': + break + We're going to build an app that does the latter. It's going to update our form with a running clock. The basic flow and functions you will be calling are: @@ -908,22 +928,32 @@ We're going to make a form and update one of the elements of that form every .01 form.Show(non_blocking=True) for i in range(1, 100): output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - rc = form.Refresh() - if rc is None or rc[0] == 'Quit': + button, values = form.Refresh() + if values is None or button == 'Quit': break - time.sleep(.01) + time.sleep(.01) else: form.CloseNonBlockingForm() + What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.Refreshu()` is called. That's it... this example follows the async design pattern well. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.Refresh()` is called. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + +That's it... this example follows the async design pattern well. ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + `Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + `Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + `Demo Recipes.py` - Three sample forms including an asynchronous form + `Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. ## Fun Stuff @@ -945,7 +975,9 @@ While not an "issue" this is a ***stern warning*** ## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + **Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. ## Contributing @@ -960,6 +992,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case | 2.1.1 | July 18, 2018 - Global settings exposed, fixes | 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July XX, 2018 - Changed form.Read return codes, Slider Elements, Listbox element ## Code Condition @@ -971,13 +1004,15 @@ It's a recipe for success if done right. PySimpleGUI has completed the "Make it While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + ## Authors MikeTheWatchGuy ## License This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. -For non-commercial individual, the GNU Lesser General Public License (LGPL 3) applies. +For non-commercial individuals, the GNU Lesser General Public License (LGPL 3) applies. ## Acknowledgments @@ -1008,3 +1043,4 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + From f52b97772846769775c57994a1bd3260b9509667 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 10:15:45 -0400 Subject: [PATCH 050/521] Update readme.md --- readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 05d9bc22f..3c67215fe 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,5 @@ -![logo01 2](https://user-images.githubusercontent.com/13696193/43081788-6b373d42-8e60-11e8-8f86-3ef0f01e54b5.png) +![logo01 2 _1](https://user-images.githubusercontent.com/13696193/43082118-41397cde-8e61-11e8-94e2-cf386de53d88.png) + ](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI From 528a0250ad8dfb3b29a1eb106b0431d1af9d7079 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 10:17:19 -0400 Subject: [PATCH 051/521] Update readme.md --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 3c67215fe..1d465060c 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,4 @@ -![logo01 2 _1](https://user-images.githubusercontent.com/13696193/43082118-41397cde-8e61-11e8-94e2-cf386de53d88.png) - +![logo01 2 _2](https://user-images.githubusercontent.com/13696193/43082229-8b7343b6-8e61-11e8-90d4-808e1cb694ef.png) ](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI From fce4d45472743d5ced0cd1f9bbe877fd446518f4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 10:18:59 -0400 Subject: [PATCH 052/521] Update readme.md --- readme.md | 470 +++++++++++++++++++++++++++--------------------------- 1 file changed, 235 insertions(+), 235 deletions(-) diff --git a/readme.md b/readme.md index 1d465060c..4017c0258 100644 --- a/readme.md +++ b/readme.md @@ -1,12 +1,12 @@ -![logo01 2 _2](https://user-images.githubusercontent.com/13696193/43082229-8b7343b6-8e61-11e8-90d4-808e1cb694ef.png) +![logo01 2](https://user-images.githubusercontent.com/13696193/43081788-6b373d42-8e60-11e8-8f86-3ef0f01e54b5.png) -](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 -# PySimpleGUI - -This really is a simple GUI, but also powerfully customizable. - - import PySimpleGUI as SG +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +# PySimpleGUI + +This really is a simple GUI, but also powerfully customizable. + import PySimpleGUI as SG + SG.MsgBox('My Message Box', 'This is the shortest GUI program ever!') ![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) @@ -14,10 +14,10 @@ This really is a simple GUI, but also powerfully customizable. Add a Progress Meter to your code with ONE LINE of code EasyProgressMeter('My meter title', current_value, max value) - + ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but limited). The primary difference between these and PySimpleGUI is that in addition to getting those simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! @@ -28,30 +28,30 @@ GUI Packages with more functionality, like QT and WxPython, require configuring With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: File Browse Folder Browse Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window + Persistent Windows + Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) Single-Line-Of-Coide Proress Bar & Debug Print - + An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) @@ -60,41 +60,41 @@ An example of many widgets used on a single form. A little further down you'll ### Design Goals > Copy, Paste, Run. -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. Be Pythonic... Python's lists in particular worked out really well: - - Forms are represented as Python lists. + - Forms are represented as Python lists. - A form is a list of rows - A row is a list of elements - Return values are a list - Each Elements is specified by names such as Text, Button, Checkbox, etc. + Each Elements is specified by names such as Text, Button, Checkbox, etc. Some elements have shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing calling `Button`, with `button_name = "Submit"` will create a button with the text 'Submit' on it, Other examples include shortening the name of the function. `Text` is shorted to `Txt` or `T`. See each API call for the shortcuts. ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + ### Using To use in your code, simply import.... - `import PySimpleGUI as SG` + `import PySimpleGUI as SG` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) @@ -103,70 +103,70 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi --- ## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + ### Python Language Features There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call + * Variable number of arguments to a function call * Optional parameters to a function call - + #### Variable Number of Arguments The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") Each new item begins on a new line in the Message Box ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) - + #### Optional Parameters to a Function Call - + This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, line_width=MESSAGE_BOX_LINE_WIDTH, font=None): If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', + SG.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) - + ![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) --- -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) + #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. @@ -175,7 +175,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` - + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -209,7 +209,7 @@ This becomes a debug print of sorts that will route to a scrolled window. There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - - GetFileBox + - GetFileBox - GetFolderBox `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` @@ -241,7 +241,7 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! - for i in range(1,10000): + for i in range(1,10000): SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') That line of code resulted in this window popping up and updating. @@ -249,10 +249,10 @@ That line of code resulted in this window popping up and updating. ![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break + break ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -271,17 +271,17 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e # Copy these design patterns! ## Pattern 1 - With Context Manager - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] button, (source_filename, ) = form.LayoutAndShow(form_rows) ## Pattern 2 - No Context Manager - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] button, (source_filename,) = form.LayoutAndShow(form_rows) @@ -300,13 +300,13 @@ You will use these design patterns or code templates for all of your "normal" (b Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. [SG.Submit(), SG.Cancel()]] @@ -322,45 +322,45 @@ This is the code that **displays** the form, collects the information and return ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) - -If you have a SINGLE value being returned, it is written this way: - + +If you have a SINGLE value being returned, it is written this way: + (button, (value1,)) = form.LayoutAndShow(form_rows) Another way of parsing the return values is to store the list of values into a variable representing the list of values. - (button, (value_list)) = form.LayoutAndShow(form_rows) + (button, (value_list)) = form.LayoutAndShow(form_rows) value1 = value_list[0] value2 = value_list[1] ... - + --- ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], - [Text('Here is some text with font sizing', font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], - [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], - [Text('_' * 90, size=(60, 1))], - [Text('Choose Source and Destination Folders', size=(35,1))], - [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], + [Text('Here is some text with font sizing', font=("Helvetica", 15))], + [InputText()], + [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], + [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], + [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], + [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], + [Text('_' * 90, size=(60, 1))], + [Text('Choose Source and Destination Folders', size=(35,1))], + [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], + [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], + [SimpleButton('Your Button with any text you want')], [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], - [Submit(), Cancel()]] - + [Submit(), Cancel()]] + (button, (values)) = form.LayoutAndShow(layout) MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) @@ -376,13 +376,13 @@ Clicking the Submit button caused the form call to return. The call to MsgBox r (button, (values)) = form.LayoutAndShow(layout) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- # Building Custom Forms You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - Control-Q (when cursor is on function name) brings up a box with the function definition + Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values ## Synchronous Forms @@ -396,11 +396,11 @@ NON-BLOCKING form call: ### Beginning a Form The first step is to create the form object using the desired form customization. - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: This is the definition of the FlexForm object: - def FlexForm(title, + def FlexForm(title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), @@ -412,7 +412,7 @@ This is the definition of the FlexForm object: auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): - + Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. default_element_size - Size of elements in form in characters (width, height) @@ -457,22 +457,22 @@ A summary of the variables that can be changed when a FlexForm is created ## Elements "Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - Text - Single Line Input - Buttons including these types: + Text + Single Line Input + Buttons including these types: File Browse Folder Browse Non-closing return - Close form - Checkboxes - Radio Buttons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows + Close form + Checkboxes + Radio Buttons + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window + Persistent Windows + Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) @@ -484,15 +484,15 @@ Building a form is simply making lists of Elements. Each list is a row in the o The code is a crude representation of the GUI, laid out in text. #### Text Element - layout = [[SG.Text('This is what a Text Element looks like')]] - + layout = [[SG.Text('This is what a Text Element looks like')]] + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - Text(Text, + Text(Text, scale=(None, None), size=(None, None), auto_size_text=None, @@ -568,7 +568,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - + #### Text Input Element layout = [[SG.InputText('Default text')]] @@ -594,10 +594,10 @@ Shorthand functions that are equivalent to `InputText` are `Input` and `In` Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - + ![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - InputCombo(values, + InputCombo(values, scale=(None, None), size=(None, None), auto_size_text=None) @@ -635,7 +635,7 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o #### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] @@ -665,7 +665,7 @@ An up/down spinner control. The valid values are passed in as a list. ![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - Spin(values, + Spin(values, intiial_value=None, scale=(None, None), size=(None, None), @@ -679,7 +679,7 @@ An up/down spinner control. The valid values are passed in as a list. size - (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display - + #### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. @@ -691,9 +691,9 @@ The Types of buttons include: Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. @@ -706,7 +706,7 @@ While it's possible to build forms using the Button Element directly, you should auto_size_text=None, button_color=None, font=None) - + Pre-made buttons include: OK @@ -722,7 +722,7 @@ Pre-made buttons include: ![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. @@ -736,30 +736,30 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (-1,0) The code for the entire form could be: - layout = [[SG.T('Source Folder')], - [SG.In()], + layout = [[SG.T('Source Folder')], + [SG.In()], [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] **Custom Buttons** If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. - + layout = [[SG.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) -All buttons can have their text changed by changing the `button_text` variable. +All buttons can have their text changed by changing the `button_text` variable. **File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) - + This code produces a form where the Browse button only shows files of type .TXT layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. --- @@ -770,7 +770,7 @@ The **easiest** way to get progress meters into your code is to use the `EasyPro You've already seen EasyProgressMeter calls presented earlier in this readme. SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - + The return value for `EasyProgressMeter` is: `True` if meter updated correctly `False` if user clicked the Cancel button, closed the form, or vale reached the max value. @@ -779,25 +779,25 @@ If you want a bit more customization of your meter, then you can go up 1 level a You setup the progress meter by calling - my_meter = ProgressMeter(title, + my_meter = ProgressMeter(title, max_value, *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) Then to update the bar within your loop return_code = ProgressMeterUpdate(my_meter, - value, + value, *args): Putting it all together you get this design pattern - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') @@ -813,26 +813,26 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Here's a complete solution for a chat-window using an Async form with an Output Element import PySimpleGUI as g - - with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) - form.AddRow(g.Output(size=(80, 20))) - form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) - - # ---===--- Loop taking in user input and printing it --- # - while True: - (button, value) = form.Read() - if button == 'SEND': - print(value) - else: - print('Exiting the form now') + + with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) + form.AddRow(g.Output(size=(80, 20))) + form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) + + # ---===--- Loop taking in user input and printing it --- # + while True: + (button, value) = form.Read() + if button == 'SEND': + print(value) + else: + print('Exiting the form now') break - + ## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - results = ShowTabbedForm('Title for the form', + results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), (form2,layout2, 'Tab 2 label')) @@ -842,21 +842,21 @@ Each of the tabs of the form is in fact a form. The same steps are taken to cre **Global Settings** Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - SetOptions(icon=None, + SetOptions(icon=None, button_color=(None,None), - element_size=(None,None), - margins=(None,None), - element_padding=(None,None), + element_size=(None,None), + margins=(None,None), + element_padding=(None,None), auto_size_text=None, - font=None, border_width=None, - autoclose_time=None, - message_box_line_width=None, + font=None, border_width=None, + autoclose_time=None, + message_box_line_width=None, progress_meter_border_depth=None, text_justification=None): Explanation of parameters - icon - filename of icon used for taskbar and title bar + icon - filename of icon used for taskbar and title bar button_color - button color (foreground, background) element_size - element size (width, height) in characters margins - tkinter margins around outsize @@ -869,7 +869,7 @@ Explanation of parameters progress_meter_border_depth - amount of border around raised or lowered progress meters text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - + These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - Form level @@ -878,7 +878,7 @@ These settings apply to all forms `SetOptions`. The Row options and Element opt Each lower level overrides the settings of the higher level -## Asynchronous (Non-Blocking) Forms +## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.refresh` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. When do you use a non-blocking form? A couple of examples are @@ -911,30 +911,30 @@ If you need to close the form form.CloseNonBlockingForm() -Rather than the usual `form.LayoutAndShow()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.Refresh()` every now and then. +Rather than the usual `form.LayoutAndShow()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.Refresh()` every now and then. When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` **Example - Running timer that updates** We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - with SG.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) - form_rows = [[SG.Text('Non-blocking GUI with updates')], - [output_element], - [SG.SimpleButton('Quit')]] - - form.AddRows(form_rows) - form.Show(non_blocking=True) - for i in range(1, 100): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - button, values = form.Refresh() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: + with SG.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[SG.Text('Non-blocking GUI with updates')], + [output_element], + [SG.SimpleButton('Quit')]] + + form.AddRows(form_rows) + form.Show(non_blocking=True) + for i in range(1, 100): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + button, values = form.Refresh() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: form.CloseNonBlockingForm() - + What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.Refresh()` is called. @@ -954,19 +954,19 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify `Demo Recipes.py` - Three sample forms including an asynchronous form -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. ## Fun Stuff Here are some things to try if you're bored or want to further customize **Random colors** To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and +To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and that color's compliment. sprint **sprint** -Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. +Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. --- # Known Issues @@ -980,12 +980,12 @@ While not an "issue" this is a ***stern warning*** **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. -## Contributing - +## Contributing + A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versioning -|Version | Description | + +## Versioning +|Version | Description | |--|--| | 1.0.9 | July 10, 2018 - Initial Release | | 1.0.21 | July 13, 2018 - Readme updates | @@ -993,35 +993,35 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.1.1 | July 18, 2018 - Global settings exposed, fixes | 2.2.0| July 20, 2018 - Image Elements, Print output | 2.3.0 | July XX, 2018 - Changed form.Read return codes, Slider Elements, Listbox element + +## Code Condition -## Code Condition - - Make it run - Make it right + Make it run + Make it right Make it fast -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Authors + +## Authors MikeTheWatchGuy - -## License - + +## License + This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. For non-commercial individuals, the GNU Lesser General Public License (LGPL 3) applies. - -## Acknowledgments - + +## Acknowledgments + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence ## How Do I Finally, I must thank the fine folks at How Do I. https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** Here are the steps to run that application Install howdoi: @@ -1031,7 +1031,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. From f6f02b6f2b8f22ea5d1338ab4cfb6735d41a2463 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 10:21:26 -0400 Subject: [PATCH 053/521] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 4017c0258..199845992 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -![logo01 2](https://user-images.githubusercontent.com/13696193/43081788-6b373d42-8e60-11e8-8f86-3ef0f01e54b5.png) +![logo01 2 _2](https://user-images.githubusercontent.com/13696193/43082437-1252511a-8e62-11e8-9150-fc227cc56cfe.png) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI From f3bee1687e568c6726d12f31329f2a0d0fd3a4dc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 15:14:34 -0400 Subject: [PATCH 054/521] 2.3 Release Large change to ReadMe and Recipes. Some functions renamed or a new name was created, leaving legacy name in place... for now. As long as docs steer people in the direction of the new names it'll be ok --- Demo Recipes.py | 181 +++++++-------- PySimpleGUI.py | 218 +++++++++++++++--- readme.md | 600 ++++++++++++++++++++++++++++-------------------- 3 files changed, 627 insertions(+), 372 deletions(-) diff --git a/Demo Recipes.py b/Demo Recipes.py index f9e957e7d..db2168a4e 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -4,7 +4,7 @@ import string import PySimpleGUI as SG - +# A simple blocking form. Your best starter-form def SourceDestFolders(): with SG.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: form_rows = [[SG.Text('Enter the Source and Destination folders')], @@ -12,161 +12,158 @@ def SourceDestFolders(): [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), SG.FolderBrowse()], [SG.Submit(), SG.Cancel()]] - button, (source, dest) = form.LayoutAndShow(form_rows) + button, (source, dest) = form.LayoutAndRead(form_rows) if button == 'Submit': - # do something useful with the inputs SG.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) else: SG.MsgBoxError('Cancelled', 'User Cancelled') +# YOUR BEST STARTING POINT +# This is a form showing you all of the basic Elements (widgets) +# Some have a few of the optional parameters set, but there are more to choose from +# You want to use the context manager because it will free up resources when you are finished +# Use this especially if you are runningm multi-threaded +# Where you free up resources is really important to tkinter +def Everything(): + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + +# Should you decide not to use a context manager, then try this form as your starting point +# Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if +# you are running multithreaded def Everything_NoContextManager(): form = SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) layout = [[SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], [SG.Text('Here is some text.... and a place to enter text')], [SG.InputText()], [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2, 10))], - [SG.InputCombo(['choice 1', 'choice 2'], size=(20, 3))], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), SG.Slider(range=(1,100), orientation='h', size=(35,20), default_value=85)], + [SG.Listbox(values=['Listbox 1','Listbox 2', 'Listbox 3'], size=(30,6)), + SG.Slider(range=(1,100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], - [SG.SimpleButton('Your very own button', button_color=('white', 'green'))], - [SG.Submit(), SG.Cancel()]] + [SG.Text('Choose Source and Destination Folders', size=(35, 1), text_color='red')], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))]] - button, (values) = form.LayoutAndShow(layout) + button, values = form.LayoutAndRead(layout) + del(form) SG.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) - -def Everything(): - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [[SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Spin(values=(1,2,3), initial_value=1, size=(2,1)), SG.T('Spinner 1', size=(20,1)), - SG.Spin(values=(1,2,3), initial_value=1, size=(2,1)),SG.T('Spinner 2')], - [SG.Multiline(default_text='This is the default Text should you decide not to type anything', scale=(2, 10))], - [SG.InputCombo(['choice 1', 'choice 2'], size=(20, 3))], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False), SG.InputText('Dest'), SG.FolderBrowse()], - [SG.SimpleButton('Custom Button', button_color=('white', 'green'))], - [SG.Submit(), SG.Cancel()]] - - button, (values) = form.LayoutAndShow(layout) - - SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) - def ProgressMeter(): for i in range(1,10000): if not SG.EasyProgressMeter('My Meter', i+1, 10000): break + # SG.Print(i) -def RunningTimer(): - with SG.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) - form_rows = [[SG.Text('Non-blocking GUI with updates')], - [output_element], - [SG.SimpleButton('Quit')]] - - form.AddRows(form_rows) - form.Show(non_blocking=True) - for i in range(1, 100): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - rc = form.Refresh() - if rc is None or rc[0] == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - - - -# Persistant form. Does not close when Send button is clicked. -# Normally all Simple Buttons cause forms to close +# Blocking form that doesn't close def ChatBot(): with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - form.AddRow(SG.Text('This is where standard out is being routed', size=[40, 1])) - form.AddRow(SG.Output(size=(80, 20))) - form.AddRow(SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) - button, value = form.Read() - + layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], + [SG.Output(size=(80, 20))], + [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: + button, value = form.Read() if button == 'SEND': print(value) else: break - button, value = form.Read() - +# Shows a form that's a running counter +# this is the basic design pattern if you can keep your reading of the +# form within the 'with' block. If your read occurs far away in your code from the form creation +# then you will want to use the NonBlockingPeriodicUpdateForm example def NonBlockingPeriodicUpdateForm_ContextManager(): - # Show a form that's a running counter with SG.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = SG.Text('',size=(10,2), font=('Helvetica', 20), text_color='red', justification='center') - form_rows = [[SG.Text('Non blocking GUI with updates', justification='center')], - [output_element], + text_element = SG.Text('',size=(10,2), font=('Helvetica', 20), text_color='red', justification='center') + layout = [[SG.Text('Non blocking GUI with updates', justification='center')], + [text_element], [SG.T(' '*15), SG.Quit()]] - form.AddRows(form_rows) - form.Show(non_blocking=True) + form.LayoutAndRead(layout, non_blocking=True) for i in range(1,500): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - rc = form.Refresh() - if rc is None: # if user closed the window using X - break - button, values = rc - if button == 'Quit': + text_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X break time.sleep(.01) else: # if the loop finished then need to close the form for the user form.CloseNonBlockingForm() - +# Use this context-manager-free version if your read of the form occurs far away in your code +# from the form creation (call to LayoutAndRead) def NonBlockingPeriodicUpdateForm(): # Show a form that's a running counter form = SG.FlexForm('Running Timer', auto_size_text=True) - output_element = SG.Text('',size=(8,2), font=('Helvetica', 20)) + text_element = SG.Text('',size=(10,2), font=('Helvetica', 20), justification='center') form_rows = [[SG.Text('Non blocking GUI with updates')], - [output_element], - [SG.Quit()]] - form.AddRows(form_rows) - form.Show(non_blocking=True) + [text_element], + [SG.T(' ' * 15), SG.Quit()]] + form.LayoutAndRead(form_rows, non_blocking=True) for i in range(1,50000): - output_element.Update(f'{(i/100)/60:02d}:{(i/100)%60:02d}.{i%100:02d}') - rc = form.Refresh() - if rc is None or rc[0] == 'Quit': # if user closed the window using X or clicked Quit button + text_element.Update(f'{(i//100)//60:02d}:{(i//100)%60:02d}.{i%100:02d}') + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button break time.sleep(.01) else: # if the loop finished then need to close the form for the user form.CloseNonBlockingForm() - + del(form) def DebugTest(): # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) for i in range (1,300): SG.Print(i, randint(1, 1000), end='', sep='-') - # SG.PrintClose() - def main(): - SG.SetOptions(border_width=1, element_padding=(4,6), font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), - progress_meter_border_depth=0) - SourceDestFolders() + # SG.SetOptions(border_width=1, font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), slider_border_width=1) + Everything_NoContextManager() Everything() NonBlockingPeriodicUpdateForm_ContextManager() + NonBlockingPeriodicUpdateForm() + ChatBot() + Everything() ProgressMeter() + SourceDestFolders() ChatBot() DebugTest() + SG.MsgBox('Done with all recipes') if __name__ == '__main__': main() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bcc082fbd..76f53a7b7 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -17,7 +17,7 @@ DEFAULT_AUTOSIZE_TEXT = False DEFAULT_FONT = ("Helvetica", 10) DEFAULT_TEXT_JUSTIFICATION = 'left' -DEFAULT_BORDER_WIDTH = 4 +DEFAULT_BORDER_WIDTH = 1 DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form DEFAULT_DEBUG_WINDOW_SIZE = (80,20) MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 @@ -32,7 +32,8 @@ # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember # DEFAULT_BUTTON_COLOR = (GREENS[3], TANS[0]) # Foreground, Background (None, None) == System Default # DEFAULT_BUTTON_COLOR = (YELLOWS[0], GREENS[4]) # Foreground, Background (None, None) == System Default -DEFAULT_BUTTON_COLOR = ('white', 'black') # Foreground, Background (None, None) == System Default +DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = ('white', 'black') # Foreground, Background (None, None) == System Default # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[2]) # Foreground, Background (None, None) == System Default DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) @@ -43,21 +44,35 @@ # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[0], BLUES[0]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (PURPLES[1],PURPLES[0]) # a nice purple progress bar DEFAULT_PROGRESS_BAR_SIZE = (35,25) # Size of Progress Bar (characters for length, pixels for width) -DEFAULT_PROGRESS_BAR_BORDER_WIDTH=2 +DEFAULT_PROGRESS_BAR_BORDER_WIDTH=1 DEFAULT_PROGRESS_BAR_RELIEF = tk.SUNKEN DEFAULT_PROGRESS_BAR_STYLE = 'default' DEFAULT_METER_ORIENTATION = 'Horizontal' +DEFAULT_SLIDER_ORIENTATION = 'vertical' +DEFAULT_SLIDER_BORDER_WIDTH=1 +DEFAULT_SLIDER_RELIEF = tk.SUNKEN + +DEFAULT_LISTBOX_SELECT_MODE = tk.SINGLE +SELECT_MODE_MULTIPLE = tk.MULTIPLE +LISTBOX_SELECT_MODE_MULTIPLE = 'multiple' +SELECT_MODE_BROWSE = tk.BROWSE +LISTBOX_SELECT_MODE_BROWSE = 'browse' +SELECT_MODE_EXTENDED = tk.EXTENDED +LISTBOX_SELECT_MODE_EXTENDED = 'extended' +SELECT_MODE_SINGLE = tk.SINGLE +LISTBOX_SELECT_MODE_SINGLE = 'single' + # DEFAULT_METER_ORIENTATION = 'Vertical' # ----====----====----==== Constants the user should NOT f-with ====----====----====----# ThisRow = 555666777 # magic number # Progress Bar Relief Choices # -relief -RAISED='raised' -SUNKEN='sunken' -FLAT='flat' -RIDGE='ridge' -GROOVE='groove' -SOLID = 'solid' +RELIEF_RAISED= 'raised' +RELIEF_SUNKEN= 'sunken' +RELIEF_FLAT= 'flat' +RELIEF_RIDGE= 'ridge' +RELIEF_GROOVE= 'groove' +RELIEF_SOLID = 'solid' PROGRESS_BAR_STYLES = ('default','winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative') # DEFAULT_WINDOW_ICON = '' @@ -99,6 +114,8 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_INPUT_SPIN = 9 ELEM_TYPE_BUTTON = 3 ELEM_TYPE_IMAGE = 30 +ELEM_TYPE_INPUT_SLIDER = 10 +ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 ELEM_TYPE_PROGRESS_BAR = 200 ELEM_TYPE_BLANK = 100 @@ -200,6 +217,37 @@ def __del__(self): pass super().__del__() + +# ---------------------------------------------------------------------- # +# Combo # +# ---------------------------------------------------------------------- # +class Listbox(Element): + + def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + self.Values = values + self.TKListBox = None + if select_mode == LISTBOX_SELECT_MODE_BROWSE: + self.SelectMode = SELECT_MODE_BROWSE + elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: + self.SelectMode = SELECT_MODE_EXTENDED + elif select_mode == LISTBOX_SELECT_MODE_MULTIPLE: + self.SelectMode = SELECT_MODE_MULTIPLE + elif select_mode == LISTBOX_SELECT_MODE_SINGLE: + self.SelectMode = SELECT_MODE_SINGLE + else: + self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font) + return + + def __del__(self): + try: + self.TKListBox.__del__() + except: + pass + super().__del__() + + + # ---------------------------------------------------------------------- # # Radio # # ---------------------------------------------------------------------- # @@ -361,11 +409,6 @@ def __del__(self): # New Type of Widget that's a Text Widget in disguise # # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): - ''' Demonstrate python interpreter output in Tkinter Text widget -type python expression in the entry, hit DoIt and see the results -in the text pane.''' - # previous_stderr = None - # previous_stdout = None def __init__(self, parent, width, height, bd): tk.Frame.__init__(self, parent) self.output = tk.Text(parent, width=width, height=height, bd=bd) @@ -552,6 +595,23 @@ def __init__(self, filename, scale=(None, None), size=(None, None), auto_size_te def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# Slider # +# ---------------------------------------------------------------------- # +class Slider(Element): + def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None): + self.TKScale = None + self.Range = (1,10) if range == (None, None) else range + self.DefaultValue = 5 if default_value is None else default_value + self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION + self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH + self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF + super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font) + return + + def __del__(self): + super().__del__() + # ------------------------------------------------------------------------- # @@ -629,9 +689,17 @@ def AddRows(self,rows): for row in rows: self.AddRow(*row) - def LayoutAndShow(self,rows): + def Layout(self,rows): + self.AddRows(rows) + + def LayoutAndShow(self,rows, non_blocking=False): self.AddRows(rows) - self.Show() + self.Show(non_blocking=non_blocking) + return self.ReturnValues + + def LayoutAndRead(self,rows, non_blocking=False): + self.AddRows(rows) + self.Show(non_blocking=non_blocking) return self.ReturnValues # ------------------------- ShowForm THIS IS IT! ------------------------- # @@ -676,27 +744,41 @@ def AutoCloseAlarmCallback(self): pass def Read(self): - if self.TKrootDestroyed: return None - if not self.TKrootDestroyed and not self.Shown: + if self.TKrootDestroyed: + return None, None + if not self.Shown: self.Show() - elif not self.TKrootDestroyed: + else: self.TKroot.mainloop() if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return(BuildResults(self)) + return BuildResults(self) + + def ReadNonBlocking(self, Message=''): + if self.TKrootDestroyed: + return None, None + if Message: + print(Message) + try: + rc = self.TKroot.update() + except: + self.TKrootDestroyed = True + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + return BuildResults(self) + # LEGACY version of ReadNonBlocking def Refresh(self, Message=''): if self.TKrootDestroyed: - return None + return None, None if Message: print(Message) try: - self.TKroot.update() + rc = self.TKroot.update() except: self.TKrootDestroyed = True _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return(BuildResults(self)) + return BuildResults(self) def Close(self): try: @@ -874,8 +956,14 @@ def InitializeResults(form): elif element.Type == ELEM_TYPE_INPUT_COMBO: r.append(element.TextInputDefault) return_vals.append(None) + elif element.Type == ELEM_TYPE_INPUT_LISTBOX: + r.append(None) + return_vals.append(None) elif element.Type == ELEM_TYPE_INPUT_SPIN: - r.append(element.TextInputDefault) + r.append(element.DefaultValue) + return_vals.append(None) + elif element.Type == ELEM_TYPE_INPUT_SLIDER: + r.append(element.DefaultValue) return_vals.append(None) results.append(r) form.Results=results @@ -930,6 +1018,11 @@ def BuildResults(form): value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) + elif element.Type == ELEM_TYPE_INPUT_LISTBOX: + items=element.TKListbox.curselection() + value = [element.Values[int(item)] for item in items] + results[row_num][col_num] = value + input_values.append(value) elif element.Type == ELEM_TYPE_INPUT_SPIN: try: value=element.TKStringVar.get() @@ -937,6 +1030,13 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) + elif element.Type == ELEM_TYPE_INPUT_SLIDER: + try: + value=element.TKIntVar.get() + except: + value = 0 + results[row_num][col_num] = value + input_values.append(value) elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) @@ -947,7 +1047,7 @@ def BuildResults(form): results[row_num][col_num] = value input_values.append(value) - return_value = (button_pressed_text,input_values) + return_value = button_pressed_text,input_values form.ReturnValues = return_value form.ResultsBuilt = True return return_value @@ -957,6 +1057,8 @@ def BuildResults(form): # ===================================== TK CODE STARTS HERE ====================================================== # # ------------------------------------------------------------------------------------------------------------------ # def ConvertFlexToTK(MyFlexForm): + def CharWidthInPixels(): + return tkinter.font.Font().measure('A') # single character width master = MyFlexForm.TKroot # only set title on non-tabbed forms if not MyFlexForm.IsTabbedForm: @@ -1081,6 +1183,18 @@ def ConvertFlexToTK(MyFlexForm): element.TKCombo['values'] = element.Values element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) element.TKCombo.current(0) + # ------------------------- LISTBOX (Drop Down) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_LISTBOX: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + + element.TKStringVar = tk.StringVar() + element.TKListbox= tk.Listbox(tk_row_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) + for item in element.Values: + element.TKListbox.insert(tk.END, item) + element.TKListbox.selection_set(0,0) + element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT MULTI LINE element ------------------------- # elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText @@ -1162,6 +1276,21 @@ def ConvertFlexToTK(MyFlexForm): tktext_label.image = photo # tktext_label.configure(anchor=tk.NW, image=photo) tktext_label.pack(side=tk.LEFT) + # ------------------------- SLIDER Box element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_SLIDER: + slider_length = element_size[0] * CharWidthInPixels() + slider_width = element_size[1] + element.TKIntVar = tk.IntVar() + element.TKIntVar.set(element.DefaultValue) + if element.Orientation[0] == 'v': + range_from = element.Range[1] + range_to = element.Range[0] + else: + range_from = element.Range[0] + range_to = element.Range[1] + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) + # tktext_label.configure(anchor=tk.NW, image=photo) + tkscale.pack(side=tk.LEFT) #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets tk_row_frame.grid(row=row_num+2, sticky=tk.W, padx=DEFAULT_MARGINS[0]) @@ -1520,7 +1649,6 @@ def ProgressMeterUpdate(bar, value, *args): if bar.BarExpired: return False message, w, h = ConvertArgsToSingleString(*args) - bar.TextToDisplay = message bar.CurrentValue = value rc = bar.UpdateBar(value) @@ -1529,8 +1657,8 @@ def ProgressMeterUpdate(bar, value, *args): bar.ParentForm.Close() if bar.ParentForm.RootNeedsDestroying: try: - bar.ParentForm.TKroot.destroy() _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + bar.ParentForm.TKroot.destroy() except: pass bar.ParentForm.RootNeedsDestroying = False bar.ParentForm.__del__() @@ -1841,9 +1969,12 @@ def SetGlobalIcon(icon): # ============================== SetOptions =========# # Sets the icon to be used by default # # ===================================================# -def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), margins=(None,None), element_padding=(None,None), - auto_size_text=None, font=None, border_width=None, autoclose_time=None, message_box_line_width=None, +def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), margins=(None,None), + element_padding=(None,None),auto_size_text=None, font=None, border_width=None, + slider_border_width=None, slider_relief=None, slider_orientation=None, + autoclose_time=None, message_box_line_width=None, progress_meter_border_depth=None, text_justification=None, debug_win_size=(None,None)): + global DEFAULT_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels @@ -1856,6 +1987,9 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma global DEFAULT_PROGRESS_BAR_BORDER_WIDTH global DEFAULT_TEXT_JUSTIFICATION global DEFAULT_DEBUG_WINDOW_SIZE + global DEFAULT_SLIDER_BORDER_WIDTH + global DEFAULT_SLIDER_RELIEF + global DEFAULT_SLIDER_ORIENTATION global _my_windows if icon: @@ -1896,6 +2030,15 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma if progress_meter_border_depth != None: DEFAULT_PROGRESS_BAR_BORDER_WIDTH = progress_meter_border_depth + if slider_border_width != None: + DEFAULT_SLIDER_BORDER_WIDTH = slider_border_width + + if slider_orientation != None: + DEFAULT_SLIDER_ORIENTATION = slider_orientation + + if slider_relief != None: + DEFAULT_SLIDER_RELIEF = slider_relief + if text_justification != None: DEFAULT_TEXT_JUSTIFICATION = text_justification @@ -1904,12 +2047,21 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma return True - - - -# ============================== sprint ======# +# ============================== sprint ======#fddddddddddddddddddddddd # Is identical to the Scrolled Text Box # # Provides a crude 'print' mechanism but in a # # GUI environment # # ============================================# sprint=ScrolledTextBox + +# Converts an object's contents into a nice printable string. Great for dumping debug data +def ObjToString_old(obj): + return str(obj.__class__) + '\n' + '\n'.join( + (repr(item) + ' = ' + repr(obj.__dict__[item]) for item in sorted(obj.__dict__))) + +def ObjToString(obj, extra=' '): + return str(obj.__class__) + '\n' + '\n'.join( + (extra + (str(item) + ' = ' + + (ObjToString(obj.__dict__[item], extra + ' ') if hasattr(obj.__dict__[item], '__dict__') else str( + obj.__dict__[item]))) + for item in sorted(obj.__dict__))) \ No newline at end of file diff --git a/readme.md b/readme.md index 199845992..79abcc07e 100644 --- a/readme.md +++ b/readme.md @@ -2,11 +2,12 @@ [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI - -This really is a simple GUI, but also powerfully customizable. + (Ver 2.3) + +This really is a simple GUI, but also powerfully customizable. + + import PySimpleGUI as SG - import PySimpleGUI as SG - SG.MsgBox('My Message Box', 'This is the shortest GUI program ever!') ![snap0102](https://user-images.githubusercontent.com/13696193/42781058-1d28d9fa-8913-11e8-847e-5c2afc16ca4c.jpg) @@ -14,10 +15,10 @@ This really is a simple GUI, but also powerfully customizable. Add a Progress Meter to your code with ONE LINE of code EasyProgressMeter('My meter title', current_value, max value) - + ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`(no longer maintained) and `WxSimpleGUI` (a great package, but limited). The primary difference between these and PySimpleGUI is that in addition to getting those simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! @@ -28,30 +29,30 @@ GUI Packages with more functionality, like QT and WxPython, require configuring With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: File Browse Folder Browse Non-closing return - Close form - Checkboxes - Radio Buttons - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows + Close form + Checkboxes + Radio Buttons + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window + Persistent Windows + Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) Single-Line-Of-Coide Proress Bar & Debug Print - + An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. ![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) @@ -60,41 +61,41 @@ An example of many widgets used on a single form. A little further down you'll ### Design Goals > Copy, Paste, Run. -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. Be Pythonic... Python's lists in particular worked out really well: - - Forms are represented as Python lists. + - Forms are represented as Python lists. - A form is a list of rows - A row is a list of elements - Return values are a list - Each Elements is specified by names such as Text, Button, Checkbox, etc. + Each Elements is specified by names such as Text, Button, Checkbox, etc. Some elements have shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing calling `Button`, with `button_name = "Submit"` will create a button with the text 'Submit' on it, Other examples include shortening the name of the function. `Text` is shorted to `Txt` or `T`. See each API call for the shortcuts. ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. - +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. + ### Using To use in your code, simply import.... - `import PySimpleGUI as SG` + `import PySimpleGUI as SG` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own forms. SG.MsgBox('This is my first message box') ![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) @@ -103,70 +104,70 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi --- ## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + ### Python Language Features There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call + * Variable number of arguments to a function call * Optional parameters to a function call - + #### Variable Number of Arguments The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") Each new item begins on a new line in the Message Box ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) - + #### Optional Parameters to a Function Call - + This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, line_width=MESSAGE_BOX_LINE_WIDTH, font=None): If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', + SG.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) - + ![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) --- -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) - -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) - +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) + +![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) + #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. @@ -175,7 +176,7 @@ The differences tend to be the number and types of buttons. Here are the calls import PySimpleGUI as SG `SG.MsgBoxOK('This is an OK MsgBox')` - + ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') @@ -209,7 +210,7 @@ This becomes a debug print of sorts that will route to a scrolled window. There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - GetTextBox - - GetFileBox + - GetFileBox - GetFolderBox `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` @@ -241,7 +242,7 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! - for i in range(1,10000): + for i in range(1,10000): SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') That line of code resulted in this window popping up and updating. @@ -249,10 +250,10 @@ That line of code resulted in this window popping up and updating. ![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break + break ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -271,17 +272,17 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e # Copy these design patterns! ## Pattern 1 - With Context Manager - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] button, (source_filename, ) = form.LayoutAndShow(form_rows) ## Pattern 2 - No Context Manager - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] button, (source_filename,) = form.LayoutAndShow(form_rows) @@ -300,13 +301,13 @@ You will use these design patterns or code templates for all of your "normal" (b Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [SG.InputText(), SG.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. [SG.Submit(), SG.Cancel()]] @@ -322,67 +323,75 @@ This is the code that **displays** the form, collects the information and return ## Return values - Return information from FlexForm, SG's primary form builder interface, is in this format: - - (button, (value1, value2, ...)) - + Return information from FlexForm, SG's primary form builder interface, is in this format: + + (button, (value1, value2, ...)) + Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) - -If you have a SINGLE value being returned, it is written this way: - + +If you have a SINGLE value being returned, it is written this way: + (button, (value1,)) = form.LayoutAndShow(form_rows) Another way of parsing the return values is to store the list of values into a variable representing the list of values. - (button, (value_list)) = form.LayoutAndShow(form_rows) + (button, (value_list)) = form.LayoutAndShow(form_rows) value1 = value_list[0] value2 = value_list[1] ... - + --- ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - layout = [[Text('Here they all are!', size=(30,1), font=("Helvetica", 25), text_color='red')], - [Text('Here is some text with font sizing', font=("Helvetica", 15))], - [InputText()], - [Checkbox('My first checkbox!'), Checkbox('My second checkbox!', default=True)], - [Radio('My first Radio!', "RADIO1", default=True), Radio('My second checkbox!', "RADIO1")], - [Multiline(DefaultText='This is the DEFAULT text should you decide not to type anything', scale=(2, 10))], - [InputCombo(['choice 1', 'choice 2'], size=(20, 3))], - [Text('_' * 90, size=(60, 1))], - [Text('Choose Source and Destination Folders', size=(35,1))], - [Text('Source Folder', size=(15, 1), auto_size_text=False), InputText('Source'), FolderBrowse()], - [Text('Destination Folder', size=(15, 1), auto_size_text=False), InputText('Dest'), FolderBrowse()], - [SimpleButton('Your Button with any text you want')], - [SimpleButton('Big Text', size=(12,1), font=("Helvetica", 20))], - [Submit(), Cancel()]] - - (button, (values)) = form.LayoutAndShow(layout) - - MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. -![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results](https://user-images.githubusercontent.com/13696193/42604952-502f64e6-8543-11e8-8045-bc10d38c5fd4.jpg) +![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + (button, (values)) = form.LayoutAndShow(layout) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- # Building Custom Forms You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - Control-Q (when cursor is on function name) brings up a box with the function definition + Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values ## Synchronous Forms @@ -396,11 +405,11 @@ NON-BLOCKING form call: ### Beginning a Form The first step is to create the form object using the desired form customization. - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: This is the definition of the FlexForm object: - def FlexForm(title, + def FlexForm(title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), @@ -412,7 +421,7 @@ This is the definition of the FlexForm object: auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): - + Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. default_element_size - Size of elements in form in characters (width, height) @@ -437,6 +446,10 @@ Sizes can be set at the element level, or in this case, the size variables apply In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. + + + #### FlexForm - form-level variables overview A summary of the variables that can be changed when a FlexForm is created @@ -457,22 +470,24 @@ A summary of the variables that can be changed when a FlexForm is created ## Elements "Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - Text - Single Line Input - Buttons including these types: + Text + Single Line Input + Buttons including these types: File Browse Folder Browse Non-closing return - Close form - Checkboxes - Radio Buttons - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows + Close form + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window + Persistent Windows + Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) @@ -484,15 +499,15 @@ Building a form is simply making lists of Elements. Each list is a row in the o The code is a crude representation of the GUI, laid out in text. #### Text Element - layout = [[SG.Text('This is what a Text Element looks like')]] + layout = [[SG.Text('This is what a Text Element looks like')]] + - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - Text(Text, + Text(Text, scale=(None, None), size=(None, None), auto_size_text=None, @@ -568,7 +583,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. ### Input Elements These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - + #### Text Input Element layout = [[SG.InputText('Default text')]] @@ -594,10 +609,10 @@ Shorthand functions that are equivalent to `InputText` are `Input` and `In` Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] - + ![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - InputCombo(values, + InputCombo(values, scale=(None, None), size=(None, None), auto_size_text=None) @@ -608,6 +623,68 @@ Also known as a drop-down list. Only required parameter is the list of choices. size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + Listbox(values, + select_mode=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +#### Slider Element +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + scale=(None, None), + size=(None, None), + font=None): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text + + + + + #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. @@ -635,7 +712,7 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o #### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] @@ -665,7 +742,7 @@ An up/down spinner control. The valid values are passed in as a list. ![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - Spin(values, + Spin(values, intiial_value=None, scale=(None, None), size=(None, None), @@ -679,7 +756,7 @@ An up/down spinner control. The valid values are passed in as a list. size - (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display - + #### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. @@ -691,9 +768,9 @@ The Types of buttons include: Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. @@ -706,7 +783,7 @@ While it's possible to build forms using the Button Element directly, you should auto_size_text=None, button_color=None, font=None) - + Pre-made buttons include: OK @@ -722,7 +799,7 @@ Pre-made buttons include: ![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. @@ -736,30 +813,30 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (-1,0) The code for the entire form could be: - layout = [[SG.T('Source Folder')], - [SG.In()], + layout = [[SG.T('Source Folder')], + [SG.In()], [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] **Custom Buttons** If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. - + layout = [[SG.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) -All buttons can have their text changed by changing the `button_text` variable. +All buttons can have their text changed by changing the `button_text` variable. **File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) - + This code produces a form where the Browse button only shows files of type .TXT layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. --- @@ -770,7 +847,7 @@ The **easiest** way to get progress meters into your code is to use the `EasyPro You've already seen EasyProgressMeter calls presented earlier in this readme. SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - + The return value for `EasyProgressMeter` is: `True` if meter updated correctly `False` if user clicked the Cancel button, closed the form, or vale reached the max value. @@ -779,25 +856,25 @@ If you want a bit more customization of your meter, then you can go up 1 level a You setup the progress meter by calling - my_meter = ProgressMeter(title, + my_meter = ProgressMeter(title, max_value, *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) Then to update the bar within your loop return_code = ProgressMeterUpdate(my_meter, - value, + value, *args): Putting it all together you get this design pattern - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') @@ -812,27 +889,31 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Here's a complete solution for a chat-window using an Async form with an Output Element - import PySimpleGUI as g - - with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - form.AddRow(g.Text('This is where standard out is being routed', size=[40,1])) - form.AddRow(g.Output(size=(80, 20))) - form.AddRow(g.Multiline(size=(70, 5), enter_submits=True), g.ReadFormButton('SEND', button_color=(g.YELLOWS[0], g.BLUES[0])), g.SimpleButton('EXIT', button_color=(g.YELLOWS[0], g.GREENS[0]))) - - # ---===--- Loop taking in user input and printing it --- # - while True: - (button, value) = form.Read() - if button == 'SEND': - print(value) - else: - print('Exiting the form now') - break - + import PySimpleGUI as SG + # Blocking form that doesn't close + def ChatBot(): + with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], + [SG.Output(size=(80, 20))], + [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + + ## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - results = ShowTabbedForm('Title for the form', + results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), (form2,layout2, 'Tab 2 label')) @@ -842,21 +923,26 @@ Each of the tabs of the form is in fact a form. The same steps are taken to cre **Global Settings** Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - SetOptions(icon=None, + SetOptions(icon=None, button_color=(None,None), - element_size=(None,None), - margins=(None,None), - element_padding=(None,None), + element_size=(None,None), + margins=(None,None), + element_padding=(None,None), auto_size_text=None, - font=None, border_width=None, - autoclose_time=None, - message_box_line_width=None, + font=None, + border_width=None, + slider_border_width=None, + slider_relief=None, + slider_orientation=None, + autoclose_time=None, + message_box_line_width=None, progress_meter_border_depth=None, - text_justification=None): + text_justification=None, + debug_win_size=(None,None): Explanation of parameters - icon - filename of icon used for taskbar and title bar + icon - filename of icon used for taskbar and title bar button_color - button color (foreground, background) element_size - element size (width, height) in characters margins - tkinter margins around outsize @@ -864,12 +950,16 @@ Explanation of parameters auto_size_text - autosize the elements to fit their text font - font used for elements border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider autoclose_time - time in seconds for autoclose boxes message_box_line_width - number of characers in a line of text in message boxes progress_meter_border_depth - amount of border around raised or lowered progress meters text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + - These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - Form level @@ -878,8 +968,8 @@ These settings apply to all forms `SetOptions`. The Row options and Element opt Each lower level overrides the settings of the higher level -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.refresh` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. When do you use a non-blocking form? A couple of examples are * A media file player like an MP3 player @@ -887,11 +977,11 @@ When do you use a non-blocking form? A couple of examples are * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `Refresh` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that Refresh always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: - button, values = form.Refresh() + button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break @@ -906,38 +996,38 @@ Setup Periodic refresh - form.Refresh() + form.ReadNonBlocking() If you need to close the form form.CloseNonBlockingForm() -Rather than the usual `form.LayoutAndShow()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.Refresh()` every now and then. +Rather than the usual `form.LayoutAndShow()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` **Example - Running timer that updates** We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - with SG.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) - form_rows = [[SG.Text('Non-blocking GUI with updates')], - [output_element], - [SG.SimpleButton('Quit')]] - - form.AddRows(form_rows) - form.Show(non_blocking=True) - for i in range(1, 100): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - button, values = form.Refresh() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: + with SG.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = SG.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[SG.Text('Non-blocking GUI with updates')], + [output_element], + [SG.SimpleButton('Quit')]] + + form.AddRows(form_rows) + form.Show(non_blocking=True) + for i in range(1, 100): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: form.CloseNonBlockingForm() - + What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.Refresh()` is called. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. @@ -954,19 +1044,19 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify `Demo Recipes.py` - Three sample forms including an asynchronous form -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. ## Fun Stuff Here are some things to try if you're bored or want to further customize **Random colors** To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and +To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and that color's compliment. sprint **sprint** -Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. +Call `sprint` with as many parameters as you want and it'll print them all out in a `ScrolledTextBox`. This is simply a function pointing to `PySimpleGUI.ScrolledTextBox`. --- # Known Issues @@ -980,48 +1070,63 @@ While not an "issue" this is a ***stern warning*** **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. -## Contributing - +## Contributing + A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versioning -|Version | Description | + +## Versions +|Version | Description | |--|--| | 1.0.9 | July 10, 2018 - Initial Release | | 1.0.21 | July 13, 2018 - Readme updates | | 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case | 2.1.1 | July 18, 2018 - Global settings exposed, fixes | 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July XX, 2018 - Changed form.Read return codes, Slider Elements, Listbox element - -## Code Condition +| 2.3.0 | July XX, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) This Readme is being updated with Listbox and Image elements. If you want to use them, they behave as one would expect. Note use of pixels in some parameters. + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +### Upcoming +Make suggestions people! Future release features + +Button images. Ability to replace boring rectangular buttons with your own images. - Make it run - Make it right +Columns. How multiple columns would be specified in the SDK interface are still being designed. + +Progress Meters - Replace custom meter with tkinter meter. + + +## Code Condition + + Make it run + Make it right Make it fast -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Authors + +## Authors MikeTheWatchGuy - -## License - + +## License + This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. For non-commercial individuals, the GNU Lesser General Public License (LGPL 3) applies. - -## Acknowledgments - + +## Acknowledgments + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence ## How Do I Finally, I must thank the fine folks at How Do I. https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** Here are the steps to run that application Install howdoi: @@ -1031,7 +1136,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. @@ -1044,3 +1149,4 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + From c6b0f4111a2072a19410402eccab763c0507bc6b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 15:20:41 -0400 Subject: [PATCH 055/521] New picture of all widgets --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 79abcc07e..29dc5073a 100644 --- a/readme.md +++ b/readme.md @@ -55,7 +55,7 @@ The `PySimpleGUI` solution is focused on the ***developer***. How can the desir An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. -![all widgets](https://user-images.githubusercontent.com/13696193/42604818-adb1dd5c-8542-11e8-94cb-575881590f21.jpg) +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) --- ### Design Goals From 9bc4eddce60b1f9149a29c525fbb60135183b3df Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 23 Jul 2018 18:33:49 -0400 Subject: [PATCH 056/521] Forgot to add Listbox and Slider to feature list! --- readme.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 29dc5073a..df3995ddc 100644 --- a/readme.md +++ b/readme.md @@ -40,6 +40,8 @@ The `PySimpleGUI` solution is focused on the ***developer***. How can the desir Close form Checkboxes Radio Buttons + Listbox + Slider Icons Multi-line Text Input Scroll-able Output @@ -1082,10 +1084,11 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case | 2.1.1 | July 18, 2018 - Global settings exposed, fixes | 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July XX, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July XX, 2018 - Planned release. Will have button images. ### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) This Readme is being updated with Listbox and Image elements. If you want to use them, they behave as one would expect. Note use of pixels in some parameters. +2.3 - Sliders, Listbox's and Image elements (oh my!) If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. From b88483bb767522ae3ae497b016931c1611c17dfc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 00:05:01 -0400 Subject: [PATCH 057/521] Readme update More on Listbox and Slider. SimpleGUI Print function for debug output. --- readme.md | 105 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 18 deletions(-) diff --git a/readme.md b/readme.md index df3995ddc..729420885 100644 --- a/readme.md +++ b/readme.md @@ -24,11 +24,11 @@ There are a number of 'easy to use' Python GUIs, but they're **very** limiting. Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. -The `PySimpleGUI` solution is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? +The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? Features of PySimpleGUI include: Text @@ -55,10 +55,43 @@ The `PySimpleGUI` solution is focused on the ***developer***. How can the desir Single-Line-Of-Coide Proress Bar & Debug Print -An example of many widgets used on a single form. A little further down you'll find the FIFTEEN lines of code required to create this complex form. +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Copy and paste into a temp file and it'll run, presenting you with the screen you see. ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) +Here is the code that produced the above screenshot. + + import PySimpleGUI as SG + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + **A note on screen shots** +You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + + --- ### Design Goals > Copy, Paste, Run. @@ -258,6 +291,33 @@ With a little trickery you can provide a way to break out of your loop using the break ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = SG.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + + import PySimpleGUI as SG + + for i in range(100): + SG.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + + import PySimpleGUI as SG + + print=SG.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. --- # Custom Form API Calls @@ -327,19 +387,25 @@ This is the code that **displays** the form, collects the information and return Return information from FlexForm, SG's primary form builder interface, is in this format: - (button, (value1, value2, ...)) + button, (value1, value2, ...) Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - (button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndShow(form_rows) + Or, you can unpack the return results separately. + + button, values = form.LayoutAndShow(form_rows) + filename, folder1, folder2, should_overwrite = values If you have a SINGLE value being returned, it is written this way: - (button, (value1,)) = form.LayoutAndShow(form_rows) + button, (value1,) = form.LayoutAndShow(form_rows) + + Another way of parsing the return values is to store the list of values into a variable representing the list of values. - (button, (value_list)) = form.LayoutAndShow(form_rows) + button, value_list = form.LayoutAndShow(form_rows) value1 = value_list[0] value2 = value_list[1] ... @@ -373,8 +439,6 @@ This code utilizes as many of the elements in one form as possible. button, values = form.LayoutAndRead(layout) - MsgBox('Results', 'You clicked {}'.format(button),'The values returned from form', values , font = ("Helvetica", 15)) - This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) @@ -383,8 +447,6 @@ Clicking the Submit button caused the form call to return. The call to MsgBox r ![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) - - (button, (values)) = form.LayoutAndShow(layout) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. @@ -628,6 +690,11 @@ Also known as a drop-down list. Only required parameter is the list of choices. #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + layout = [[SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) + + Listbox(values, select_mode=None, scale=(None, None), @@ -658,6 +725,10 @@ The `select_mode` option can be a string or a constant value defined as a variab #### Slider Element Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + layout = [[SG.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) + Slider(range=(None,None), default_value=None, orientation=None, @@ -683,10 +754,6 @@ Sliders have a couple of slider-specific settings as well as appearance settings size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text - - - - #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. @@ -1085,7 +1152,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.1.1 | July 18, 2018 - Global settings exposed, fixes | 2.2.0| July 20, 2018 - Image Elements, Print output | 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July XX, 2018 - Planned release. Will have button images. +| 2.4.0 | July XX, 2018 - Planned release. Button images. ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -1119,8 +1186,7 @@ MikeTheWatchGuy ## License -This project is limited to non-commercial applications. If you wish to use it commercially, please contact one of the authors. -For non-commercial individuals, the GNU Lesser General Public License (LGPL 3) applies. +GNU Lesser General Public License (LGPL 3) ## Acknowledgments @@ -1153,3 +1219,6 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + + + From e2f9f5c83450a625a12475c9fecff3ad002caa19 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 00:07:07 -0400 Subject: [PATCH 058/521] Readme --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 729420885..f624212e4 100644 --- a/readme.md +++ b/readme.md @@ -262,8 +262,10 @@ There are 3 very basic user input high-level function calls. It's expected that #### Progress Meter! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + ![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) + EasyProgressMeter(title, current_value, max_value, From 8e329e7690b9393d45fc6c79f71d9a41a68fa8ec Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 12:20:34 -0400 Subject: [PATCH 059/521] Removed F-string Oops, and f-string creaped in --- Demo Recipes.py | 134 ++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 68 deletions(-) diff --git a/Demo Recipes.py b/Demo Recipes.py index db2168a4e..adb5e0fff 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -1,22 +1,20 @@ import time from random import randint -import random -import string -import PySimpleGUI as SG +import PySimpleGUI as sg # A simple blocking form. Your best starter-form def SourceDestFolders(): - with SG.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: - form_rows = [[SG.Text('Enter the Source and Destination folders')], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source')], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), SG.FolderBrowse()], - [SG.Submit(), SG.Cancel()]] + with sg.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: + form_rows = [[sg.Text('Enter the Source and Destination folders')], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source')], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) if button == 'Submit': - SG.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) + sg.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) else: - SG.MsgBoxError('Cancelled', 'User Cancelled') + sg.MsgBoxError('Cancelled', 'User Cancelled') # YOUR BEST STARTING POINT # This is a form showing you all of the basic Elements (widgets) @@ -25,71 +23,71 @@ def SourceDestFolders(): # Use this especially if you are runningm multi-threaded # Where you free up resources is really important to tkinter def Everything(): - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] ] button, values = form.LayoutAndRead(layout) - SG.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) # Should you decide not to use a context manager, then try this form as your starting point # Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if # you are running multithreaded def Everything_NoContextManager(): - form = SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) - layout = [[SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), SG.Slider(range=(1,100), orientation='h', size=(35,20), default_value=85)], - [SG.Listbox(values=['Listbox 1','Listbox 2', 'Listbox 3'], size=(30,6)), - SG.Slider(range=(1,100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1), text_color='red')], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))]] + form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1), text_color='red')], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))]] button, values = form.LayoutAndRead(layout) del(form) - SG.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) def ProgressMeter(): for i in range(1,10000): - if not SG.EasyProgressMeter('My Meter', i+1, 10000): break + if not sg.EasyProgressMeter('My Meter', i + 1, 10000): break # SG.Print(i) # Blocking form that doesn't close def ChatBot(): - with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], - [SG.Output(size=(80, 20))], - [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form # if you call LayoutAndRead from here, then you will miss the first button click form.Layout(layout) @@ -106,15 +104,15 @@ def ChatBot(): # form within the 'with' block. If your read occurs far away in your code from the form creation # then you will want to use the NonBlockingPeriodicUpdateForm example def NonBlockingPeriodicUpdateForm_ContextManager(): - with SG.FlexForm('Running Timer', auto_size_text=True) as form: - text_element = SG.Text('',size=(10,2), font=('Helvetica', 20), text_color='red', justification='center') - layout = [[SG.Text('Non blocking GUI with updates', justification='center')], - [text_element], - [SG.T(' '*15), SG.Quit()]] + with sg.FlexForm('Running Timer', auto_size_text=True) as form: + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') + layout = [[sg.Text('Non blocking GUI with updates', justification='center')], + [text_element], + [sg.T(' ' * 15), sg.Quit()]] form.LayoutAndRead(layout, non_blocking=True) for i in range(1,500): - text_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': # if user closed the window using X break @@ -127,15 +125,15 @@ def NonBlockingPeriodicUpdateForm_ContextManager(): # from the form creation (call to LayoutAndRead) def NonBlockingPeriodicUpdateForm(): # Show a form that's a running counter - form = SG.FlexForm('Running Timer', auto_size_text=True) - text_element = SG.Text('',size=(10,2), font=('Helvetica', 20), justification='center') - form_rows = [[SG.Text('Non blocking GUI with updates')], + form = sg.FlexForm('Running Timer', auto_size_text=True) + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') + form_rows = [[sg.Text('Non blocking GUI with updates')], [text_element], - [SG.T(' ' * 15), SG.Quit()]] + [sg.T(' ' * 15), sg.Quit()]] form.LayoutAndRead(form_rows, non_blocking=True) for i in range(1,50000): - text_element.Update(f'{(i//100)//60:02d}:{(i//100)%60:02d}.{i%100:02d}') + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button break @@ -148,22 +146,22 @@ def NonBlockingPeriodicUpdateForm(): def DebugTest(): # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) for i in range (1,300): - SG.Print(i, randint(1, 1000), end='', sep='-') + sg.Print(i, randint(1, 1000), end='', sep='-') def main(): # SG.SetOptions(border_width=1, font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), slider_border_width=1) - Everything_NoContextManager() - Everything() NonBlockingPeriodicUpdateForm_ContextManager() NonBlockingPeriodicUpdateForm() + Everything_NoContextManager() + Everything() ChatBot() Everything() ProgressMeter() SourceDestFolders() ChatBot() DebugTest() - SG.MsgBox('Done with all recipes') + sg.MsgBox('Done with all recipes') if __name__ == '__main__': main() From b7eb946027a10937b8babddf9dd6e5b39843b19e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 14:12:39 -0400 Subject: [PATCH 060/521] RELEASE 2.4 (early) Wasn't building correctly on Raspberry Pi and wanted to correct it quickly. Am not paracticing good source code management! --- PySimpleGUI.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 76f53a7b7..ab01ba2cf 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -37,12 +37,16 @@ # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[2]) # Foreground, Background (None, None) == System Default DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) -BarColor=() # DEFAULT_PROGRESS_BAR_COLOR = (GREENS[2], GREENS[0]) # a nice green progress bar DEFAULT_PROGRESS_BAR_COLOR = (GREENS[3], GREENS[3]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[1], BLUES[1]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[0], BLUES[0]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (PURPLES[1],PURPLES[0]) # a nice purple progress bar + +# A transparent button is simply one that matches the background +TRANSPARENT_BUTTON = ('#F0F0F0', '#F0F0F0') +#-------------------------------------------------------------------------------- + DEFAULT_PROGRESS_BAR_SIZE = (35,25) # Size of Progress Bar (characters for length, pixels for width) DEFAULT_PROGRESS_BAR_BORDER_WIDTH=1 DEFAULT_PROGRESS_BAR_RELIEF = tk.SUNKEN @@ -459,14 +463,18 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None,None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): self.BType = button_type self.FileTypes = file_types self.TKButton = None self.Target = target self.ButtonText = button_text self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR + self.ImageFilename = image_filename + self.ImageSize = image_size + self.ImageSubsample = image_subsample self.UserData = None + self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH super().__init__(ELEM_TYPE_BUTTON, scale, size, auto_size_text, font=font) return @@ -913,13 +921,13 @@ def No(button_text='No', scale=(None, None), size=(None, None), auto_size_text=N # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(button_text, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + return Button(CLOSES_WIN, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample, button_text=button_text,border_width=border_width, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): - return Button(READ_FORM, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + return Button(READ_FORM, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample,border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -1151,9 +1159,20 @@ def CharWidthInPixels(): bc = DEFAULT_BUTTON_COLOR if bc == 'Random' or bc == 'random': bc = GetRandomColorPair() + border_depth = element.BorderWidth tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels + if element.ImageFilename: + photo = tk.PhotoImage(file=element.ImageFilename) + if element.ImageSize != (None, None): + width, height = element.ImageSize + if element.ImageSubsample: + photo = photo.subsample(element.ImageSubsample) + else: + width, height = photo.width(), photo.height() + tkbutton.config(image=photo, width=width, height=height) + tkbutton.image = photo tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if not focus_set and btype == CLOSES_WIN: @@ -1757,7 +1776,8 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, for line in EasyProgressMeter.EasyProgressMeterData.StatMessages: message = message + str(line) + '\n' message = "\n".join(EasyProgressMeter.EasyProgressMeterData.StatMessages) - rc = ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, current_value, *args, message) + args= args + (message,) + rc = ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, current_value, *args) # if counter >= max then the progress meter is all done. Indicate none running if current_value >= EasyProgressMeter.EasyProgressMeterData.MaxValue or not rc: EasyProgressMeter.EasyProgressMeterData.MeterID = None From efa5b5fc6bf3da973b8e52e3af72d9e52f9da8c4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 14:13:12 -0400 Subject: [PATCH 061/521] Minor change --- Demo Recipes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Demo Recipes.py b/Demo Recipes.py index adb5e0fff..6f2a76cd2 100644 --- a/Demo Recipes.py +++ b/Demo Recipes.py @@ -156,7 +156,6 @@ def main(): Everything_NoContextManager() Everything() ChatBot() - Everything() ProgressMeter() SourceDestFolders() ChatBot() From d9d548747b47ca7b0c1db6e94dd43f8aef228fc4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 15:52:14 -0400 Subject: [PATCH 062/521] Readme update for version 2.4 features. Button images --- ButtonGraphics/Exit.png | Bin 0 -> 8167 bytes ButtonGraphics/Loop.png | Bin 0 -> 3441 bytes ButtonGraphics/Next.png | Bin 0 -> 8065 bytes ButtonGraphics/Pause.png | Bin 0 -> 7586 bytes ButtonGraphics/Restart.png | Bin 0 -> 8013 bytes ButtonGraphics/Rewind.png | Bin 0 -> 7902 bytes ButtonGraphics/Stop.png | Bin 0 -> 7747 bytes Demo High Level APIs.py | 11 - Demo Media Player.py | 60 ++++ Demo NonBlocking Form.py | 59 ++++ __pycache__/PySimpleGUI.cpython-36.pyc | Bin 0 -> 54552 bytes readme.md | 370 +++++++++++++++---------- 12 files changed, 340 insertions(+), 160 deletions(-) create mode 100644 ButtonGraphics/Exit.png create mode 100644 ButtonGraphics/Loop.png create mode 100644 ButtonGraphics/Next.png create mode 100644 ButtonGraphics/Pause.png create mode 100644 ButtonGraphics/Restart.png create mode 100644 ButtonGraphics/Rewind.png create mode 100644 ButtonGraphics/Stop.png delete mode 100644 Demo High Level APIs.py create mode 100644 Demo Media Player.py create mode 100644 Demo NonBlocking Form.py create mode 100644 __pycache__/PySimpleGUI.cpython-36.pyc diff --git a/ButtonGraphics/Exit.png b/ButtonGraphics/Exit.png new file mode 100644 index 0000000000000000000000000000000000000000..f2ef87d2f17a082ab91e6a4f57dbd5ecd588ecde GIT binary patch literal 8167 zcmWkz1yod96n!)j3eq7t(k0y`H3E`@GzbWal=Oh40#Z@}BGMo-bazO@e59lV>F!4Q zUuR9MHS67b-@Esmz4zHCT>GgiF##l}YxD1ej|;wC78CWs&m9*vBR2>l zy#McmG4jX%3W69@;7SVm-e1T3j9ln@QdXahi8auzcTb6bNQL36kz+qmF#ee5U_{QV zle817X+p}Xy50GkU#Rj_dON|cBOPD$KUs0pYwX|7y@!gN9;%i!(5rQ~A{z}zG-@^m(V)b??C#K7N&vwlqd&s+BdCJFztPMAj(s`!tjhnT#wZp4doZ>Pv5BgVJ zkKEkc!nJZ_ZPhNS2<6q{VUrG`z9uFnnT3U0mVSQMWC#QT&&H?(N1H&N?F@yozepor zfr{2#>xT{x54-B?>*Y*a{hI@TB~e2RvnI>)EVtY1GG$AE_+RJEQEFAI9txr>CdS=%u~) z8Mn5!TAAUxG;MZ*@NMT)+G~1s;mRquVU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M8`XNti+MW}uP#45%K9D&u0%PAxkNr*=AKEGstRKG0wj0`lFDMYf&r)S63oXRW?Rf!Mdj?F*trMT=w5N8ej*dHgkVsvn z2s1prSXC6mLHpGsa)Lj=d$$HN{Q&)ySQP4L_~j=l_RUK9TgK>O;s9h4O*iP=LvZD% KN+pVx!T$p@`L*x> literal 0 HcmV?d00001 diff --git a/ButtonGraphics/Loop.png b/ButtonGraphics/Loop.png new file mode 100644 index 0000000000000000000000000000000000000000..cb303d8f8e843c5536deb921ece9bd38e3a63370 GIT binary patch literal 3441 zcmV-%4UY1OP)pSBS}O-RCt{2-FuLoXI%&I&z?O^woO8UC6~5aY(ot;sl7;z3PW2{ zp;TuS5N`}Rj<-?kppN4eb;eN<9j}FgI_d}`;xMHa>TN(EREhD z*=(}uUi{d-ibMDco+>^!*^||DfT4a*U>1gPJ}$*evAOvBMy$nh z-OqOh6T*<)*nyqcRg5oSs>IwY!yqtZC0>qeu@x_oxBqPQ&2I+BWEVYx&)`mc3P);s zW?Se7LxzOd7vM(xAU0tImi1vyGdLk4?DO~s{JV&{W5vHeXR!v?;GNiyX<6_fjp<@; z?<(fHrWQ){86((+cZi7SH__W2yNfw*b5e0w^0)wRm&KjXe zep(hYrT>I2JEpJ)H;FdbsEk@Qqahm8Z5Y#kLRLM-@K3nT5@52=MCteVgs8{O zG6XGyVZ0jmh?B101nKvf#Q)%if;K(HFuqGXsAs}?(e7wj`LESOrZi<|JX*too-1R& z?3CKY*N~hU_c*h5#*=su<86L^TEy2jH9JeU$l-OSoEg)?i0_fO%ufk(+WGFJxb(Ml zMd>zhfx%O4Pe}Cd3*xlgi3h}Jd$9QLNAN|76h7U-Zy(1U5-gidgMaRDj@xx$r?e~M zR^pe$UC>X=2x0f)A@MEklaTF`_^Lz(CuMCTGWWF-^!i#{Eb*6%#LAveq&$W9&U*UKAU)gjp^es2T5 z4mGUx<&9q za0B^G{-_H_QExVpr1I>k>) zT%;-*?U5rxL$=B$^~l^KQuxvhwuyd%Pc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{NPAP=Y>lh+x+$!)*0* zt<5c0+GhIlkcSsG#yx$y;)3E{M8&Mw=2C0qUbkJMz}hYgfscE5QKQg4%;gi;y|bWY6ArQ6@O3wGZS37fSYRvy0W| z)~#E2oAGzNQD}2l?Lzth2gD&BLxv3LXT#a?)^p~J966E~y_=2Idu&|^-(3V}@N9c| zdwctQ>j^D3EG_Hk=s2L?Z#v)(5fIAen*QdL(bj8b*pPOPIqOtQPak?Vc6#%r2Vnf? z=ihB6`r|evJz_m!kvU_7%?-PH+wnccd&VI-m{SIsL&l64F{06&Gil(!fyXvBHu44x z56Jj5p*YwGxLW38I^xE*wzd~`?AWo&oUnTH=FM#;{Caan_MNB$kD~a0b~#>@%#rY0 P00000NkvXXu0mjfUC#0B literal 0 HcmV?d00001 diff --git a/ButtonGraphics/Pause.png b/ButtonGraphics/Pause.png new file mode 100644 index 0000000000000000000000000000000000000000..284b1e52eb8e64c911dcb5375ed0201b613cc660 GIT binary patch literal 7586 zcmWkz2RxK-96yr1sjP5Z_I6|wXJut)WG6DS_sAJ%QwZ51XA`msQD^*-y|c6T3je3~ z^WNR(qexg{7 zs#nx>-f_GcnhZC5Jv_d^MMUn-I(zRebw!e4?PIy>{-|?TWsr+~S}H6od}duec|1LB>}qKV)#IQ} zO-oJH8OoQjMfi>1WoA*OEHiM>*V58D>gebw86O`{qo=1&z|_oQ=i-K_501eHj-@#{ zA(MR6gn1_?C#7m?YB?I3n(>2!gB3QlMq}I3IbWpQ<>~0?ctYhCFK%vbh@_>Z*RhBp zRgl7tz5DP8noDoSj+O20?Vgg7k|YZOA8%`G*7j2MQ`Kw&Xmq|xs9eXw!ouwuxc`i3 zrW3iG$TQ-m^gz};lt6V(zm3rHyLa!}KW1cHItkF24z9Xsy>QBwfCdHz;+gwx7BV%| z*SFp2AlmN~ZN5ihN~prNd4i`^UD$-=lN%GWUpWbzZ+Q0ZZIVh>yQf5TI#E!>kfsp@0zZFORiMjE!%w&6N=Ht|A%=dCxeYZ@twK(NPf9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Rj$}XeWHT9WqwRY-1z+S&%e;w*}0;lqhr;}FTb3=dK_YuekSU`qbU9#Bx17`Ag`L& P00000NkvXXu0mjfIJlGQ literal 0 HcmV?d00001 diff --git a/ButtonGraphics/Rewind.png b/ButtonGraphics/Rewind.png new file mode 100644 index 0000000000000000000000000000000000000000..af18729733d6fd0caa2577f5fd999cfbe5fac9d0 GIT binary patch literal 7902 zcmV<49wFh0P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc9&<@VK~#8N&7E72 zRmHu=w}U}Z5HNtupb`Nkh)M(#MI$6eVj*55AzGz*NS!<-=cMv*-cl7)m8zV#oSd9g zotLQb5(z436iqamNTj?3HAuK97d6NL1Bx;P&;&jIU$ejMH%+fSdxo1|)mPoCSFi4W zf8XkL+iUNAOzjhl;lqayI_8*TI!25b(LQ9zkO{{hfBa|L+uP5IRi^}p7zYQzu3)!u z>*mdyU)#HP@0#xJ?seO@Z{PgUM;~?W*s)_ztouab6JtmSUmGxBz`#+XMvWdbX3UH* zf%%be5;iwqW*4B2+ z=+UD)VkTT0yye(qk3BDnPuRcqV>C0PH={D)d!S<7?tlI3U$4Zhxhwe4mMvR4Km72+ zBR*}8xFInU&OH0{j%YjXT(xS|FJk7b zt(P4U92nJMK%5)e;;=L+@cl4iZVY^AGjYjlxhe&oca(%LrKNfT%hCROVa)xjSFiqQ z9L`q9xrX!5VMWg<4g=!QH0+#n&bc*=_*N_q$whRb^Ssl`l^2vR2~3*jonEfIqrTi7 z#@zO|zy0mjIF!AcRvaeu?EMg8@ZiA%V@AvyJ9g}kV^CvVKp=5N5XbBT%3)p(@>Ix$ zB^Be`)nnPq^SaQ%a`g3P;0G~d7VO%!>x25LLyE&igYy->t1(ySDbq zE3eezoRG>eLZtoN81*R%_59KoUwrY#F#N4lcn~;fLncg^F!^(z``o<|@VPDqV4yCD zn-Di)jpdkKwa7dOS2-*Jw3#!62*ma(5F-Vi`oI=T##le#3?hFQ&qNpx=hX%$Rll`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WV8X!Ytj>tH2%7i>GYCE-2f`oHHoi2KAfT%V^wHw$M zS80zeSg_!Gal^NvDu({zkQ*YzA!gu=88hZhnKI?aF_82Ll8dOkSQ5Ro?AyQ+TuA65 z=c4D!PHziDe{U{dzWfJEmMmEihromTHH8WsHbaECavFB|<(J>u-roMLSZw@jkJ3C} z61`LgwVfju(peJS%X~ZK>*$Uf;@jf>;?}q#d$(S8Sa8@40db;i3u7k5jQReUF=OV& zKpTHjnWtjDoR=wILY27AyiCiUM*Ht=+O+BZm=Qk>BUZ-+$00jcRAGP5M-Y=HO*(Vt z%$eT_WBB8k^j{?|Y%X?hX%(tOu1bOBcZ3mlKK=C5zgWF`_1b#b5y8jN96`j4IVNUI zN8AivJ9+ZtTjJ!;-(>XoX9mzpz8NaSuFCI@ll3brSFXG(ZW14g8PORtqP30=A&!b6 zj<|mr5ayg4=FA&EempOFPY$MMY`O5Q8j-^d0Jh9$+bh?vU%xm^SP&+xi2I4^-<&-H zIO>K7h!pn|1H+WjF>7YTA?>n}BS&5oC*AZz&%ymS1A+d`kO0U3opFJ%dE2&a&&46> zshAB*!i+6(-||6!%|6ul#28XSn8I(NcZ?l7wtdv7QM}&z*@+V;@&*jQq{lUsn*aa+ literal 0 HcmV?d00001 diff --git a/ButtonGraphics/Stop.png b/ButtonGraphics/Stop.png new file mode 100644 index 0000000000000000000000000000000000000000..28c7a0d1adda3b28c63f4974e69f9a9034e5e36b GIT binary patch literal 7747 zcmWkz2RNHu7>!b!+N)+_)vTG?N)U>gwQ3Vmv#Pe*BX;;v6t!DwE48b36;-us)vitL z_1}I^@+HrcC->g(z3+R@d(Oq^XseMCGZ8}|5HfWnLJxe}{d*JQgS-3hR0Hrq6X z0fCTE{d?p5n0<8#fv_B@BOV&~ycrBcJ2OvYuT_?o346h(2FtRdeCmaM6!VTKd0MS> zVLupqY~iKwirhbr>R8oBdEI9_o`Lj3a8T`o--hg}FYLXr-+J(^W%gY;aqB0_?(?g~ zAXsSBb@ftcy32h3b`(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+n_b`G4@RJW&bhhDp42_eSdeB^onc>b>> zZWeOVtnN>~ygc0xs+rlY#Ho_&UpEzp*b$`J$5VyRwR{XZ?t_I$(H)*$_6D7HvR(V3 z(dcIl)&9@?U0Wg0|SORLMb^4mJFsVEa3)_Wl9g4L1d0z~kh?7&LuOd*1L}%8r<5hU32G zgzF0Qv?&zpb2HcKe^XUg=UHhiu#;Iy(O)~uP58F4(bw(qFMbB>i@`U`L2dTf&~Wjcxj%wffBg!`tFGRc4YtsE z;f(t1X2c*G1L;XiPZt&v5Fiy26r7!%oTRAmRv_`+38%nv5=mwaj!aH6JVT?UXbJHw zfCJgfss8Mi4%v{? i6uYp4Ip^!UA#kRryYA?hmHhzcdE(EkCoMd_3P literal 0 HcmV?d00001 diff --git a/Demo High Level APIs.py b/Demo High Level APIs.py deleted file mode 100644 index 92bd53edc..000000000 --- a/Demo High Level APIs.py +++ /dev/null @@ -1,11 +0,0 @@ -import PySimpleGUI as sg - -sg.MsgBox('Title', 'My first message... Is the length the same?') -rc, number = sg.GetTextBox('Title goes here', 'Enter a number') -if not rc: - sg.MsgBoxError('You have cancelled') - exit(0) - -msg = '\n'.join([f'{i}' for i in range(0,int(number))]) - -sg.ScrolledTextBox(msg, height=10) \ No newline at end of file diff --git a/Demo Media Player.py b/Demo Media Player.py new file mode 100644 index 000000000..4770c90e2 --- /dev/null +++ b/Demo Media Player.py @@ -0,0 +1,60 @@ +import PySimpleGUI as sg + +# +# An Async Demonstration of a media player +# Uses button images for a super snazzy look +# See how it looks here: +# https://user-images.githubusercontent.com/13696193/43159403-45c9726e-8f50-11e8-9da0-0d272e20c579.jpg +# + + +def MediaPlayerGUI(): + + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # A text element that will be changed to display messages in the GUI + TextElem = sg.Text('', size=(20, 3), font=("Helvetica", 14)) + + # 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), + font=("Helvetica", 25)) + # define layout of the rows + layout= [[sg.Text('Media File Player', size=(20, 1), font=("Helvetica", 25))], + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0, + size=(10, 2), font=("Helvetica", 15)), sg.Text(' ' * 2), + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0, + font=("Helvetica", 15), size=(10, 2)), sg.Text(' ' * 2), + sg.ReadFormButton('Next', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0, + size=(10, 2), font=("Helvetica", 15)), sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0, + size=(10, 2), font=("Helvetica", 15))], + [sg.Text('Treble', font=("Helvetica", 15), size=(6, 1)), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), + sg.Text(' ' * 5), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1)), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15))], + ] + + # Call the same LayoutAndRead but indicate the form is non-blocking + form.LayoutAndRead(layout, non_blocking=True) + # Our event loop + while(True): + # Read the form (this call will not block) + button, values = form.ReadNonBlocking() + if button == 'Exit': + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + TextElem.Update(button) + +MediaPlayerGUI() + diff --git a/Demo NonBlocking Form.py b/Demo NonBlocking Form.py new file mode 100644 index 000000000..8e43d6dd8 --- /dev/null +++ b/Demo NonBlocking Form.py @@ -0,0 +1,59 @@ +import PySimpleGUI as sg +import time + +def main(): + StatusOutputExample() + +# form that doen't block +def StatusOutputExample_context_manager(): + with sg.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + + form.LayoutAndRead(form_rows, non_blocking=True) + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + +# form that doen't block +def StatusOutputExample(): + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +if __name__ == '__main__': + + main() diff --git a/__pycache__/PySimpleGUI.cpython-36.pyc b/__pycache__/PySimpleGUI.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19cd01373e01921ea2254dae97571284e134e56e GIT binary patch literal 54552 zcmdtL37j0qRX;xWwX?IQR;T5$t7CgSyEQA#Xm@5+ z(<^D$Gr8o%x#Tz(IWQp!A;jT^{7ncU3FIII2zP+~1u#hnm?J>o7lMK0_x--=={dBL zWrHD~|4LI`U0q#W_3G8DSMR-gwY|MPanH%4FSB0n_kGRR@YjX-UHFxEM|?izQ~p_> z<;OKJ>zfN$0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Z-HP1IM-LgIv&y^&9aKGkJUZ)V!#4Bo=v?F`<*V1~hG8GMn!gABgJ z;LjO6&EPK>$WB3SU(?)IrMdIRmDne`u6WKM(wSrbVZdas!FRf(;^f%0&mf$ zP&=S0nm2N0ii<^>Br*@pWx1>@Wl<)qsud}VXkQpDna&$H=A8tuFln*faHP2~o8x@o zE03aTMto(&Sk(2#f?$&`{1>RFrTytp61h49osp2_j(GX$y^MDazmUn}z8?q$Lcvrx z5{|{)lu*6o3u5)UBvbvJt2%o+*LU`IuE1|)=c?4r-5WbQI*)eV*qQ9?N%f^(;kz}J zP6m^xo%=784qY9>ef?iJiGQ)1W8qjdwmh0=9!F`>$cEozt zY>Hi(>R + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + + + --- # Known Issues @@ -1154,18 +1234,18 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.1.1 | July 18, 2018 - Global settings exposed, fixes | 2.2.0| July 20, 2018 - Image Elements, Print output | 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July XX, 2018 - Planned release. Button images. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. +New debug printing capability. `sg.Print` + ### Upcoming Make suggestions people! Future release features -Button images. Ability to replace boring rectangular buttons with your own images. - Columns. How multiple columns would be specified in the SDK interface are still being designed. Progress Meters - Replace custom meter with tkinter meter. @@ -1216,11 +1296,3 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. - - - - - - - - From a9266a22a7d4696d75031d72a875067e8c38c11b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 16:19:29 -0400 Subject: [PATCH 063/521] Initial Checkin --- PySimpleGUI_Logo_640.png | Bin 0 -> 26841 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 PySimpleGUI_Logo_640.png diff --git a/PySimpleGUI_Logo_640.png b/PySimpleGUI_Logo_640.png new file mode 100644 index 0000000000000000000000000000000000000000..0de414a322ad2b1f6b3d335e38039cba5447b0b0 GIT binary patch literal 26841 zcmeEtRaBh8((T~x8r)qH2<{#nf_n(=?iyTzTW|{@xVuAeceen+T?QFu?r{G5Ki%j1 zc4nv#E)5{xQYaQ{*uek&$iJTZb_Y*lP>h4#OJ2t*% zOib7EazxRNmDJ!?2^wq>lc$2X{!tg6BksZwJ!yYe!d4$1cX@OM(80iYS7iMF-511fRkRUmHqK0ShiHiQM{Q-chUNttt z`d~ofWxX~Ai5J%V?09mdVA8$yjJNmV>1{Vxpn_H`2|BfueQy`&w9giVlHPBy1G3;b z+*v=cf`53yq&9ny*qh`urzt0ZmP}37F&3qW>E$z$CfnQD)e?eV&9!;tZs995G*>N= zau42r|JfPjduZgxXS(^jJhWw~1>P`=-+0uuxE}Q{Q-3`%gvW>u7SpWM(yJWgjgCrkK>rgNQO z+2e!sLhXAfYU6Sz*{(V+2TTsF2vXxiZ&mw#YmrEd_@7t96yvj_Gk>=WN#zTSFhA2m zD`}G@?L?TJR*~81o%b+8#o-})11fFl{0$Ao(;bkK>qf!x_o;sBobAVVoXRIcfrgYq zXi}(qMTuN)Jao4nO}bgJVffNY-K0sts)Nbm=ugqUuXsW@i>mUO2ln?dyDI?BBo_i_^N3QZF7vw1TqVq4gVml$qOs31NOF5duBN#NX|j{8qz?55vDuXP5c=}gvat&I`$d3%bT zHB@_XV9yab(`wso%suqKb;UR_r8Da91&3`lzFfWG?6N$2RvOt7fwCA zzpjt~MNBf?b>4d?S_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No0Zb18ToXG!ezxfGvg1dyjf0sPjiKyW!|sY^4X7f6j59?y(9NDf=T7egLS0gx$R z^BtqCgay9a&E%gB8oMU4k1YIQzY%;v000Pt0JcL}<;;N2@rTVNr<~s}fh}O`iE;N6 z;x*$}?W#R@*d349o(nE`cA-luj@?rM0I)Isf&Lq2SMB#SAEGcj%F7@jC)4?=0_hDV z3i;&_Sb!j}+4i|U#5__=WoDY*iIz|LfF@Xq(>dM+m;5VPX F{U6S=p0xk~ literal 0 HcmV?d00001 From a89f838a40924e207770d071de348ebf242bc47c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 16:21:09 -0400 Subject: [PATCH 064/521] Removed --- __pycache__/PySimpleGUI.cpython-36.pyc | Bin 54552 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 __pycache__/PySimpleGUI.cpython-36.pyc diff --git a/__pycache__/PySimpleGUI.cpython-36.pyc b/__pycache__/PySimpleGUI.cpython-36.pyc deleted file mode 100644 index 19cd01373e01921ea2254dae97571284e134e56e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54552 zcmdtL37j0qRX;xWwX?IQR;T5$t7CgSyEQA#Xm@5+ z(<^D$Gr8o%x#Tz(IWQp!A;jT^{7ncU3FIII2zP+~1u#hnm?J>o7lMK0_x--=={dBL zWrHD~|4LI`U0q#W_3G8DSMR-gwY|MPanH%4FSB0n_kGRR@YjX-UHFxEM|?izQ~p_> z<;OKJ>zfN$0YB4%hzG5p#Qn3OLfDE(&Zxzwq1o76+={zT6IMc=wOMU)O{@szi2$`c}42by_RcKU=HRzgVl)|FzbrZ(D2C zzgp{ZYgA&jFSkzlR{LfG>O1P+a%&mStyWQ{xObAvyIZ9;^4UzpxwOu2;`m zS2mYtrQLh?ed{Xq@74zOAJ#_H?dqJraE*1X>bI^_o2={A4cUIAZenWo285ff8xd}? zZc>}At%%)hZBsW|+Y#Gg-J-TwJ0;Jp>LzQK+G^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)lu*6o3u5)UBvbvJt2%o+*LU`IuE1|)=c?4r-5WbQI*)eV*qQ9?N%f^(;kz}J zP6m^xo%=784qY9>ef?iJiGQ)1W8qjdwmh0=9!F`>$cEozt zY>Hi(>R Date: Tue, 24 Jul 2018 17:01:11 -0400 Subject: [PATCH 065/521] Updated logo --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 4d20c02d1..343d06dee 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,5 @@ -![logo01 2 _2](https://user-images.githubusercontent.com/13696193/43082437-1252511a-8e62-11e8-9150-fc227cc56cfe.png) - +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI (Ver 2.4) From 5af691c029ad6c4cb688d2eaf34369813d2567f0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 17:02:58 -0400 Subject: [PATCH 066/521] Logo --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 343d06dee..bef49c49f 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,6 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI (Ver 2.4) From 892adf86eebb9108f38d46b8b79ff23b29c1e1cb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 17:09:41 -0400 Subject: [PATCH 067/521] readme --- readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index bef49c49f..df5277239 100644 --- a/readme.md +++ b/readme.md @@ -5,8 +5,9 @@ # PySimpleGUI (Ver 2.4) -This really is a simple GUI, but also powerfully customizable. +Super-simple GUI to grasp... Powerfully customizable. +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. import PySimpleGUI as sg From a723b6f4638945be3628d11ad08838ef2c5685fe Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 17:15:47 -0400 Subject: [PATCH 068/521] Button Image example --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index df5277239..6da4b2198 100644 --- a/readme.md +++ b/readme.md @@ -925,6 +925,14 @@ Three parameters are used for button images. image_size - Size of image file in pixels image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 +Here's an example form made with button images. +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. From 13d99dcd75c385cf4c70a77c0cf673ba9b50334b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 24 Jul 2018 17:44:23 -0400 Subject: [PATCH 069/521] Tabbed forms example and explanation --- Demo Tabbed Form.py | 89 +++++++++++++++++++++++++++++++++++++++++++++ readme.md | 14 ++++++- 2 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 Demo Tabbed Form.py diff --git a/Demo Tabbed Form.py b/Demo Tabbed Form.py new file mode 100644 index 000000000..305202ebb --- /dev/null +++ b/Demo Tabbed Form.py @@ -0,0 +1,89 @@ +import PySimpleGUI as sg + +MAX_NUMBER_OF_THREADS = 12 + +def eBaySuperSearcherGUI(): + # Drop Down list of options + configs = ('0 - Gruen - Started 2 days ago in Watches', + '1 - Gruen - Currently Active in Watches', + '2 - Alpina - Currently Active in Jewelry', + '3 - Gruen - Ends in 1 day in Watches', + '4 - Gruen - Completed in Watches', + '5 - Gruen - Advertising', + '6 - Gruen - Currently Active in Jewelry', + '7 - Gruen - Price Test', + '8 - Gruen - No brand name specified') + + us_categories = ('Use Default with no change', + 'All - 1', + 'Jewelry - 281', + ' Watches - 14324', + ' Wristwatches - 31387', + ' Pocket Watches - 3937', + 'Advertising - 34', + ' Watch Ads - 165254' + ) + + german_categories =('Use Default with no change', + 'All - 1', + 'Jewelry - 281', + ' Watches - 14324', + ' Wristwatches - 31387', + ' Pocket Watches - 3937', + 'Advertising - 1', + ' Watch Ads - 19823' + ) + + + # the form layout + with sg.FlexForm('EBay Super Searcher', auto_size_text=True) as form: + with sg.FlexForm('EBay Super Searcher') as form2: + layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], + [sg.Text('Choose base configuration to run')], + [sg.InputCombo(configs)], + [sg.Text('_'*100, size=(80,1))], + [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], + [sg.InputText(),sg.Text('Custom text to add to folder name')], + [sg.Text('_'*100, size=(80,1))], + [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], + [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Text('Time Filters')], + [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue')), sg.Text(f'{MAX_NUMBER_OF_THREADS} Threads will be started')]] + + + # First category is default (need to special case this) + layout_tab_2 = [[sg.Text('Choose Category')], + [sg.Text('US Categories'),sg.Text('German Categories')], + [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] + + for i,cat in enumerate(us_categories): + if i == 0: continue # skip first one + layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) + + + layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) + layout_tab_2.append([sg.Text('US Search String Override')]) + layout_tab_2.append([sg.InputText(size=(100,1))]) + layout_tab_2.append([sg.Text('German Search String Override')]) + layout_tab_2.append([sg.InputText(size=(100,1))]) + layout_tab_2.append([sg.Text('Typical US Search String')]) + layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) + layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) + layout_tab_2.append([sg.Submit(button_color=('red', 'yellow'),auto_size_text=True), sg.Cancel(button_color=('white', 'blue'), auto_size_text=True)]) + + results =sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) + + return results + + +if __name__ == '__main__': + results = eBaySuperSearcherGUI() + print(results) + sg.MsgBox('Results', results) \ No newline at end of file diff --git a/readme.md b/readme.md index 6da4b2198..6da141ebd 100644 --- a/readme.md +++ b/readme.md @@ -1023,9 +1023,18 @@ Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label')) + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a label shown on the tab)` ## Global Settings **Global Settings** @@ -1305,3 +1314,4 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + From 2109bdbc97a464c123e0721c26741e35dd56592e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 25 Jul 2018 06:40:14 -0400 Subject: [PATCH 070/521] Renamed demo files, new demo of tabbed forms Changed filenames to remove spaces so will be easier to work with on Linux. --- Demo_Color.py | 1729 +++++++++++++++++++++++++++++++++++ Demo_Compare_Files.py | 33 + Demo_DisplayHash1and256.py | 123 +++ Demo_DuplicateFileFinder.py | 57 ++ Demo_GoodColors.py | 50 + Demo_HowDoI.py | 55 ++ Demo_Media_Player.py | 64 ++ Demo_NonBlocking_Form.py | 59 ++ Demo_Recipes.py | 168 ++++ Demo_Tabbed_Form.py | 89 ++ 10 files changed, 2427 insertions(+) create mode 100644 Demo_Color.py create mode 100644 Demo_Compare_Files.py create mode 100644 Demo_DisplayHash1and256.py create mode 100644 Demo_DuplicateFileFinder.py create mode 100644 Demo_GoodColors.py create mode 100644 Demo_HowDoI.py create mode 100644 Demo_Media_Player.py create mode 100644 Demo_NonBlocking_Form.py create mode 100644 Demo_Recipes.py create mode 100644 Demo_Tabbed_Form.py diff --git a/Demo_Color.py b/Demo_Color.py new file mode 100644 index 000000000..142b19cba --- /dev/null +++ b/Demo_Color.py @@ -0,0 +1,1729 @@ +import PySimpleGUI as g + +MY_WINDOW_ICON = 'E:\\TheRealMyDocs\\Icons\\The Planets\\jupiter.ico' +reverse = {} +colorhex = {} + +colors = { + "abbey" : ( 76, 79, 86), + "acadia" : ( 27, 20, 4), + "acapulco" : (124, 176, 161), + "aero blue" : (201, 255, 229), + "affair" : (113, 70, 147), + "akaroa" : (212, 196, 168), + "alabaster" : (250, 250, 250), + "albescent white" : (245, 233, 211), + "algae green" : (147, 223, 184), + "alice blue" : (240, 248, 255), + "alizarin crimson" : (227, 38, 54), + "allports" : ( 0, 118, 163), + "almond" : (238, 217, 196), + "almond frost" : (144, 123, 113), + "alpine" : (175, 143, 44), + "alto" : (219, 219, 219), + "aluminium" : (169, 172, 182), + "amaranth" : (229, 43, 80), + "amazon" : ( 59, 122, 87), + "amber" : (255, 191, 0), + "americano" : (135, 117, 110), + "amethyst" : (153, 102, 204), + "amethyst smoke" : (163, 151, 180), + "amour" : (249, 234, 243), + "amulet" : (123, 159, 128), + "anakiwa" : (157, 229, 255), + "antique brass" : (200, 138, 101), + "antique bronze" : (112, 74, 7), + "anzac" : (224, 182, 70), + "apache" : (223, 190, 111), + "apple" : ( 79, 168, 61), + "apple blossom" : (175, 77, 67), + "apple green" : (226, 243, 236), + "apricot" : (235, 147, 115), + "apricot peach" : (251, 206, 177), + "apricot white" : (255, 254, 236), + "aqua deep" : ( 1, 75, 67), + "aqua forest" : ( 95, 167, 119), + "aqua haze" : (237, 245, 245), + "aqua island" : (161, 218, 215), + "aqua spring" : (234, 249, 245), + "aqua squeeze" : (232, 245, 242), + "aquamarine" : (127, 255, 212), + "aquamarine blue" : (113, 217, 226), + "arapawa" : ( 17, 12, 108), + "armadillo" : ( 67, 62, 55), + "arrowtown" : (148, 135, 113), + "ash" : (198, 195, 181), + "asparagus" : (123, 160, 91), + "asphalt" : ( 19, 10, 6), + "astra" : (250, 234, 185), + "astral" : ( 50, 125, 160), + "astronaut" : ( 40, 58, 119), + "astronaut blue" : ( 1, 62, 98), + "athens gray" : (238, 240, 243), + "aths special" : (236, 235, 206), + "atlantis" : (151, 205, 45), + "atoll" : ( 10, 111, 117), + "atomic tangerine" : (255, 153, 102), + "au chico" : (151, 96, 93), + "aubergine" : ( 59, 9, 16), + "australian mint" : (245, 255, 190), + "avocado" : (136, 141, 101), + "axolotl" : ( 78, 102, 73), + "azalea" : (247, 200, 218), + "aztec" : ( 13, 28, 25), + "azure" : ( 49, 91, 161), + "azure radiance" : ( 0, 127, 255), + "baby blue" : (224, 255, 255), + "bahama blue" : ( 2, 99, 149), + "bahia" : (165, 203, 12), + "baja white" : (255, 248, 209), + "bali hai" : (133, 159, 175), + "baltic sea" : ( 42, 38, 48), + "bamboo" : (218, 99, 4), + "banana mania" : (251, 231, 178), + "bandicoot" : (133, 132, 112), + "barberry" : (222, 215, 23), + "barley corn" : (166, 139, 91), + "barley white" : (255, 244, 206), + "barossa" : ( 68, 1, 45), + "bastille" : ( 41, 33, 48), + "battleship gray" : (130, 143, 114), + "bay leaf" : (125, 169, 141), + "bay of many" : ( 39, 58, 129), + "bazaar" : (152, 119, 123), + "bean " : ( 61, 12, 2), + "beauty bush" : (238, 193, 190), + "beaver" : (146, 111, 91), + "beeswax" : (254, 242, 199), + "beige" : (245, 245, 220), + "bermuda" : (125, 216, 198), + "bermuda gray" : (107, 139, 162), + "beryl green" : (222, 229, 192), + "bianca" : (252, 251, 243), + "big stone" : ( 22, 42, 64), + "bilbao" : ( 50, 124, 20), + "biloba flower" : (178, 161, 234), + "birch" : ( 55, 48, 33), + "bird flower" : (212, 205, 22), + "biscay" : ( 27, 49, 98), + "bismark" : ( 73, 113, 131), + "bison hide" : (193, 183, 164), + "bistre" : ( 61, 43, 31), + "bitter" : (134, 137, 116), + "bitter lemon" : (202, 224, 13), + "bittersweet" : (254, 111, 94), + "bizarre" : (238, 222, 218), + "black" : ( 0, 0, 0), + "black bean" : ( 8, 25, 16), + "black forest" : ( 11, 19, 4), + "black haze" : (246, 247, 247), + "black marlin" : ( 62, 44, 28), + "black olive" : ( 36, 46, 22), + "black pearl" : ( 4, 19, 34), + "black rock" : ( 13, 3, 50), + "black rose" : (103, 3, 45), + "black russian" : ( 10, 0, 28), + "black squeeze" : (242, 250, 250), + "black white" : (255, 254, 246), + "blackberry" : ( 77, 1, 53), + "blackcurrant" : ( 50, 41, 58), + "blaze orange" : (255, 102, 0), + "bleach white" : (254, 243, 216), + "bleached cedar" : ( 44, 33, 51), + "blizzard blue" : (163, 227, 237), + "blossom" : (220, 180, 188), + "blue" : ( 0, 0, 255), + "blue bayoux" : ( 73, 102, 121), + "blue bell" : (153, 153, 204), + "blue chalk" : (241, 233, 255), + "blue charcoal" : ( 1, 13, 26), + "blue chill" : ( 12, 137, 144), + "blue diamond" : ( 56, 4, 116), + "blue dianne" : ( 32, 72, 82), + "blue gem" : ( 44, 14, 140), + "blue haze" : (191, 190, 216), + "blue lagoon" : ( 1, 121, 135), + "blue marguerite" : (118, 102, 198), + "blue ribbon" : ( 0, 102, 255), + "blue romance" : (210, 246, 222), + "blue smoke" : (116, 136, 129), + "blue stone" : ( 1, 97, 98), + "blue violet" : (100, 86, 183), + "blue whale" : ( 4, 46, 76), + "blue zodiac" : ( 19, 38, 77), + "blumine" : ( 24, 88, 122), + "blush" : (180, 70, 104), + "blush pink" : (255, 111, 255), + "bombay" : (175, 177, 184), + "bon jour" : (229, 224, 225), + "bondi blue" : ( 0, 149, 182), + "bone" : (228, 209, 192), + "bordeaux" : ( 92, 1, 32), + "bossanova" : ( 78, 42, 90), + "boston blue" : ( 59, 145, 180), + "botticelli" : (199, 221, 229), + "bottle green" : ( 9, 54, 36), + "boulder" : (122, 122, 122), + "bouquet" : (174, 128, 158), + "bourbon" : (186, 111, 30), + "bracken" : ( 74, 42, 4), + "brandy" : (222, 193, 150), + "brandy punch" : (205, 132, 41), + "brandy rose" : (187, 137, 131), + "breaker bay" : ( 93, 161, 159), + "brick red" : (198, 45, 66), + "bridal heath" : (255, 250, 244), + "bridesmaid" : (254, 240, 236), + "bright gray" : ( 60, 65, 81), + "bright green" : (102, 255, 0), + "bright red" : (177, 0, 0), + "bright sun" : (254, 211, 60), + "bright turquoise" : ( 8, 232, 222), + "brilliant rose" : (246, 83, 166), + "brink pink" : (251, 96, 127), + "bronco" : (171, 161, 150), + "bronze" : ( 63, 33, 9), + "bronze olive" : ( 78, 66, 12), + "bronzetone" : ( 77, 64, 15), + "broom" : (255, 236, 19), + "brown" : (150, 75, 0), + "brown bramble" : ( 89, 40, 4), + "brown derby" : ( 73, 38, 21), + "brown pod" : ( 64, 24, 1), + "brown rust" : (175, 89, 62), + "brown tumbleweed" : ( 55, 41, 14), + "bubbles" : (231, 254, 255), + "buccaneer" : ( 98, 47, 48), + "bud" : (168, 174, 156), + "buddha gold" : (193, 160, 4), + "buff" : (240, 220, 130), + "bulgarian rose" : ( 72, 6, 7), + "bull shot" : (134, 77, 30), + "bunker" : ( 13, 17, 23), + "bunting" : ( 21, 31, 76), + "burgundy" : (144, 0, 32), + "burnham" : ( 0, 46, 32), + "burning orange" : (255, 112, 52), + "burning sand" : (217, 147, 118), + "burnt maroon" : ( 66, 3, 3), + "burnt orange" : (204, 85, 0), + "burnt sienna" : (233, 116, 81), + "burnt umber" : (138, 51, 36), + "bush" : ( 13, 46, 28), + "buttercup" : (243, 173, 22), + "buttered rum" : (161, 117, 13), + "butterfly bush" : ( 98, 78, 154), + "buttermilk" : (255, 241, 181), + "buttery white" : (255, 252, 234), + "cab sav" : ( 77, 10, 24), + "cabaret" : (217, 73, 114), + "cabbage pont" : ( 63, 76, 58), + "cactus" : ( 88, 113, 86), + "cadet blue" : (169, 178, 195), + "cadillac" : (176, 76, 106), + "cafe royale" : (111, 68, 12), + "calico" : (224, 192, 149), + "california" : (254, 157, 4), + "calypso" : ( 49, 114, 141), + "camarone" : ( 0, 88, 26), + "camelot" : (137, 52, 86), + "cameo" : (217, 185, 155), + "camouflage" : ( 60, 57, 16), + "camouflage green" : (120, 134, 107), + "can can" : (213, 145, 164), + "canary" : (243, 251, 98), + "candlelight" : (252, 217, 23), + "candy corn" : (251, 236, 93), + "cannon black" : ( 37, 23, 6), + "cannon pink" : (137, 67, 103), + "cape cod" : ( 60, 68, 67), + "cape honey" : (254, 229, 172), + "cape palliser" : (162, 102, 69), + "caper" : (220, 237, 180), + "caramel" : (255, 221, 175), + "cararra" : (238, 238, 232), + "cardin green" : ( 1, 54, 28), + "cardinal" : (196, 30, 58), + "cardinal pink" : (140, 5, 94), + "careys pink" : (210, 158, 170), + "caribbean green" : ( 0, 204, 153), + "carissma" : (234, 136, 168), + "carla" : (243, 255, 216), + "carmine" : (150, 0, 24), + "carnaby tan" : ( 92, 46, 1), + "carnation" : (249, 90, 97), + "carnation pink" : (255, 166, 201), + "carousel pink" : (249, 224, 237), + "carrot orange" : (237, 145, 33), + "casablanca" : (248, 184, 83), + "casal" : ( 47, 97, 104), + "cascade" : (139, 169, 165), + "cashmere" : (230, 190, 165), + "casper" : (173, 190, 209), + "castro" : ( 82, 0, 31), + "catalina blue" : ( 6, 42, 120), + "catskill white" : (238, 246, 247), + "cavern pink" : (227, 190, 190), + "cedar" : ( 62, 28, 20), + "cedar wood finish" : (113, 26, 0), + "celadon" : (172, 225, 175), + "celery" : (184, 194, 93), + "celeste" : (209, 210, 202), + "cello" : ( 30, 56, 91), + "celtic" : ( 22, 50, 34), + "cement" : (141, 118, 98), + "ceramic" : (252, 255, 249), + "cerise" : (218, 50, 135), + "cerise red" : (222, 49, 99), + "cerulean" : ( 2, 164, 211), + "cerulean blue" : ( 42, 82, 190), + "chablis" : (255, 244, 243), + "chalet green" : ( 81, 110, 61), + "chalky" : (238, 215, 148), + "chambray" : ( 53, 78, 140), + "chamois" : (237, 220, 177), + "champagne" : (250, 236, 204), + "chantilly" : (248, 195, 223), + "charade" : ( 41, 41, 55), + "chardon" : (255, 243, 241), + "chardonnay" : (255, 205, 140), + "charlotte" : (186, 238, 249), + "charm" : (212, 116, 148), + "chartreuse" : (127, 255, 0), + "chartreuse yellow" : (223, 255, 0), + "chateau green" : ( 64, 168, 96), + "chatelle" : (189, 179, 199), + "chathams blue" : ( 23, 85, 121), + "chelsea cucumber" : (131, 170, 93), + "chelsea gem" : (158, 83, 2), + "chenin" : (223, 205, 111), + "cherokee" : (252, 218, 152), + "cherry pie" : ( 42, 3, 89), + "cherrywood" : (101, 26, 20), + "cherub" : (248, 217, 233), + "chestnut" : (185, 78, 72), + "chestnut rose" : (205, 92, 92), + "chetwode blue" : (133, 129, 217), + "chicago" : ( 93, 92, 88), + "chiffon" : (241, 255, 200), + "chilean fire" : (247, 119, 3), + "chilean heath" : (255, 253, 230), + "china ivory" : (252, 255, 231), + "chino" : (206, 199, 167), + "chinook" : (168, 227, 189), + "chocolate" : ( 55, 2, 2), + "christalle" : ( 51, 3, 107), + "christi" : (103, 167, 18), + "christine" : (231, 115, 10), + "chrome white" : (232, 241, 212), + "cinder" : ( 14, 14, 24), + "cinderella" : (253, 225, 220), + "cinnabar" : (227, 66, 52), + "cinnamon" : (123, 63, 0), + "cioccolato" : ( 85, 40, 12), + "citrine white" : (250, 247, 214), + "citron" : (158, 169, 31), + "citrus" : (161, 197, 10), + "clairvoyant" : ( 72, 6, 86), + "clam shell" : (212, 182, 175), + "claret" : (127, 23, 52), + "classic rose" : (251, 204, 231), + "clay ash" : (189, 200, 179), + "clay creek" : (138, 131, 96), + "clear day" : (233, 255, 253), + "clementine" : (233, 110, 0), + "clinker" : ( 55, 29, 9), + "cloud" : (199, 196, 191), + "cloud burst" : ( 32, 46, 84), + "cloudy" : (172, 165, 159), + "clover" : ( 56, 73, 16), + "cobalt" : ( 0, 71, 171), + "cocoa bean" : ( 72, 28, 28), + "cocoa brown" : ( 48, 31, 30), + "coconut cream" : (248, 247, 220), + "cod gray" : ( 11, 11, 11), + "coffee" : (112, 101, 85), + "coffee bean" : ( 42, 20, 14), + "cognac" : (159, 56, 29), + "cola" : ( 63, 37, 0), + "cold purple" : (171, 160, 217), + "cold turkey" : (206, 186, 186), + "colonial white" : (255, 237, 188), + "comet" : ( 92, 93, 117), + "como" : ( 81, 124, 102), + "conch" : (201, 217, 210), + "concord" : (124, 123, 122), + "concrete" : (242, 242, 242), + "confetti" : (233, 215, 90), + "congo brown" : ( 89, 55, 55), + "congress blue" : ( 2, 71, 142), + "conifer" : (172, 221, 77), + "contessa" : (198, 114, 107), + "copper" : (184, 115, 51), + "copper canyon" : (126, 58, 21), + "copper rose" : (153, 102, 102), + "copper rust" : (148, 71, 71), + "copperfield" : (218, 138, 103), + "coral" : (255, 127, 80), + "coral red" : (255, 64, 64), + "coral reef" : (199, 188, 162), + "coral tree" : (168, 107, 107), + "corduroy" : ( 96, 110, 104), + "coriander" : (196, 208, 176), + "cork" : ( 64, 41, 29), + "corn" : (231, 191, 5), + "corn field" : (248, 250, 205), + "corn harvest" : (139, 107, 11), + "cornflower" : (147, 204, 234), + "cornflower blue" : (100, 149, 237), + "cornflower lilac" : (255, 176, 172), + "corvette" : (250, 211, 162), + "cosmic" : (118, 57, 93), + "cosmos" : (255, 216, 217), + "costa del sol" : ( 97, 93, 48), + "cotton candy" : (255, 183, 213), + "cotton seed" : (194, 189, 182), + "county green" : ( 1, 55, 26), + "cowboy" : ( 77, 40, 45), + "crail" : (185, 81, 64), + "cranberry" : (219, 80, 121), + "crater brown" : ( 70, 36, 37), + "cream" : (255, 253, 208), + "cream brulee" : (255, 229, 160), + "cream can" : (245, 200, 92), + "creole" : ( 30, 15, 4), + "crete" : (115, 120, 41), + "crimson" : (220, 20, 60), + "crocodile" : (115, 109, 88), + "crown of thorns" : (119, 31, 31), + "crowshead" : ( 28, 18, 8), + "cruise" : (181, 236, 223), + "crusoe" : ( 0, 72, 22), + "crusta" : (253, 123, 51), + "cumin" : (146, 67, 33), + "cumulus" : (253, 255, 213), + "cupid" : (251, 190, 218), + "curious blue" : ( 37, 150, 209), + "cutty sark" : ( 80, 118, 114), + "cyan / aqua" : ( 0, 255, 255), + "cyprus" : ( 0, 62, 64), + "daintree" : ( 1, 39, 49), + "dairy cream" : (249, 228, 188), + "daisy bush" : ( 79, 35, 152), + "dallas" : (110, 75, 38), + "dandelion" : (254, 216, 93), + "danube" : ( 96, 147, 209), + "dark blue" : ( 0, 0, 200), + "dark burgundy" : (119, 15, 5), + "dark ebony" : ( 60, 32, 5), + "dark fern" : ( 10, 72, 13), + "dark tan" : (102, 16, 16), + "dawn" : (166, 162, 154), + "dawn pink" : (243, 233, 229), + "de york" : (122, 196, 136), + "deco" : (210, 218, 151), + "deep blue" : ( 34, 8, 120), + "deep blush" : (228, 118, 152), + "deep bronze" : ( 74, 48, 4), + "deep cerulean" : ( 0, 123, 167), + "deep cove" : ( 5, 16, 64), + "deep fir" : ( 0, 41, 0), + "deep forest green" : ( 24, 45, 9), + "deep koamaru" : ( 27, 18, 123), + "deep oak" : ( 65, 32, 16), + "deep sapphire" : ( 8, 37, 103), + "deep sea" : ( 1, 130, 107), + "deep sea green" : ( 9, 88, 89), + "deep teal" : ( 0, 53, 50), + "del rio" : (176, 154, 149), + "dell" : ( 57, 100, 19), + "delta" : (164, 164, 157), + "deluge" : (117, 99, 168), + "denim" : ( 21, 96, 189), + "derby" : (255, 238, 216), + "desert" : (174, 96, 32), + "desert sand" : (237, 201, 175), + "desert storm" : (248, 248, 247), + "dew" : (234, 255, 254), + "di serria" : (219, 153, 94), + "diesel" : ( 19, 0, 0), + "dingley" : ( 93, 119, 71), + "disco" : (135, 21, 80), + "dixie" : (226, 148, 24), + "dodger blue" : ( 30, 144, 255), + "dolly" : (249, 255, 139), + "dolphin" : (100, 96, 119), + "domino" : (142, 119, 94), + "don juan" : ( 93, 76, 81), + "donkey brown" : (166, 146, 121), + "dorado" : (107, 87, 85), + "double colonial white" : (238, 227, 173), + "double pearl lusta" : (252, 244, 208), + "double spanish white" : (230, 215, 185), + "dove gray" : (109, 108, 108), + "downriver" : ( 9, 34, 86), + "downy" : (111, 208, 197), + "driftwood" : (175, 135, 81), + "drover" : (253, 247, 173), + "dull lavender" : (168, 153, 230), + "dune" : ( 56, 53, 51), + "dust storm" : (229, 204, 201), + "dusty gray" : (168, 152, 155), + "eagle" : (182, 186, 164), + "earls green" : (201, 185, 59), + "early dawn" : (255, 249, 230), + "east bay" : ( 65, 76, 125), + "east side" : (172, 145, 206), + "eastern blue" : ( 30, 154, 176), + "ebb" : (233, 227, 227), + "ebony" : ( 12, 11, 29), + "ebony clay" : ( 38, 40, 59), + "eclipse" : ( 49, 28, 23), + "ecru white" : (245, 243, 229), + "ecstasy" : (250, 120, 20), + "eden" : ( 16, 88, 82), + "edgewater" : (200, 227, 215), + "edward" : (162, 174, 171), + "egg sour" : (255, 244, 221), + "egg white" : (255, 239, 193), + "eggplant" : ( 97, 64, 81), + "el paso" : ( 30, 23, 8), + "el salva" : (143, 62, 51), + "electric lime" : (204, 255, 0), + "electric violet" : (139, 0, 255), + "elephant" : ( 18, 52, 71), + "elf green" : ( 8, 131, 112), + "elm" : ( 28, 124, 125), + "emerald" : ( 80, 200, 120), + "eminence" : (108, 48, 130), + "emperor" : ( 81, 70, 73), + "empress" : (129, 115, 119), + "endeavour" : ( 0, 86, 167), + "energy yellow" : (248, 221, 92), + "english holly" : ( 2, 45, 21), + "english walnut" : ( 62, 43, 35), + "envy" : (139, 166, 144), + "equator" : (225, 188, 100), + "espresso" : ( 97, 39, 24), + "eternity" : ( 33, 26, 14), + "eucalyptus" : ( 39, 138, 91), + "eunry" : (207, 163, 157), + "evening sea" : ( 2, 78, 70), + "everglade" : ( 28, 64, 46), + "faded jade" : ( 66, 121, 119), + "fair pink" : (255, 239, 236), + "falcon" : (127, 98, 109), + "fall green" : (236, 235, 189), + "falu red" : (128, 24, 24), + "fantasy" : (250, 243, 240), + "fedora" : (121, 106, 120), + "feijoa" : (159, 221, 140), + "fern" : ( 99, 183, 108), + "fern frond" : (101, 114, 32), + "fern green" : ( 79, 121, 66), + "ferra" : (112, 79, 80), + "festival" : (251, 233, 108), + "feta" : (240, 252, 234), + "fiery orange" : (179, 82, 19), + "finch" : ( 98, 102, 73), + "finlandia" : ( 85, 109, 86), + "finn" : (105, 45, 84), + "fiord" : ( 64, 81, 105), + "fire" : (170, 66, 3), + "fire bush" : (232, 153, 40), + "firefly" : ( 14, 42, 48), + "flame pea" : (218, 91, 56), + "flamenco" : (255, 125, 7), + "flamingo" : (242, 85, 42), + "flax" : (238, 220, 130), + "flax smoke" : (123, 130, 101), + "flesh" : (255, 203, 164), + "flint" : (111, 106, 97), + "flirt" : (162, 0, 109), + "flush mahogany" : (202, 52, 53), + "flush orange" : (255, 127, 0), + "foam" : (216, 252, 250), + "fog" : (215, 208, 255), + "foggy gray" : (203, 202, 182), + "forest green" : ( 34, 139, 34), + "forget me not" : (255, 241, 238), + "fountain blue" : ( 86, 180, 190), + "frangipani" : (255, 222, 179), + "french gray" : (189, 189, 198), + "french lilac" : (236, 199, 238), + "french pass" : (189, 237, 253), + "french rose" : (246, 74, 138), + "fresh eggplant" : (153, 0, 102), + "friar gray" : (128, 126, 121), + "fringy flower" : (177, 226, 193), + "froly" : (245, 117, 132), + "frost" : (237, 245, 221), + "frosted mint" : (219, 255, 248), + "frostee" : (228, 246, 231), + "fruit salad" : ( 79, 157, 93), + "fuchsia blue" : (122, 88, 193), + "fuchsia pink" : (193, 84, 193), + "fuego" : (190, 222, 13), + "fuel yellow" : (236, 169, 39), + "fun blue" : ( 25, 89, 168), + "fun green" : ( 1, 109, 57), + "fuscous gray" : ( 84, 83, 77), + "fuzzy wuzzy brown" : (196, 86, 85), + "gable green" : ( 22, 53, 49), + "gallery" : (239, 239, 239), + "galliano" : (220, 178, 12), + "gamboge" : (228, 155, 15), + "geebung" : (209, 143, 27), + "genoa" : ( 21, 115, 107), + "geraldine" : (251, 137, 137), + "geyser" : (212, 223, 226), + "ghost" : (199, 201, 213), + "gigas" : ( 82, 60, 148), + "gimblet" : (184, 181, 106), + "gin" : (232, 242, 235), + "gin fizz" : (255, 249, 226), + "givry" : (248, 228, 191), + "glacier" : (128, 179, 196), + "glade green" : ( 97, 132, 95), + "go ben" : (114, 109, 78), + "goblin" : ( 61, 125, 82), + "gold" : (255, 215, 0), + "gold drop" : (241, 130, 0), + "gold sand" : (230, 190, 138), + "gold tips" : (222, 186, 19), + "golden bell" : (226, 137, 19), + "golden dream" : (240, 213, 45), + "golden fizz" : (245, 251, 61), + "golden glow" : (253, 226, 149), + "golden grass" : (218, 165, 32), + "golden sand" : (240, 219, 125), + "golden tainoi" : (255, 204, 92), + "goldenrod" : (252, 214, 103), + "gondola" : ( 38, 20, 20), + "gordons green" : ( 11, 17, 7), + "gorse" : (255, 241, 79), + "gossamer" : ( 6, 155, 129), + "gossip" : (210, 248, 176), + "gothic" : (109, 146, 161), + "governor bay" : ( 47, 60, 179), + "grain brown" : (228, 213, 183), + "grandis" : (255, 211, 140), + "granite green" : (141, 137, 116), + "granny apple" : (213, 246, 227), + "granny smith" : (132, 160, 160), + "granny smith apple" : (157, 224, 147), + "grape" : ( 56, 26, 81), + "graphite" : ( 37, 22, 7), + "gravel" : ( 74, 68, 75), + "gray" : (128, 128, 128), + "gray asparagus" : ( 70, 89, 69), + "gray chateau" : (162, 170, 179), + "gray nickel" : (195, 195, 189), + "gray nurse" : (231, 236, 230), + "gray olive" : (169, 164, 145), + "gray suit" : (193, 190, 205), + "green" : ( 0, 255, 0), + "green haze" : ( 1, 163, 104), + "green house" : ( 36, 80, 15), + "green kelp" : ( 37, 49, 28), + "green leaf" : ( 67, 106, 13), + "green mist" : (203, 211, 176), + "green pea" : ( 29, 97, 66), + "green smoke" : (164, 175, 110), + "green spring" : (184, 193, 177), + "green vogue" : ( 3, 43, 82), + "green waterloo" : ( 16, 20, 5), + "green white" : (232, 235, 224), + "green yellow" : (173, 255, 47), + "grenadier" : (213, 70, 0), + "guardsman red" : (186, 1, 1), + "gulf blue" : ( 5, 22, 87), + "gulf stream" : (128, 179, 174), + "gull gray" : (157, 172, 183), + "gum leaf" : (182, 211, 191), + "gumbo" : (124, 161, 166), + "gun powder" : ( 65, 66, 87), + "gunsmoke" : (130, 134, 133), + "gurkha" : (154, 149, 119), + "hacienda" : (152, 129, 27), + "hairy heath" : (107, 42, 20), + "haiti" : ( 27, 16, 53), + "half baked" : (133, 196, 204), + "half colonial white" : (253, 246, 211), + "half dutch white" : (254, 247, 222), + "half spanish white" : (254, 244, 219), + "half and half" : (255, 254, 225), + "hampton" : (229, 216, 175), + "harlequin" : ( 63, 255, 0), + "harp" : (230, 242, 234), + "harvest gold" : (224, 185, 116), + "havelock blue" : ( 85, 144, 217), + "hawaiian tan" : (157, 86, 22), + "hawkes blue" : (212, 226, 252), + "heath" : ( 84, 16, 18), + "heather" : (183, 195, 208), + "heathered gray" : (182, 176, 149), + "heavy metal" : ( 43, 50, 40), + "heliotrope" : (223, 115, 255), + "hemlock" : ( 94, 93, 59), + "hemp" : (144, 120, 116), + "hibiscus" : (182, 49, 108), + "highland" : (111, 142, 99), + "hillary" : (172, 165, 134), + "himalaya" : (106, 93, 27), + "hint of green" : (230, 255, 233), + "hint of red" : (251, 249, 249), + "hint of yellow" : (250, 253, 228), + "hippie blue" : ( 88, 154, 175), + "hippie green" : ( 83, 130, 75), + "hippie pink" : (174, 69, 96), + "hit gray" : (161, 173, 181), + "hit pink" : (255, 171, 129), + "hokey pokey" : (200, 165, 40), + "hoki" : (101, 134, 159), + "holly" : ( 1, 29, 19), + "hollywood cerise" : (244, 0, 161), + "honey flower" : ( 79, 28, 112), + "honeysuckle" : (237, 252, 132), + "hopbush" : (208, 109, 161), + "horizon" : ( 90, 135, 160), + "horses neck" : ( 96, 73, 19), + "hot cinnamon" : (210, 105, 30), + "hot pink" : (255, 105, 180), + "hot toddy" : (179, 128, 7), + "humming bird" : (207, 249, 243), + "hunter green" : ( 22, 29, 16), + "hurricane" : (135, 124, 123), + "husk" : (183, 164, 88), + "ice cold" : (177, 244, 231), + "iceberg" : (218, 244, 240), + "illusion" : (246, 164, 201), + "inch worm" : (176, 227, 19), + "indian khaki" : (195, 176, 145), + "indian tan" : ( 77, 30, 1), + "indigo" : ( 79, 105, 198), + "indochine" : (194, 107, 3), + "international klein blue" : ( 0, 47, 167), + "international orange" : (255, 79, 0), + "irish coffee" : ( 95, 61, 38), + "iroko" : ( 67, 49, 32), + "iron" : (212, 215, 217), + "ironside gray" : (103, 102, 98), + "ironstone" : (134, 72, 60), + "island spice" : (255, 252, 238), + "ivory" : (255, 255, 240), + "jacaranda" : ( 46, 3, 41), + "jacarta" : ( 58, 42, 106), + "jacko bean" : ( 46, 25, 5), + "jacksons purple" : ( 32, 32, 141), + "jade" : ( 0, 168, 107), + "jaffa" : (239, 134, 63), + "jagged ice" : (194, 232, 229), + "jagger" : ( 53, 14, 87), + "jaguar" : ( 8, 1, 16), + "jambalaya" : ( 91, 48, 19), + "janna" : (244, 235, 211), + "japanese laurel" : ( 10, 105, 6), + "japanese maple" : (120, 1, 9), + "japonica" : (216, 124, 99), + "java" : ( 31, 194, 194), + "jazzberry jam" : (165, 11, 94), + "jelly bean" : ( 41, 123, 154), + "jet stream" : (181, 210, 206), + "jewel" : ( 18, 107, 64), + "jon" : ( 59, 31, 31), + "jonquil" : (238, 255, 154), + "jordy blue" : (138, 185, 241), + "judge gray" : ( 84, 67, 51), + "jumbo" : (124, 123, 130), + "jungle green" : ( 41, 171, 135), + "jungle mist" : (180, 207, 211), + "juniper" : (109, 146, 146), + "just right" : (236, 205, 185), + "kabul" : ( 94, 72, 62), + "kaitoke green" : ( 0, 70, 32), + "kangaroo" : (198, 200, 189), + "karaka" : ( 30, 22, 9), + "karry" : (255, 234, 212), + "kashmir blue" : ( 80, 112, 150), + "kelp" : ( 69, 73, 54), + "kenyan copper" : (124, 28, 5), + "keppel" : ( 58, 176, 158), + "key lime pie" : (191, 201, 33), + "khaki" : (240, 230, 140), + "kidnapper" : (225, 234, 212), + "kilamanjaro" : ( 36, 12, 2), + "killarney" : ( 58, 106, 71), + "kimberly" : (115, 108, 159), + "kingfisher daisy" : ( 62, 4, 128), + "kobi" : (231, 159, 196), + "kokoda" : (110, 109, 87), + "korma" : (143, 75, 14), + "koromiko" : (255, 189, 95), + "kournikova" : (255, 231, 114), + "kumera" : (136, 98, 33), + "la palma" : ( 54, 135, 22), + "la rioja" : (179, 193, 16), + "las palmas" : (198, 230, 16), + "laser" : (200, 181, 104), + "laser lemon" : (255, 255, 102), + "laurel" : (116, 147, 120), + "lavender" : (181, 126, 220), + "lavender gray" : (189, 187, 215), + "lavender magenta" : (238, 130, 238), + "lavender pink" : (251, 174, 210), + "lavender purple" : (150, 123, 182), + "lavender rose" : (251, 160, 227), + "lavender blush" : (255, 240, 245), + "leather" : (150, 112, 89), + "lemon" : (253, 233, 16), + "lemon chiffon" : (255, 250, 205), + "lemon ginger" : (172, 158, 34), + "lemon grass" : (155, 158, 143), + "light apricot" : (253, 213, 177), + "light orchid" : (226, 156, 210), + "light wisteria" : (201, 160, 220), + "lightning yellow" : (252, 192, 30), + "lilac" : (200, 162, 200), + "lilac bush" : (152, 116, 211), + "lily" : (200, 170, 191), + "lily white" : (231, 248, 255), + "lima" : (118, 189, 23), + "lime" : (191, 255, 0), + "limeade" : (111, 157, 2), + "limed ash" : (116, 125, 99), + "limed oak" : (172, 138, 86), + "limed spruce" : ( 57, 72, 81), + "linen" : (250, 240, 230), + "link water" : (217, 228, 245), + "lipstick" : (171, 5, 99), + "lisbon brown" : ( 66, 57, 33), + "livid brown" : ( 77, 40, 46), + "loafer" : (238, 244, 222), + "loblolly" : (189, 201, 206), + "lochinvar" : ( 44, 140, 132), + "lochmara" : ( 0, 126, 199), + "locust" : (168, 175, 142), + "log cabin" : ( 36, 42, 29), + "logan" : (170, 169, 205), + "lola" : (223, 207, 219), + "london hue" : (190, 166, 195), + "lonestar" : (109, 1, 1), + "lotus" : (134, 60, 60), + "loulou" : ( 70, 11, 65), + "lucky" : (175, 159, 28), + "lucky point" : ( 26, 26, 104), + "lunar green" : ( 60, 73, 58), + "luxor gold" : (167, 136, 44), + "lynch" : (105, 126, 154), + "mabel" : (217, 247, 255), + "macaroni and cheese" : (255, 185, 123), + "madang" : (183, 240, 190), + "madison" : ( 9, 37, 93), + "madras" : ( 63, 48, 2), + "magenta / fuchsia" : (255, 0, 255), + "magic mint" : (170, 240, 209), + "magnolia" : (248, 244, 255), + "mahogany" : ( 78, 6, 6), + "mai tai" : (176, 102, 8), + "maize" : (245, 213, 160), + "makara" : (137, 125, 109), + "mako" : ( 68, 73, 84), + "malachite" : ( 11, 218, 81), + "malibu" : (125, 200, 247), + "mallard" : ( 35, 52, 24), + "malta" : (189, 178, 161), + "mamba" : (142, 129, 144), + "manatee" : (141, 144, 161), + "mandalay" : (173, 120, 27), + "mandy" : (226, 84, 101), + "mandys pink" : (242, 195, 178), + "mango tango" : (231, 114, 0), + "manhattan" : (245, 201, 153), + "mantis" : (116, 195, 101), + "mantle" : (139, 156, 144), + "manz" : (238, 239, 120), + "mardi gras" : ( 53, 0, 54), + "marigold" : (185, 141, 40), + "marigold yellow" : (251, 232, 112), + "mariner" : ( 40, 106, 205), + "maroon" : (128, 0, 0), + "maroon flush" : (195, 33, 72), + "maroon oak" : ( 82, 12, 23), + "marshland" : ( 11, 15, 8), + "martini" : (175, 160, 158), + "martinique" : ( 54, 48, 80), + "marzipan" : (248, 219, 157), + "masala" : ( 64, 59, 56), + "matisse" : ( 27, 101, 157), + "matrix" : (176, 93, 84), + "matterhorn" : ( 78, 59, 65), + "mauve" : (224, 176, 255), + "mauvelous" : (240, 145, 169), + "maverick" : (216, 194, 213), + "medium carmine" : (175, 64, 53), + "medium purple" : (147, 112, 219), + "medium red violet" : (187, 51, 133), + "melanie" : (228, 194, 213), + "melanzane" : ( 48, 5, 41), + "melon" : (254, 186, 173), + "melrose" : (199, 193, 255), + "mercury" : (229, 229, 229), + "merino" : (246, 240, 230), + "merlin" : ( 65, 60, 55), + "merlot" : (131, 25, 35), + "metallic bronze" : ( 73, 55, 27), + "metallic copper" : (113, 41, 29), + "meteor" : (208, 125, 18), + "meteorite" : ( 60, 31, 118), + "mexican red" : (167, 37, 37), + "mid gray" : ( 95, 95, 110), + "midnight" : ( 1, 22, 53), + "midnight blue" : ( 0, 51, 102), + "midnight moss" : ( 4, 16, 4), + "mikado" : ( 45, 37, 16), + "milan" : (250, 255, 164), + "milano red" : (184, 17, 4), + "milk punch" : (255, 246, 212), + "millbrook" : ( 89, 68, 51), + "mimosa" : (248, 253, 211), + "mindaro" : (227, 249, 136), + "mine shaft" : ( 50, 50, 50), + "mineral green" : ( 63, 93, 83), + "ming" : ( 54, 116, 125), + "minsk" : ( 63, 48, 127), + "mint green" : (152, 255, 152), + "mint julep" : (241, 238, 193), + "mint tulip" : (196, 244, 235), + "mirage" : ( 22, 25, 40), + "mischka" : (209, 210, 221), + "mist gray" : (196, 196, 188), + "mobster" : (127, 117, 137), + "moccaccino" : (110, 29, 20), + "mocha" : (120, 45, 25), + "mojo" : (192, 71, 55), + "mona lisa" : (255, 161, 148), + "monarch" : (139, 7, 35), + "mondo" : ( 74, 60, 48), + "mongoose" : (181, 162, 127), + "monsoon" : (138, 131, 137), + "monte carlo" : (131, 208, 198), + "monza" : (199, 3, 30), + "moody blue" : (127, 118, 211), + "moon glow" : (252, 254, 218), + "moon mist" : (220, 221, 204), + "moon raker" : (214, 206, 246), + "morning glory" : (158, 222, 224), + "morocco brown" : ( 68, 29, 0), + "mortar" : ( 80, 67, 81), + "mosque" : ( 3, 106, 110), + "moss green" : (173, 223, 173), + "mountain meadow" : ( 26, 179, 133), + "mountain mist" : (149, 147, 150), + "mountbatten pink" : (153, 122, 141), + "muddy waters" : (183, 142, 92), + "muesli" : (170, 139, 91), + "mulberry" : (197, 75, 140), + "mulberry wood" : ( 92, 5, 54), + "mule fawn" : (140, 71, 47), + "mulled wine" : ( 78, 69, 98), + "mustard" : (255, 219, 88), + "my pink" : (214, 145, 136), + "my sin" : (255, 179, 31), + "mystic" : (226, 235, 237), + "nandor" : ( 75, 93, 82), + "napa" : (172, 164, 148), + "narvik" : (237, 249, 241), + "natural gray" : (139, 134, 128), + "navajo white" : (255, 222, 173), + "navy blue" : ( 0, 0, 128), + "nebula" : (203, 219, 214), + "negroni" : (255, 226, 197), + "neon carrot" : (255, 153, 51), + "nepal" : (142, 171, 193), + "neptune" : (124, 183, 187), + "nero" : ( 20, 6, 0), + "nevada" : (100, 110, 117), + "new orleans" : (243, 214, 157), + "new york pink" : (215, 131, 127), + "niagara" : ( 6, 161, 137), + "night rider" : ( 31, 18, 15), + "night shadz" : (170, 55, 90), + "nile blue" : ( 25, 55, 81), + "nobel" : (183, 177, 177), + "nomad" : (186, 177, 162), + "norway" : (168, 189, 159), + "nugget" : (197, 153, 34), + "nutmeg" : (129, 66, 44), + "nutmeg wood finish" : (104, 54, 0), + "oasis" : (254, 239, 206), + "observatory" : ( 2, 134, 111), + "ocean green" : ( 65, 170, 120), + "ochre" : (204, 119, 34), + "off green" : (230, 248, 243), + "off yellow" : (254, 249, 227), + "oil" : ( 40, 30, 21), + "old brick" : (144, 30, 30), + "old copper" : (114, 74, 47), + "old gold" : (207, 181, 59), + "old lace" : (253, 245, 230), + "old lavender" : (121, 104, 120), + "old rose" : (192, 128, 129), + "olive" : (128, 128, 0), + "olive drab" : (107, 142, 35), + "olive green" : (181, 179, 92), + "olive haze" : (139, 132, 112), + "olivetone" : (113, 110, 16), + "olivine" : (154, 185, 115), + "onahau" : (205, 244, 255), + "onion" : ( 47, 39, 14), + "opal" : (169, 198, 194), + "opium" : (142, 111, 112), + "oracle" : ( 55, 116, 117), + "orange" : (255, 104, 31), + "orange peel" : (255, 160, 0), + "orange roughy" : (196, 87, 25), + "orange white" : (254, 252, 237), + "orchid" : (218, 112, 214), + "orchid white" : (255, 253, 243), + "oregon" : (155, 71, 3), + "orient" : ( 1, 94, 133), + "oriental pink" : (198, 145, 145), + "orinoco" : (243, 251, 212), + "oslo gray" : (135, 141, 145), + "ottoman" : (233, 248, 237), + "outer space" : ( 45, 56, 58), + "outrageous orange" : (255, 96, 55), + "oxford blue" : ( 56, 69, 85), + "oxley" : (119, 158, 134), + "oyster bay" : (218, 250, 255), + "oyster pink" : (233, 206, 205), + "paarl" : (166, 85, 41), + "pablo" : (119, 111, 97), + "pacific blue" : ( 0, 157, 196), + "pacifika" : (119, 129, 32), + "paco" : ( 65, 31, 16), + "padua" : (173, 230, 196), + "pale canary" : (255, 255, 153), + "pale leaf" : (192, 211, 185), + "pale oyster" : (152, 141, 119), + "pale prim" : (253, 254, 184), + "pale rose" : (255, 225, 242), + "pale sky" : (110, 119, 131), + "pale slate" : (195, 191, 193), + "palm green" : ( 9, 35, 15), + "palm leaf" : ( 25, 51, 14), + "pampas" : (244, 242, 238), + "panache" : (234, 246, 238), + "pancho" : (237, 205, 171), + "papaya whip" : (255, 239, 213), + "paprika" : (141, 2, 38), + "paradiso" : ( 49, 125, 130), + "parchment" : (241, 233, 210), + "paris daisy" : (255, 244, 110), + "paris m" : ( 38, 5, 106), + "paris white" : (202, 220, 212), + "parsley" : ( 19, 79, 25), + "pastel green" : (119, 221, 119), + "pastel pink" : (255, 209, 220), + "patina" : ( 99, 154, 143), + "pattens blue" : (222, 245, 255), + "paua" : ( 38, 3, 104), + "pavlova" : (215, 196, 152), + "peach" : (255, 229, 180), + "peach cream" : (255, 240, 219), + "peach orange" : (255, 204, 153), + "peach schnapps" : (255, 220, 214), + "peach yellow" : (250, 223, 173), + "peanut" : (120, 47, 22), + "pear" : (209, 226, 49), + "pearl bush" : (232, 224, 213), + "pearl lusta" : (252, 244, 220), + "peat" : (113, 107, 86), + "pelorous" : ( 62, 171, 191), + "peppermint" : (227, 245, 225), + "perano" : (169, 190, 242), + "perfume" : (208, 190, 248), + "periglacial blue" : (225, 230, 214), + "periwinkle" : (204, 204, 255), + "periwinkle gray" : (195, 205, 230), + "persian blue" : ( 28, 57, 187), + "persian green" : ( 0, 166, 147), + "persian indigo" : ( 50, 18, 122), + "persian pink" : (247, 127, 190), + "persian plum" : (112, 28, 28), + "persian red" : (204, 51, 51), + "persian rose" : (254, 40, 162), + "persimmon" : (255, 107, 83), + "peru tan" : (127, 58, 2), + "pesto" : (124, 118, 49), + "petite orchid" : (219, 150, 144), + "pewter" : (150, 168, 161), + "pharlap" : (163, 128, 123), + "picasso" : (255, 243, 157), + "pickled bean" : (110, 72, 38), + "pickled bluewood" : ( 49, 68, 89), + "picton blue" : ( 69, 177, 232), + "pig pink" : (253, 215, 228), + "pigeon post" : (175, 189, 217), + "pigment indigo" : ( 75, 0, 130), + "pine cone" : (109, 94, 84), + "pine glade" : (199, 205, 144), + "pine green" : ( 1, 121, 111), + "pine tree" : ( 23, 31, 4), + "pink" : (255, 192, 203), + "pink flamingo" : (255, 102, 255), + "pink flare" : (225, 192, 200), + "pink lace" : (255, 221, 244), + "pink lady" : (255, 241, 216), + "pink salmon" : (255, 145, 164), + "pink swan" : (190, 181, 183), + "piper" : (201, 99, 35), + "pipi" : (254, 244, 204), + "pippin" : (255, 225, 223), + "pirate gold" : (186, 127, 3), + "pistachio" : (157, 194, 9), + "pixie green" : (192, 216, 182), + "pizazz" : (255, 144, 0), + "pizza" : (201, 148, 21), + "plantation" : ( 39, 80, 75), + "plum" : (132, 49, 121), + "pohutukawa" : (143, 2, 28), + "polar" : (229, 249, 246), + "polo blue" : (141, 168, 204), + "pomegranate" : (243, 71, 35), + "pompadour" : (102, 0, 69), + "porcelain" : (239, 242, 243), + "porsche" : (234, 174, 105), + "port gore" : ( 37, 31, 79), + "portafino" : (255, 255, 180), + "portage" : (139, 159, 238), + "portica" : (249, 230, 99), + "pot pourri" : (245, 231, 226), + "potters clay" : (140, 87, 56), + "powder ash" : (188, 201, 194), + "powder blue" : (176, 224, 230), + "prairie sand" : (154, 56, 32), + "prelude" : (208, 192, 229), + "prim" : (240, 226, 236), + "primrose" : (237, 234, 153), + "provincial pink" : (254, 245, 241), + "prussian blue" : ( 0, 49, 83), + "puce" : (204, 136, 153), + "pueblo" : (125, 44, 20), + "puerto rico" : ( 63, 193, 170), + "pumice" : (194, 202, 196), + "pumpkin" : (255, 117, 24), + "pumpkin skin" : (177, 97, 11), + "punch" : (220, 67, 51), + "punga" : ( 77, 61, 20), + "purple" : (102, 0, 153), + "purple heart" : (101, 45, 193), + "purple mountain's majesty" : (150, 120, 182), + "purple pizzazz" : (255, 0, 204), + "putty" : (231, 205, 140), + "quarter pearl lusta" : (255, 253, 244), + "quarter spanish white" : (247, 242, 225), + "quicksand" : (189, 151, 142), + "quill gray" : (214, 214, 209), + "quincy" : ( 98, 63, 45), + "racing green" : ( 12, 25, 17), + "radical red" : (255, 53, 94), + "raffia" : (234, 218, 184), + "rainee" : (185, 200, 172), + "rajah" : (247, 182, 104), + "rangitoto" : ( 46, 50, 34), + "rangoon green" : ( 28, 30, 19), + "raven" : (114, 123, 137), + "raw sienna" : (210, 125, 70), + "raw umber" : (115, 74, 18), + "razzle dazzle rose" : (255, 51, 204), + "razzmatazz" : (227, 11, 92), + "rebel" : ( 60, 18, 6), + "red" : (255, 0, 0), + "red beech" : (123, 56, 1), + "red berry" : (142, 0, 0), + "red damask" : (218, 106, 65), + "red devil" : (134, 1, 17), + "red orange" : (255, 63, 52), + "red oxide" : (110, 9, 2), + "red ribbon" : (237, 10, 63), + "red robin" : (128, 52, 31), + "red stage" : (208, 95, 4), + "red violet" : (199, 21, 133), + "redwood" : ( 93, 30, 15), + "reef" : (201, 255, 162), + "reef gold" : (159, 130, 28), + "regal blue" : ( 1, 63, 106), + "regent gray" : (134, 148, 159), + "regent st blue" : (170, 214, 230), + "remy" : (254, 235, 243), + "reno sand" : (168, 101, 21), + "resolution blue" : ( 0, 35, 135), + "revolver" : ( 44, 22, 50), + "rhino" : ( 46, 63, 98), + "rice cake" : (255, 254, 240), + "rice flower" : (238, 255, 226), + "rich gold" : (168, 83, 7), + "rio grande" : (187, 208, 9), + "ripe lemon" : (244, 216, 28), + "ripe plum" : ( 65, 0, 86), + "riptide" : (139, 230, 216), + "river bed" : ( 67, 76, 89), + "rob roy" : (234, 198, 116), + "robin's egg blue" : ( 0, 204, 204), + "rock" : ( 77, 56, 51), + "rock blue" : (158, 177, 205), + "rock spray" : (186, 69, 12), + "rodeo dust" : (201, 178, 155), + "rolling stone" : (116, 125, 131), + "roman" : (222, 99, 96), + "roman coffee" : (121, 93, 76), + "romance" : (255, 254, 253), + "romantic" : (255, 210, 183), + "ronchi" : (236, 197, 78), + "roof terracotta" : (166, 47, 32), + "rope" : (142, 77, 30), + "rose" : (255, 0, 127), + "rose bud" : (251, 178, 163), + "rose bud cherry" : (128, 11, 71), + "rose fog" : (231, 188, 180), + "rose white" : (255, 246, 245), + "rose of sharon" : (191, 85, 0), + "rosewood" : (101, 0, 11), + "roti" : (198, 168, 75), + "rouge" : (162, 59, 108), + "royal blue" : ( 65, 105, 225), + "royal heath" : (171, 52, 114), + "royal purple" : (107, 63, 160), + "rum" : (121, 105, 137), + "rum swizzle" : (249, 248, 228), + "russet" : (128, 70, 27), + "russett" : (117, 90, 87), + "rust" : (183, 65, 14), + "rustic red" : ( 72, 4, 4), + "rusty nail" : (134, 86, 10), + "saddle" : ( 76, 48, 36), + "saddle brown" : ( 88, 52, 1), + "saffron" : (244, 196, 48), + "saffron mango" : (249, 191, 88), + "sage" : (158, 165, 135), + "sahara" : (183, 162, 20), + "sahara sand" : (241, 231, 136), + "sail" : (184, 224, 249), + "salem" : ( 9, 127, 75), + "salmon" : (255, 140, 105), + "salomie" : (254, 219, 141), + "salt box" : (104, 94, 110), + "saltpan" : (241, 247, 242), + "sambuca" : ( 58, 32, 16), + "san felix" : ( 11, 98, 7), + "san juan" : ( 48, 75, 106), + "san marino" : ( 69, 108, 172), + "sand dune" : (130, 111, 101), + "sandal" : (170, 141, 111), + "sandrift" : (171, 145, 122), + "sandstone" : (121, 109, 98), + "sandwisp" : (245, 231, 162), + "sandy beach" : (255, 234, 200), + "sandy brown" : (244, 164, 96), + "sangria" : (146, 0, 10), + "sanguine brown" : (141, 61, 56), + "santa fe" : (177, 109, 82), + "santas gray" : (159, 160, 177), + "sapling" : (222, 212, 164), + "sapphire" : ( 47, 81, 158), + "saratoga" : ( 85, 91, 16), + "satin linen" : (230, 228, 212), + "sauvignon" : (255, 245, 243), + "sazerac" : (255, 244, 224), + "scampi" : (103, 95, 166), + "scandal" : (207, 250, 244), + "scarlet" : (255, 36, 0), + "scarlet gum" : ( 67, 21, 96), + "scarlett" : (149, 0, 21), + "scarpa flow" : ( 88, 85, 98), + "schist" : (169, 180, 151), + "school bus yellow" : (255, 216, 0), + "schooner" : (139, 132, 126), + "science blue" : ( 0, 102, 204), + "scooter" : ( 46, 191, 212), + "scorpion" : (105, 95, 98), + "scotch mist" : (255, 251, 220), + "screamin' green" : (102, 255, 102), + "sea buckthorn" : (251, 161, 41), + "sea green" : ( 46, 139, 87), + "sea mist" : (197, 219, 202), + "sea nymph" : (120, 163, 156), + "sea pink" : (237, 152, 158), + "seagull" : (128, 204, 234), + "seance" : (115, 30, 143), + "seashell" : (241, 241, 241), + "seashell peach" : (255, 245, 238), + "seaweed" : ( 27, 47, 17), + "selago" : (240, 238, 253), + "selective yellow" : (255, 186, 0), + "sepia" : (112, 66, 20), + "sepia black" : ( 43, 2, 2), + "sepia skin" : (158, 91, 64), + "serenade" : (255, 244, 232), + "shadow" : (131, 112, 80), + "shadow green" : (154, 194, 184), + "shady lady" : (170, 165, 169), + "shakespeare" : ( 78, 171, 209), + "shalimar" : (251, 255, 186), + "shamrock" : ( 51, 204, 153), + "shark" : ( 37, 39, 44), + "sherpa blue" : ( 0, 73, 80), + "sherwood green" : ( 2, 64, 44), + "shilo" : (232, 185, 179), + "shingle fawn" : (107, 78, 49), + "ship cove" : (120, 139, 186), + "ship gray" : ( 62, 58, 68), + "shiraz" : (178, 9, 49), + "shocking" : (226, 146, 192), + "shocking pink" : (252, 15, 192), + "shuttle gray" : ( 95, 102, 114), + "siam" : (100, 106, 84), + "sidecar" : (243, 231, 187), + "silk" : (189, 177, 168), + "silver" : (192, 192, 192), + "silver chalice" : (172, 172, 172), + "silver rust" : (201, 192, 187), + "silver sand" : (191, 193, 194), + "silver tree" : (102, 181, 143), + "sinbad" : (159, 215, 211), + "siren" : (122, 1, 58), + "sirocco" : (113, 128, 128), + "sisal" : (211, 203, 186), + "skeptic" : (202, 230, 218), + "sky blue" : (118, 215, 234), + "slate gray" : (112, 128, 144), + "smalt" : ( 0, 51, 153), + "smalt blue" : ( 81, 128, 143), + "smoky" : ( 96, 91, 115), + "snow drift" : (247, 250, 247), + "snow flurry" : (228, 255, 209), + "snowy mint" : (214, 255, 219), + "snuff" : (226, 216, 237), + "soapstone" : (255, 251, 249), + "soft amber" : (209, 198, 180), + "soft peach" : (245, 237, 239), + "solid pink" : (137, 56, 67), + "solitaire" : (254, 248, 226), + "solitude" : (234, 246, 255), + "sorbus" : (253, 124, 7), + "sorrell brown" : (206, 185, 143), + "soya bean" : (106, 96, 81), + "spanish green" : (129, 152, 133), + "spectra" : ( 47, 90, 87), + "spice" : (106, 68, 46), + "spicy mix" : (136, 83, 66), + "spicy mustard" : (116, 100, 13), + "spicy pink" : (129, 110, 113), + "spindle" : (182, 209, 234), + "spray" : (121, 222, 236), + "spring green" : ( 0, 255, 127), + "spring leaves" : ( 87, 131, 99), + "spring rain" : (172, 203, 177), + "spring sun" : (246, 255, 220), + "spring wood" : (248, 246, 241), + "sprout" : (193, 215, 176), + "spun pearl" : (170, 171, 183), + "squirrel" : (143, 129, 118), + "st tropaz" : ( 45, 86, 155), + "stack" : (138, 143, 138), + "star dust" : (159, 159, 156), + "stark white" : (229, 215, 189), + "starship" : (236, 242, 69), + "steel blue" : ( 70, 130, 180), + "steel gray" : ( 38, 35, 53), + "stiletto" : (156, 51, 54), + "stonewall" : (146, 133, 115), + "storm dust" : (100, 100, 99), + "storm gray" : (113, 116, 134), + "stratos" : ( 0, 7, 65), + "straw" : (212, 191, 141), + "strikemaster" : (149, 99, 135), + "stromboli" : ( 50, 93, 82), + "studio" : (113, 74, 178), + "submarine" : (186, 199, 201), + "sugar cane" : (249, 255, 246), + "sulu" : (193, 240, 124), + "summer green" : (150, 187, 171), + "sun" : (251, 172, 19), + "sundance" : (201, 179, 91), + "sundown" : (255, 177, 179), + "sunflower" : (228, 212, 34), + "sunglo" : (225, 104, 101), + "sunglow" : (255, 204, 51), + "sunset orange" : (254, 76, 64), + "sunshade" : (255, 158, 44), + "supernova" : (255, 201, 1), + "surf" : (187, 215, 193), + "surf crest" : (207, 229, 210), + "surfie green" : ( 12, 122, 121), + "sushi" : (135, 171, 57), + "suva gray" : (136, 131, 135), + "swamp" : ( 0, 27, 28), + "swamp green" : (172, 183, 142), + "swans down" : (220, 240, 234), + "sweet corn" : (251, 234, 140), + "sweet pink" : (253, 159, 162), + "swirl" : (211, 205, 197), + "swiss coffee" : (221, 214, 213), + "sycamore" : (144, 141, 57), + "tabasco" : (160, 39, 18), + "tacao" : (237, 179, 129), + "tacha" : (214, 197, 98), + "tahiti gold" : (233, 124, 7), + "tahuna sands" : (238, 240, 200), + "tall poppy" : (179, 45, 41), + "tallow" : (168, 165, 137), + "tamarillo" : (153, 22, 19), + "tamarind" : ( 52, 21, 21), + "tan" : (210, 180, 140), + "tan hide" : (250, 157, 90), + "tana" : (217, 220, 193), + "tangaroa" : ( 3, 22, 60), + "tangerine" : (242, 133, 0), + "tango" : (237, 122, 28), + "tapa" : (123, 120, 116), + "tapestry" : (176, 94, 129), + "tara" : (225, 246, 232), + "tarawera" : ( 7, 58, 80), + "tasman" : (207, 220, 207), + "taupe" : ( 72, 60, 50), + "taupe gray" : (179, 175, 149), + "tawny port" : (105, 37, 69), + "te papa green" : ( 30, 67, 60), + "tea" : (193, 186, 176), + "tea green" : (208, 240, 192), + "teak" : (177, 148, 97), + "teal" : ( 0, 128, 128), + "teal blue" : ( 4, 66, 89), + "temptress" : ( 59, 0, 11), + "tenn" : (205, 87, 0), + "tequila" : (255, 230, 199), + "terracotta" : (226, 114, 91), + "texas" : (248, 249, 156), + "texas rose" : (255, 181, 85), + "thatch" : (182, 157, 152), + "thatch green" : ( 64, 61, 25), + "thistle" : (216, 191, 216), + "thistle green" : (204, 202, 168), + "thunder" : ( 51, 41, 47), + "thunderbird" : (192, 43, 24), + "tia maria" : (193, 68, 14), + "tiara" : (195, 209, 209), + "tiber" : ( 6, 53, 55), + "tickle me pink" : (252, 128, 165), + "tidal" : (241, 255, 173), + "tide" : (191, 184, 176), + "timber green" : ( 22, 50, 44), + "timberwolf" : (217, 214, 207), + "titan white" : (240, 238, 255), + "toast" : (154, 110, 97), + "tobacco brown" : (113, 93, 71), + "toledo" : ( 58, 0, 32), + "tolopea" : ( 27, 2, 69), + "tom thumb" : ( 63, 88, 59), + "tonys pink" : (231, 159, 140), + "topaz" : (124, 119, 138), + "torch red" : (253, 14, 53), + "torea bay" : ( 15, 45, 158), + "tory blue" : ( 20, 80, 170), + "tosca" : (141, 63, 63), + "totem pole" : (153, 27, 7), + "tower gray" : (169, 189, 191), + "tradewind" : ( 95, 179, 172), + "tranquil" : (230, 255, 255), + "travertine" : (255, 253, 232), + "tree poppy" : (252, 156, 29), + "treehouse" : ( 59, 40, 32), + "trendy green" : (124, 136, 26), + "trendy pink" : (140, 100, 149), + "trinidad" : (230, 78, 3), + "tropical blue" : (195, 221, 249), + "tropical rain forest" : ( 0, 117, 94), + "trout" : ( 74, 78, 90), + "true v" : (138, 115, 214), + "tuatara" : ( 54, 53, 52), + "tuft bush" : (255, 221, 205), + "tulip tree" : (234, 179, 59), + "tumbleweed" : (222, 166, 129), + "tuna" : ( 53, 53, 66), + "tundora" : ( 74, 66, 68), + "turbo" : (250, 230, 0), + "turkish rose" : (181, 114, 129), + "turmeric" : (202, 187, 72), + "turquoise" : ( 48, 213, 200), + "turquoise blue" : (108, 218, 231), + "turtle green" : ( 42, 56, 11), + "tuscany" : (189, 94, 46), + "tusk" : (238, 243, 195), + "tussock" : (197, 153, 75), + "tutu" : (255, 241, 249), + "twilight" : (228, 207, 222), + "twilight blue" : (238, 253, 255), + "twine" : (194, 149, 93), + "tyrian purple" : (102, 2, 60), + "ultramarine" : ( 18, 10, 143), + "valencia" : (216, 68, 55), + "valentino" : ( 53, 14, 66), + "valhalla" : ( 43, 25, 79), + "van cleef" : ( 73, 23, 12), + "vanilla" : (209, 190, 168), + "vanilla ice" : (243, 217, 223), + "varden" : (255, 246, 223), + "venetian red" : (114, 1, 15), + "venice blue" : ( 5, 89, 137), + "venus" : (146, 133, 144), + "verdigris" : ( 93, 94, 55), + "verdun green" : ( 73, 84, 0), + "vermilion" : (255, 77, 0), + "vesuvius" : (177, 74, 11), + "victoria" : ( 83, 68, 145), + "vida loca" : ( 84, 144, 25), + "viking" : (100, 204, 219), + "vin rouge" : (152, 61, 97), + "viola" : (203, 143, 169), + "violent violet" : ( 41, 12, 94), + "violet" : ( 36, 10, 64), + "violet eggplant" : (153, 17, 153), + "violet red" : (247, 70, 138), + "viridian" : ( 64, 130, 109), + "viridian green" : (103, 137, 117), + "vis vis" : (255, 239, 161), + "vista blue" : (143, 214, 180), + "vista white" : (252, 248, 247), + "vivid tangerine" : (255, 153, 128), + "vivid violet" : (128, 55, 144), + "voodoo" : ( 83, 52, 85), + "vulcan" : ( 16, 18, 29), + "wafer" : (222, 203, 198), + "waikawa gray" : ( 90, 110, 156), + "waiouru" : ( 54, 60, 13), + "walnut" : (119, 63, 26), + "wasabi" : (120, 138, 37), + "water leaf" : (161, 233, 222), + "watercourse" : ( 5, 111, 87), + "waterloo " : (123, 124, 148), + "wattle" : (220, 215, 71), + "watusi" : (255, 221, 207), + "wax flower" : (255, 192, 168), + "we peep" : (247, 219, 230), + "web orange" : (255, 165, 0), + "wedgewood" : ( 78, 127, 158), + "well read" : (180, 51, 50), + "west coast" : ( 98, 81, 25), + "west side" : (255, 145, 15), + "westar" : (220, 217, 210), + "wewak" : (241, 155, 171), + "wheat" : (245, 222, 179), + "wheatfield" : (243, 237, 207), + "whiskey" : (213, 154, 111), + "whisper" : (247, 245, 250), + "white" : (255, 255, 255), + "white ice" : (221, 249, 241), + "white lilac" : (248, 247, 252), + "white linen" : (248, 240, 232), + "white pointer" : (254, 248, 255), + "white rock" : (234, 232, 212), + "wild blue yonder" : (122, 137, 184), + "wild rice" : (236, 224, 144), + "wild sand" : (244, 244, 244), + "wild strawberry" : (255, 51, 153), + "wild watermelon" : (253, 91, 120), + "wild willow" : (185, 196, 106), + "william" : ( 58, 104, 108), + "willow brook" : (223, 236, 218), + "willow grove" : (101, 116, 93), + "windsor" : ( 60, 8, 120), + "wine berry" : ( 89, 29, 53), + "winter hazel" : (213, 209, 149), + "wisp pink" : (254, 244, 248), + "wisteria" : (151, 113, 181), + "wistful" : (164, 166, 211), + "witch haze" : (255, 252, 153), + "wood bark" : ( 38, 17, 5), + "woodland" : ( 77, 83, 40), + "woodrush" : ( 48, 42, 15), + "woodsmoke" : ( 12, 13, 15), + "woody brown" : ( 72, 49, 49), + "xanadu" : (115, 134, 120), + "yellow" : (255, 255, 0), + "yellow green" : (197, 225, 122), + "yellow metal" : (113, 99, 56), + "yellow orange" : (255, 174, 66), + "yellow sea" : (254, 169, 4), + "your pink" : (255, 195, 192), + "yukon gold" : (123, 102, 8), + "yuma" : (206, 194, 145), + "zambezi" : (104, 85, 88), + "zanah" : (218, 236, 214), + "zest" : (229, 132, 27), + "zeus" : ( 41, 35, 25), + "ziggurat" : (191, 219, 226), + "zinnwaldite" : (235, 194, 175), + "zircon" : (244, 248, 255), + "zombie" : (228, 214, 155), + "zorba" : (165, 155, 145), + "zuccini" : ( 4, 64, 34), + "zumthor" : (237, 246, 255)} + +def build_reverse_dict(): + global reverse + global colorhex + global colors + for color in colors: + rgb = colors[color] + hex = '#%02X%02X%02X' % (rgb) + reverse[hex] = color + colorhex[color] = hex + return + + +def get_complementary_hex(color): + # strip the # from the beginning + color = color[1:] + # convert the string into hex + color = int(color, 16) + # invert the three bytes + # as good as substracting each of RGB component by 255(FF) + comp_color = 0xFFFFFF ^ color + # convert the color back to hex by prefixing a # + comp_color = "#%06X" % comp_color + # return the result + return comp_color + +def get_complementary_rgb(red, green, blue): + color_string = '#%02X%02X%02X' % (red, green, blue) + # strip the # from the beginning + color = color_string[1:] + # convert the string into hex + color = int(color, 16) + # invert the three bytes + # as good as substracting each of RGB component by 255(FF) + comp_color = 0xFFFFFF ^ color + # convert the color back to hex by prefixing a # + comp_color = "#%06X" % comp_color + # return the result + return comp_color + +def get_name_from_hex(hex): + global reverse + global colorhex + global colors + + hex = hex.upper() + try: + name = reverse[hex] + except: + name = 'No Hex For Name' + return name + +def get_hex_from_name(name): + global reverse + global colorhex + global colors + + name = name.lower() + try: + hex = colorhex[name] + except: + hex = '#000000' + return hex + +def show_all_colors_on_buttons(): + global reverse + global colorhex + global colors + form = g.FlexForm('Colors on Buttons Demo', default_element_size=(3,1), location=(0,0), icon=MY_WINDOW_ICON, font=("Helvetica", 7)) + row = [] + row_len = 20 + for i, c in enumerate(colors): + hex = get_hex_from_name(c) + button1 = g.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)) + row.append(button1) + row.append(button2) + if (i+1) % row_len == 0: + form.AddRow(*row) + row = [] + if row != []: + form.AddRow(*row) + form.Show() + + +GoodColors = [('#0e6251',g.RGB(255,246,122) ), + ('white', g.RGB(0,74,60)), + (g.RGB(0,210,124),g.RGB(0,74,60) ), + (g.RGB(0,210,87),g.RGB(0,74,60) ), + (g.RGB(0,164,73),g.RGB(0,74,60) ), + (g.RGB(0,74,60),g.RGB(0,74,60) ), + + ] + + +def main(): + global colors + global reverse + + build_reverse_dict() + list_of_colors = [c for c in colors] + printable = '\n'.join(map(str, list_of_colors)) + # show_all_colors_on_buttons() + while True: + # ------- Form show ------- # + layout = [[g.Text('Find color')], + [g.Text('Demonstration of colors')], + [g.Text('Enter a color name in text or hex #RRGGBB format')], + [g.InputText()], + [g.Listbox(list_of_colors, size=(20,30)), g.T('Or choose from list')], + [g.Submit(), g.Quit(), g.SimpleButton('Show me lots of colors!', button_color=('white','#0e6251'))], + ] + # [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).LayoutAndShow(layout) + + drop_down_value = drop_down_value[0] + + # ------- Form show ------- # + # layout = [[g.Text('Find color')], + # [g.Text('Demonstration of colors')], + # [g.Text('Enter a color name in text or hex #RRGGBB format')], + # [g.InputText()], + # [g.InputCombo(list_of_colors, size=(20,6)), g.T('Or choose from list')], + # [g.Submit(), g.Quit(), g.SimpleButton('Show me lots of colors!', button_color=('white','#0e6251'))], + # ] + # # [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).LayoutAndShow(layout) + + + # ------- OUTPUT results portion ------- # + if button == '' or button == 'Quit' or button is None: + exit(0) + elif button == 'Show me lots of colors!': + show_all_colors_on_buttons() + + if hex_input is not '' and hex_input[0] == '#': + color_hex = hex_input.upper() + color_name = get_name_from_hex(hex_input) + else: + color_name = drop_down_value + color_hex = get_hex_from_name(color_name) + + complementary_hex = get_complementary_hex(color_hex) + complementary_color = get_name_from_hex(complementary_hex) + + # 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')], + [g.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))], + ] + g.FlexForm('Color demo', default_element_size=(100,1), auto_size_text=True, auto_close=True, auto_close_duration=5, icon=MY_WINDOW_ICON).LayoutAndShow(layout) + + + +if __name__ == '__main__': + main() diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py new file mode 100644 index 000000000..25077a9a3 --- /dev/null +++ b/Demo_Compare_Files.py @@ -0,0 +1,33 @@ +import PySimpleGUI as sg + +def GetFilesToCompare(): + with sg.FlexForm('File Compare', auto_size_text=True) as form: + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(15, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(15, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + rc = form.LayoutAndShow(form_rows) + return rc + +def main(): + button, (f1, f2) = GetFilesToCompare() + if any((button != 'Submit', f1 =='', f2 == '')): + sg.MsgBoxError('Operation cancelled') + exit(69) + + with open(f1, 'rb') as file1: + with open(f2, 'rb') as file2: + a = file1.read() + b = file2.read() + + for i, x in enumerate(a): + if x != b[i]: + sg.MsgBox('Compare results for files', f1, f2, '**** Mismatch at offset {} ****'.format(i)) + break + else: + if len(a) == len(b): + sg.MsgBox('**** The files are IDENTICAL ****') + + +if __name__ == '__main__': + main() diff --git a/Demo_DisplayHash1and256.py b/Demo_DisplayHash1and256.py new file mode 100644 index 000000000..4aa3db1d0 --- /dev/null +++ b/Demo_DisplayHash1and256.py @@ -0,0 +1,123 @@ +#!Python 3 +import hashlib +import PySimpleGUI as SG + + ######################################################################### +# DisplayHash # +# A PySimpleGUI demo app that displays SHA1 hash for user browsed file # +# Useful and a recipe for GUI success # + ######################################################################### + +# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # +# Reads a file, computes the Hash # +# ---------------------------------------------------------------------------------- # +def compute_sha1_hash_for_file(filename): + try: + x = open(filename, "rb").read() + except: + return 0 + + m = hashlib.sha1() + m.update(x) + f_sha = m.hexdigest() + + return f_sha + + +# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # +# Reads a file, computes the Hash # +# ---------------------------------------------------------------------------------- # +def compute_sha256_hash_for_file(filename): + try: + f = open(filename, "rb") + x = f.read() + except: + return 0 + + m = hashlib.sha256() + m.update(x) + f_sha = m.hexdigest() + + return f_sha + + + # ====____====____==== Uses A GooeyGUI GUI ====____====____== # +# Get the filename, display the hash, dirt simple all around # + # ----------------------------------------------------------- # + +# ---------------------------------------------------------------------- # +# Compute and display SHA1 hash # +# Builds and displays the form using the most basic building blocks # +# ---------------------------------------------------------------------- # +def HashManuallyBuiltGUI(): + # ------- Form design ------- # + with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + (button, (source_filename, )) = form.LayoutAndShow(form_rows) + + if button == 'Submit': + if source_filename != '': + hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() + hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() + SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) + else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') + else: + SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') + +def HashManuallyBuiltGUINonContext(): + # ------- Form design ------- # + form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + [SG.InputText(), SG.FileBrowse()], + [SG.Submit(), SG.Cancel()]] + button, (source_filename, ) = form.LayoutAndShow(form_rows) + + if button == 'Submit': + if source_filename != '': + hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() + hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() + SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) + else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') + else: + SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') + + + + +# ---------------------------------------------------------------------- # +# Compute and display SHA1 hash # +# This one cheats and uses the higher-level Get A File pre-made func # +# Hey, it's a really common operation so why not? # +# ---------------------------------------------------------------------- # +def HashMostCompactGUI(): + # ------- INPUT GUI portion ------- # + + rc, source_filename = SG.GetFileBox('Display A Hash Using PySimpleGUI', + 'Display a Hash code for file of your choice') + + # ------- OUTPUT GUI results portion ------- # + if rc == True: + hash = compute_sha1_hash_for_file(source_filename) + SG.MsgBox('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) + else: + SG.MsgBox('Display Hash - Compact GUI', '* Cancelled *') + + +# ---------------------------------------------------------------------- # +# Our main calls two GUIs that act identically but use different calls # +# ---------------------------------------------------------------------- # +def main(): + HashManuallyBuiltGUINonContext() + HashMostCompactGUI() + + +# ====____====____==== Pseudo-MAIN program ====____====____==== # +# This is our main-alike piece of code # +# + Starts up the GUI # +# + Gets values from GUI # +# + Runs DeDupe_folder based on GUI inputs # +# ------------------------------------------------------------- # +if __name__ == '__main__': + main() diff --git a/Demo_DuplicateFileFinder.py b/Demo_DuplicateFileFinder.py new file mode 100644 index 000000000..40cef6996 --- /dev/null +++ b/Demo_DuplicateFileFinder.py @@ -0,0 +1,57 @@ +import hashlib +import os +import PySimpleGUI as sg + + +# ====____====____==== FUNCTION DeDuplicate_folder(path) ====____====____==== # +# Function to de-duplicate the folder passed in # +# --------------------------------------------------------------------------- # +def FindDuplicatesFilesInFolder(path): + shatab = [] + total = 0 + small_count, dup_count, error_count = 0,0,0 + pngdir = path + if not os.path.exists(path): + sg.MsgBox('Duplicate Finder', '** Folder doesn\'t exist***', path) + return + pngfiles = os.listdir(pngdir) + total_files = len(pngfiles) + for idx, f in enumerate(pngfiles): + if not sg.EasyProgressMeter('Counting Duplicates', idx + 1, total_files, 'Counting Duplicate Files'): + break + total += 1 + fname = os.path.join(pngdir, f) + if os.path.isdir(fname): + continue + x = open(fname, "rb").read() + + m = hashlib.sha256() + m.update(x) + f_sha = m.digest() + if f_sha in shatab: + # uncomment next line to remove duplicate files + # os.remove(fname) + dup_count += 1 + # sg.Print(f'Duplicate file - {f}') # cannot current use sg.Print with Progress Meter + continue + shatab.append(f_sha) + + msg = f'{total} Files processed\n'\ + f'{dup_count} Duplicates found\n' + sg.MsgBox('Duplicate Finder Ended', msg) + +# ====____====____==== Pseudo-MAIN program ====____====____==== # +# This is our main-alike piece of code # +# + Starts up the GUI # +# + Gets values from GUI # +# + Runs DeDupe_folder based on GUI inputs # +# ------------------------------------------------------------- # +if __name__ == '__main__': + + source_folder = None + rc, source_folder = sg.GetPathBox('Duplicate Finder - Count number of duplicate files', 'Enter path to folder you wish to find duplicates in') + if rc is True and source_folder is not None: + FindDuplicatesFilesInFolder(source_folder) + else: + sg.MsgBoxCancel('Cancelling', '*** Cancelling ***') + exit(0) diff --git a/Demo_GoodColors.py b/Demo_GoodColors.py new file mode 100644 index 000000000..7d0402f8d --- /dev/null +++ b/Demo_GoodColors.py @@ -0,0 +1,50 @@ +import PySimpleGUI as gg +import time + +def main(): + # ------- Make a new FlexForm ------- # + form = gg.FlexForm('GoodColors', auto_size_text=True, default_element_size=(30,2)) + form.AddRow(gg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) + form.AddRow(gg.Text('Here come the good colors as defined by PySimpleGUI')) + + #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# + text_color = gg.YELLOWS[0] + buttons = (gg.SimpleButton(f'BLUES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# + buttons = (gg.SimpleButton(f'PURPLES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# + buttons = (gg.SimpleButton(f'GREENS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# + text_color = gg.GREENS[0] # let's use GREEN text on the tan + buttons = (gg.SimpleButton(f'TANS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# + text_color = 'black' # let's use black text on the tan + buttons = (gg.SimpleButton(f'YELLOWS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) + form.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) + form.AddRow(*buttons) + form.AddRow(gg.Text('_' * 100, size=(65, 1))) + + + #===== Add a click me button for fun and SHOW the form ===== ===== ===== ===== ===== ===== =====# + form.AddRow(gg.SimpleButton('Click ME!')) + (button, value) = form.Show() # show it! + + +if __name__ == '__main__': + main() diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py new file mode 100644 index 000000000..e7385bfdc --- /dev/null +++ b/Demo_HowDoI.py @@ -0,0 +1,55 @@ +import PySimpleGUI as SG +import subprocess +import howdoi + +# Test this command in a dos window if you are having trouble. +HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' + +# if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file +DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' + +def HowDoI(): + ''' + Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle + Excellent example of 2 GUI concepts + 1. Output Element that will show text in a scrolled window + 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but doesn't close the form + :return: never returns + ''' + # ------- Make a new FlexForm ------- # + SG.SetOptions(border_width=1) + form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) + form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) + form.AddRow(SG.Output(size=(90, 20))) + form.AddRow(SG.Multiline(size=(85, 5), enter_submits=True), + SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), + SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button == 'SEND': + QueryHowDoI(value[0][:-1]) # send string without carriage return on end + else: + break # exit button clicked + + exit(69) + +def QueryHowDoI(Query): + ''' + Kicks off a subprocess to send the 'Query' to HowDoI + Prints the result, which in this program will route to a gooeyGUI window + :param Query: text english question to ask the HowDoI web engine + :return: nothing + ''' + howdoi_command = HOW_DO_I_COMMAND + t = subprocess.Popen(howdoi_command + ' '+ Query, stdout=subprocess.PIPE) + (output, err) = t.communicate() + print('You asked: '+ Query) + print('_______________________________________') + print(output.decode("utf-8") ) + exit_code = t.wait() + +if __name__ == '__main__': + HowDoI() + diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py new file mode 100644 index 000000000..fdc014346 --- /dev/null +++ b/Demo_Media_Player.py @@ -0,0 +1,64 @@ +import PySimpleGUI as sg + +# +# An Async Demonstration of a media player +# Uses button images for a super snazzy look +# See how it looks here: +# https://user-images.githubusercontent.com/13696193/43159403-45c9726e-8f50-11e8-9da0-0d272e20c579.jpg +# +def MediaPlayerGUI(): + + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # 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 + form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)) + # define layout of the rows + layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))], + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Next', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], + [sg.Text('_'*30)], + [sg.Text(' '*30)], + [ + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] + + ] + + # Call the same LayoutAndRead but indicate the form is non-blocking + form.LayoutAndRead(layout, non_blocking=True) + # Our event loop + while(True): + # Read the form (this call will not block) + button, values = form.ReadNonBlocking() + if button == 'Exit': + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + TextElem.Update(button) + +MediaPlayerGUI() + diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py new file mode 100644 index 000000000..8e43d6dd8 --- /dev/null +++ b/Demo_NonBlocking_Form.py @@ -0,0 +1,59 @@ +import PySimpleGUI as sg +import time + +def main(): + StatusOutputExample() + +# form that doen't block +def StatusOutputExample_context_manager(): + with sg.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + + form.LayoutAndRead(form_rows, non_blocking=True) + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + +# form that doen't block +def StatusOutputExample(): + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +if __name__ == '__main__': + + main() diff --git a/Demo_Recipes.py b/Demo_Recipes.py new file mode 100644 index 000000000..8b8e92936 --- /dev/null +++ b/Demo_Recipes.py @@ -0,0 +1,168 @@ +import time +from random import randint +import PySimpleGUI as sg + +# A simple blocking form. Your best starter-form +def SourceDestFolders(): + with sg.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: + form_rows = [[sg.Text('Enter the Source and Destination folders')], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source')], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, (source, dest) = form.LayoutAndRead(form_rows) + if button == 'Submit': + sg.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) + else: + sg.MsgBoxError('Cancelled', 'User Cancelled') + +# YOUR BEST STARTING POINT +# This is a form showing you all of the basic Elements (widgets) +# Some have a few of the optional parameters set, but there are more to choose from +# You want to use the context manager because it will free up resources when you are finished +# Use this especially if you are runningm multi-threaded +# Where you free up resources is really important to tkinter +def Everything(): + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + sg.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + +# Should you decide not to use a context manager, then try this form as your starting point +# Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if +# you are running multithreaded +def Everything_NoContextManager(): + form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1), text_color='red')], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))]] + + button, values = form.LayoutAndRead(layout) + del(form) + + sg.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) + +def ProgressMeter(): + for i in range(1,10000): + if not sg.EasyProgressMeter('My Meter', i + 1, 10000): break + # SG.Print(i) + +# Blocking form that doesn't close +def ChatBot(): + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + +# Shows a form that's a running counter +# this is the basic design pattern if you can keep your reading of the +# form within the 'with' block. If your read occurs far away in your code from the form creation +# then you will want to use the NonBlockingPeriodicUpdateForm example +def NonBlockingPeriodicUpdateForm_ContextManager(): + with sg.FlexForm('Running Timer', auto_size_text=True) as form: + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') + layout = [[sg.Text('Non blocking GUI with updates', justification='center')], + [text_element], + [sg.T(' ' * 15), sg.Quit()]] + form.LayoutAndRead(layout, non_blocking=True) + + for i in range(1,500): + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + +# Use this context-manager-free version if your read of the form occurs far away in your code +# from the form creation (call to LayoutAndRead) +def NonBlockingPeriodicUpdateForm(): + # Show a form that's a running counter + form = sg.FlexForm('Running Timer', auto_size_text=True) + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') + form_rows = [[sg.Text('Non blocking GUI with updates')], + [text_element], + [sg.T(' ' * 15), sg.Quit()]] + form.LayoutAndRead(form_rows, non_blocking=True) + + for i in range(1,50000): + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + del(form) + +def DebugTest(): + # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) + for i in range (1,300): + sg.Print(i, randint(1, 1000), end='', sep='-') + + +def main(): + # SG.SetOptions(border_width=1, font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), slider_border_width=1) + NonBlockingPeriodicUpdateForm_ContextManager() + NonBlockingPeriodicUpdateForm() + Everything_NoContextManager() + Everything() + ChatBot() + ProgressMeter() + SourceDestFolders() + ChatBot() + DebugTest() + sg.MsgBox('Done with all recipes') + +if __name__ == '__main__': + main() + exit(69) diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py new file mode 100644 index 000000000..e6bcede0c --- /dev/null +++ b/Demo_Tabbed_Form.py @@ -0,0 +1,89 @@ +import PySimpleGUI as sg + +MAX_NUMBER_OF_THREADS = 12 + +def eBaySuperSearcherGUI(): + # Drop Down list of options + configs = ('0 - Gruen - Started 2 days ago in Watches', + '1 - Gruen - Currently Active in Watches', + '2 - Alpina - Currently Active in Jewelry', + '3 - Gruen - Ends in 1 day in Watches', + '4 - Gruen - Completed in Watches', + '5 - Gruen - Advertising', + '6 - Gruen - Currently Active in Jewelry', + '7 - Gruen - Price Test', + '8 - Gruen - No brand name specified') + + us_categories = ('Use Default with no change', + 'All - 1', + 'Jewelry - 281', + ' Watches - 14324', + ' Wristwatches - 31387', + ' Pocket Watches - 3937', + 'Advertising - 34', + ' Watch Ads - 165254' + ) + + german_categories =('Use Default with no change', + 'All - 1', + 'Jewelry - 281', + ' Watches - 14324', + ' Wristwatches - 31387', + ' Pocket Watches - 3937', + 'Advertising - 1', + ' Watch Ads - 19823' + ) + + + # the form layout + with sg.FlexForm('EBay Super Searcher', auto_size_text=True) as form: + with sg.FlexForm('EBay Super Searcher') as form2: + layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], + [sg.Text('Choose base configuration to run')], + [sg.InputCombo(configs)], + [sg.Text('_'*100, size=(80,1))], + [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], + [sg.InputText(),sg.Text('Custom text to add to folder name')], + [sg.Text('_'*100, size=(80,1))], + [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], + [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Text('Time Filters')], + [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue')), sg.Text(f'{MAX_NUMBER_OF_THREADS} Threads will be started')]] + + + # First category is default (need to special case this) + layout_tab_2 = [[sg.Text('Choose Category')], + [sg.Text('US Categories'),sg.Text('German Categories')], + [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] + + for i,cat in enumerate(us_categories): + if i == 0: continue # skip first one + layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) + + + layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) + layout_tab_2.append([sg.Text('US Search String Override')]) + layout_tab_2.append([sg.InputText(size=(100,1))]) + layout_tab_2.append([sg.Text('German Search String Override')]) + layout_tab_2.append([sg.InputText(size=(100,1))]) + layout_tab_2.append([sg.Text('Typical US Search String')]) + layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) + layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) + layout_tab_2.append([sg.Submit(button_color=('red', 'yellow'),auto_size_text=True), sg.Cancel(button_color=('white', 'blue'), auto_size_text=True)]) + + results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) + + return results + + +if __name__ == '__main__': + results = eBaySuperSearcherGUI() + print(results) + sg.MsgBox('Results', results) \ No newline at end of file From bce8382d6e43c0455578fe1a8bb7ef1fe3c3befc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 25 Jul 2018 07:38:20 -0400 Subject: [PATCH 071/521] Remove renamed files --- Demo DisplayHash1and256.py | 123 -------------------------- Demo DuplicateFileFinder.py | 56 ------------ Demo GoodColors.py | 50 ----------- Demo HowDoI.py | 54 ------------ Demo Media Player.py | 60 ------------- Demo NonBlocking Form.py | 59 ------------- Demo Recipes.py | 167 ------------------------------------ Demo Tabbed Form.py | 89 ------------------- 8 files changed, 658 deletions(-) delete mode 100644 Demo DisplayHash1and256.py delete mode 100644 Demo DuplicateFileFinder.py delete mode 100644 Demo GoodColors.py delete mode 100644 Demo HowDoI.py delete mode 100644 Demo Media Player.py delete mode 100644 Demo NonBlocking Form.py delete mode 100644 Demo Recipes.py delete mode 100644 Demo Tabbed Form.py diff --git a/Demo DisplayHash1and256.py b/Demo DisplayHash1and256.py deleted file mode 100644 index dbc47afcc..000000000 --- a/Demo DisplayHash1and256.py +++ /dev/null @@ -1,123 +0,0 @@ -#!Python 3 -import hashlib -import PySimpleGUI as SG - - ######################################################################### -# DisplayHash # -# A PySimpleGUI demo app that displays SHA1 hash for user browsed file # -# Useful and a recipe for GUI success # - ######################################################################### - -# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # -# Reads a file, computes the Hash # -# ---------------------------------------------------------------------------------- # -def compute_sha1_hash_for_file(filename): - try: - x = open(filename, "rb").read() - except: - return 0 - - m = hashlib.sha1() - m.update(x) - f_sha = m.hexdigest() - - return f_sha - - -# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # -# Reads a file, computes the Hash # -# ---------------------------------------------------------------------------------- # -def compute_sha256_hash_for_file(filename): - try: - f = open(filename, "rb") - x = f.read() - except: - return 0 - - m = hashlib.sha256() - m.update(x) - f_sha = m.hexdigest() - - return f_sha - - - # ====____====____==== Uses A GooeyGUI GUI ====____====____== # -# Get the filename, display the hash, dirt simple all around # - # ----------------------------------------------------------- # - -# ---------------------------------------------------------------------- # -# Compute and display SHA1 hash # -# Builds and displays the form using the most basic building blocks # -# ---------------------------------------------------------------------- # -def HashManuallyBuiltGUI(): - # ------- Form design ------- # - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] - (button, (source_filename, )) = form.LayoutAndShow(form_rows) - - if button == 'Submit': - if source_filename != '': - hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() - hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') - else: - SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') - -def HashManuallyBuiltGUINonContext(): - # ------- Form design ------- # - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] - (button, (source_filename, )) = form.LayoutAndShow(form_rows) - - if button == 'Submit': - if source_filename != '': - hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() - hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') - else: - SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') - - - - -# ---------------------------------------------------------------------- # -# Compute and display SHA1 hash # -# This one cheats and uses the higher-level Get A File pre-made func # -# Hey, it's a really common operation so why not? # -# ---------------------------------------------------------------------- # -def HashMostCompactGUI(): - # ------- INPUT GUI portion ------- # - - rc, source_filename = SG.GetFileBox('Display A Hash Using PySimpleGUI', - 'Display a Hash code for file of your choice') - - # ------- OUTPUT GUI results portion ------- # - if rc == True: - hash = compute_sha1_hash_for_file(source_filename) - SG.MsgBox('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) - else: - SG.MsgBox('Display Hash - Compact GUI', '* Cancelled *') - - -# ---------------------------------------------------------------------- # -# Our main calls two GUIs that act identically but use different calls # -# ---------------------------------------------------------------------- # -def main(): - HashManuallyBuiltGUINonContext() - HashMostCompactGUI() - - -# ====____====____==== Pseudo-MAIN program ====____====____==== # -# This is our main-alike piece of code # -# + Starts up the GUI # -# + Gets values from GUI # -# + Runs DeDupe_folder based on GUI inputs # -# ------------------------------------------------------------- # -if __name__ == '__main__': - main() diff --git a/Demo DuplicateFileFinder.py b/Demo DuplicateFileFinder.py deleted file mode 100644 index 49b061bbc..000000000 --- a/Demo DuplicateFileFinder.py +++ /dev/null @@ -1,56 +0,0 @@ -import hashlib -import os -import PySimpleGUI as gg - - -# ====____====____==== FUNCTION DeDuplicate_folder(path) ====____====____==== # -# Function to de-duplicate the folder passed in # -# --------------------------------------------------------------------------- # -def FindDuplicatesFilesInFolder(path): - shatab = [] - total = 0 - small_count, dup_count, error_count = 0,0,0 - pngdir = path - if not os.path.exists(path): - gg.MsgBox('Duplicate Finder', '** Folder doesn\'t exist***', path) - return - pngfiles = os.listdir(pngdir) - total_files = len(pngfiles) - for idx, f in enumerate(pngfiles): - if not gg.EasyProgressMeter('Counting Duplicates', idx+1, total_files, 'Counting Duplicate Files'): - break - total += 1 - fname = os.path.join(pngdir, f) - if os.path.isdir(fname): - continue - x = open(fname, "rb").read() - - m = hashlib.sha256() - m.update(x) - f_sha = m.digest() - if f_sha in shatab: - # uncomment next line to remove duplicate files - # os.remove(fname) - dup_count += 1 - continue - shatab.append(f_sha) - - msg = f'{total} Files processed\n'\ - f'{dup_count} Duplicates found\n' - gg.MsgBox('Duplicate Finder Ended', msg) - -# ====____====____==== Pseudo-MAIN program ====____====____==== # -# This is our main-alike piece of code # -# + Starts up the GUI # -# + Gets values from GUI # -# + Runs DeDupe_folder based on GUI inputs # -# ------------------------------------------------------------- # -if __name__ == '__main__': - - source_folder = None - rc, source_folder = gg.GetPathBox('Duplicate Finder - Count number of duplicate files', 'Enter path to folder you wish to find duplicates in') - if rc is True and source_folder is not None: - FindDuplicatesFilesInFolder(source_folder) - else: - gg.MsgBoxCancel('Cancelling', '*** Cancelling ***') - exit(0) diff --git a/Demo GoodColors.py b/Demo GoodColors.py deleted file mode 100644 index 7d0402f8d..000000000 --- a/Demo GoodColors.py +++ /dev/null @@ -1,50 +0,0 @@ -import PySimpleGUI as gg -import time - -def main(): - # ------- Make a new FlexForm ------- # - form = gg.FlexForm('GoodColors', auto_size_text=True, default_element_size=(30,2)) - form.AddRow(gg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) - form.AddRow(gg.Text('Here come the good colors as defined by PySimpleGUI')) - - #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - text_color = gg.YELLOWS[0] - buttons = (gg.SimpleButton(f'BLUES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) - - #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton(f'PURPLES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) - - #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton(f'GREENS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) - - #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - text_color = gg.GREENS[0] # let's use GREEN text on the tan - buttons = (gg.SimpleButton(f'TANS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) - - #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# - text_color = 'black' # let's use black text on the tan - buttons = (gg.SimpleButton(f'YELLOWS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) - - - #===== Add a click me button for fun and SHOW the form ===== ===== ===== ===== ===== ===== =====# - form.AddRow(gg.SimpleButton('Click ME!')) - (button, value) = form.Show() # show it! - - -if __name__ == '__main__': - main() diff --git a/Demo HowDoI.py b/Demo HowDoI.py deleted file mode 100644 index 26858ed3f..000000000 --- a/Demo HowDoI.py +++ /dev/null @@ -1,54 +0,0 @@ -import PySimpleGUI as SG -import subprocess -import howdoi - -# Test this command in a dos window if you are having trouble. -HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' - -# if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file -DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' - -def HowDoI(): - ''' - Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle - Excellent example of 2 GUI concepts - 1. Output Element that will show text in a scrolled window - 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but doesn't close the form - :return: never returns - ''' - # ------- Make a new FlexForm ------- # - form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) - form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) - form.AddRow(SG.Output(size=(90, 20))) - form.AddRow(SG.Multiline(size=(85, 5), enter_submits=True), - SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), - SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) - - # ---===--- Loop taking in user input and using it to query HowDoI --- # - while True: - (button, value) = form.Read() - if button == 'SEND': - QueryHowDoI(value[0][:-1]) # send string without carriage return on end - else: - break # exit button clicked - - exit(69) - -def QueryHowDoI(Query): - ''' - Kicks off a subprocess to send the 'Query' to HowDoI - Prints the result, which in this program will route to a gooeyGUI window - :param Query: text english question to ask the HowDoI web engine - :return: nothing - ''' - howdoi_command = HOW_DO_I_COMMAND - t = subprocess.Popen(howdoi_command + ' '+ Query, stdout=subprocess.PIPE) - (output, err) = t.communicate() - print('You asked: '+ Query) - print('_______________________________________') - print(output.decode("utf-8") ) - exit_code = t.wait() - -if __name__ == '__main__': - HowDoI() - diff --git a/Demo Media Player.py b/Demo Media Player.py deleted file mode 100644 index 4770c90e2..000000000 --- a/Demo Media Player.py +++ /dev/null @@ -1,60 +0,0 @@ -import PySimpleGUI as sg - -# -# An Async Demonstration of a media player -# Uses button images for a super snazzy look -# See how it looks here: -# https://user-images.githubusercontent.com/13696193/43159403-45c9726e-8f50-11e8-9da0-0d272e20c579.jpg -# - - -def MediaPlayerGUI(): - - # Images are located in a subfolder in the Demo Media Player.py folder - image_pause = './ButtonGraphics/Pause.png' - image_restart = './ButtonGraphics/Restart.png' - image_next = './ButtonGraphics/Next.png' - image_exit = './ButtonGraphics/Exit.png' - - # A text element that will be changed to display messages in the GUI - TextElem = sg.Text('', size=(20, 3), font=("Helvetica", 14)) - - # 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), - font=("Helvetica", 25)) - # define layout of the rows - layout= [[sg.Text('Media File Player', size=(20, 1), font=("Helvetica", 25))], - [TextElem], - [sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0, - size=(10, 2), font=("Helvetica", 15)), sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0, - font=("Helvetica", 15), size=(10, 2)), sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0, - size=(10, 2), font=("Helvetica", 15)), sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0, - size=(10, 2), font=("Helvetica", 15))], - [sg.Text('Treble', font=("Helvetica", 15), size=(6, 1)), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), - sg.Text(' ' * 5), - sg.Text('Volume', font=("Helvetica", 15), size=(7, 1)), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15))], - ] - - # Call the same LayoutAndRead but indicate the form is non-blocking - form.LayoutAndRead(layout, non_blocking=True) - # Our event loop - while(True): - # Read the form (this call will not block) - button, values = form.ReadNonBlocking() - if button == 'Exit': - break - # If a button was pressed, display it on the GUI by updating the text element - if button: - TextElem.Update(button) - -MediaPlayerGUI() - diff --git a/Demo NonBlocking Form.py b/Demo NonBlocking Form.py deleted file mode 100644 index 8e43d6dd8..000000000 --- a/Demo NonBlocking Form.py +++ /dev/null @@ -1,59 +0,0 @@ -import PySimpleGUI as sg -import time - -def main(): - StatusOutputExample() - -# form that doen't block -def StatusOutputExample_context_manager(): - with sg.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20)) - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - - form.LayoutAndRead(form_rows, non_blocking=True) - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - -# form that doen't block -def StatusOutputExample(): - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - - -if __name__ == '__main__': - - main() diff --git a/Demo Recipes.py b/Demo Recipes.py deleted file mode 100644 index 6f2a76cd2..000000000 --- a/Demo Recipes.py +++ /dev/null @@ -1,167 +0,0 @@ -import time -from random import randint -import PySimpleGUI as sg - -# A simple blocking form. Your best starter-form -def SourceDestFolders(): - with sg.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: - form_rows = [[sg.Text('Enter the Source and Destination folders')], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source')], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, (source, dest) = form.LayoutAndRead(form_rows) - if button == 'Submit': - sg.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) - else: - sg.MsgBoxError('Cancelled', 'User Cancelled') - -# YOUR BEST STARTING POINT -# This is a form showing you all of the basic Elements (widgets) -# Some have a few of the optional parameters set, but there are more to choose from -# You want to use the context manager because it will free up resources when you are finished -# Use this especially if you are runningm multi-threaded -# Where you free up resources is really important to tkinter -def Everything(): - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - sg.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) - -# Should you decide not to use a context manager, then try this form as your starting point -# Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if -# you are running multithreaded -def Everything_NoContextManager(): - form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1), text_color='red')], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))]] - - button, values = form.LayoutAndRead(layout) - del(form) - - sg.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) - -def ProgressMeter(): - for i in range(1,10000): - if not sg.EasyProgressMeter('My Meter', i + 1, 10000): break - # SG.Print(i) - -# Blocking form that doesn't close -def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - -# Shows a form that's a running counter -# this is the basic design pattern if you can keep your reading of the -# form within the 'with' block. If your read occurs far away in your code from the form creation -# then you will want to use the NonBlockingPeriodicUpdateForm example -def NonBlockingPeriodicUpdateForm_ContextManager(): - with sg.FlexForm('Running Timer', auto_size_text=True) as form: - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') - layout = [[sg.Text('Non blocking GUI with updates', justification='center')], - [text_element], - [sg.T(' ' * 15), sg.Quit()]] - form.LayoutAndRead(layout, non_blocking=True) - - for i in range(1,500): - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X - break - time.sleep(.01) - else: - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - -# Use this context-manager-free version if your read of the form occurs far away in your code -# from the form creation (call to LayoutAndRead) -def NonBlockingPeriodicUpdateForm(): - # Show a form that's a running counter - form = sg.FlexForm('Running Timer', auto_size_text=True) - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') - form_rows = [[sg.Text('Non blocking GUI with updates')], - [text_element], - [sg.T(' ' * 15), sg.Quit()]] - form.LayoutAndRead(form_rows, non_blocking=True) - - for i in range(1,50000): - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - time.sleep(.01) - else: - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - del(form) - -def DebugTest(): - # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) - for i in range (1,300): - sg.Print(i, randint(1, 1000), end='', sep='-') - - -def main(): - # SG.SetOptions(border_width=1, font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), slider_border_width=1) - NonBlockingPeriodicUpdateForm_ContextManager() - NonBlockingPeriodicUpdateForm() - Everything_NoContextManager() - Everything() - ChatBot() - ProgressMeter() - SourceDestFolders() - ChatBot() - DebugTest() - sg.MsgBox('Done with all recipes') - -if __name__ == '__main__': - main() - exit(69) diff --git a/Demo Tabbed Form.py b/Demo Tabbed Form.py deleted file mode 100644 index 305202ebb..000000000 --- a/Demo Tabbed Form.py +++ /dev/null @@ -1,89 +0,0 @@ -import PySimpleGUI as sg - -MAX_NUMBER_OF_THREADS = 12 - -def eBaySuperSearcherGUI(): - # Drop Down list of options - configs = ('0 - Gruen - Started 2 days ago in Watches', - '1 - Gruen - Currently Active in Watches', - '2 - Alpina - Currently Active in Jewelry', - '3 - Gruen - Ends in 1 day in Watches', - '4 - Gruen - Completed in Watches', - '5 - Gruen - Advertising', - '6 - Gruen - Currently Active in Jewelry', - '7 - Gruen - Price Test', - '8 - Gruen - No brand name specified') - - us_categories = ('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 34', - ' Watch Ads - 165254' - ) - - german_categories =('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 1', - ' Watch Ads - 19823' - ) - - - # the form layout - with sg.FlexForm('EBay Super Searcher', auto_size_text=True) as form: - with sg.FlexForm('EBay Super Searcher') as form2: - layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], - [sg.Text('Choose base configuration to run')], - [sg.InputCombo(configs)], - [sg.Text('_'*100, size=(80,1))], - [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], - [sg.InputText(),sg.Text('Custom text to add to folder name')], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], - [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Time Filters')], - [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue')), sg.Text(f'{MAX_NUMBER_OF_THREADS} Threads will be started')]] - - - # First category is default (need to special case this) - layout_tab_2 = [[sg.Text('Choose Category')], - [sg.Text('US Categories'),sg.Text('German Categories')], - [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] - - for i,cat in enumerate(us_categories): - if i == 0: continue # skip first one - layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) - - - layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) - layout_tab_2.append([sg.Text('US Search String Override')]) - layout_tab_2.append([sg.InputText(size=(100,1))]) - layout_tab_2.append([sg.Text('German Search String Override')]) - layout_tab_2.append([sg.InputText(size=(100,1))]) - layout_tab_2.append([sg.Text('Typical US Search String')]) - layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) - layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) - layout_tab_2.append([sg.Submit(button_color=('red', 'yellow'),auto_size_text=True), sg.Cancel(button_color=('white', 'blue'), auto_size_text=True)]) - - results =sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) - - return results - - -if __name__ == '__main__': - results = eBaySuperSearcherGUI() - print(results) - sg.MsgBox('Results', results) \ No newline at end of file From 60173f9b6c6846e213f7f0f535867c1823355efb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 26 Jul 2018 19:53:17 -0400 Subject: [PATCH 072/521] RELEASE 2.5 Background colors. Readme for 2.5 --- PySimpleGUI.py | 273 +++++++++++++++++++++++++++++++++++-------------- readme.md | 111 +++++++++++++++----- 2 files changed, 279 insertions(+), 105 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ab01ba2cf..006a04dcd 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -29,16 +29,23 @@ TANS = ("#FFF9D5","#F4EFCF","#DDD8BA") NICE_BUTTON_COLORS = ((GREENS[3], TANS[0]), ('#000000','#FFFFFF'),('#FFFFFF', '#000000'), (YELLOWS[0], PURPLES[1]), (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) + +COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long +DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default +DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") +DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) +DEFAULT_BACKGROUND_COLOR = None +DEFAULT_ELEMENT_BACKGROUND_COLOR = None +DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = None +DEFAULT_TEXT_COLOR = 'black' +DEFAULT_INPUT_ELEMENTS_COLOR = COLOR_SYSTEM_DEFAULT +DEFAULT_SCROLLBAR_COLOR = None # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember # DEFAULT_BUTTON_COLOR = (GREENS[3], TANS[0]) # Foreground, Background (None, None) == System Default # DEFAULT_BUTTON_COLOR = (YELLOWS[0], GREENS[4]) # Foreground, Background (None, None) == System Default -DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default # DEFAULT_BUTTON_COLOR = ('white', 'black') # Foreground, Background (None, None) == System Default # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[2]) # Foreground, Background (None, None) == System Default -DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") -DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) # DEFAULT_PROGRESS_BAR_COLOR = (GREENS[2], GREENS[0]) # a nice green progress bar -DEFAULT_PROGRESS_BAR_COLOR = (GREENS[3], GREENS[3]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[1], BLUES[1]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (BLUES[0], BLUES[0]) # a nice green progress bar # DEFAULT_PROGRESS_BAR_COLOR = (PURPLES[1],PURPLES[0]) # a nice purple progress bar @@ -46,10 +53,19 @@ # A transparent button is simply one that matches the background TRANSPARENT_BUTTON = ('#F0F0F0', '#F0F0F0') #-------------------------------------------------------------------------------- +# Progress Bar Relief Choices +RELIEF_RAISED= 'raised' +RELIEF_SUNKEN= 'sunken' +RELIEF_FLAT= 'flat' +RELIEF_RIDGE= 'ridge' +RELIEF_GROOVE= 'groove' +RELIEF_SOLID = 'solid' -DEFAULT_PROGRESS_BAR_SIZE = (35,25) # Size of Progress Bar (characters for length, pixels for width) +DEFAULT_PROGRESS_BAR_COLOR = (GREENS[0], '#D0D0D0') # a nice green progress bar +DEFAULT_PROGRESS_BAR_SIZE = (35,20) # Size of Progress Bar (characters for length, pixels for width) DEFAULT_PROGRESS_BAR_BORDER_WIDTH=1 -DEFAULT_PROGRESS_BAR_RELIEF = tk.SUNKEN +DEFAULT_PROGRESS_BAR_RELIEF = RELIEF_GROOVE +PROGRESS_BAR_STYLES = ('default','winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative') DEFAULT_PROGRESS_BAR_STYLE = 'default' DEFAULT_METER_ORIENTATION = 'Horizontal' DEFAULT_SLIDER_ORIENTATION = 'vertical' @@ -69,16 +85,8 @@ # DEFAULT_METER_ORIENTATION = 'Vertical' # ----====----====----==== Constants the user should NOT f-with ====----====----====----# ThisRow = 555666777 # magic number -# Progress Bar Relief Choices -# -relief -RELIEF_RAISED= 'raised' -RELIEF_SUNKEN= 'sunken' -RELIEF_FLAT= 'flat' -RELIEF_RIDGE= 'ridge' -RELIEF_GROOVE= 'groove' -RELIEF_SOLID = 'solid' -PROGRESS_BAR_STYLES = ('default','winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative') + # DEFAULT_WINDOW_ICON = '' MESSAGE_BOX_LINE_WIDTH = 60 @@ -142,7 +150,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # Element CLASS # # ------------------------------------------------------------------------- # class Element(): - def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): self.Size = size self.Type = type self.AutoSizeText = auto_size_text @@ -159,6 +167,7 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.ParentForm=None self.TextInputDefault = None self.Position = (0,0) # Default position Row 0, Col 0 + self.BackgroundColor = background_color if background_color is not None else DEFAULT_ELEMENT_BACKGROUND_COLOR return def __del__(self): @@ -184,10 +193,11 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char=''): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None): self.DefaultText = default_text self.PasswordCharacter = password_char - super().__init__(ELEM_TYPE_INPUT_TEXT, scale, size, auto_size_text) + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg) return def ReturnKeyHandler(self, event): @@ -208,10 +218,11 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None): + def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): self.Values = values self.TKComboBox = None - super().__init__(ELEM_TYPE_INPUT_COMBO, scale, size, auto_size_text) + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg) return def __del__(self): @@ -227,7 +238,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): self.Values = values self.TKListBox = None if select_mode == LISTBOX_SELECT_MODE_BROWSE: @@ -240,7 +251,8 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non self.SelectMode = SELECT_MODE_SINGLE else: self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE - super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font) + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg) return def __del__(self): @@ -256,13 +268,13 @@ def __del__(self): # Radio # # ---------------------------------------------------------------------- # class Radio(Element): - def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, font=None): self.InitialState = default self.Text = text self.TKRadio = None self.GroupID = group_id self.Value = None - super().__init__(ELEM_TYPE_INPUT_RADIO, scale, size, auto_size_text, font) + super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color) return def __del__(self): @@ -276,13 +288,13 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): self.Text = text self.InitialState = default self.Value = None self.TKCheckbox = None - super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale, size, auto_size_text, font) + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color) return def __del__(self): @@ -299,11 +311,12 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None): + def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): self.Values = values self.DefaultValue = initial_value self.TKSpinBox = None - super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font) + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg) return def __del__(self): @@ -317,10 +330,11 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None): + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): self.DefaultText = default_text self.EnterSubmits = enter_submits - super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale, size, auto_size_text) + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg) return def ReturnKeyHandler(self, event): @@ -340,13 +354,17 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None): self.DisplayText = text - self.TextColor = text_color if text_color else 'black' + self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR self.Justification = justification if justification else DEFAULT_TEXT_JUSTIFICATION + if background_color is None: + bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR + else: + bg = background_color # self.Font = Font if Font else DEFAULT_FONT # i=1/0 - super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, font=font if font else DEFAULT_FONT) + super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT) return def Update(self, NewValue): @@ -364,7 +382,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class TKProgressBar(): - def __init__(self, root, max, length=400, width=20, highlightt=0, relief='sunken', border_width=4, orientation='horizontal', BarColor=DEFAULT_PROGRESS_BAR_COLOR): + def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], style=DEFAULT_PROGRESS_BAR_STYLE, relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH, orientation='horizontal', BarColor=DEFAULT_PROGRESS_BAR_COLOR): self.Length = length self.Width = width self.Max = max @@ -372,39 +390,35 @@ def __init__(self, root, max, length=400, width=20, highlightt=0, relief='sunken self.Count = None self.PriorCount = 0 if orientation[0].lower() == 'h': - self.TKCanvas = tk.Canvas(root, width=length, height=width, highlightt=highlightt, relief=relief, borderwidth=border_width) - self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(length * 1.5), width * 1.5, fill=BarColor[0], tags='bar') + s = ttk.Style() + s.theme_use(style) + s.configure("my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style='my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate') + # self.TKCanvas = tk.Canvas(root, width=length, height=width, highlightt=highlightt, relief=relief, borderwidth=border_width) + # self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(length * 1.5), width * 1.5, fill=BarColor[0], tags='bar') # self.canvas.pack(padx='10') else: - self.TKCanvas = tk.Canvas(root, width=width, height=length, highlightt=highlightt, relief=relief, borderwidth=border_width) - self.TKRect = self.TKCanvas.create_rectangle(width * 1.5, 2 * length + 40, 0, length * .5, fill=BarColor[0], tags='bar') + # s = ttk.Style() + # s.theme_use('clam') + # s.configure('Vertical.mycolor.progbar', forground=BarColor[0], background=BarColor[1]) + s = ttk.Style() + s.theme_use(style) + s.configure("my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style='my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate') + # self.TKCanvas = tk.Canvas(root, width=width, height=length, highlightt=highlightt, relief=relief, borderwidth=border_width) + # self.TKRect = self.TKCanvas.create_rectangle(width * 1.5, 2 * length + 40, 0, length * .5, fill=BarColor[0], tags='bar') # self.canvas.pack() def Update(self, count): - if count > self.Max: return - if self.Orientation[0].lower() == 'h': - try: - if count != self.PriorCount: - delta = count - self.PriorCount - self.TKCanvas.move(self.TKRect, delta*(self.Length / self.Max), 0) - if 0: self.TKCanvas.update() - except: - return False # the window was closed by the user on us - else: - try: - if count != self.PriorCount: - delta = count - self.PriorCount - self.TKCanvas.move(self.TKRect, 0, delta*(-self.Length / self.Max)) - if 0: self.TKCanvas.update() - except: - return False # the window was closed by the user on us - self.PriorCount = count + if count > self.Max: return False + try: + self.TKProgressBarForReal['value'] = count + except: return False return True def __del__(self): try: - self.TKCanvas.__del__() - self.TKRect.__del__() + self.TKProgressBarForReal.__del__() except: pass @@ -413,14 +427,15 @@ def __del__(self): # New Type of Widget that's a Text Widget in disguise # # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): - def __init__(self, parent, width, height, bd): + def __init__(self, parent, width, height, bd, background_color=None): tk.Frame.__init__(self, parent) self.output = tk.Text(parent, width=width, height=height, bd=bd) - + if background_color and background_color != COLOR_SYSTEM_DEFAULT: + self.output.configure(background=background_color) self.vsb = tk.Scrollbar(parent, orient="vertical", command=self.output.yview) - self.vsb.pack(side="right", fill="y") self.output.configure(yscrollcommand=self.vsb.set) self.output.pack(side="left", fill="both", expand=True) + self.vsb.pack(side="left", fill="y") self.previous_stdout = sys.stdout self.previous_stderr = sys.stderr @@ -448,9 +463,10 @@ def __del__(self): sys.stderr = self.previous_stderr class Output(Element): - def __init__(self, scale=(None, None), size=(None, None)): + def __init__(self, scale=(None, None), size=(None, None), background_color=None): self.TKOut = None - super().__init__(ELEM_TYPE_OUTPUT, scale, size) + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg) def __del__(self): try: @@ -607,14 +623,14 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None): + def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None): self.TKScale = None self.Range = (1,10) if range == (None, None) else range self.DefaultValue = 5 if default_value is None else default_value self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF - super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font) + super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color) return def __del__(self): @@ -651,7 +667,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): self.AutoSizeText = auto_size_text self.Title = title self.Rows = [] # a list of ELEMENTS for this row @@ -659,6 +675,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.Scale = scale self.Location = location self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR + self.BackgroundColor = background_color if background_color else DEFAULT_BACKGROUND_COLOR self.IsTabbedForm = is_tabbed_form self.ParentWindow = None self.Font = font if font else DEFAULT_FONT @@ -1139,6 +1156,8 @@ def CharWidthInPixels(): # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget + if element.BackgroundColor is not None: + tktext_label.configure(background=element.BackgroundColor) tktext_label.pack(side=tk.LEFT) # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: @@ -1188,6 +1207,8 @@ def CharWidthInPixels(): show = element.PasswordCharacter if element.PasswordCharacter else "" element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show) element.TKEntry.bind('', element.ReturnKeyHandler) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKEntry.configure(background=element.BackgroundColor) element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) if not focus_set: focus_set = True @@ -1198,11 +1219,27 @@ def CharWidthInPixels(): if auto_size_text is False: width=element_size[0] else: width = max_line_len element.TKStringVar = tk.StringVar() + if element.BackgroundColor and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + combostyle = ttk.Style() + try: + combostyle.theme_create('combostyle', + settings={'TCombobox': + {'configure': + {'selectbackground': element.BackgroundColor, + 'fieldbackground': element.BackgroundColor, + 'background': element.BackgroundColor} + }}) + except: pass + # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox + combostyle.theme_use('combostyle') element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) + # element.TKCombo['state']='readonly' element.TKCombo['values'] = element.Values + # if element.BackgroundColor is not None: + # element.TKCombo.configure(background=element.BackgroundColor) element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) element.TKCombo.current(0) - # ------------------------- LISTBOX (Drop Down) element ------------------------- # + # ------------------------- LISTBOX element ------------------------- # elif element_type == ELEM_TYPE_INPUT_LISTBOX: max_line_len = max([len(str(l)) for l in element.Values]) if auto_size_text is False: width=element_size[0] @@ -1213,13 +1250,21 @@ def CharWidthInPixels(): for item in element.Values: element.TKListbox.insert(tk.END, item) element.TKListbox.selection_set(0,0) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKListbox.configure(background=element.BackgroundColor) + # vsb = tk.Scrollbar(tk_row_frame, orient="vertical", command=element.TKListbox.yview) + # element.TKListbox.configure(yscrollcommand=vsb.set) element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + # vsb.pack(side=tk.LEFT, fill='y') # ------------------------- INPUT MULTI LINE element ------------------------- # elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText width, height = element_size element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) element.TKText.insert(1.0, default_text) # set the default text + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKText.configure(background=element.BackgroundColor) + element.TKText.vbar.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) if element.EnterSubmits: element.TKText.bind('', element.ReturnKeyHandler) @@ -1233,6 +1278,8 @@ def CharWidthInPixels(): element.TKIntVar = tk.IntVar() element.TKIntVar.set(default_value) element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) + if element.BackgroundColor is not None: + element.TKCheckbutton.configure(background=element.BackgroundColor) element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- PROGRESS BAR element ------------------------- # elif element_type == ELEM_TYPE_PROGRESS_BAR: @@ -1249,9 +1296,9 @@ def CharWidthInPixels(): bar_color = element.BarColor else: bar_color = DEFAULT_PROGRESS_BAR_COLOR - element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) - s = ttk.Style() - element.TKProgressBar.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief, style=element.BarStyle ) + # element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) + element.TKProgressBar.TKProgressBarForReal.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT RADIO BUTTON element ------------------------- # elif element_type == ELEM_TYPE_INPUT_RADIO: width = 0 if auto_size_text else element_size[0] @@ -1269,7 +1316,9 @@ def CharWidthInPixels(): element.TKIntVar.set(value) element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, value=value, bd=border_depth, font=font) - element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.BackgroundColor is not None: + element.TKRadio.configure(background=element.BackgroundColor) + element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) # ------------------------- INPUT SPIN Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SPIN: width, height = element_size @@ -1278,11 +1327,13 @@ def CharWidthInPixels(): element.TKSpinBox = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth) element.TKStringVar.set(element.DefaultValue) element.TKSpinBox.configure(font=font) # set wrap to width of widget + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKSpinBox.configure(background=element.BackgroundColor) element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth) + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor) element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: @@ -1309,10 +1360,15 @@ def CharWidthInPixels(): range_to = element.Range[1] tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) # tktext_label.configure(anchor=tk.NW, image=photo) + if element.BackgroundColor is not None: + tkscale.configure(background=element.BackgroundColor) + tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) tkscale.pack(side=tk.LEFT) #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets tk_row_frame.grid(row=row_num+2, sticky=tk.W, padx=DEFAULT_MARGINS[0]) + if MyFlexForm.BackgroundColor is not None: + tk_row_frame.configure(background=MyFlexForm.BackgroundColor) if not MyFlexForm.IsTabbedForm: MyFlexForm.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) else: MyFlexForm.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) @@ -1351,11 +1407,26 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A if not len(args): ('******************* SHOW TABBED FORMS ERROR .... no arguments') return + if DEFAULT_BACKGROUND_COLOR: + framestyle = ttk.Style() + try: + framestyle.theme_create('framestyle', parent='alt', + settings={'TFrame': + {'configure': + {'background': DEFAULT_BACKGROUND_COLOR, + }}}) + except: pass + # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox + # framestyle.theme_use('framestyle') tab_control = ttk.Notebook(root) for num,x in enumerate(args): form, rows, tab_name = x form.AddRows(rows) + + if DEFAULT_BACKGROUND_COLOR: + framestyle.theme_use('framestyle') tab = ttk.Frame(tab_control) # Create tab 1 + # s.configure("my.Frame.TFrame", background=DEFAULT_BACKGROUND_COLOR) tab_control.add(tab, text=tab_name) # Add tab 1 # tab_control.configure(text='new text') tab_control.grid(row=0, sticky=tk.W) @@ -1386,6 +1457,8 @@ def StartupTK(my_flex_form): ow = _my_windows.NumOpenWindows root = tk.Tk() if not ow else tk.Toplevel() + if my_flex_form.BackgroundColor is not None: + root.configure(background=my_flex_form.BackgroundColor) _my_windows.NumOpenWindows += 1 my_flex_form.TKroot = root @@ -1604,7 +1677,7 @@ def ConvertArgsToSingleString(*args): # if not isinstance(message, str): message = str(message) message = str(message) longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, MESSAGE_BOX_LINE_WIDTH) + width_used = max(longest_line_len, width_used) max_line_total = max(max_line_total, width_used) lines_needed = _GetNumLinesNeeded(message, width_used) total_lines += lines_needed @@ -1631,7 +1704,7 @@ def ProgressMeter(title, max_value, *args, orientation=None, bar_color=DEFAULT_P local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width target = (0,0) if local_orientation[0].lower() == 'h' else (0,1) - bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, target=target, border_width=local_border_width) + bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, target=target, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) form = FlexForm(title, auto_size_text=True) # Form using a horizontal bar @@ -1640,7 +1713,7 @@ def ProgressMeter(title, max_value, *args, orientation=None, bar_color=DEFAULT_P bar2.TextToDisplay = single_line_message bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(Text(single_line_message, size=(width + 20, height + 3), auto_size_text=True)) + form.AddRow(Text(single_line_message, size=(width, height + 3), auto_size_text=True)) form.AddRow((bar2)) form.AddRow((Cancel(button_color=button_color))) else: @@ -1648,7 +1721,7 @@ def ProgressMeter(title, max_value, *args, orientation=None, bar_color=DEFAULT_P bar2.TextToDisplay = single_line_message bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(bar2, Text(single_line_message, size=(width +20, height + 3), auto_size_text=True)) + form.AddRow(bar2, Text(single_line_message, size=(width, height + 3), auto_size_text=True)) form.AddRow((Cancel(button_color=button_color))) form.NonBlocking = True @@ -1993,7 +2066,11 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma element_padding=(None,None),auto_size_text=None, font=None, border_width=None, slider_border_width=None, slider_relief=None, slider_orientation=None, autoclose_time=None, message_box_line_width=None, - progress_meter_border_depth=None, text_justification=None, debug_win_size=(None,None)): + progress_meter_border_depth=None, progress_meter_style=None, + progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None, + text_justification=None, background_color=None, element_background_color=None, + text_element_background_color=None, input_elements_background_color=None, + scrollbar_color=None, text_color=None, debug_win_size=(None,None)): global DEFAULT_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term @@ -2005,11 +2082,21 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma global DEFAULT_BUTTON_COLOR global MESSAGE_BOX_LINE_WIDTH global DEFAULT_PROGRESS_BAR_BORDER_WIDTH + global DEFAULT_PROGRESS_BAR_STYLE + global DEFAULT_PROGRESS_BAR_RELIEF + global DEFAULT_PROGRESS_BAR_COLOR + global DEFAULT_PROGRESS_BAR_SIZE global DEFAULT_TEXT_JUSTIFICATION global DEFAULT_DEBUG_WINDOW_SIZE global DEFAULT_SLIDER_BORDER_WIDTH global DEFAULT_SLIDER_RELIEF global DEFAULT_SLIDER_ORIENTATION + global DEFAULT_BACKGROUND_COLOR + global DEFAULT_INPUT_ELEMENTS_COLOR + global DEFAULT_ELEMENT_BACKGROUND_COLOR + global DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR + global DEFAULT_SCROLLBAR_COLOR + global DEFAULT_TEXT_COLOR global _my_windows if icon: @@ -2050,6 +2137,18 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma if progress_meter_border_depth != None: DEFAULT_PROGRESS_BAR_BORDER_WIDTH = progress_meter_border_depth + if progress_meter_style != None: + DEFAULT_PROGRESS_BAR_STYLE = progress_meter_style + + if progress_meter_relief != None: + DEFAULT_PROGRESS_BAR_RELIEF = progress_meter_relief + + if progress_meter_color != None: + DEFAULT_PROGRESS_BAR_COLOR = progress_meter_color + + if progress_meter_size != None: + DEFAULT_PROGRESS_BAR_SIZE = progress_meter_size + if slider_border_width != None: DEFAULT_SLIDER_BORDER_WIDTH = slider_border_width @@ -2062,12 +2161,30 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma if text_justification != None: DEFAULT_TEXT_JUSTIFICATION = text_justification + if background_color != None: + DEFAULT_BACKGROUND_COLOR = background_color + + if text_element_background_color != None: + DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = text_element_background_color + + if input_elements_background_color != None: + DEFAULT_INPUT_ELEMENTS_COLOR = input_elements_background_color + + if element_background_color != None: + DEFAULT_ELEMENT_BACKGROUND_COLOR = element_background_color + if debug_win_size != (None,None): DEFAULT_DEBUG_WINDOW_SIZE = debug_win_size + if text_color != None: + DEFAULT_TEXT_COLOR = text_color + + if scrollbar_color != None: + DEFAULT_SCROLLBAR_COLOR = scrollbar_color + return True -# ============================== sprint ======#fddddddddddddddddddddddd +# ============================== sprint ======# # Is identical to the Scrolled Text Box # # Provides a crude 'print' mechanism but in a # # GUI environment # diff --git a/readme.md b/readme.md index 6da141ebd..787fe6850 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI - (Ver 2.4) + (Ver 2.5) Super-simple GUI to grasp... Powerfully customizable. @@ -16,13 +16,22 @@ Looking to take your Python code from the world of command lines and into the co ![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) -Add a Progress Meter to your code with ONE LINE of code + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + +Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. + +![snap0153](https://user-images.githubusercontent.com/13696193/43261051-5838b356-90a9-11e8-96cc-e8a4860d0464.jpg) + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: EasyProgressMeter('My meter title', current_value, max value) ![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) -Or how about a media player GUI with custom buttons... in 30 lines of code. +You can build an async media player GUI with custom buttons in 30 lines of code. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) @@ -112,9 +121,6 @@ You will see a number of different styles of buttons, data entry fields, etc, in - A row is a list of elements - Return values are a list - Each Elements is specified by names such as Text, Button, Checkbox, etc. - -Some elements have shortcuts, meant to make it easy on the programmer who will write less code using them. Rather than writing calling `Button`, with `button_name = "Submit"` will create a button with the text 'Submit' on it, Other examples include shortening the name of the function. `Text` is shorted to `Txt` or `T`. See each API call for the shortcuts. ----- ## Getting Started with PySimpleGUI @@ -1035,27 +1041,64 @@ Recall that values is a list as well. Multiple tabs in the form would return li ((button1, (values1)), (button2, (values2)) + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + ## Global Settings **Global Settings** Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - SetOptions(icon=None, - button_color=(None,None), - element_size=(None,None), - margins=(None,None), - element_padding=(None,None), - auto_size_text=None, - font=None, - border_width=None, - slider_border_width=None, - slider_relief=None, - slider_orientation=None, - autoclose_time=None, - message_box_line_width=None, - progress_meter_border_depth=None, - text_justification=None, - debug_win_size=(None,None): + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) Explanation of parameters @@ -1073,6 +1116,16 @@ Explanation of parameters autoclose_time - time in seconds for autoclose boxes message_box_line_width - number of characers in a line of text in message boxes progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' debug_win_size - size of the Print output window @@ -1083,7 +1136,7 @@ These settings apply to all forms `SetOptions`. The Row options and Element opt - Row level - Element level -Each lower level overrides the settings of the higher level +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). ## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. @@ -1173,13 +1226,13 @@ That's it... this example follows the async design pattern well. ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: +`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. + `Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename `Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning -`Demo Recipes.py` - Three sample forms including an asynchronous form - -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. ## Fun Stuff Here are some things to try if you're bored or want to further customize @@ -1253,6 +1306,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.2.0| July 20, 2018 - Image Elements, Print output | 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -1261,12 +1315,15 @@ If using Progress Meters, avoid cancelling them when you have another window ope New debug printing capability. `sg.Print` +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + ### Upcoming Make suggestions people! Future release features Columns. How multiple columns would be specified in the SDK interface are still being designed. -Progress Meters - Replace custom meter with tkinter meter. ## Code Condition From 4895ab61f2107f1bc8c892859ba640db584378d0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 27 Jul 2018 15:45:38 -0400 Subject: [PATCH 073/521] RELEASE 2.6 New setting for Button Element sizing. System-wide DEFAULT_AUTO_SIZE_BUTTONS. Can also be set at the form level. This will greatly compact code. --- Demo_HowDoI.py | 3 +- Demo_Recipes.py | 146 +++++++++++++++++++++++++++++++++--------------- PySimpleGUI.py | 106 +++++++++++++++++++++++------------ 3 files changed, 172 insertions(+), 83 deletions(-) diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index e7385bfdc..257a06561 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -17,7 +17,8 @@ def HowDoI(): :return: never returns ''' # ------- Make a new FlexForm ------- # - SG.SetOptions(border_width=1) + # Set system-wide options that will affect all future forms. Give our form a spiffy look and feel + SG.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841')) form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) form.AddRow(SG.Output(size=(90, 20))) diff --git a/Demo_Recipes.py b/Demo_Recipes.py index 8b8e92936..68bc72a12 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -4,10 +4,10 @@ # A simple blocking form. Your best starter-form def SourceDestFolders(): - with sg.FlexForm('Demo Source / Destination Folders', auto_size_text=True) as form: + with sg.FlexForm('Demo Source / Destination Folders') as form: form_rows = [[sg.Text('Enter the Source and Destination folders')], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source')], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], + [sg.Text('Source Folder', size=(15, 1), justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) @@ -16,6 +16,35 @@ def SourceDestFolders(): else: sg.MsgBoxError('Cancelled', 'User Cancelled') + +def MachineLearningGUI(): + sg.SetOptions(text_justification='right') + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 13))], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 13))], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + button, values = form.LayoutAndShow(layout) + del(form) + sg.SetOptions(text_justification='left') + + return button, values + # YOUR BEST STARTING POINT # This is a form showing you all of the basic Elements (widgets) # Some have a few of the optional parameters set, but there are more to choose from @@ -23,65 +52,70 @@ def SourceDestFolders(): # Use this especially if you are runningm multi-threaded # Where you free up resources is really important to tkinter def Everything(): + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText()], [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10), + [sg.Multiline(default_text='This is the default Text should you decide not to type anything',size=(35,3)), + sg.Multiline(default_text='A second multi-line',size=(35,3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))] ] button, values = form.LayoutAndRead(layout) - sg.MsgBox('Title', 'Typical message box', 'The results of the form are a lot of data! Get ready... ', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) # Should you decide not to use a context manager, then try this form as your starting point # Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if # you are running multithreaded def Everything_NoContextManager(): form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1), text_color='red')], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))]] + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] + ] button, values = form.LayoutAndRead(layout) del(form) - sg.MsgBox('Title', 'Typical message box', 'Here are the restults! There is one entry per input field ', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + def ProgressMeter(): - for i in range(1,10000): - if not sg.EasyProgressMeter('My Meter', i + 1, 10000): break - # SG.Print(i) + for i in range(1,100): + if not sg.EasyProgressMeter('My Meter', i + 1, 100, orientation='v'): break + time.sleep(.01) # Blocking form that doesn't close def ChatBot(): @@ -149,18 +183,40 @@ def DebugTest(): for i in range (1,300): sg.Print(i, randint(1, 1000), end='', sep='-') - +#=---------------------------------- main ------------------------------ def main(): - # SG.SetOptions(border_width=1, font=("Helvetica", 10), button_color=('white', SG.BLUES[0]), slider_border_width=1) - NonBlockingPeriodicUpdateForm_ContextManager() - NonBlockingPeriodicUpdateForm() + + # sg.MsgBox('Changing look and feel.', 'Done by calling SetOptions') + SourceDestFolders() + + sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841'), border_width=0, slider_border_width=0, progress_meter_border_depth=0) + + MachineLearningGUI() Everything_NoContextManager() + + # sg.SetOptions(background_color='#B89FB6', text_element_background_color='#B89FB6', element_background_color='#B89FB6', button_color=('white','#7E6C92'), text_color='#3F403F',border_width=0, slider_border_width=0, progress_meter_border_depth=0) + + sg.SetOptions(background_color='#A5CADD', input_elements_background_color='#E0F5FF', text_element_background_color='#A5CADD', element_background_color='#A5CADD', button_color=('white','#303952'), text_color='#822E45',border_width=0, progress_meter_color=('#3D8255','white'), slider_border_width=0, progress_meter_border_depth=0) + + Everything_NoContextManager() + Everything() - ChatBot() + ProgressMeter() - SourceDestFolders() + + # Set system-wide options that will affect all future forms + + + NonBlockingPeriodicUpdateForm_ContextManager() + + + NonBlockingPeriodicUpdateForm() + + ChatBot() + DebugTest() + sg.MsgBox('Done with all recipes') if __name__ == '__main__': diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 006a04dcd..e18b401ee 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -15,6 +15,7 @@ DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels DEFAULT_AUTOSIZE_TEXT = False +DEFAULT_AUTOSIZE_BUTTONS = True DEFAULT_FONT = ("Helvetica", 10) DEFAULT_TEXT_JUSTIFICATION = 'left' DEFAULT_BORDER_WIDTH = 1 @@ -62,7 +63,7 @@ RELIEF_SOLID = 'solid' DEFAULT_PROGRESS_BAR_COLOR = (GREENS[0], '#D0D0D0') # a nice green progress bar -DEFAULT_PROGRESS_BAR_SIZE = (35,20) # Size of Progress Bar (characters for length, pixels for width) +DEFAULT_PROGRESS_BAR_SIZE = (25,20) # Size of Progress Bar (characters for length, pixels for width) DEFAULT_PROGRESS_BAR_BORDER_WIDTH=1 DEFAULT_PROGRESS_BAR_RELIEF = RELIEF_GROOVE PROGRESS_BAR_STYLES = ('default','winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative') @@ -382,7 +383,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class TKProgressBar(): - def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], style=DEFAULT_PROGRESS_BAR_STYLE, relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH, orientation='horizontal', BarColor=DEFAULT_PROGRESS_BAR_COLOR): + def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], style=DEFAULT_PROGRESS_BAR_STYLE, relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH, orientation='horizontal', BarColor=(None,None)): self.Length = length self.Width = width self.Max = max @@ -423,8 +424,10 @@ def __del__(self): pass # ---------------------------------------------------------------------- # -# Output # -# New Type of Widget that's a Text Widget in disguise # +# TKOutput # +# New Type of TK Widget that's a Text Widget in disguise # +# Note that it's inherited from the TKFrame class so that the # +# Scroll bar will span the length of the frame # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): def __init__(self, parent, width, height, bd, background_color=None): @@ -462,6 +465,10 @@ def __del__(self): sys.stdout = self.previous_stdout sys.stderr = self.previous_stderr +# ---------------------------------------------------------------------- # +# Output # +# Routes stdout, stderr to a scrolled window # +# ---------------------------------------------------------------------- # class Output(Element): def __init__(self, scale=(None, None), size=(None, None), background_color=None): self.TKOut = None @@ -479,7 +486,8 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None,None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): + def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None,None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + self.AutoSizeButton = auto_size_button self.BType = button_type self.FileTypes = file_types self.TKButton = None @@ -491,7 +499,7 @@ def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', self.ImageSubsample = image_subsample self.UserData = None self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH - super().__init__(ELEM_TYPE_BUTTON, scale, size, auto_size_text, font=font) + super().__init__(ELEM_TYPE_BUTTON, scale, size, font=font) return # ------- Button Callback ------- # @@ -667,8 +675,9 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=DEFAULT_AUTOSIZE_TEXT, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): - self.AutoSizeText = auto_size_text + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT + self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title self.Rows = [] # a list of ELEMENTS for this row self.DefaultElementSize = default_element_size @@ -901,50 +910,50 @@ def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # -def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # -def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(button_text='No', scale=(None, None), size=(None, None), auto_size_text=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color) +def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): + return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): - return Button(CLOSES_WIN, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample, button_text=button_text,border_width=border_width, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(CLOSES_WIN, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample, button_text=button_text,border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_text=None, button_color=None, font=None): - return Button(READ_FORM, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample,border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_text=auto_size_text, button_color=button_color, font=font) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(READ_FORM, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample,border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -1164,7 +1173,10 @@ def CharWidthInPixels(): element.Location = (row_num, col_num) btext = element.ButtonText btype = element.BType - if auto_size_text is False: width=element_size[0] + if element.AutoSizeButton is not None: + auto_size = element.AutoSizeButton + else: auto_size = MyFlexForm.AutoSizeButtons + if auto_size is False: width=element_size[0] else: width = 0 height=element_size[1] lines = btext.split('\n') @@ -1334,7 +1346,7 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor) - element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill=tk.X) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: photo = tk.PhotoImage(file=element.Filename) @@ -1687,7 +1699,7 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def ProgressMeter(title, max_value, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): +def ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): ''' Create and show a form on tbe caller's behalf. :param title: @@ -1801,7 +1813,7 @@ def ComputeProgressStats(self): # ============================== EasyProgressMeter =====# -def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): +def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): ''' A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call before your loop. You've got enough code to write! @@ -2063,7 +2075,7 @@ def SetGlobalIcon(icon): # Sets the icon to be used by default # # ===================================================# def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), margins=(None,None), - element_padding=(None,None),auto_size_text=None, font=None, border_width=None, + element_padding=(None,None),auto_size_text=None, auto_size_buttons=None, font=None, border_width=None, slider_border_width=None, slider_relief=None, slider_orientation=None, autoclose_time=None, message_box_line_width=None, progress_meter_border_depth=None, progress_meter_style=None, @@ -2076,6 +2088,7 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels global DEFAULT_AUTOSIZE_TEXT + global DEFAULT_AUTOSIZE_BUTTONS global DEFAULT_FONT global DEFAULT_BORDER_WIDTH global DEFAULT_AUTOCLOSE_TIME @@ -2119,9 +2132,12 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma if element_padding != (None,None): DEFAULT_ELEMENT_PADDING = element_padding - if auto_size_text: + if auto_size_text != None: DEFAULT_AUTOSIZE_TEXT = auto_size_text + if auto_size_buttons != None: + DEFAULT_AUTOSIZE_BUTTONS = auto_size_buttons + if font !=None: DEFAULT_FONT = font @@ -2201,4 +2217,20 @@ def ObjToString(obj, extra=' '): (extra + (str(item) + ' = ' + (ObjToString(obj.__dict__[item], extra + ' ') if hasattr(obj.__dict__[item], '__dict__') else str( obj.__dict__[item]))) - for item in sorted(obj.__dict__))) \ No newline at end of file + for item in sorted(obj.__dict__))) + + +def main(): + with FlexForm('Demo form..', auto_size_text=True) as form: + form_rows = [[Text('You are running the PySimpleGUI.py file itself')], + [Text('You should be importing it rather than running it\n')], + [Text('Here is your sample input form....')], + [Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source'),FolderBrowse()], + [Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Dest'), FolderBrowse()], + [Submit(), Cancel()]] + + button, (source, dest) = form.LayoutAndRead(form_rows) + +if __name__ == '__main__': + main() + exit(69) From 2c0afe8fb871a4c1ba010190b1f0ef9bf1f24f23 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 27 Jul 2018 15:50:14 -0400 Subject: [PATCH 074/521] Small tweaks for 2.6 --- Demo_Recipes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Demo_Recipes.py b/Demo_Recipes.py index 68bc72a12..9653247f7 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -28,12 +28,12 @@ def MachineLearningGUI(): [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 13))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 13))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], @@ -192,14 +192,13 @@ def main(): sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841'), border_width=0, slider_border_width=0, progress_meter_border_depth=0) MachineLearningGUI() + Everything_NoContextManager() # sg.SetOptions(background_color='#B89FB6', text_element_background_color='#B89FB6', element_background_color='#B89FB6', button_color=('white','#7E6C92'), text_color='#3F403F',border_width=0, slider_border_width=0, progress_meter_border_depth=0) sg.SetOptions(background_color='#A5CADD', input_elements_background_color='#E0F5FF', text_element_background_color='#A5CADD', element_background_color='#A5CADD', button_color=('white','#303952'), text_color='#822E45',border_width=0, progress_meter_color=('#3D8255','white'), slider_border_width=0, progress_meter_border_depth=0) - Everything_NoContextManager() - Everything() ProgressMeter() From 05caecc60009947319d2140ae2299fa70fe4c16c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 27 Jul 2018 15:52:59 -0400 Subject: [PATCH 075/521] RELEASE 2.6 --- readme.md | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 787fe6850..e7f760405 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI - (Ver 2.5) + (Ver 2.6) Super-simple GUI to grasp... Powerfully customizable. @@ -22,7 +22,7 @@ Looking to take your Python code from the world of command lines and into the co Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. -![snap0153](https://user-images.githubusercontent.com/13696193/43261051-5838b356-90a9-11e8-96cc-e8a4860d0464.jpg) +![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: @@ -494,7 +494,8 @@ This is the definition of the FlexForm object: def FlexForm(title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=DEFAULT_AUTOSIZE_TEXT, + auto_size_text=None, + auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None,Font=None, @@ -508,7 +509,8 @@ This is the definition of the FlexForm object: Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True is elements should size themselves according to contents + auto_size_text - Bool. True if elements should size themselves according to contents + auto_size_buttons - Bool. True if button elements should size themselves according to their text label scale - Set size of element to be a multiple of the Element size location - Location to place window in pixels button_color - Default color for buttons (foreground, background). Can be text or hex @@ -868,7 +870,7 @@ While it's possible to build forms using the Button Element directly, you should SimpleButton(text, scale=(None, None), size=(None, None), - auto_size_text=None, + auto_size_button=None, button_color=None, font=None) @@ -906,13 +908,13 @@ The code for the entire form could be: [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] **Custom Buttons** -If you want to define your own button, you will generally do this with the Button Element `SimpleButton`. +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. layout = [[SG.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) -All buttons can have their text changed by changing the `button_text` variable. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -932,6 +934,7 @@ Three parameters are used for button images. image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 Here's an example form made with button images. + ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form @@ -1080,6 +1083,7 @@ Let's have some fun customizing! Make PySimpleGUI look the way you want it to l margins=(None,None), element_padding=(None,None) auto_size_text=None + auto_size_buttons=None font=None border_width=None slider_border_width=None @@ -1108,6 +1112,7 @@ Explanation of parameters margins - tkinter margins around outsize element_padding - tkinter padding around each element auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text font - font used for elements border_width - amount of bezel or border around sunken or raised elements slider_border_width - changes the way sliders look @@ -1307,6 +1312,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -1322,6 +1328,8 @@ Listboxes are still without scrollwheels. The mouse can drag to see more items. ### Upcoming Make suggestions people! Future release features +Auto Sized Buttons - Rather than using the default setting for TEXT fields, broke out button sizing into it's own setting. Makes much more sense. Reduces the amount of code. + Columns. How multiple columns would be specified in the SDK interface are still being designed. @@ -1338,12 +1346,30 @@ While the internals to PySimpleGUI are a tad sketchy, the public interfaces into Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like classes. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. + + + + + + ## Authors MikeTheWatchGuy ## License -GNU Lesser General Public License (LGPL 3) +GNU Lesser General Public License (LGPL 3) + ## Acknowledgments From d1b14520797349f590d1a60f99383883ee057774 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 27 Jul 2018 15:58:59 -0400 Subject: [PATCH 076/521] Removed autosize text setting Required for 2.6. --- Demo_Tabbed_Form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index e6bcede0c..4305a003d 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -76,7 +76,7 @@ def eBaySuperSearcherGUI(): layout_tab_2.append([sg.Text('Typical US Search String')]) layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) - layout_tab_2.append([sg.Submit(button_color=('red', 'yellow'),auto_size_text=True), sg.Cancel(button_color=('white', 'blue'), auto_size_text=True)]) + layout_tab_2.append([sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) From b51cf2b355d20eb6a629ba136fffb99e8adc1f01 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 28 Jul 2018 06:45:39 -0400 Subject: [PATCH 077/521] Fix for Pi Was using Python feature that caused errors on Pi running 3.4. --- Demo_NonBlocking_Form.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 8e43d6dd8..29c5b9d8b 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -3,6 +3,7 @@ def main(): StatusOutputExample() + StatusOutputExample_context_manager() # form that doen't block def StatusOutputExample_context_manager(): @@ -15,7 +16,7 @@ def StatusOutputExample_context_manager(): form.LayoutAndRead(form_rows, non_blocking=True) for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i/100), 60), i%100)) + output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break @@ -44,7 +45,7 @@ def StatusOutputExample(): # for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break From e9ac588ab8edb7ae0019c5cd033797e7c66f6028 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 28 Jul 2018 14:41:56 -0400 Subject: [PATCH 078/521] Element Docstrings Added Docstrings to the elements... it's a start --- PySimpleGUI.py | 135 +++++++++++++++++++++++++++++++++++++++++++++++-- readme.md | 29 +++++++++-- 2 files changed, 156 insertions(+), 8 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e18b401ee..c89c86406 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -193,8 +193,16 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None): + ''' + Input a line of text Element + :param default_text: Default value to display + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param password_char: If non-blank, will display this character for every character typed + :param background_color: Color for Element. Text or RGB Hex + ''' self.DefaultText = default_text self.PasswordCharacter = password_char bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR @@ -220,6 +228,14 @@ def __del__(self): class InputCombo(Element): def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): + ''' + Input Combo Box Element (also called Dropdown box) + :param values: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + ''' self.Values = values self.TKComboBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR @@ -240,6 +256,15 @@ def __del__(self): class Listbox(Element): def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + ''' + Listbox Element + :param values: + :param select_mode: + :param font: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex ''' self.Values = values self.TKListBox = None if select_mode == LISTBOX_SELECT_MODE_BROWSE: @@ -270,6 +295,17 @@ def __del__(self): # ---------------------------------------------------------------------- # class Radio(Element): def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, font=None): + ''' + Radio Button Element + :param text: + :param group_id: + :param default: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' self.InitialState = default self.Text = text self.TKRadio = None @@ -290,6 +326,16 @@ def __del__(self): # ---------------------------------------------------------------------- # class Checkbox(Element): def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + ''' + Check Box Element + :param text: + :param default: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' self.Text = text self.InitialState = default self.Value = None @@ -313,6 +359,16 @@ class Spin(Element): # Values = None # TKSpinBox = None def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + ''' + Spin Box Element + :param values: + :param initial_value: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' self.Values = values self.DefaultValue = initial_value self.TKSpinBox = None @@ -332,6 +388,15 @@ def __del__(self): # ---------------------------------------------------------------------- # class Multiline(Element): def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): + ''' + Input Multi-line Element + :param default_text: + :param enter_submits: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + ''' self.DefaultText = default_text self.EnterSubmits = enter_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR @@ -356,6 +421,17 @@ def __del__(self): # ---------------------------------------------------------------------- # class Text(Element): def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None): + ''' + Text Element - Displays text in your form. Can be updated in non-blocking forms + :param text: The text to display + :param scale: Scaling factor (w,h) (2,2)= 2 * Size + :param size: Size of Element in Characters + :param auto_size_text: True if the field should shrink to fit the text + :param font: Font name and size ("name", size) + :param text_color: Text Color name or RGB hex value '#RRGGBB' + :param background_color: Background color for text (name or RGB Hex) + :param justification: 'left', 'right', 'center' + ''' self.DisplayText = text self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR self.Justification = justification if justification else DEFAULT_TEXT_JUSTIFICATION @@ -471,6 +547,12 @@ def __del__(self): # ---------------------------------------------------------------------- # class Output(Element): def __init__(self, scale=(None, None), size=(None, None), background_color=None): + ''' + Output Element - reroutes stdout, stderr to this window + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param background_color: Color for Element. Text or RGB Hex + ''' self.TKOut = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg) @@ -487,6 +569,22 @@ def __del__(self): # ---------------------------------------------------------------------- # class Button(Element): def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None,None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + ''' + Button Element - Specifies all types of buttons + :param button_type: + :param target: + :param button_text: + :param file_types: + :param image_filename: + :param image_size: + :param image_subsample: + :param border_width: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_button: + :param button_color: + :param font: + ''' self.AutoSizeButton = auto_size_button self.BType = button_type self.FileTypes = file_types @@ -575,6 +673,19 @@ def __del__(self): # ---------------------------------------------------------------------- # class ProgressBar(Element): def __init__(self, max_value, orientation=None, target=(None, None), scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None): + ''' + Progress Bar Element + :param max_value: + :param orientation: + :param target: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param bar_color: + :param style: + :param border_width: + :param relief: + ''' self.MaxValue = max_value self.TKProgressBar = None self.Cancelled = False @@ -619,7 +730,13 @@ def __del__(self): # Image # # ---------------------------------------------------------------------- # class Image(Element): - def __init__(self, filename, scale=(None, None), size=(None, None), auto_size_text=None): + def __init__(self, filename, scale=(None, None), size=(None, None)): + ''' + Image Element + :param filename: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + ''' self.Filename = filename super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, auto_size_text=auto_size_text) return @@ -632,6 +749,18 @@ def __del__(self): # ---------------------------------------------------------------------- # class Slider(Element): def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None): + ''' + Slider Element + :param range: + :param default_value: + :param orientation: + :param border_width: + :param relief: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' self.TKScale = None self.Range = (1,10) if range == (None, None) else range self.DefaultValue = 5 if default_value is None else default_value @@ -1346,7 +1475,7 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor) - element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill=tk.X) + element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: photo = tk.PhotoImage(file=element.Filename) diff --git a/readme.md b/readme.md index e7f760405..8e24dcac9 100644 --- a/readme.md +++ b/readme.md @@ -336,7 +336,7 @@ A word of caution. There are known problems when multiple PySimpleGUI windows a You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. --- -# Custom Form API Calls +# Custom Form API Calls (Your First Form) This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. @@ -378,6 +378,27 @@ The second design pattern is not context manager based. If you are struggling w You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. +### Laying out your form +Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. + + layout = [ [row 1], + [row 2], + [row 3] ] + +Simple enough... a list of lists. +A row is a list of Elements. For example this could be a row with a couple of elements on it. + + [ Input, Button] + +Turning back to our example. This GUI roughly looks like this: + + layout = [ [Text], + [InputText, FileBrowse] + [Submit, Cancel] ] + + Now let's put it all together into an entire program. + + ### Line by line explanation Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! @@ -396,12 +417,9 @@ Now we're on the second row of the form. On this row there are 2 elements. The The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. (button, (source_filename, )) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field - +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. ---- - ## Return values Return information from FlexForm, SG's primary form builder interface, is in this format: @@ -1398,3 +1416,4 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + From 2629d23ac1f9cc243ed307a514b18f744e5d30d0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 29 Jul 2018 08:57:28 -0400 Subject: [PATCH 079/521] More/better comments A design recipe for Non-blocking forms --- Demo_NonBlocking_Form.py | 64 ++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 29c5b9d8b..d388a7a63 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -1,31 +1,11 @@ import PySimpleGUI as sg import time -def main(): - StatusOutputExample() - StatusOutputExample_context_manager() - -# form that doen't block -def StatusOutputExample_context_manager(): - with sg.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20)) - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - - form.LayoutAndRead(form_rows, non_blocking=True) - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() # form that doen't block +# good for applications with an loop that polls hardware def StatusOutputExample(): # Make a form, but don't use context manager form = sg.FlexForm('Running Timer', auto_size_text=True) @@ -41,18 +21,50 @@ def StatusOutputExample(): # # Some place later in your code... # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh + # else it won't refresh. # - - for i in range(1, 1000): + # your program's main loop + i=0 + while (True): + # 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)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break + i += 1 + # Your code begins here time.sleep(.01) - else: - form.CloseNonBlockingForm() + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + + + +# This design pattern follows the uses a context manager to better control the resources +# It may not be realistic to use a context manager within an embedded (Pi) environment +# If on a Pi, then consider the above design patterns instead +def StatusOutputExample_context_manager(): + with sg.FlexForm('Running Timer', auto_size_text=True) as form: + output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20)) + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + + form.LayoutAndRead(form_rows, non_blocking=True) + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + +def main(): + StatusOutputExample() + sg.MsgBox('End of non-blocking demonstration') + # StatusOutputExample_context_manager() if __name__ == '__main__': From 418027adfb9100465b4291fc3b2985c41e08fd26 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 29 Jul 2018 09:11:51 -0400 Subject: [PATCH 080/521] Better poll loop --- Demo_NonBlocking_Form.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index d388a7a63..42a90be0b 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -10,11 +10,11 @@ def StatusOutputExample(): # Make a form, but don't use context manager form = sg.FlexForm('Running Timer', auto_size_text=True) # 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)) + output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center') # Create the rows form_rows = [[sg.Text('Non-blocking GUI with updates')], [output_element], - [sg.SimpleButton('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! form.LayoutAndRead(form_rows, non_blocking=True) @@ -29,8 +29,13 @@ def StatusOutputExample(): # 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)) button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': + if button == 'Quit' or values is None: break + if button == 'LED On': + print('Turning on the LED') + elif button == 'LED Off': + print('Turning off the LED') + i += 1 # Your code begins here time.sleep(.01) From bbc6a555f97c7e136573e01993e4a09bcf552aec Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 30 Jul 2018 10:12:12 -0400 Subject: [PATCH 081/521] Readme updates Python3 requirement spelled out --- Demo_NonBlocking_Form.py | 2 -- readme.md | 12 +++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 42a90be0b..8ea24f6e9 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -2,8 +2,6 @@ import time - - # form that doen't block # good for applications with an loop that polls hardware def StatusOutputExample(): diff --git a/readme.md b/readme.md index 8e24dcac9..683cbb053 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,8 @@ Super-simple GUI to grasp... Powerfully customizable. +Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. import PySimpleGUI as sg @@ -70,9 +72,11 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Copy and paste into a temp file and it'll run, presenting you with the screen you see. +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) @@ -115,11 +119,13 @@ You will see a number of different styles of buttons, data entry fields, etc, in `PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. - Be Pythonic... Python's lists in particular worked out really well: + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. - Forms are represented as Python lists. - A form is a list of rows - A row is a list of elements -- Return values are a list +- Return values are a list of button presses and input values. ----- From 499433badd837ba294e843a1ab32b287fc801f96 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 30 Jul 2018 15:18:36 -0400 Subject: [PATCH 082/521] Design description --- readme.md | 68 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/readme.md b/readme.md index 683cbb053..70ee46b77 100644 --- a/readme.md +++ b/readme.md @@ -384,6 +384,45 @@ The second design pattern is not context manager based. If you are struggling w You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. +### How GUI Programming in Python Should Look + +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. + +Let's look at this one. + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + ### Laying out your form Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. @@ -422,7 +461,7 @@ Now we're on the second row of the form. On this row there are 2 elements. The The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - (button, (source_filename, )) = form.LayoutAndRead(form_rows) + button, (source_filename, ) = form.LayoutAndRead(form_rows) This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. @@ -557,9 +596,6 @@ In addition to `size` there is a `scale` option. `scale` will take the Element' There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. - - - #### FlexForm - form-level variables overview A summary of the variables that can be changed when a FlexForm is created @@ -1266,20 +1302,19 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify ## Fun Stuff Here are some things to try if you're bored or want to further customize -**Random colors** +**Colors - Random and predefined** To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and -that color's compliment. -sprint +To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and that color's compliment. **Debug Output** Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. -For a fun time, add this line to the top of your script +For a fun time, add these lines to the top of your script import PySimpleGUI as sg print = sg.Print +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. **Look and Feel** Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. @@ -1306,9 +1341,6 @@ And this was the output You'll quickly wonder how you ever coded without it. - - - --- # Known Issues While not an "issue" this is a ***stern warning*** @@ -1352,10 +1384,10 @@ Listboxes are still without scrollwheels. The mouse can drag to see more items. ### Upcoming Make suggestions people! Future release features -Auto Sized Buttons - Rather than using the default setting for TEXT fields, broke out button sizing into it's own setting. Makes much more sense. Reduces the amount of code. - Columns. How multiple columns would be specified in the SDK interface are still being designed. +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. + ## Code Condition @@ -1378,14 +1410,10 @@ A moment about the design-spirit of `PySimpleGUI`. From the beginning, this pac While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. **Functions as objects** -In Python, functions behave just like classes. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. **Lists** -It seemed quite natural to use Python's powerful list constructs when possible. - - - - +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. ## Authors From 9386ec8fc1fea191b09907fb4773051ee42abc9b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 30 Jul 2018 17:00:42 -0400 Subject: [PATCH 083/521] Window location global setting Added ability to change the default location of the window from centered to any value. --- PySimpleGUI.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c89c86406..75182dc6c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -21,6 +21,7 @@ DEFAULT_BORDER_WIDTH = 1 DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form DEFAULT_DEBUG_WINDOW_SIZE = (80,20) +DEFAULT_WINDOW_LOCATION = (None,None) MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 #################### COLOR STUFF #################### BLUES = ("#082567","#0A37A3","#00345B") @@ -738,7 +739,7 @@ def __init__(self, filename, scale=(None, None), size=(None, None)): :param size: Size of field in characters ''' self.Filename = filename - super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, auto_size_text=auto_size_text) + super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size) return def __del__(self): @@ -1520,6 +1521,8 @@ def CharWidthInPixels(): screen_height = master.winfo_screenheight() if MyFlexForm.Location != (None, None): x,y = MyFlexForm.Location + elif DEFAULT_WINDOW_LOCATION != (None, None): + x,y = DEFAULT_WINDOW_LOCATION else: master.update_idletasks() # don't forget win_width = master.winfo_width() @@ -1546,7 +1549,7 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A if title is not None: root.title(title) if not len(args): - ('******************* SHOW TABBED FORMS ERROR .... no arguments') + print('******************* SHOW TABBED FORMS ERROR .... no arguments') return if DEFAULT_BACKGROUND_COLOR: framestyle = ttk.Style() @@ -2211,7 +2214,7 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None, text_justification=None, background_color=None, element_background_color=None, text_element_background_color=None, input_elements_background_color=None, - scrollbar_color=None, text_color=None, debug_win_size=(None,None)): + scrollbar_color=None, text_color=None, debug_win_size=(None,None), window_location=(None,None)): global DEFAULT_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term @@ -2239,6 +2242,7 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma global DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR global DEFAULT_SCROLLBAR_COLOR global DEFAULT_TEXT_COLOR + global DEFAULT_WINDOW_LOCATION global _my_windows if icon: @@ -2318,6 +2322,9 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma if element_background_color != None: DEFAULT_ELEMENT_BACKGROUND_COLOR = element_background_color + if window_location != (None,None): + DEFAULT_WINDOW_LOCATION = window_location + if debug_win_size != (None,None): DEFAULT_DEBUG_WINDOW_SIZE = debug_win_size From e4a9f8048995e0d808c1cb6c6d2c7536b6f0d4b4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 30 Jul 2018 23:50:52 -0400 Subject: [PATCH 084/521] Realtime Buttons New type of button, the realtime button, allows buttons to be 'polled'. They register as pushed as soon as the button goes down versus click which happens when you release the button. --- PySimpleGUI.py | 72 +++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 75182dc6c..b6c0d7380 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -112,10 +112,11 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) #todo Consider removing the Submit, Cancel types... they are just 'RETURN' type in reality #uncomment this line and indent to go back to using Enums # class ButtonType(Enum): -BROWSE_FOLDER = 1 -BROWSE_FILE = 2 -CLOSES_WIN = 5 -READ_FORM = 7 +BUTTON_TYPE_BROWSE_FOLDER = 1 +BUTTON_TYPE_BROWSE_FILE = 2 +BUTTON_TYPE_CLOSES_WIN = 5 +BUTTON_TYPE_READ_FORM = 7 +BUTTON_TYPE_REALTIME = 9 # ------------------------- Element types ------------------------- # # class ElementType(Enum): @@ -216,7 +217,7 @@ def ReturnKeyHandler(self, event): for row in MyForm.Rows: for element in row.Elements: if element.Type == ELEM_TYPE_BUTTON: - if element.BType == CLOSES_WIN or element.BType == READ_FORM: + if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: element.ButtonCallBack() return @@ -410,7 +411,7 @@ def ReturnKeyHandler(self, event): for row in MyForm.Rows: for element in row.Elements: if element.Type == ELEM_TYPE_BUTTON: - if element.BType == CLOSES_WIN or element.BType == READ_FORM: + if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: element.ButtonCallBack() return @@ -569,7 +570,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None,None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -601,6 +602,14 @@ def __init__(self, button_type=CLOSES_WIN, target=(None, None), button_text='', super().__init__(ELEM_TYPE_BUTTON, scale, size, font=font) return + def ButtonReleaseCallBack(self, parm): + r, c = self.Position + self.ParentForm.Results[r][c] = False # mark this button's location in results + + def ButtonPressCallBack(self, parm): + r, c = self.Position + self.ParentForm.Results[r][c] = True # mark this button's location in results + # ------- Button Callback ------- # def ButtonCallBack(self): global _my_windows @@ -622,15 +631,15 @@ def ButtonCallBack(self): else: strvar = None filetypes = [] if self.FileTypes is None else self.FileTypes - if self.BType == BROWSE_FOLDER: + if self.BType == BUTTON_TYPE_BROWSE_FOLDER: folder_name = tk.filedialog.askdirectory() # show the 'get folder' dialog box try: strvar.set(folder_name) except: pass - elif self.BType == BROWSE_FILE: + elif self.BType == BUTTON_TYPE_BROWSE_FILE: file_name = tk.filedialog.askopenfilename(filetypes=filetypes) # show the 'get file' dialog box strvar.set(file_name) - elif self.BType == CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window + elif self.BType == BUTTON_TYPE_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window # first, get the results table built # modify the Results table in the parent FlexForm object r,c = self.Position @@ -644,7 +653,7 @@ def ButtonCallBack(self): if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - elif self.BType == READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE + elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE # first, get the results table built # modify the Results table in the parent FlexForm object r,c = self.Position @@ -658,7 +667,7 @@ def ReturnKeyHandler(self, event): for row in MyForm.Rows: for element in row.Elements: if element.Type == ELEM_TYPE_BUTTON: - if element.BType == CLOSES_WIN or element.BType == READ_FORM: + if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: element.ButtonCallBack() return @@ -1041,49 +1050,52 @@ def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- FILE BROWSE Element lazy function ------------------------- # def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- OK BUTTON Element lazy function ------------------------- # def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- YES BUTTON Element lazy function ------------------------- # def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- YES BUTTON Element lazy function ------------------------- # def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- NO BUTTON Element lazy function ------------------------- # def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(CLOSES_WIN, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample, button_text=button_text,border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(READ_FORM, image_filename=image_filename, image_size=image_size,image_subsample=image_subsample,border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + +def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -1177,7 +1189,8 @@ def BuildResults(form): elif element.Type == ELEM_TYPE_BUTTON: if results[row_num][col_num] is True: button_pressed_text = element.ButtonText - results[row_num][col_num] = False + if element.BType != BUTTON_TYPE_REALTIME: # Do not clear realtime buttons + results[row_num][col_num] = False elif element.Type == ELEM_TYPE_INPUT_COMBO: value=element.TKStringVar.get() results[row_num][col_num] = value @@ -1321,10 +1334,15 @@ def CharWidthInPixels(): if bc == 'Random' or bc == 'random': bc = GetRandomColorPair() border_depth = element.BorderWidth - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) + if btype != BUTTON_TYPE_REALTIME: + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) + else: + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) + tkbutton.bind('', element.ButtonReleaseCallBack) + tkbutton.bind('', element.ButtonPressCallBack) element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels - if element.ImageFilename: + if element.ImageFilename: # if button has an image on it photo = tk.PhotoImage(file=element.ImageFilename) if element.ImageSize != (None, None): width, height = element.ImageSize @@ -1336,7 +1354,7 @@ def CharWidthInPixels(): tkbutton.image = photo tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - if not focus_set and btype == CLOSES_WIN: + if not focus_set and btype == BUTTON_TYPE_CLOSES_WIN: focus_set = True element.TKButton.bind('', element.ReturnKeyHandler) element.TKButton.focus_set() From bf0c09ac055a7ec6fef4a10e8ceb1ad56caaf244 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 31 Jul 2018 00:01:07 -0400 Subject: [PATCH 085/521] Demo of Realtime Buttons Remote control demo using Realtime Buttons --- Demo_NonBlocking_Form.py | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 8ea24f6e9..6121e7254 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -42,6 +42,53 @@ def StatusOutputExample(): form.CloseNonBlockingForm() +def RemoteControlExample(): + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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') + + + form_rows = [[sg.Text('Robotics Remote Control')], + [output_element], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit()] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh. + # + # your program's main loop + i=0 + while (True): + # 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)) + button, values = form.ReadNonBlocking() + if button is not None: + print(button) + if button == 'Quit' or values is None: + break + if button == 'LED On': + print('Turning on the LED') + elif button == 'LED Off': + print('Turning off the LED') + + i += 1 + # Your code begins here + time.sleep(.01) + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + + + # This design pattern follows the uses a context manager to better control the resources # It may not be realistic to use a context manager within an embedded (Pi) environment @@ -65,6 +112,7 @@ def StatusOutputExample_context_manager(): form.CloseNonBlockingForm() def main(): + RemoteControlExample() StatusOutputExample() sg.MsgBox('End of non-blocking demonstration') # StatusOutputExample_context_manager() From b41f65dc658338048491eea7a6141c4ce1382aac Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 31 Jul 2018 09:28:12 -0400 Subject: [PATCH 086/521] Realtime Button addition --- readme.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 70ee46b77..84b0d2e62 100644 --- a/readme.md +++ b/readme.md @@ -57,6 +57,7 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Folder Browse Non-closing return Close form + Realtime Checkboxes Radio Buttons Listbox @@ -622,6 +623,7 @@ A summary of the variables that can be changed when a FlexForm is created Folder Browse Non-closing return Close form + Realtime Checkboxes Radio Buttons Listbox @@ -915,6 +917,7 @@ The Types of buttons include: * File Browse * Close Form * Read Form +* Realtime Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. @@ -925,6 +928,8 @@ File Browse - Same as the Folder Browse except rather than choosing a folder, a Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` SimpleButton(text, @@ -979,7 +984,7 @@ All buttons can have their text changed by changing the `button_text` variable i **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to. +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. @@ -1004,6 +1009,40 @@ You'll find the source code in the file Demo Media Player. Here is what the but This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + +![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. **File Types** The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is @@ -1163,6 +1202,7 @@ Let's have some fun customizing! Make PySimpleGUI look the way you want it to l input_elements_background_color=None scrollbar_color=None, text_color=None debug_win_size=(None,None) + window_location=(None,None) Explanation of parameters @@ -1193,6 +1233,7 @@ Explanation of parameters text_color - Text element default text color text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: @@ -1369,6 +1410,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.6.5 | Aug XX, 2018 - window_location default setting ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) From 3066a1c099735ef9b36106ffc6260ce5179af94d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 31 Jul 2018 10:53:55 -0400 Subject: [PATCH 087/521] Pi Robotics Demo / Design Pattern --- ButtonGraphics/RobotBack.png | Bin 0 -> 1000 bytes ButtonGraphics/RobotForward.png | Bin 0 -> 1483 bytes ButtonGraphics/RobotLeft.png | Bin 0 -> 1454 bytes ButtonGraphics/RobotRight.png | Bin 0 -> 1472 bytes Demo_Pi_Robotics.py | 96 ++++++++++++++++++++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 ButtonGraphics/RobotBack.png create mode 100644 ButtonGraphics/RobotForward.png create mode 100644 ButtonGraphics/RobotLeft.png create mode 100644 ButtonGraphics/RobotRight.png create mode 100644 Demo_Pi_Robotics.py diff --git a/ButtonGraphics/RobotBack.png b/ButtonGraphics/RobotBack.png new file mode 100644 index 0000000000000000000000000000000000000000..dfb51e5a245f66a1449d35f72e6afe0788e19cd6 GIT binary patch literal 1000 zcmV>P)!;Y~V z*duI_U2WIcO1sqVXlK}-WP}{f;wIkad;a8aef-SlJV-4&FqpI%$l=@{r1d@CW)-tY zgF|?Uzmt4?OAX^mf%)7Vk>V$w<64?o!7{43nEUxGLh(KaktF-`g%kK4mvbP~=}nlC zY(+J1g-qJ$PeO{FfNxmMOneOH5T14-?qw`qRypEJ{K=JmoW|E0^%N6`OOeWc;3!gI zA&+S6BMc=b`>EtZHXv07afQZTNq3@{!`GTVi*)G4C2Da75p?Gc`RjW&AYJ-$rw;4I zgg8*W5BH9lBI;R4e8%&>{v;b8Is6*v{veltEdG%0ot~sY7Jjai3a=sHY#qI1#z6bwdD9Ev zCi!__#teq>Nud1Q%*T%6ZP}xyWz0Yu$sB;)kRO8|&(Sl32Iq^xGVGDEDP9X1G}uE7 zF2u?TN>kJ#yqw!PA)!GQS92?y6J{eZxC6Ud3|0{4WGOH88stlNe#i)1a`+=Kco@4@ z5-lT4l}`DRxCZ%rESle#f=d>^2L_K|D@9U8n1y_*7DX`)3J7X1(cN$<7&LR-iKVla)xeC(u;<^(aQ!%mkZ zp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mBG%R(SACP`~Kl*Jmc;W@Qxba zpI5w^z(G8OWd>n>@lN|`!J0V70hp}BxSjUHEAO;Pue?*@2z(7)S22E%c(|n}yCHd* zJK?nP?gq?1X4|mIMZh;X(q7nk7gMj!n~@FTa!k*dFrBPy^us$GurD(mKzys+flLE? zVYqu%`{_7g+8DQ#24*+_uX?~yh1;FOV?16+Rjz!>B^_f- zUHg&tZHa#{aS5z|{SpULNl(Q`@qRoQ>vTTgUGR>&=&!&*F@L(Y7CQj1VvM)4A5Y>z zXi{!*swp?)0eC*9QzT{6&Z8{BMGhdnZQFMqmo-+zE!$5Ee#iL^;H~221a)Kg$;RzI zE+!a`EHIQXY4GF?N3^?2(|U~6HFvbo=Cjz86EL)=4`Z>a7vg+hbTDPJn6<3onu~e5 z^H|^s8IR6Gr3u5n17?PcF|=o(*i}Qd#2rVE9%j2@U3S4?4!{g7w59XV+0(@n7{AGV zzAi?%aa&bR=@fUKG_kizz7&UG{3cE3U0JMf#5wj&SQm@Dai9EMqUT}z2*z(V_pDo7 zH88UzZxPtgw+_Zeaevg^s3$vOnmswS>K3P(us6mFR}DFqn)@kfeMqfUR!K9P;tul} z#(l6(wH*$`5$5WW_h45kW0LU7r=8d1urw}0bK|rT|28P;Xu@e|$ew<$>!>nDe&)w% zW8O;3eXHQG*cx*sb@iv%+W54q%*Ct7Xo*1)5V^x3uDB&B-fmNMHrr l#OdA9(b2S!P?KrX{sV=|NrAHH+KB)F002ovPDHLkV1grQ)`|cC literal 0 HcmV?d00001 diff --git a/ButtonGraphics/RobotLeft.png b/ButtonGraphics/RobotLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..2b3d89e6fb4914639ffd5e4a426af68e6977eea2 GIT binary patch literal 1454 zcmV;f1yTBmP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1w%VPsF%dBI=_D1W}`8cu>Mcf*{5i zjL{jrjnRLZ9A|590o_hL14o-gf$^9+m8GWU&BIp4xWTJ!Fw|*8#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SL@}!ntrMtn3##`U0Mt34-|;4{c8TZi8VYH1@Fhr9>e z55CR1S{p8c?;w4KJ$MvU()#csq=ouseB(_^^Lhx<=luakLn*BS3n4Ack!M2~rY?ZL zAU^jO*cS@x7KjDNov;#2ha8F0dF2Dx1P1DOh&ReTpyN%aPK2}``dwdX9@==kNhe+% zsz?Xj6sm?Snp3QcoCG~}J;aM08McQi+7CVfo$y+y+KBlO>+~Mv4%r4{23PUobD*jo zgILzhP({}38;E7KU@2V*@uHWY*Q{Ga_dzUAY($lwxDaAFZ^3HN)f(_V#ETpW>S!)} z4zWzR3Ce06FnW#U7{zvV2*e+a4sBFj?FM|C(4?W z0bsm;f`!z~kyfjPBXxTQ}=!vu$SSi}yrWG~euB%vI48CyE(duskTf0BORfNIe5M%|XltVUuAf}%4ol7% z{c=UtZHlk>g?1S=D7E37p}p#q&y>XB`bqc|QaSqByT7&1^5tL?dvCEma0&<7W@cMP zf5Vi4Sl5mxu~)V4K{9;k-iHs|W)Hjx(eAZxCyimq=wwL#~wt=Hh4&S57(6&?9U(3I-x63EKTFa=rW&1Xs% zNG`yp=qZR7r1n}?XF)7a%9>3kqgjKwtQ=pqsr@NB8REmfhdRCRIK=X*zIm1AW-WUu zIZ3<@@j{bXRdoeq<mbhLg>)>WH`|Em=n2!9c^fKs zL#dpSn+|CqcA=xyuw?JMeomk3gjZ$$ctmd zhdJ4~vr<(K-LAr>q)P&ZIPMhH)-jN`hb5YoHfsQAub5}*C2iQ0yP0b@_|kM{u+lx3|w4meH$k+BiJ# zt<}N##{G$Yi~7c7*Sb^UI=AlM4V-E9CG%6IRcc(#kv-zy4-SI8!7Sgp;4GT0H8NRQ zBT7SccUepd__qb4;54yNSalmPMXgp#+tye78-a@tCnX!AZ Date: Thu, 2 Aug 2018 12:59:54 -0400 Subject: [PATCH 088/521] Credit to Fredrik Lundhl For his work on tkinter --- readme.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 84b0d2e62..9b29f3d3d 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 # PySimpleGUI - (Ver 2.6) + (Ver 2.7) Super-simple GUI to grasp... Powerfully customizable. @@ -118,7 +118,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in ### Design Goals > Copy, Paste, Run. -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the SDK to visually match what's on the screen. +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. > Be Pythonic @@ -128,6 +128,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in - A row is a list of elements - Return values are a list of button presses and input values. +It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. ----- ## Getting Started with PySimpleGUI @@ -1468,6 +1469,8 @@ GNU Lesser General Public License (LGPL 3) + ## Acknowledgments * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` + ## How Do I Finally, I must thank the fine folks at How Do I. From 3848284f7ddc76a5b5a39652bf185789e42f264c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 2 Aug 2018 20:54:10 -0400 Subject: [PATCH 089/521] Added readme.rst to docs --- Docs/readme.rst | 1174 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1174 insertions(+) create mode 100644 Docs/readme.rst diff --git a/Docs/readme.rst b/Docs/readme.rst new file mode 100644 index 000000000..d7260a069 --- /dev/null +++ b/Docs/readme.rst @@ -0,0 +1,1174 @@ +.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png + :alt: pysimplegui\_logo + + pysimplegui\_logo +|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of +some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and +into the convenience of a GUI? Have a Raspberry Pi with a touchscreen +that's going to waste because you don't have the time to learn a GUI +SDK? Look no further, you've found your GUI package. + +:: + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + +.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg + :alt: snap0136 + + snap0136 +Build beautiful customized forms that fit your specific problem. Let +PySimpleGUI solve your GUI problem while you solve the real problems. Do +you really want to plod through the mountains of code required to +program tkinter? + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +Perhaps you're looking for a way to interact with your Raspberry Pi in a +more friendly way. The is the same form as above, except shown on a Pi. + +.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg + :alt: raspberry pi + + raspberry pi +In addition to a primary GUI, you can add a Progress Meter to your code +with ONE LINE of code. Slide this into any of your ``for`` loops and get +a nice meter like this: + +:: + + EasyProgressMeter('My meter title', current_value, max value) + +.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg + :alt: progress meter 2 + + progress meter 2 +You can build an async media player GUI with custom buttons in 30 lines +of code. + +.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg + :alt: media file player + + media file player +I was frustrated by having to deal with the dos prompt when I had a +powerful Windows machine right in front of me. Why is it SO difficult to +do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** +limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and +``WxSimpleGUI`` , both really handy but limited. The primary difference +between these and PySimpleGUI is that in addition to getting the simple +Message Boxes you also get the ability to make your own forms that are +highly customizeable. Don't like the standard Message Box? Then make +your own! + +Every call has optional parameters so that you can change the look and +feel. Don't like the button color? It's easy to change by adding a +button\_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require +configuring and can take a ***week*** to get *reasonably familiar* with +the interfaces. Clearly there needs to be a middle ground between forms +with 1 or two input fields and a full-blown GUI. You'll be making your +own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with +the python interpreter on Windows. Double click a py file and up pops a +GUI window, a more pleasant experience than opening a dos Window and +typing a command line. + +The ``PySimpleGUI`` package is focused on the ***developer***. How can +the desired result be achieved in as little and as simple code as +possible? This was the mantra used to create PySimpleGUI. How can it be +done is a Python-like way? + +:: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + +An example of many widgets used on a single form. A little further down +you'll find the TWENTY lines of code required to create this complex +form. Try it if you don't believe it. Start Python, copy and paste the +code below into the >>> prompt and hit enter. This will pop up... + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Here is the code that produced the above screenshot. + +:: + + import PySimpleGUI as SG + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +**A note on screen shots** You will see a number of different styles of +buttons, data entry fields, etc, in this readme. They were all made with +the same SDK, the only difference is in the settings that are specified +on a per-element, row, form, or global basis. One setting in particular, +border\_width, can make a big difference on the look of the form. Some +of the screenshots had a border\_width of 6, others a value of 1. + +APIs +---- + +PySimpleGUI can be broken down into 2 types of API's: \* High Level +single call functions \* Custom form functions + +Python Language Features +~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a couple of Python language features that PySimpleGUI utilizes +heavily that should be understood first... \* Variable number of +arguments to a function call \* Optional parameters to a function call + +Variable Number of Arguments +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The "High Level" API calls that *output* values take a variable number +of arguments so that they match a "print" statement as much as possible. +The idea is to make it simple for the programmer to output as many items +as desired and in any format. The user need not convert the variables to +be output into the strings. The PySimpleGUI functions do that for the +user. + +:: + + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + +.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg + :alt: snap0104 + + snap0104 +Optional Parameters to a Function Call +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This feature of the Python language is utilized ***heavily*** as a +method of customizing forms and form Elements. Rather than requiring the +programmer to specify every possible option for a widget, instead only +the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details +aren't important. What is important is seeing that there is a long list +of potential tweaks that a caller can make. However, they don't *have* +to be specified on each and every call. + +:: + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, +the call would look something like this: + +:: + + SG.MsgBox('This box has a custom button color', + button_color=('black', 'yellow')) + +.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg + :alt: snap0105 + + snap0105 + +-------------- + +High Level API Calls +~~~~~~~~~~~~~~~~~~~~ + +The classic "input a value, print result" example. Often command line +programs simply take some value as input on the command line, do +something with it and then display the results. Moving from the command +line to a GUI is very simple. This code prompts user to input a line of +text and then displays that text in a messages box: + +:: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg + :alt: GetTextBox + + GetTextBox +.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg + :alt: MsgBox + + MsgBox +Message Boxes +^^^^^^^^^^^^^ + +In addition to MsgBox, you'll find a several API calls that are +shortcuts to common messages boxes. You can achieve similar results by +calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the +calls and the windows that are created. + +:: + + import PySimpleGUI as SG + +``SG.MsgBoxOK('This is an OK MsgBox')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg + :alt: msgboxok + + msgboxok +:: + + SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg + :alt: msgboxokcancel + + msgboxokcancel +:: + + SG.MsgBoxCancel('This is a Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg + :alt: msgboxcancel + + msgboxcancel +:: + + SG.MsgBoxYesNo('This is a Yes No MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg + :alt: msgboxyesno + + msgboxyesno +:: + + SG.MsgBoxError('This is an error MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg + :alt: msgbox error + + msgbox error +:: + + SG.MsgBoxAutoClose('This is an autoclose MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg + :alt: msgbox autoclose + + msgbox autoclose +:: + + SG.ScrolledTextBox(my_text, height=10) + +.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg + :alt: scrolledtextbox + + scrolledtextbox +Take a moment to look at that last one. It's such a simple API call and +yet the result is awesome. Rather than seeing text scrolling past on +your display, you can capture that text and present it in a scrolled +interface. It's handy enough of an API call that it can also be called +using the name ``sprint`` which is easier to remember than +``ScrollectTextBox``. Your code could contain a line like: + +:: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled +window. + +High Level User Input +^^^^^^^^^^^^^^^^^^^^^ + +There are 3 very basic user input high-level function calls. It's +expected that for most applications, a custom input form will be +created. If you need only 1 value, then perhaps one of these high level +functions will work. - GetTextBox - GetFileBox - GetFolderBox + +``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg + :alt: gettextbox + + gettextbox +:: + + submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg + :alt: getfilebox + + getfilebox +:: + + submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg + :alt: getfolderbox + + getfolderbox +Progress Meter! +^^^^^^^^^^^^^^^ + +We all have loops in our code. 'Isn't it joyful waiting, watching a +counter scrolling past in a text window? How about one line of code to +get a progress meter, that contains statistics about your code? + +.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg + :alt: progress meter 3 + + progress meter 3 +:: + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + +:: + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg + :alt: progress meter 5 + + progress meter 5 +A meter AND fun statistics to watch while your machine grinds away, all +for the price of 1 line of code. With a little trickery you can provide +a way to break out of your loop using the Progress Meter form. The +cancel button results in a ``False`` return value from +``EasyProgressMeter``. It normally returns ``True``. + +:: + + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): + break + +***Be sure and add one to your loop counter*** so that your counter goes +from 1 to the max value. If you do not add one, your counter will never +hit the max value. Instead it will go from 0 to max-1. #### Debug Output +Another call in the 'Easy' families of APIs is ``EasyPrint``. It will +output to a debug window. If the debug window isn't open, then the first +call will open it. No need to do anything but stick a 'print' call in +your code. You can even replace your 'print' calls with calls to +EasyPrint by simply sticking the statement + +:: + + print = SG.EasyPrint + +at the top of your code. There are a number of names for the same +EasyPrint function. ``Print`` is one of the better ones to use as it's +easy to remember. It is simply ``print`` with a capital P. + +:: + + import PySimpleGUI as SG + + for i in range(100): + SG.Print(i) + +|snap0125| Or if you didn't want to change your code: + +:: + + import PySimpleGUI as SG + + print=SG.Print + for i in range(100): + print(i) + +Just like the standard print call, ``EasyPrint`` supports the ``sep`` +and ``end`` keyword arguments. Other names that can be used to call +``EasyPrint`` include Print, ``eprint``, If you want to close the +window, call the function ``EasyPrintClose``. + +A word of caution. There are known problems when multiple PySimpleGUI +windows are opened, particularly if the user closes them in an unusual +way. Not a reason to stay away from using it. Just something to keep in +mind if you encounter a problem. + +You can change the size of the debug window using the ``SetOptions`` +call with the ``debug_win_size`` parameter. + +All Widgets / Elements +---------------------- + +This code utilizes as many of the elements in one form as possible. + +:: + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to +make things line up well. This is code you only have to write once. When +looking at the code, remember that what you're seeing is a list of +lists. Each row contains a list of Graphical Elements that are used to +create the form. + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Clicking the Submit button caused the form call to return. The call to +MsgBox resulted in this dialog box. |results 2| + +**``Note, button value can be None``**. The value for ``button`` will be +the text that is displayed on the button element when it was created. If +the user closed the form using something other than a button, then +``button`` will be ``None``. + +You can see in the MsgBox that the values returned are a list. Each +input field in the form generates one item in the return values list. +All input fields return a ``string`` except for Check Boxes and Radio +Buttons. These return ``bool``. + +ProgressBar +^^^^^^^^^^^ + +The ``ProgressBar`` element is used to build custom Progress Bar forms. +It is HIGHLY recommended that you use the functions that provide a +complete progress meter solution for you. Progress Meters are not easy +to work with because the forms have to be non-blocking and they are +tricky to debug. + +The **easiest** way to get progress meters into your code is to use the +``EasyProgessMeter`` API. This consists of a pair of functions, +``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily +cancel any progress meter by calling it with the current value = max +value. This will mark the meter as expired and close the window. You've +already seen EasyProgressMeter calls presented earlier in this readme. + +:: + + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for ``EasyProgressMeter`` is: ``True`` if meter updated +correctly ``False`` if user clicked the Cancel button, closed the form, +or vale reached the max value. **Customized Progress Bar** If you want a +bit more customization of your meter, then you can go up 1 level and use +the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs +behave like an object we're all used to. First you create the +``ProgressMeter`` object, then you call the ``Update`` method to update +it. + +You setup the progress meter by calling + +:: + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) + +Then to update the bar within your loop + +:: + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): + +Putting it all together you get this design pattern + +:: + + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + +The final way of using a Progress Meter with PySimpleGUI is to build a +custom form with a ``ProgressBar`` Element in the form. You will need to +run your form as a non-blocking form. When you are ready to update your +progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` +element itself. + +Output +^^^^^^ + +The Output Element is a re-direction of Stdout. Anything "printed" will +be displayed in this element. + +:: + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an +Output Element + +:: + + import PySimpleGUI as SG + # Blocking form that doesn't close + def ChatBot(): + with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], + [SG.Output(size=(80, 20))], + [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + +Tabbed Forms +------------ + +Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has +the format + +:: + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken +to create the form as before. A ``FlexForm`` is created, then rows are +filled with Elements, and finally the form is shown. When calling +``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the +format: ``(the form, the rows, a string shown on the tab)`` + +Results are returned as a list of lists. For each form you'll get a list +that's in the same format as a normal form. A single tab's values would +be: + +:: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would +return like this: + +:: + + ((button1, (values1)), (button2, (values2)) + +## Colors ## Starting in version 2.5 you can change the background +colors for the window and the Elements. + +Your forms can go from this: |snap0155| + +to this... with one function call... + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +While you can do it on an element by element or form level basis, the +easiest way, by far, is a call to ``SetOptions``. + +Be aware that once you change these options they are changed for the +rest of your program's execution. All of your forms will have that look +and feel, until you change it to something else (which could be the +system default colors. + +This call sets all of the different color options. + +:: + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + +Global Settings +--------------- + +**Global Settings** Let's have some fun customizing! Make PySimpleGUI +look the way you want it to look. You can set the global settings using +the function ``PySimpleGUI.SetOptions``. Each option has an optional +parameter that's used to set it. + +:: + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + +:: + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + +These settings apply to all forms ``SetOptions``. The Row options and +Element options will take precedence over these settings. Settings can +be thought of as levels of settings with the Form-level being the +highest and the Element-level the lowest. Thus the levels are: + +- Form level +- Row level +- Element level + +Each lower level overrides the settings of the higher level. Once +settings have been changed, they remain changed for the duration of the +program (unless changed again). + +Asynchronous (Non-Blocking) Forms +--------------------------------- + +So you want to be a wizard do ya? Well go boldly! While the majority of +GUIs are a simple exercise to "collect input values and return with +them", there are instances where we want to continue executing while the +form is open. These are "asynchronous" forms and require special +options, new SDK calls, and **great care**. With asynchronous forms the +form is shown, user input is read, but your code keeps right on +chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` +on a periodic basis. Once a second or more will produce a reasonably +snappy GUI. + +When do you use a non-blocking form? A couple of examples are \* A media +file player like an MP3 player \* A status dashboard that's periodically +updated \* Progress Meters - when you want to make your own progress +meters \* Output using print to a scrolled text element. Good for +debugging. + +Word of warning... version 2.2, the currently released, and upcoming +version 2.3 differ in the return code for the ``ReadNonBlocking`` call. +Previously the function returned 2 values, except when the form is +closed using the "X" which returned a single value of ``None``. The +*new* way is that ``ReadNonBlocking`` always returns 2 values. If the +user closed the form with the "X" then the return values will be None, +None. You will want to key off the second value to catch this case. The +proper code to check if the user has exited the form will be a +polling-loop that looks something like this: + +:: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update +our form with a running clock. + +The basic flow and functions you will be calling are: Setup + +:: + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + +Periodic refresh + +:: + + form.ReadNonBlocking() + +If you need to close the form + +:: + + form.CloseNonBlockingForm() + +Rather than the usual ``form.LayoutAndRead()`` call, we're manually +adding the rows (doing the layout) and then showing the form. After the +form is shown, you simply call ``form.ReadNonBlocking()`` every now and +then. + +When you are ready to close the form (assuming the form wasn't closed by +the user or a button click) you simply call +``form.CloseNonBlockingForm()`` + +**Example - Running timer that updates** See the sample code on the +GitHub named Demo Media Player for another example of Async Forms. We're +going to make a form and update one of the elements of that form every +.01 seconds. Here's the entire code to do that. + +:: + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + +What we have here is the same sequence of function calls as in the +description. Get a form, add rows to it, show the form, and then refresh +it every now and then. + +The new thing in this example is the call use of the Update method for +the Text Element. The first thing we do inside the loop is "update" the +text element that we made earlier. This changes the value of the text +field on the form. The new value will be displayed when +``form.ReadNonBlocking()`` is called. + +Note the ``else`` statement on the for loop. This is needed because +we're about to exit the loop while the form is still open. The user has +not closed the form using the X nor a button so it's up to the caller to +close the form using ``CloseNonBlockingForm``. + +That's it... this example follows the async design pattern well. + +Sample Applications +------------------- + +Use the example programs as a starting basis for your GUI. Copy, paste, +modify and run! The demo files are: + +``Demo Recipes.py`` - Sample forms for all major form types and +situations. This is the place to get your code template from. Includes +asynchronous forms, etc. + +``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls +to get a filename + +``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a +folder & Easy Progress Meter to show progress of the file scanning + +``Demo HowDoI.py`` - An amazing little application. Acts as a front-end +to HowDoI. This one program could forever change how you code. It does +searches on Stack Overflow and returns the CODE found in the best answer +for your query. If anyone wants to help me package this application up, +I could use a hand. + +Fun Stuff +--------- + +Here are some things to try if you're bored or want to further customize + +**Colors - Random and predefined** To set a button or text to a random +color, use the string ``'random'`` as the color value. You can also call +``PySimpleGUI.GetRandomColor``. To get a random color pair call +``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a +random color and that color's compliment. + +**Debug Output** Be sure and check out the EasyPrint (Print) function +described in the high-level API section. Leave your code the way it is, +route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + +:: + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in +a window on your screen rather than to the terminal. + +**Look and Feel** Dial in the look and feel that you like with the +``SetOptions`` function. You can change all of the defaults in one +function call. One line of code to customize the entire GUI. + +**ObjToString** Ever wanted to easily display an objects contents +easily? Use ObjToString to get a nicely formatted recursive walk of your +objects. This statement: + +:: + + print(sg.ObjToSting(x)) + +And this was the output + +:: + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +-------------- + +Known Issues +============ + +While not an "issue" this is a ***stern warning*** + +**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads +----------------------------------------------------------------------------------------------------------------------------------------- + +**Progress Meters** - the visual graphic portion of the meter may be +off. May return to the native tkinter progress meter solution in the +future. Right now a "custom" progress meter is used. On the bright side, +the statistics shown are extremely accurate and can tell you something +about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and +EasyPrint/Print). If you start overlapping having Async forms open with +normal forms then things get a littler squirrelly. Still tracking down +the issues and am making it more solid every day possible. You'll know +there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You +print and the output goes to a window, with a scroll bar, that you can +copy and paste from. Being a new feature, it's got some potential +problems. There are known interaction problems with other GUI windows. +For example, closing a Print window can also close other windows you +have open. For now, don't close your debug print window until other +windows are closed too. + +Contributing +------------ + +A MikeTheWatchGuy production... entirely responsible for this code.... +unless it causes you trouble in which case I'm not at all responsible. + +Versions +-------- + ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| Version | Description | ++===========+==================================================================================================================================================+ +| 1.0.9 | July 10, 2018 - Initial Release | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 1.0.21 | July 13, 2018 - Readme updates | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.2.0 | July 20, 2018 - Image Elements, Print output | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.5 | Aug XX, 2018 - window\_location default setting | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + +Release Notes +~~~~~~~~~~~~~ + +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another +window open. It could lead to future windows being blank. It's being +worked on. + +New debug printing capability. ``sg.Print`` + +2.5 Discovered issue with scroll bar on ``Output`` elements. The bar +will match size of ROW not the size of the element. Normally you never +notice this due to where on a form the ``Output`` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more +items. The mouse scrollwheel will also scroll the list and will +``page up`` and ``page down`` keys. + +Upcoming +~~~~~~~~ + +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface +are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a +backend other than tkinter. Qt, WxPython, etc. + +Code Condition +-------------- + +:: + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the +"Make it run" phase. It's far from "right" in many ways. These are being +worked on. The module is particularly poor for PEP 8 compliance. It was +a learning exercise that turned into a somewhat complete GUI solution +for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public +interfaces into the SDK are more strictly defined and comply with PEP 8 +for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the +code stronger and better in the end, a good thing for us all, right? + +Design +------ + +A moment about the design-spirit of ``PySimpleGUI``. From the beginning, +this package was meant to take advantage of Python's capabilities with +the goal of programming ease. + +**Single File** While not the best programming practice, the +implementation resulted in a single file solution. Only one file is +needed, PySimpleGUI.py. You can post this file, email it, and easily +import it using one statement. + +**Functions as objects** In Python, functions behave just like object. +When you're placing a Text Element into your form, you may be sometimes +calling a function and other times declaring an object. If you use the +word Text, then you're getting an object. If you're using ``Txt``, then +you're calling a function that returns a ``Text`` object. + +**Lists** It seemed quite natural to use Python's powerful list +constructs when possible. The form is specified as a series of lists. +Each "row" of the GUI is represented as a list of Elements. When the +form read returns the results to the user, all of the results are +presented as a single list. This makes reading a form's values +super-simple to do in a single line of Python code. + +Authors +------- + +MikeTheWatchGuy + +License +------- + +GNU Lesser General Public License (LGPL 3) + + +Acknowledgments +--------------- + +- Jorj McKie was the motivator behind the entire project. His + wxsimpleGUI concepts sparked PySimpleGUI into existence +- `Fredrik Lundh `__ for his + work on ``tkinter`` + +How Do I +-------- + +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi Their utility has forever changed the +way and pace in which I can program. I urge you to try the HowDoI.py +application here on GitHub. Trust me, **it's going to be worth the +effort!** Here are the steps to run that application + +:: + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through +stack overflow posts. It finds the best answer, gets the code from the +answer, and presents it as a response. It gives you the correct answer +OFTEN. It's a miracle that it work SO well. For Python questions, I +simply start my query with 'Python'. Let's say you forgot how to reverse +a list in Python. When you run HowDoI and ask this question, this is +what you'll see. |snap0109| + +In the hands of a competent programmer, this tool is **amazing**. It's a +must-try kind of program that has completely changed my programming +process. I'm not afraid of asking for help! You just have to be smart +about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field +which means you can copy and paste the results right into your code. + +.. |Downloads| image:: http://pepy.tech/badge/pysimplegui + :target: http://pepy.tech/project/pysimplegui +.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg +.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg +.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg +.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg From e5b7fd4fc2b65269b17265aa45502d359e19c02d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 2 Aug 2018 22:21:32 -0400 Subject: [PATCH 090/521] remove docs --- Docs/readme.rst | 1174 ----------------------------------------------- 1 file changed, 1174 deletions(-) delete mode 100644 Docs/readme.rst diff --git a/Docs/readme.rst b/Docs/readme.rst deleted file mode 100644 index d7260a069..000000000 --- a/Docs/readme.rst +++ /dev/null @@ -1,1174 +0,0 @@ -.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png - :alt: pysimplegui\_logo - - pysimplegui\_logo -|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of -some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and -into the convenience of a GUI? Have a Raspberry Pi with a touchscreen -that's going to waste because you don't have the time to learn a GUI -SDK? Look no further, you've found your GUI package. - -:: - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - -.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg - :alt: snap0136 - - snap0136 -Build beautiful customized forms that fit your specific problem. Let -PySimpleGUI solve your GUI problem while you solve the real problems. Do -you really want to plod through the mountains of code required to -program tkinter? - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -Perhaps you're looking for a way to interact with your Raspberry Pi in a -more friendly way. The is the same form as above, except shown on a Pi. - -.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg - :alt: raspberry pi - - raspberry pi -In addition to a primary GUI, you can add a Progress Meter to your code -with ONE LINE of code. Slide this into any of your ``for`` loops and get -a nice meter like this: - -:: - - EasyProgressMeter('My meter title', current_value, max value) - -.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg - :alt: progress meter 2 - - progress meter 2 -You can build an async media player GUI with custom buttons in 30 lines -of code. - -.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg - :alt: media file player - - media file player -I was frustrated by having to deal with the dos prompt when I had a -powerful Windows machine right in front of me. Why is it SO difficult to -do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** -limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and -``WxSimpleGUI`` , both really handy but limited. The primary difference -between these and PySimpleGUI is that in addition to getting the simple -Message Boxes you also get the ability to make your own forms that are -highly customizeable. Don't like the standard Message Box? Then make -your own! - -Every call has optional parameters so that you can change the look and -feel. Don't like the button color? It's easy to change by adding a -button\_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require -configuring and can take a ***week*** to get *reasonably familiar* with -the interfaces. Clearly there needs to be a middle ground between forms -with 1 or two input fields and a full-blown GUI. You'll be making your -own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with -the python interpreter on Windows. Double click a py file and up pops a -GUI window, a more pleasant experience than opening a dos Window and -typing a command line. - -The ``PySimpleGUI`` package is focused on the ***developer***. How can -the desired result be achieved in as little and as simple code as -possible? This was the mantra used to create PySimpleGUI. How can it be -done is a Python-like way? - -:: - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - -An example of many widgets used on a single form. A little further down -you'll find the TWENTY lines of code required to create this complex -form. Try it if you don't believe it. Start Python, copy and paste the -code below into the >>> prompt and hit enter. This will pop up... - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Here is the code that produced the above screenshot. - -:: - - import PySimpleGUI as SG - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -**A note on screen shots** You will see a number of different styles of -buttons, data entry fields, etc, in this readme. They were all made with -the same SDK, the only difference is in the settings that are specified -on a per-element, row, form, or global basis. One setting in particular, -border\_width, can make a big difference on the look of the form. Some -of the screenshots had a border\_width of 6, others a value of 1. - -APIs ----- - -PySimpleGUI can be broken down into 2 types of API's: \* High Level -single call functions \* Custom form functions - -Python Language Features -~~~~~~~~~~~~~~~~~~~~~~~~ - -There are a couple of Python language features that PySimpleGUI utilizes -heavily that should be understood first... \* Variable number of -arguments to a function call \* Optional parameters to a function call - -Variable Number of Arguments -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The "High Level" API calls that *output* values take a variable number -of arguments so that they match a "print" statement as much as possible. -The idea is to make it simple for the programmer to output as many items -as desired and in any format. The user need not convert the variables to -be output into the strings. The PySimpleGUI functions do that for the -user. - -:: - - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - -.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg - :alt: snap0104 - - snap0104 -Optional Parameters to a Function Call -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This feature of the Python language is utilized ***heavily*** as a -method of customizing forms and form Elements. Rather than requiring the -programmer to specify every possible option for a widget, instead only -the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details -aren't important. What is important is seeing that there is a long list -of potential tweaks that a caller can make. However, they don't *have* -to be specified on each and every call. - -:: - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, -the call would look something like this: - -:: - - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) - -.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg - :alt: snap0105 - - snap0105 - --------------- - -High Level API Calls -~~~~~~~~~~~~~~~~~~~~ - -The classic "input a value, print result" example. Often command line -programs simply take some value as input on the command line, do -something with it and then display the results. Moving from the command -line to a GUI is very simple. This code prompts user to input a line of -text and then displays that text in a messages box: - -:: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg - :alt: GetTextBox - - GetTextBox -.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg - :alt: MsgBox - - MsgBox -Message Boxes -^^^^^^^^^^^^^ - -In addition to MsgBox, you'll find a several API calls that are -shortcuts to common messages boxes. You can achieve similar results by -calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the -calls and the windows that are created. - -:: - - import PySimpleGUI as SG - -``SG.MsgBoxOK('This is an OK MsgBox')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg - :alt: msgboxok - - msgboxok -:: - - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg - :alt: msgboxokcancel - - msgboxokcancel -:: - - SG.MsgBoxCancel('This is a Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg - :alt: msgboxcancel - - msgboxcancel -:: - - SG.MsgBoxYesNo('This is a Yes No MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg - :alt: msgboxyesno - - msgboxyesno -:: - - SG.MsgBoxError('This is an error MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg - :alt: msgbox error - - msgbox error -:: - - SG.MsgBoxAutoClose('This is an autoclose MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg - :alt: msgbox autoclose - - msgbox autoclose -:: - - SG.ScrolledTextBox(my_text, height=10) - -.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg - :alt: scrolledtextbox - - scrolledtextbox -Take a moment to look at that last one. It's such a simple API call and -yet the result is awesome. Rather than seeing text scrolling past on -your display, you can capture that text and present it in a scrolled -interface. It's handy enough of an API call that it can also be called -using the name ``sprint`` which is easier to remember than -``ScrollectTextBox``. Your code could contain a line like: - -:: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled -window. - -High Level User Input -^^^^^^^^^^^^^^^^^^^^^ - -There are 3 very basic user input high-level function calls. It's -expected that for most applications, a custom input form will be -created. If you need only 1 value, then perhaps one of these high level -functions will work. - GetTextBox - GetFileBox - GetFolderBox - -``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg - :alt: gettextbox - - gettextbox -:: - - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg - :alt: getfilebox - - getfilebox -:: - - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg - :alt: getfolderbox - - getfolderbox -Progress Meter! -^^^^^^^^^^^^^^^ - -We all have loops in our code. 'Isn't it joyful waiting, watching a -counter scrolling past in a text window? How about one line of code to -get a progress meter, that contains statistics about your code? - -.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg - :alt: progress meter 3 - - progress meter 3 -:: - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - -:: - - for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg - :alt: progress meter 5 - - progress meter 5 -A meter AND fun statistics to watch while your machine grinds away, all -for the price of 1 line of code. With a little trickery you can provide -a way to break out of your loop using the Progress Meter form. The -cancel button results in a ``False`` return value from -``EasyProgressMeter``. It normally returns ``True``. - -:: - - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - -***Be sure and add one to your loop counter*** so that your counter goes -from 1 to the max value. If you do not add one, your counter will never -hit the max value. Instead it will go from 0 to max-1. #### Debug Output -Another call in the 'Easy' families of APIs is ``EasyPrint``. It will -output to a debug window. If the debug window isn't open, then the first -call will open it. No need to do anything but stick a 'print' call in -your code. You can even replace your 'print' calls with calls to -EasyPrint by simply sticking the statement - -:: - - print = SG.EasyPrint - -at the top of your code. There are a number of names for the same -EasyPrint function. ``Print`` is one of the better ones to use as it's -easy to remember. It is simply ``print`` with a capital P. - -:: - - import PySimpleGUI as SG - - for i in range(100): - SG.Print(i) - -|snap0125| Or if you didn't want to change your code: - -:: - - import PySimpleGUI as SG - - print=SG.Print - for i in range(100): - print(i) - -Just like the standard print call, ``EasyPrint`` supports the ``sep`` -and ``end`` keyword arguments. Other names that can be used to call -``EasyPrint`` include Print, ``eprint``, If you want to close the -window, call the function ``EasyPrintClose``. - -A word of caution. There are known problems when multiple PySimpleGUI -windows are opened, particularly if the user closes them in an unusual -way. Not a reason to stay away from using it. Just something to keep in -mind if you encounter a problem. - -You can change the size of the debug window using the ``SetOptions`` -call with the ``debug_win_size`` parameter. - -All Widgets / Elements ----------------------- - -This code utilizes as many of the elements in one form as possible. - -:: - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to -make things line up well. This is code you only have to write once. When -looking at the code, remember that what you're seeing is a list of -lists. Each row contains a list of Graphical Elements that are used to -create the form. - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Clicking the Submit button caused the form call to return. The call to -MsgBox resulted in this dialog box. |results 2| - -**``Note, button value can be None``**. The value for ``button`` will be -the text that is displayed on the button element when it was created. If -the user closed the form using something other than a button, then -``button`` will be ``None``. - -You can see in the MsgBox that the values returned are a list. Each -input field in the form generates one item in the return values list. -All input fields return a ``string`` except for Check Boxes and Radio -Buttons. These return ``bool``. - -ProgressBar -^^^^^^^^^^^ - -The ``ProgressBar`` element is used to build custom Progress Bar forms. -It is HIGHLY recommended that you use the functions that provide a -complete progress meter solution for you. Progress Meters are not easy -to work with because the forms have to be non-blocking and they are -tricky to debug. - -The **easiest** way to get progress meters into your code is to use the -``EasyProgessMeter`` API. This consists of a pair of functions, -``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily -cancel any progress meter by calling it with the current value = max -value. This will mark the meter as expired and close the window. You've -already seen EasyProgressMeter calls presented earlier in this readme. - -:: - - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for ``EasyProgressMeter`` is: ``True`` if meter updated -correctly ``False`` if user clicked the Cancel button, closed the form, -or vale reached the max value. **Customized Progress Bar** If you want a -bit more customization of your meter, then you can go up 1 level and use -the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs -behave like an object we're all used to. First you create the -``ProgressMeter`` object, then you call the ``Update`` method to update -it. - -You setup the progress meter by calling - -:: - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) - -Then to update the bar within your loop - -:: - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): - -Putting it all together you get this design pattern - -:: - - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - -The final way of using a Progress Meter with PySimpleGUI is to build a -custom form with a ``ProgressBar`` Element in the form. You will need to -run your form as a non-blocking form. When you are ready to update your -progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` -element itself. - -Output -^^^^^^ - -The Output Element is a re-direction of Stdout. Anything "printed" will -be displayed in this element. - -:: - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an -Output Element - -:: - - import PySimpleGUI as SG - # Blocking form that doesn't close - def ChatBot(): - with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], - [SG.Output(size=(80, 20))], - [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - -Tabbed Forms ------------- - -Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has -the format - -:: - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken -to create the form as before. A ``FlexForm`` is created, then rows are -filled with Elements, and finally the form is shown. When calling -``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the -format: ``(the form, the rows, a string shown on the tab)`` - -Results are returned as a list of lists. For each form you'll get a list -that's in the same format as a normal form. A single tab's values would -be: - -:: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would -return like this: - -:: - - ((button1, (values1)), (button2, (values2)) - -## Colors ## Starting in version 2.5 you can change the background -colors for the window and the Elements. - -Your forms can go from this: |snap0155| - -to this... with one function call... - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -While you can do it on an element by element or form level basis, the -easiest way, by far, is a call to ``SetOptions``. - -Be aware that once you change these options they are changed for the -rest of your program's execution. All of your forms will have that look -and feel, until you change it to something else (which could be the -system default colors. - -This call sets all of the different color options. - -:: - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - -Global Settings ---------------- - -**Global Settings** Let's have some fun customizing! Make PySimpleGUI -look the way you want it to look. You can set the global settings using -the function ``PySimpleGUI.SetOptions``. Each option has an optional -parameter that's used to set it. - -:: - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - -:: - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - -These settings apply to all forms ``SetOptions``. The Row options and -Element options will take precedence over these settings. Settings can -be thought of as levels of settings with the Form-level being the -highest and the Element-level the lowest. Thus the levels are: - -- Form level -- Row level -- Element level - -Each lower level overrides the settings of the higher level. Once -settings have been changed, they remain changed for the duration of the -program (unless changed again). - -Asynchronous (Non-Blocking) Forms ---------------------------------- - -So you want to be a wizard do ya? Well go boldly! While the majority of -GUIs are a simple exercise to "collect input values and return with -them", there are instances where we want to continue executing while the -form is open. These are "asynchronous" forms and require special -options, new SDK calls, and **great care**. With asynchronous forms the -form is shown, user input is read, but your code keeps right on -chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` -on a periodic basis. Once a second or more will produce a reasonably -snappy GUI. - -When do you use a non-blocking form? A couple of examples are \* A media -file player like an MP3 player \* A status dashboard that's periodically -updated \* Progress Meters - when you want to make your own progress -meters \* Output using print to a scrolled text element. Good for -debugging. - -Word of warning... version 2.2, the currently released, and upcoming -version 2.3 differ in the return code for the ``ReadNonBlocking`` call. -Previously the function returned 2 values, except when the form is -closed using the "X" which returned a single value of ``None``. The -*new* way is that ``ReadNonBlocking`` always returns 2 values. If the -user closed the form with the "X" then the return values will be None, -None. You will want to key off the second value to catch this case. The -proper code to check if the user has exited the form will be a -polling-loop that looks something like this: - -:: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update -our form with a running clock. - -The basic flow and functions you will be calling are: Setup - -:: - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - -Periodic refresh - -:: - - form.ReadNonBlocking() - -If you need to close the form - -:: - - form.CloseNonBlockingForm() - -Rather than the usual ``form.LayoutAndRead()`` call, we're manually -adding the rows (doing the layout) and then showing the form. After the -form is shown, you simply call ``form.ReadNonBlocking()`` every now and -then. - -When you are ready to close the form (assuming the form wasn't closed by -the user or a button click) you simply call -``form.CloseNonBlockingForm()`` - -**Example - Running timer that updates** See the sample code on the -GitHub named Demo Media Player for another example of Async Forms. We're -going to make a form and update one of the elements of that form every -.01 seconds. Here's the entire code to do that. - -:: - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - -What we have here is the same sequence of function calls as in the -description. Get a form, add rows to it, show the form, and then refresh -it every now and then. - -The new thing in this example is the call use of the Update method for -the Text Element. The first thing we do inside the loop is "update" the -text element that we made earlier. This changes the value of the text -field on the form. The new value will be displayed when -``form.ReadNonBlocking()`` is called. - -Note the ``else`` statement on the for loop. This is needed because -we're about to exit the loop while the form is still open. The user has -not closed the form using the X nor a button so it's up to the caller to -close the form using ``CloseNonBlockingForm``. - -That's it... this example follows the async design pattern well. - -Sample Applications -------------------- - -Use the example programs as a starting basis for your GUI. Copy, paste, -modify and run! The demo files are: - -``Demo Recipes.py`` - Sample forms for all major form types and -situations. This is the place to get your code template from. Includes -asynchronous forms, etc. - -``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls -to get a filename - -``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a -folder & Easy Progress Meter to show progress of the file scanning - -``Demo HowDoI.py`` - An amazing little application. Acts as a front-end -to HowDoI. This one program could forever change how you code. It does -searches on Stack Overflow and returns the CODE found in the best answer -for your query. If anyone wants to help me package this application up, -I could use a hand. - -Fun Stuff ---------- - -Here are some things to try if you're bored or want to further customize - -**Colors - Random and predefined** To set a button or text to a random -color, use the string ``'random'`` as the color value. You can also call -``PySimpleGUI.GetRandomColor``. To get a random color pair call -``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a -random color and that color's compliment. - -**Debug Output** Be sure and check out the EasyPrint (Print) function -described in the high-level API section. Leave your code the way it is, -route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - -:: - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in -a window on your screen rather than to the terminal. - -**Look and Feel** Dial in the look and feel that you like with the -``SetOptions`` function. You can change all of the defaults in one -function call. One line of code to customize the entire GUI. - -**ObjToString** Ever wanted to easily display an objects contents -easily? Use ObjToString to get a nicely formatted recursive walk of your -objects. This statement: - -:: - - print(sg.ObjToSting(x)) - -And this was the output - -:: - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - --------------- - -Known Issues -============ - -While not an "issue" this is a ***stern warning*** - -**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads ------------------------------------------------------------------------------------------------------------------------------------------ - -**Progress Meters** - the visual graphic portion of the meter may be -off. May return to the native tkinter progress meter solution in the -future. Right now a "custom" progress meter is used. On the bright side, -the statistics shown are extremely accurate and can tell you something -about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and -EasyPrint/Print). If you start overlapping having Async forms open with -normal forms then things get a littler squirrelly. Still tracking down -the issues and am making it more solid every day possible. You'll know -there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You -print and the output goes to a window, with a scroll bar, that you can -copy and paste from. Being a new feature, it's got some potential -problems. There are known interaction problems with other GUI windows. -For example, closing a Print window can also close other windows you -have open. For now, don't close your debug print window until other -windows are closed too. - -Contributing ------------- - -A MikeTheWatchGuy production... entirely responsible for this code.... -unless it causes you trouble in which case I'm not at all responsible. - -Versions --------- - -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| Version | Description | -+===========+==================================================================================================================================================+ -| 1.0.9 | July 10, 2018 - Initial Release | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 1.0.21 | July 13, 2018 - Readme updates | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.2.0 | July 20, 2018 - Image Elements, Print output | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.5 | Aug XX, 2018 - window\_location default setting | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - -Release Notes -~~~~~~~~~~~~~ - -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another -window open. It could lead to future windows being blank. It's being -worked on. - -New debug printing capability. ``sg.Print`` - -2.5 Discovered issue with scroll bar on ``Output`` elements. The bar -will match size of ROW not the size of the element. Normally you never -notice this due to where on a form the ``Output`` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more -items. The mouse scrollwheel will also scroll the list and will -``page up`` and ``page down`` keys. - -Upcoming -~~~~~~~~ - -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface -are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a -backend other than tkinter. Qt, WxPython, etc. - -Code Condition --------------- - -:: - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the -"Make it run" phase. It's far from "right" in many ways. These are being -worked on. The module is particularly poor for PEP 8 compliance. It was -a learning exercise that turned into a somewhat complete GUI solution -for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public -interfaces into the SDK are more strictly defined and comply with PEP 8 -for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the -code stronger and better in the end, a good thing for us all, right? - -Design ------- - -A moment about the design-spirit of ``PySimpleGUI``. From the beginning, -this package was meant to take advantage of Python's capabilities with -the goal of programming ease. - -**Single File** While not the best programming practice, the -implementation resulted in a single file solution. Only one file is -needed, PySimpleGUI.py. You can post this file, email it, and easily -import it using one statement. - -**Functions as objects** In Python, functions behave just like object. -When you're placing a Text Element into your form, you may be sometimes -calling a function and other times declaring an object. If you use the -word Text, then you're getting an object. If you're using ``Txt``, then -you're calling a function that returns a ``Text`` object. - -**Lists** It seemed quite natural to use Python's powerful list -constructs when possible. The form is specified as a series of lists. -Each "row" of the GUI is represented as a list of Elements. When the -form read returns the results to the user, all of the results are -presented as a single list. This makes reading a form's values -super-simple to do in a single line of Python code. - -Authors -------- - -MikeTheWatchGuy - -License -------- - -GNU Lesser General Public License (LGPL 3) + - -Acknowledgments ---------------- - -- Jorj McKie was the motivator behind the entire project. His - wxsimpleGUI concepts sparked PySimpleGUI into existence -- `Fredrik Lundh `__ for his - work on ``tkinter`` - -How Do I --------- - -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi Their utility has forever changed the -way and pace in which I can program. I urge you to try the HowDoI.py -application here on GitHub. Trust me, **it's going to be worth the -effort!** Here are the steps to run that application - -:: - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through -stack overflow posts. It finds the best answer, gets the code from the -answer, and presents it as a response. It gives you the correct answer -OFTEN. It's a miracle that it work SO well. For Python questions, I -simply start my query with 'Python'. Let's say you forgot how to reverse -a list in Python. When you run HowDoI and ask this question, this is -what you'll see. |snap0109| - -In the hands of a competent programmer, this tool is **amazing**. It's a -must-try kind of program that has completely changed my programming -process. I'm not afraid of asking for help! You just have to be smart -about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field -which means you can copy and paste the results right into your code. - -.. |Downloads| image:: http://pepy.tech/badge/pysimplegui - :target: http://pepy.tech/project/pysimplegui -.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg -.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg -.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg -.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg From 8cba6a865f40c157b1e7a1e59074de02e9e55fb8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 2 Aug 2018 22:22:32 -0400 Subject: [PATCH 091/521] readme.rst addition --- docs/readme.rst | 1174 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1174 insertions(+) create mode 100644 docs/readme.rst diff --git a/docs/readme.rst b/docs/readme.rst new file mode 100644 index 000000000..d7260a069 --- /dev/null +++ b/docs/readme.rst @@ -0,0 +1,1174 @@ +.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png + :alt: pysimplegui\_logo + + pysimplegui\_logo +|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of +some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and +into the convenience of a GUI? Have a Raspberry Pi with a touchscreen +that's going to waste because you don't have the time to learn a GUI +SDK? Look no further, you've found your GUI package. + +:: + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + +.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg + :alt: snap0136 + + snap0136 +Build beautiful customized forms that fit your specific problem. Let +PySimpleGUI solve your GUI problem while you solve the real problems. Do +you really want to plod through the mountains of code required to +program tkinter? + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +Perhaps you're looking for a way to interact with your Raspberry Pi in a +more friendly way. The is the same form as above, except shown on a Pi. + +.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg + :alt: raspberry pi + + raspberry pi +In addition to a primary GUI, you can add a Progress Meter to your code +with ONE LINE of code. Slide this into any of your ``for`` loops and get +a nice meter like this: + +:: + + EasyProgressMeter('My meter title', current_value, max value) + +.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg + :alt: progress meter 2 + + progress meter 2 +You can build an async media player GUI with custom buttons in 30 lines +of code. + +.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg + :alt: media file player + + media file player +I was frustrated by having to deal with the dos prompt when I had a +powerful Windows machine right in front of me. Why is it SO difficult to +do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** +limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and +``WxSimpleGUI`` , both really handy but limited. The primary difference +between these and PySimpleGUI is that in addition to getting the simple +Message Boxes you also get the ability to make your own forms that are +highly customizeable. Don't like the standard Message Box? Then make +your own! + +Every call has optional parameters so that you can change the look and +feel. Don't like the button color? It's easy to change by adding a +button\_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require +configuring and can take a ***week*** to get *reasonably familiar* with +the interfaces. Clearly there needs to be a middle ground between forms +with 1 or two input fields and a full-blown GUI. You'll be making your +own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with +the python interpreter on Windows. Double click a py file and up pops a +GUI window, a more pleasant experience than opening a dos Window and +typing a command line. + +The ``PySimpleGUI`` package is focused on the ***developer***. How can +the desired result be achieved in as little and as simple code as +possible? This was the mantra used to create PySimpleGUI. How can it be +done is a Python-like way? + +:: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + +An example of many widgets used on a single form. A little further down +you'll find the TWENTY lines of code required to create this complex +form. Try it if you don't believe it. Start Python, copy and paste the +code below into the >>> prompt and hit enter. This will pop up... + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Here is the code that produced the above screenshot. + +:: + + import PySimpleGUI as SG + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +**A note on screen shots** You will see a number of different styles of +buttons, data entry fields, etc, in this readme. They were all made with +the same SDK, the only difference is in the settings that are specified +on a per-element, row, form, or global basis. One setting in particular, +border\_width, can make a big difference on the look of the form. Some +of the screenshots had a border\_width of 6, others a value of 1. + +APIs +---- + +PySimpleGUI can be broken down into 2 types of API's: \* High Level +single call functions \* Custom form functions + +Python Language Features +~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a couple of Python language features that PySimpleGUI utilizes +heavily that should be understood first... \* Variable number of +arguments to a function call \* Optional parameters to a function call + +Variable Number of Arguments +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The "High Level" API calls that *output* values take a variable number +of arguments so that they match a "print" statement as much as possible. +The idea is to make it simple for the programmer to output as many items +as desired and in any format. The user need not convert the variables to +be output into the strings. The PySimpleGUI functions do that for the +user. + +:: + + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + +.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg + :alt: snap0104 + + snap0104 +Optional Parameters to a Function Call +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This feature of the Python language is utilized ***heavily*** as a +method of customizing forms and form Elements. Rather than requiring the +programmer to specify every possible option for a widget, instead only +the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details +aren't important. What is important is seeing that there is a long list +of potential tweaks that a caller can make. However, they don't *have* +to be specified on each and every call. + +:: + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, +the call would look something like this: + +:: + + SG.MsgBox('This box has a custom button color', + button_color=('black', 'yellow')) + +.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg + :alt: snap0105 + + snap0105 + +-------------- + +High Level API Calls +~~~~~~~~~~~~~~~~~~~~ + +The classic "input a value, print result" example. Often command line +programs simply take some value as input on the command line, do +something with it and then display the results. Moving from the command +line to a GUI is very simple. This code prompts user to input a line of +text and then displays that text in a messages box: + +:: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg + :alt: GetTextBox + + GetTextBox +.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg + :alt: MsgBox + + MsgBox +Message Boxes +^^^^^^^^^^^^^ + +In addition to MsgBox, you'll find a several API calls that are +shortcuts to common messages boxes. You can achieve similar results by +calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the +calls and the windows that are created. + +:: + + import PySimpleGUI as SG + +``SG.MsgBoxOK('This is an OK MsgBox')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg + :alt: msgboxok + + msgboxok +:: + + SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg + :alt: msgboxokcancel + + msgboxokcancel +:: + + SG.MsgBoxCancel('This is a Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg + :alt: msgboxcancel + + msgboxcancel +:: + + SG.MsgBoxYesNo('This is a Yes No MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg + :alt: msgboxyesno + + msgboxyesno +:: + + SG.MsgBoxError('This is an error MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg + :alt: msgbox error + + msgbox error +:: + + SG.MsgBoxAutoClose('This is an autoclose MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg + :alt: msgbox autoclose + + msgbox autoclose +:: + + SG.ScrolledTextBox(my_text, height=10) + +.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg + :alt: scrolledtextbox + + scrolledtextbox +Take a moment to look at that last one. It's such a simple API call and +yet the result is awesome. Rather than seeing text scrolling past on +your display, you can capture that text and present it in a scrolled +interface. It's handy enough of an API call that it can also be called +using the name ``sprint`` which is easier to remember than +``ScrollectTextBox``. Your code could contain a line like: + +:: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled +window. + +High Level User Input +^^^^^^^^^^^^^^^^^^^^^ + +There are 3 very basic user input high-level function calls. It's +expected that for most applications, a custom input form will be +created. If you need only 1 value, then perhaps one of these high level +functions will work. - GetTextBox - GetFileBox - GetFolderBox + +``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg + :alt: gettextbox + + gettextbox +:: + + submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg + :alt: getfilebox + + getfilebox +:: + + submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg + :alt: getfolderbox + + getfolderbox +Progress Meter! +^^^^^^^^^^^^^^^ + +We all have loops in our code. 'Isn't it joyful waiting, watching a +counter scrolling past in a text window? How about one line of code to +get a progress meter, that contains statistics about your code? + +.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg + :alt: progress meter 3 + + progress meter 3 +:: + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + +:: + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg + :alt: progress meter 5 + + progress meter 5 +A meter AND fun statistics to watch while your machine grinds away, all +for the price of 1 line of code. With a little trickery you can provide +a way to break out of your loop using the Progress Meter form. The +cancel button results in a ``False`` return value from +``EasyProgressMeter``. It normally returns ``True``. + +:: + + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): + break + +***Be sure and add one to your loop counter*** so that your counter goes +from 1 to the max value. If you do not add one, your counter will never +hit the max value. Instead it will go from 0 to max-1. #### Debug Output +Another call in the 'Easy' families of APIs is ``EasyPrint``. It will +output to a debug window. If the debug window isn't open, then the first +call will open it. No need to do anything but stick a 'print' call in +your code. You can even replace your 'print' calls with calls to +EasyPrint by simply sticking the statement + +:: + + print = SG.EasyPrint + +at the top of your code. There are a number of names for the same +EasyPrint function. ``Print`` is one of the better ones to use as it's +easy to remember. It is simply ``print`` with a capital P. + +:: + + import PySimpleGUI as SG + + for i in range(100): + SG.Print(i) + +|snap0125| Or if you didn't want to change your code: + +:: + + import PySimpleGUI as SG + + print=SG.Print + for i in range(100): + print(i) + +Just like the standard print call, ``EasyPrint`` supports the ``sep`` +and ``end`` keyword arguments. Other names that can be used to call +``EasyPrint`` include Print, ``eprint``, If you want to close the +window, call the function ``EasyPrintClose``. + +A word of caution. There are known problems when multiple PySimpleGUI +windows are opened, particularly if the user closes them in an unusual +way. Not a reason to stay away from using it. Just something to keep in +mind if you encounter a problem. + +You can change the size of the debug window using the ``SetOptions`` +call with the ``debug_win_size`` parameter. + +All Widgets / Elements +---------------------- + +This code utilizes as many of the elements in one form as possible. + +:: + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to +make things line up well. This is code you only have to write once. When +looking at the code, remember that what you're seeing is a list of +lists. Each row contains a list of Graphical Elements that are used to +create the form. + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Clicking the Submit button caused the form call to return. The call to +MsgBox resulted in this dialog box. |results 2| + +**``Note, button value can be None``**. The value for ``button`` will be +the text that is displayed on the button element when it was created. If +the user closed the form using something other than a button, then +``button`` will be ``None``. + +You can see in the MsgBox that the values returned are a list. Each +input field in the form generates one item in the return values list. +All input fields return a ``string`` except for Check Boxes and Radio +Buttons. These return ``bool``. + +ProgressBar +^^^^^^^^^^^ + +The ``ProgressBar`` element is used to build custom Progress Bar forms. +It is HIGHLY recommended that you use the functions that provide a +complete progress meter solution for you. Progress Meters are not easy +to work with because the forms have to be non-blocking and they are +tricky to debug. + +The **easiest** way to get progress meters into your code is to use the +``EasyProgessMeter`` API. This consists of a pair of functions, +``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily +cancel any progress meter by calling it with the current value = max +value. This will mark the meter as expired and close the window. You've +already seen EasyProgressMeter calls presented earlier in this readme. + +:: + + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for ``EasyProgressMeter`` is: ``True`` if meter updated +correctly ``False`` if user clicked the Cancel button, closed the form, +or vale reached the max value. **Customized Progress Bar** If you want a +bit more customization of your meter, then you can go up 1 level and use +the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs +behave like an object we're all used to. First you create the +``ProgressMeter`` object, then you call the ``Update`` method to update +it. + +You setup the progress meter by calling + +:: + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) + +Then to update the bar within your loop + +:: + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): + +Putting it all together you get this design pattern + +:: + + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + +The final way of using a Progress Meter with PySimpleGUI is to build a +custom form with a ``ProgressBar`` Element in the form. You will need to +run your form as a non-blocking form. When you are ready to update your +progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` +element itself. + +Output +^^^^^^ + +The Output Element is a re-direction of Stdout. Anything "printed" will +be displayed in this element. + +:: + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an +Output Element + +:: + + import PySimpleGUI as SG + # Blocking form that doesn't close + def ChatBot(): + with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], + [SG.Output(size=(80, 20))], + [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + +Tabbed Forms +------------ + +Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has +the format + +:: + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken +to create the form as before. A ``FlexForm`` is created, then rows are +filled with Elements, and finally the form is shown. When calling +``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the +format: ``(the form, the rows, a string shown on the tab)`` + +Results are returned as a list of lists. For each form you'll get a list +that's in the same format as a normal form. A single tab's values would +be: + +:: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would +return like this: + +:: + + ((button1, (values1)), (button2, (values2)) + +## Colors ## Starting in version 2.5 you can change the background +colors for the window and the Elements. + +Your forms can go from this: |snap0155| + +to this... with one function call... + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +While you can do it on an element by element or form level basis, the +easiest way, by far, is a call to ``SetOptions``. + +Be aware that once you change these options they are changed for the +rest of your program's execution. All of your forms will have that look +and feel, until you change it to something else (which could be the +system default colors. + +This call sets all of the different color options. + +:: + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + +Global Settings +--------------- + +**Global Settings** Let's have some fun customizing! Make PySimpleGUI +look the way you want it to look. You can set the global settings using +the function ``PySimpleGUI.SetOptions``. Each option has an optional +parameter that's used to set it. + +:: + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + +:: + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + +These settings apply to all forms ``SetOptions``. The Row options and +Element options will take precedence over these settings. Settings can +be thought of as levels of settings with the Form-level being the +highest and the Element-level the lowest. Thus the levels are: + +- Form level +- Row level +- Element level + +Each lower level overrides the settings of the higher level. Once +settings have been changed, they remain changed for the duration of the +program (unless changed again). + +Asynchronous (Non-Blocking) Forms +--------------------------------- + +So you want to be a wizard do ya? Well go boldly! While the majority of +GUIs are a simple exercise to "collect input values and return with +them", there are instances where we want to continue executing while the +form is open. These are "asynchronous" forms and require special +options, new SDK calls, and **great care**. With asynchronous forms the +form is shown, user input is read, but your code keeps right on +chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` +on a periodic basis. Once a second or more will produce a reasonably +snappy GUI. + +When do you use a non-blocking form? A couple of examples are \* A media +file player like an MP3 player \* A status dashboard that's periodically +updated \* Progress Meters - when you want to make your own progress +meters \* Output using print to a scrolled text element. Good for +debugging. + +Word of warning... version 2.2, the currently released, and upcoming +version 2.3 differ in the return code for the ``ReadNonBlocking`` call. +Previously the function returned 2 values, except when the form is +closed using the "X" which returned a single value of ``None``. The +*new* way is that ``ReadNonBlocking`` always returns 2 values. If the +user closed the form with the "X" then the return values will be None, +None. You will want to key off the second value to catch this case. The +proper code to check if the user has exited the form will be a +polling-loop that looks something like this: + +:: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update +our form with a running clock. + +The basic flow and functions you will be calling are: Setup + +:: + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + +Periodic refresh + +:: + + form.ReadNonBlocking() + +If you need to close the form + +:: + + form.CloseNonBlockingForm() + +Rather than the usual ``form.LayoutAndRead()`` call, we're manually +adding the rows (doing the layout) and then showing the form. After the +form is shown, you simply call ``form.ReadNonBlocking()`` every now and +then. + +When you are ready to close the form (assuming the form wasn't closed by +the user or a button click) you simply call +``form.CloseNonBlockingForm()`` + +**Example - Running timer that updates** See the sample code on the +GitHub named Demo Media Player for another example of Async Forms. We're +going to make a form and update one of the elements of that form every +.01 seconds. Here's the entire code to do that. + +:: + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + +What we have here is the same sequence of function calls as in the +description. Get a form, add rows to it, show the form, and then refresh +it every now and then. + +The new thing in this example is the call use of the Update method for +the Text Element. The first thing we do inside the loop is "update" the +text element that we made earlier. This changes the value of the text +field on the form. The new value will be displayed when +``form.ReadNonBlocking()`` is called. + +Note the ``else`` statement on the for loop. This is needed because +we're about to exit the loop while the form is still open. The user has +not closed the form using the X nor a button so it's up to the caller to +close the form using ``CloseNonBlockingForm``. + +That's it... this example follows the async design pattern well. + +Sample Applications +------------------- + +Use the example programs as a starting basis for your GUI. Copy, paste, +modify and run! The demo files are: + +``Demo Recipes.py`` - Sample forms for all major form types and +situations. This is the place to get your code template from. Includes +asynchronous forms, etc. + +``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls +to get a filename + +``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a +folder & Easy Progress Meter to show progress of the file scanning + +``Demo HowDoI.py`` - An amazing little application. Acts as a front-end +to HowDoI. This one program could forever change how you code. It does +searches on Stack Overflow and returns the CODE found in the best answer +for your query. If anyone wants to help me package this application up, +I could use a hand. + +Fun Stuff +--------- + +Here are some things to try if you're bored or want to further customize + +**Colors - Random and predefined** To set a button or text to a random +color, use the string ``'random'`` as the color value. You can also call +``PySimpleGUI.GetRandomColor``. To get a random color pair call +``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a +random color and that color's compliment. + +**Debug Output** Be sure and check out the EasyPrint (Print) function +described in the high-level API section. Leave your code the way it is, +route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + +:: + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in +a window on your screen rather than to the terminal. + +**Look and Feel** Dial in the look and feel that you like with the +``SetOptions`` function. You can change all of the defaults in one +function call. One line of code to customize the entire GUI. + +**ObjToString** Ever wanted to easily display an objects contents +easily? Use ObjToString to get a nicely formatted recursive walk of your +objects. This statement: + +:: + + print(sg.ObjToSting(x)) + +And this was the output + +:: + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +-------------- + +Known Issues +============ + +While not an "issue" this is a ***stern warning*** + +**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads +----------------------------------------------------------------------------------------------------------------------------------------- + +**Progress Meters** - the visual graphic portion of the meter may be +off. May return to the native tkinter progress meter solution in the +future. Right now a "custom" progress meter is used. On the bright side, +the statistics shown are extremely accurate and can tell you something +about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and +EasyPrint/Print). If you start overlapping having Async forms open with +normal forms then things get a littler squirrelly. Still tracking down +the issues and am making it more solid every day possible. You'll know +there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You +print and the output goes to a window, with a scroll bar, that you can +copy and paste from. Being a new feature, it's got some potential +problems. There are known interaction problems with other GUI windows. +For example, closing a Print window can also close other windows you +have open. For now, don't close your debug print window until other +windows are closed too. + +Contributing +------------ + +A MikeTheWatchGuy production... entirely responsible for this code.... +unless it causes you trouble in which case I'm not at all responsible. + +Versions +-------- + ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| Version | Description | ++===========+==================================================================================================================================================+ +| 1.0.9 | July 10, 2018 - Initial Release | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 1.0.21 | July 13, 2018 - Readme updates | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.2.0 | July 20, 2018 - Image Elements, Print output | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.5 | Aug XX, 2018 - window\_location default setting | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + +Release Notes +~~~~~~~~~~~~~ + +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another +window open. It could lead to future windows being blank. It's being +worked on. + +New debug printing capability. ``sg.Print`` + +2.5 Discovered issue with scroll bar on ``Output`` elements. The bar +will match size of ROW not the size of the element. Normally you never +notice this due to where on a form the ``Output`` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more +items. The mouse scrollwheel will also scroll the list and will +``page up`` and ``page down`` keys. + +Upcoming +~~~~~~~~ + +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface +are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a +backend other than tkinter. Qt, WxPython, etc. + +Code Condition +-------------- + +:: + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the +"Make it run" phase. It's far from "right" in many ways. These are being +worked on. The module is particularly poor for PEP 8 compliance. It was +a learning exercise that turned into a somewhat complete GUI solution +for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public +interfaces into the SDK are more strictly defined and comply with PEP 8 +for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the +code stronger and better in the end, a good thing for us all, right? + +Design +------ + +A moment about the design-spirit of ``PySimpleGUI``. From the beginning, +this package was meant to take advantage of Python's capabilities with +the goal of programming ease. + +**Single File** While not the best programming practice, the +implementation resulted in a single file solution. Only one file is +needed, PySimpleGUI.py. You can post this file, email it, and easily +import it using one statement. + +**Functions as objects** In Python, functions behave just like object. +When you're placing a Text Element into your form, you may be sometimes +calling a function and other times declaring an object. If you use the +word Text, then you're getting an object. If you're using ``Txt``, then +you're calling a function that returns a ``Text`` object. + +**Lists** It seemed quite natural to use Python's powerful list +constructs when possible. The form is specified as a series of lists. +Each "row" of the GUI is represented as a list of Elements. When the +form read returns the results to the user, all of the results are +presented as a single list. This makes reading a form's values +super-simple to do in a single line of Python code. + +Authors +------- + +MikeTheWatchGuy + +License +------- + +GNU Lesser General Public License (LGPL 3) + + +Acknowledgments +--------------- + +- Jorj McKie was the motivator behind the entire project. His + wxsimpleGUI concepts sparked PySimpleGUI into existence +- `Fredrik Lundh `__ for his + work on ``tkinter`` + +How Do I +-------- + +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi Their utility has forever changed the +way and pace in which I can program. I urge you to try the HowDoI.py +application here on GitHub. Trust me, **it's going to be worth the +effort!** Here are the steps to run that application + +:: + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through +stack overflow posts. It finds the best answer, gets the code from the +answer, and presents it as a response. It gives you the correct answer +OFTEN. It's a miracle that it work SO well. For Python questions, I +simply start my query with 'Python'. Let's say you forgot how to reverse +a list in Python. When you run HowDoI and ask this question, this is +what you'll see. |snap0109| + +In the hands of a competent programmer, this tool is **amazing**. It's a +must-try kind of program that has completely changed my programming +process. I'm not afraid of asking for help! You just have to be smart +about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field +which means you can copy and paste the results right into your code. + +.. |Downloads| image:: http://pepy.tech/badge/pysimplegui + :target: http://pepy.tech/project/pysimplegui +.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg +.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg +.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg +.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg From 1affeb29056aed1d4b77284dc1f982d609e1c0f6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 2 Aug 2018 22:25:13 -0400 Subject: [PATCH 092/521] removed --- docs/readme.rst | 1174 ----------------------------------------------- 1 file changed, 1174 deletions(-) delete mode 100644 docs/readme.rst diff --git a/docs/readme.rst b/docs/readme.rst deleted file mode 100644 index d7260a069..000000000 --- a/docs/readme.rst +++ /dev/null @@ -1,1174 +0,0 @@ -.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png - :alt: pysimplegui\_logo - - pysimplegui\_logo -|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of -some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and -into the convenience of a GUI? Have a Raspberry Pi with a touchscreen -that's going to waste because you don't have the time to learn a GUI -SDK? Look no further, you've found your GUI package. - -:: - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - -.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg - :alt: snap0136 - - snap0136 -Build beautiful customized forms that fit your specific problem. Let -PySimpleGUI solve your GUI problem while you solve the real problems. Do -you really want to plod through the mountains of code required to -program tkinter? - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -Perhaps you're looking for a way to interact with your Raspberry Pi in a -more friendly way. The is the same form as above, except shown on a Pi. - -.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg - :alt: raspberry pi - - raspberry pi -In addition to a primary GUI, you can add a Progress Meter to your code -with ONE LINE of code. Slide this into any of your ``for`` loops and get -a nice meter like this: - -:: - - EasyProgressMeter('My meter title', current_value, max value) - -.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg - :alt: progress meter 2 - - progress meter 2 -You can build an async media player GUI with custom buttons in 30 lines -of code. - -.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg - :alt: media file player - - media file player -I was frustrated by having to deal with the dos prompt when I had a -powerful Windows machine right in front of me. Why is it SO difficult to -do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** -limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and -``WxSimpleGUI`` , both really handy but limited. The primary difference -between these and PySimpleGUI is that in addition to getting the simple -Message Boxes you also get the ability to make your own forms that are -highly customizeable. Don't like the standard Message Box? Then make -your own! - -Every call has optional parameters so that you can change the look and -feel. Don't like the button color? It's easy to change by adding a -button\_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require -configuring and can take a ***week*** to get *reasonably familiar* with -the interfaces. Clearly there needs to be a middle ground between forms -with 1 or two input fields and a full-blown GUI. You'll be making your -own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with -the python interpreter on Windows. Double click a py file and up pops a -GUI window, a more pleasant experience than opening a dos Window and -typing a command line. - -The ``PySimpleGUI`` package is focused on the ***developer***. How can -the desired result be achieved in as little and as simple code as -possible? This was the mantra used to create PySimpleGUI. How can it be -done is a Python-like way? - -:: - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - -An example of many widgets used on a single form. A little further down -you'll find the TWENTY lines of code required to create this complex -form. Try it if you don't believe it. Start Python, copy and paste the -code below into the >>> prompt and hit enter. This will pop up... - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Here is the code that produced the above screenshot. - -:: - - import PySimpleGUI as SG - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -**A note on screen shots** You will see a number of different styles of -buttons, data entry fields, etc, in this readme. They were all made with -the same SDK, the only difference is in the settings that are specified -on a per-element, row, form, or global basis. One setting in particular, -border\_width, can make a big difference on the look of the form. Some -of the screenshots had a border\_width of 6, others a value of 1. - -APIs ----- - -PySimpleGUI can be broken down into 2 types of API's: \* High Level -single call functions \* Custom form functions - -Python Language Features -~~~~~~~~~~~~~~~~~~~~~~~~ - -There are a couple of Python language features that PySimpleGUI utilizes -heavily that should be understood first... \* Variable number of -arguments to a function call \* Optional parameters to a function call - -Variable Number of Arguments -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The "High Level" API calls that *output* values take a variable number -of arguments so that they match a "print" statement as much as possible. -The idea is to make it simple for the programmer to output as many items -as desired and in any format. The user need not convert the variables to -be output into the strings. The PySimpleGUI functions do that for the -user. - -:: - - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - -.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg - :alt: snap0104 - - snap0104 -Optional Parameters to a Function Call -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This feature of the Python language is utilized ***heavily*** as a -method of customizing forms and form Elements. Rather than requiring the -programmer to specify every possible option for a widget, instead only -the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details -aren't important. What is important is seeing that there is a long list -of potential tweaks that a caller can make. However, they don't *have* -to be specified on each and every call. - -:: - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, -the call would look something like this: - -:: - - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) - -.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg - :alt: snap0105 - - snap0105 - --------------- - -High Level API Calls -~~~~~~~~~~~~~~~~~~~~ - -The classic "input a value, print result" example. Often command line -programs simply take some value as input on the command line, do -something with it and then display the results. Moving from the command -line to a GUI is very simple. This code prompts user to input a line of -text and then displays that text in a messages box: - -:: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg - :alt: GetTextBox - - GetTextBox -.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg - :alt: MsgBox - - MsgBox -Message Boxes -^^^^^^^^^^^^^ - -In addition to MsgBox, you'll find a several API calls that are -shortcuts to common messages boxes. You can achieve similar results by -calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the -calls and the windows that are created. - -:: - - import PySimpleGUI as SG - -``SG.MsgBoxOK('This is an OK MsgBox')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg - :alt: msgboxok - - msgboxok -:: - - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg - :alt: msgboxokcancel - - msgboxokcancel -:: - - SG.MsgBoxCancel('This is a Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg - :alt: msgboxcancel - - msgboxcancel -:: - - SG.MsgBoxYesNo('This is a Yes No MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg - :alt: msgboxyesno - - msgboxyesno -:: - - SG.MsgBoxError('This is an error MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg - :alt: msgbox error - - msgbox error -:: - - SG.MsgBoxAutoClose('This is an autoclose MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg - :alt: msgbox autoclose - - msgbox autoclose -:: - - SG.ScrolledTextBox(my_text, height=10) - -.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg - :alt: scrolledtextbox - - scrolledtextbox -Take a moment to look at that last one. It's such a simple API call and -yet the result is awesome. Rather than seeing text scrolling past on -your display, you can capture that text and present it in a scrolled -interface. It's handy enough of an API call that it can also be called -using the name ``sprint`` which is easier to remember than -``ScrollectTextBox``. Your code could contain a line like: - -:: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled -window. - -High Level User Input -^^^^^^^^^^^^^^^^^^^^^ - -There are 3 very basic user input high-level function calls. It's -expected that for most applications, a custom input form will be -created. If you need only 1 value, then perhaps one of these high level -functions will work. - GetTextBox - GetFileBox - GetFolderBox - -``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg - :alt: gettextbox - - gettextbox -:: - - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg - :alt: getfilebox - - getfilebox -:: - - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg - :alt: getfolderbox - - getfolderbox -Progress Meter! -^^^^^^^^^^^^^^^ - -We all have loops in our code. 'Isn't it joyful waiting, watching a -counter scrolling past in a text window? How about one line of code to -get a progress meter, that contains statistics about your code? - -.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg - :alt: progress meter 3 - - progress meter 3 -:: - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - -:: - - for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg - :alt: progress meter 5 - - progress meter 5 -A meter AND fun statistics to watch while your machine grinds away, all -for the price of 1 line of code. With a little trickery you can provide -a way to break out of your loop using the Progress Meter form. The -cancel button results in a ``False`` return value from -``EasyProgressMeter``. It normally returns ``True``. - -:: - - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - -***Be sure and add one to your loop counter*** so that your counter goes -from 1 to the max value. If you do not add one, your counter will never -hit the max value. Instead it will go from 0 to max-1. #### Debug Output -Another call in the 'Easy' families of APIs is ``EasyPrint``. It will -output to a debug window. If the debug window isn't open, then the first -call will open it. No need to do anything but stick a 'print' call in -your code. You can even replace your 'print' calls with calls to -EasyPrint by simply sticking the statement - -:: - - print = SG.EasyPrint - -at the top of your code. There are a number of names for the same -EasyPrint function. ``Print`` is one of the better ones to use as it's -easy to remember. It is simply ``print`` with a capital P. - -:: - - import PySimpleGUI as SG - - for i in range(100): - SG.Print(i) - -|snap0125| Or if you didn't want to change your code: - -:: - - import PySimpleGUI as SG - - print=SG.Print - for i in range(100): - print(i) - -Just like the standard print call, ``EasyPrint`` supports the ``sep`` -and ``end`` keyword arguments. Other names that can be used to call -``EasyPrint`` include Print, ``eprint``, If you want to close the -window, call the function ``EasyPrintClose``. - -A word of caution. There are known problems when multiple PySimpleGUI -windows are opened, particularly if the user closes them in an unusual -way. Not a reason to stay away from using it. Just something to keep in -mind if you encounter a problem. - -You can change the size of the debug window using the ``SetOptions`` -call with the ``debug_win_size`` parameter. - -All Widgets / Elements ----------------------- - -This code utilizes as many of the elements in one form as possible. - -:: - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to -make things line up well. This is code you only have to write once. When -looking at the code, remember that what you're seeing is a list of -lists. Each row contains a list of Graphical Elements that are used to -create the form. - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Clicking the Submit button caused the form call to return. The call to -MsgBox resulted in this dialog box. |results 2| - -**``Note, button value can be None``**. The value for ``button`` will be -the text that is displayed on the button element when it was created. If -the user closed the form using something other than a button, then -``button`` will be ``None``. - -You can see in the MsgBox that the values returned are a list. Each -input field in the form generates one item in the return values list. -All input fields return a ``string`` except for Check Boxes and Radio -Buttons. These return ``bool``. - -ProgressBar -^^^^^^^^^^^ - -The ``ProgressBar`` element is used to build custom Progress Bar forms. -It is HIGHLY recommended that you use the functions that provide a -complete progress meter solution for you. Progress Meters are not easy -to work with because the forms have to be non-blocking and they are -tricky to debug. - -The **easiest** way to get progress meters into your code is to use the -``EasyProgessMeter`` API. This consists of a pair of functions, -``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily -cancel any progress meter by calling it with the current value = max -value. This will mark the meter as expired and close the window. You've -already seen EasyProgressMeter calls presented earlier in this readme. - -:: - - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for ``EasyProgressMeter`` is: ``True`` if meter updated -correctly ``False`` if user clicked the Cancel button, closed the form, -or vale reached the max value. **Customized Progress Bar** If you want a -bit more customization of your meter, then you can go up 1 level and use -the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs -behave like an object we're all used to. First you create the -``ProgressMeter`` object, then you call the ``Update`` method to update -it. - -You setup the progress meter by calling - -:: - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) - -Then to update the bar within your loop - -:: - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): - -Putting it all together you get this design pattern - -:: - - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - -The final way of using a Progress Meter with PySimpleGUI is to build a -custom form with a ``ProgressBar`` Element in the form. You will need to -run your form as a non-blocking form. When you are ready to update your -progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` -element itself. - -Output -^^^^^^ - -The Output Element is a re-direction of Stdout. Anything "printed" will -be displayed in this element. - -:: - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an -Output Element - -:: - - import PySimpleGUI as SG - # Blocking form that doesn't close - def ChatBot(): - with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], - [SG.Output(size=(80, 20))], - [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - -Tabbed Forms ------------- - -Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has -the format - -:: - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken -to create the form as before. A ``FlexForm`` is created, then rows are -filled with Elements, and finally the form is shown. When calling -``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the -format: ``(the form, the rows, a string shown on the tab)`` - -Results are returned as a list of lists. For each form you'll get a list -that's in the same format as a normal form. A single tab's values would -be: - -:: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would -return like this: - -:: - - ((button1, (values1)), (button2, (values2)) - -## Colors ## Starting in version 2.5 you can change the background -colors for the window and the Elements. - -Your forms can go from this: |snap0155| - -to this... with one function call... - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -While you can do it on an element by element or form level basis, the -easiest way, by far, is a call to ``SetOptions``. - -Be aware that once you change these options they are changed for the -rest of your program's execution. All of your forms will have that look -and feel, until you change it to something else (which could be the -system default colors. - -This call sets all of the different color options. - -:: - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - -Global Settings ---------------- - -**Global Settings** Let's have some fun customizing! Make PySimpleGUI -look the way you want it to look. You can set the global settings using -the function ``PySimpleGUI.SetOptions``. Each option has an optional -parameter that's used to set it. - -:: - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - -:: - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - -These settings apply to all forms ``SetOptions``. The Row options and -Element options will take precedence over these settings. Settings can -be thought of as levels of settings with the Form-level being the -highest and the Element-level the lowest. Thus the levels are: - -- Form level -- Row level -- Element level - -Each lower level overrides the settings of the higher level. Once -settings have been changed, they remain changed for the duration of the -program (unless changed again). - -Asynchronous (Non-Blocking) Forms ---------------------------------- - -So you want to be a wizard do ya? Well go boldly! While the majority of -GUIs are a simple exercise to "collect input values and return with -them", there are instances where we want to continue executing while the -form is open. These are "asynchronous" forms and require special -options, new SDK calls, and **great care**. With asynchronous forms the -form is shown, user input is read, but your code keeps right on -chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` -on a periodic basis. Once a second or more will produce a reasonably -snappy GUI. - -When do you use a non-blocking form? A couple of examples are \* A media -file player like an MP3 player \* A status dashboard that's periodically -updated \* Progress Meters - when you want to make your own progress -meters \* Output using print to a scrolled text element. Good for -debugging. - -Word of warning... version 2.2, the currently released, and upcoming -version 2.3 differ in the return code for the ``ReadNonBlocking`` call. -Previously the function returned 2 values, except when the form is -closed using the "X" which returned a single value of ``None``. The -*new* way is that ``ReadNonBlocking`` always returns 2 values. If the -user closed the form with the "X" then the return values will be None, -None. You will want to key off the second value to catch this case. The -proper code to check if the user has exited the form will be a -polling-loop that looks something like this: - -:: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update -our form with a running clock. - -The basic flow and functions you will be calling are: Setup - -:: - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - -Periodic refresh - -:: - - form.ReadNonBlocking() - -If you need to close the form - -:: - - form.CloseNonBlockingForm() - -Rather than the usual ``form.LayoutAndRead()`` call, we're manually -adding the rows (doing the layout) and then showing the form. After the -form is shown, you simply call ``form.ReadNonBlocking()`` every now and -then. - -When you are ready to close the form (assuming the form wasn't closed by -the user or a button click) you simply call -``form.CloseNonBlockingForm()`` - -**Example - Running timer that updates** See the sample code on the -GitHub named Demo Media Player for another example of Async Forms. We're -going to make a form and update one of the elements of that form every -.01 seconds. Here's the entire code to do that. - -:: - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - -What we have here is the same sequence of function calls as in the -description. Get a form, add rows to it, show the form, and then refresh -it every now and then. - -The new thing in this example is the call use of the Update method for -the Text Element. The first thing we do inside the loop is "update" the -text element that we made earlier. This changes the value of the text -field on the form. The new value will be displayed when -``form.ReadNonBlocking()`` is called. - -Note the ``else`` statement on the for loop. This is needed because -we're about to exit the loop while the form is still open. The user has -not closed the form using the X nor a button so it's up to the caller to -close the form using ``CloseNonBlockingForm``. - -That's it... this example follows the async design pattern well. - -Sample Applications -------------------- - -Use the example programs as a starting basis for your GUI. Copy, paste, -modify and run! The demo files are: - -``Demo Recipes.py`` - Sample forms for all major form types and -situations. This is the place to get your code template from. Includes -asynchronous forms, etc. - -``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls -to get a filename - -``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a -folder & Easy Progress Meter to show progress of the file scanning - -``Demo HowDoI.py`` - An amazing little application. Acts as a front-end -to HowDoI. This one program could forever change how you code. It does -searches on Stack Overflow and returns the CODE found in the best answer -for your query. If anyone wants to help me package this application up, -I could use a hand. - -Fun Stuff ---------- - -Here are some things to try if you're bored or want to further customize - -**Colors - Random and predefined** To set a button or text to a random -color, use the string ``'random'`` as the color value. You can also call -``PySimpleGUI.GetRandomColor``. To get a random color pair call -``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a -random color and that color's compliment. - -**Debug Output** Be sure and check out the EasyPrint (Print) function -described in the high-level API section. Leave your code the way it is, -route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - -:: - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in -a window on your screen rather than to the terminal. - -**Look and Feel** Dial in the look and feel that you like with the -``SetOptions`` function. You can change all of the defaults in one -function call. One line of code to customize the entire GUI. - -**ObjToString** Ever wanted to easily display an objects contents -easily? Use ObjToString to get a nicely formatted recursive walk of your -objects. This statement: - -:: - - print(sg.ObjToSting(x)) - -And this was the output - -:: - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - --------------- - -Known Issues -============ - -While not an "issue" this is a ***stern warning*** - -**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads ------------------------------------------------------------------------------------------------------------------------------------------ - -**Progress Meters** - the visual graphic portion of the meter may be -off. May return to the native tkinter progress meter solution in the -future. Right now a "custom" progress meter is used. On the bright side, -the statistics shown are extremely accurate and can tell you something -about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and -EasyPrint/Print). If you start overlapping having Async forms open with -normal forms then things get a littler squirrelly. Still tracking down -the issues and am making it more solid every day possible. You'll know -there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You -print and the output goes to a window, with a scroll bar, that you can -copy and paste from. Being a new feature, it's got some potential -problems. There are known interaction problems with other GUI windows. -For example, closing a Print window can also close other windows you -have open. For now, don't close your debug print window until other -windows are closed too. - -Contributing ------------- - -A MikeTheWatchGuy production... entirely responsible for this code.... -unless it causes you trouble in which case I'm not at all responsible. - -Versions --------- - -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| Version | Description | -+===========+==================================================================================================================================================+ -| 1.0.9 | July 10, 2018 - Initial Release | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 1.0.21 | July 13, 2018 - Readme updates | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.2.0 | July 20, 2018 - Image Elements, Print output | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.5 | Aug XX, 2018 - window\_location default setting | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - -Release Notes -~~~~~~~~~~~~~ - -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another -window open. It could lead to future windows being blank. It's being -worked on. - -New debug printing capability. ``sg.Print`` - -2.5 Discovered issue with scroll bar on ``Output`` elements. The bar -will match size of ROW not the size of the element. Normally you never -notice this due to where on a form the ``Output`` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more -items. The mouse scrollwheel will also scroll the list and will -``page up`` and ``page down`` keys. - -Upcoming -~~~~~~~~ - -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface -are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a -backend other than tkinter. Qt, WxPython, etc. - -Code Condition --------------- - -:: - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the -"Make it run" phase. It's far from "right" in many ways. These are being -worked on. The module is particularly poor for PEP 8 compliance. It was -a learning exercise that turned into a somewhat complete GUI solution -for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public -interfaces into the SDK are more strictly defined and comply with PEP 8 -for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the -code stronger and better in the end, a good thing for us all, right? - -Design ------- - -A moment about the design-spirit of ``PySimpleGUI``. From the beginning, -this package was meant to take advantage of Python's capabilities with -the goal of programming ease. - -**Single File** While not the best programming practice, the -implementation resulted in a single file solution. Only one file is -needed, PySimpleGUI.py. You can post this file, email it, and easily -import it using one statement. - -**Functions as objects** In Python, functions behave just like object. -When you're placing a Text Element into your form, you may be sometimes -calling a function and other times declaring an object. If you use the -word Text, then you're getting an object. If you're using ``Txt``, then -you're calling a function that returns a ``Text`` object. - -**Lists** It seemed quite natural to use Python's powerful list -constructs when possible. The form is specified as a series of lists. -Each "row" of the GUI is represented as a list of Elements. When the -form read returns the results to the user, all of the results are -presented as a single list. This makes reading a form's values -super-simple to do in a single line of Python code. - -Authors -------- - -MikeTheWatchGuy - -License -------- - -GNU Lesser General Public License (LGPL 3) + - -Acknowledgments ---------------- - -- Jorj McKie was the motivator behind the entire project. His - wxsimpleGUI concepts sparked PySimpleGUI into existence -- `Fredrik Lundh `__ for his - work on ``tkinter`` - -How Do I --------- - -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi Their utility has forever changed the -way and pace in which I can program. I urge you to try the HowDoI.py -application here on GitHub. Trust me, **it's going to be worth the -effort!** Here are the steps to run that application - -:: - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through -stack overflow posts. It finds the best answer, gets the code from the -answer, and presents it as a response. It gives you the correct answer -OFTEN. It's a miracle that it work SO well. For Python questions, I -simply start my query with 'Python'. Let's say you forgot how to reverse -a list in Python. When you run HowDoI and ask this question, this is -what you'll see. |snap0109| - -In the hands of a competent programmer, this tool is **amazing**. It's a -must-try kind of program that has completely changed my programming -process. I'm not afraid of asking for help! You just have to be smart -about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field -which means you can copy and paste the results right into your code. - -.. |Downloads| image:: http://pepy.tech/badge/pysimplegui - :target: http://pepy.tech/project/pysimplegui -.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg -.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg -.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg -.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg From 525020c84c3b19a0eaebca5eeea0d3ae3b447b02 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 2 Aug 2018 22:25:33 -0400 Subject: [PATCH 093/521] README.rst addition --- docs/README.rst | 1174 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1174 insertions(+) create mode 100644 docs/README.rst diff --git a/docs/README.rst b/docs/README.rst new file mode 100644 index 000000000..d7260a069 --- /dev/null +++ b/docs/README.rst @@ -0,0 +1,1174 @@ +.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png + :alt: pysimplegui\_logo + + pysimplegui\_logo +|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of +some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and +into the convenience of a GUI? Have a Raspberry Pi with a touchscreen +that's going to waste because you don't have the time to learn a GUI +SDK? Look no further, you've found your GUI package. + +:: + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + +.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg + :alt: snap0136 + + snap0136 +Build beautiful customized forms that fit your specific problem. Let +PySimpleGUI solve your GUI problem while you solve the real problems. Do +you really want to plod through the mountains of code required to +program tkinter? + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +Perhaps you're looking for a way to interact with your Raspberry Pi in a +more friendly way. The is the same form as above, except shown on a Pi. + +.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg + :alt: raspberry pi + + raspberry pi +In addition to a primary GUI, you can add a Progress Meter to your code +with ONE LINE of code. Slide this into any of your ``for`` loops and get +a nice meter like this: + +:: + + EasyProgressMeter('My meter title', current_value, max value) + +.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg + :alt: progress meter 2 + + progress meter 2 +You can build an async media player GUI with custom buttons in 30 lines +of code. + +.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg + :alt: media file player + + media file player +I was frustrated by having to deal with the dos prompt when I had a +powerful Windows machine right in front of me. Why is it SO difficult to +do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** +limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and +``WxSimpleGUI`` , both really handy but limited. The primary difference +between these and PySimpleGUI is that in addition to getting the simple +Message Boxes you also get the ability to make your own forms that are +highly customizeable. Don't like the standard Message Box? Then make +your own! + +Every call has optional parameters so that you can change the look and +feel. Don't like the button color? It's easy to change by adding a +button\_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require +configuring and can take a ***week*** to get *reasonably familiar* with +the interfaces. Clearly there needs to be a middle ground between forms +with 1 or two input fields and a full-blown GUI. You'll be making your +own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with +the python interpreter on Windows. Double click a py file and up pops a +GUI window, a more pleasant experience than opening a dos Window and +typing a command line. + +The ``PySimpleGUI`` package is focused on the ***developer***. How can +the desired result be achieved in as little and as simple code as +possible? This was the mantra used to create PySimpleGUI. How can it be +done is a Python-like way? + +:: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + +An example of many widgets used on a single form. A little further down +you'll find the TWENTY lines of code required to create this complex +form. Try it if you don't believe it. Start Python, copy and paste the +code below into the >>> prompt and hit enter. This will pop up... + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Here is the code that produced the above screenshot. + +:: + + import PySimpleGUI as SG + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +**A note on screen shots** You will see a number of different styles of +buttons, data entry fields, etc, in this readme. They were all made with +the same SDK, the only difference is in the settings that are specified +on a per-element, row, form, or global basis. One setting in particular, +border\_width, can make a big difference on the look of the form. Some +of the screenshots had a border\_width of 6, others a value of 1. + +APIs +---- + +PySimpleGUI can be broken down into 2 types of API's: \* High Level +single call functions \* Custom form functions + +Python Language Features +~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a couple of Python language features that PySimpleGUI utilizes +heavily that should be understood first... \* Variable number of +arguments to a function call \* Optional parameters to a function call + +Variable Number of Arguments +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The "High Level" API calls that *output* values take a variable number +of arguments so that they match a "print" statement as much as possible. +The idea is to make it simple for the programmer to output as many items +as desired and in any format. The user need not convert the variables to +be output into the strings. The PySimpleGUI functions do that for the +user. + +:: + + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + +.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg + :alt: snap0104 + + snap0104 +Optional Parameters to a Function Call +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This feature of the Python language is utilized ***heavily*** as a +method of customizing forms and form Elements. Rather than requiring the +programmer to specify every possible option for a widget, instead only +the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details +aren't important. What is important is seeing that there is a long list +of potential tweaks that a caller can make. However, they don't *have* +to be specified on each and every call. + +:: + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, +the call would look something like this: + +:: + + SG.MsgBox('This box has a custom button color', + button_color=('black', 'yellow')) + +.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg + :alt: snap0105 + + snap0105 + +-------------- + +High Level API Calls +~~~~~~~~~~~~~~~~~~~~ + +The classic "input a value, print result" example. Often command line +programs simply take some value as input on the command line, do +something with it and then display the results. Moving from the command +line to a GUI is very simple. This code prompts user to input a line of +text and then displays that text in a messages box: + +:: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg + :alt: GetTextBox + + GetTextBox +.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg + :alt: MsgBox + + MsgBox +Message Boxes +^^^^^^^^^^^^^ + +In addition to MsgBox, you'll find a several API calls that are +shortcuts to common messages boxes. You can achieve similar results by +calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the +calls and the windows that are created. + +:: + + import PySimpleGUI as SG + +``SG.MsgBoxOK('This is an OK MsgBox')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg + :alt: msgboxok + + msgboxok +:: + + SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg + :alt: msgboxokcancel + + msgboxokcancel +:: + + SG.MsgBoxCancel('This is a Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg + :alt: msgboxcancel + + msgboxcancel +:: + + SG.MsgBoxYesNo('This is a Yes No MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg + :alt: msgboxyesno + + msgboxyesno +:: + + SG.MsgBoxError('This is an error MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg + :alt: msgbox error + + msgbox error +:: + + SG.MsgBoxAutoClose('This is an autoclose MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg + :alt: msgbox autoclose + + msgbox autoclose +:: + + SG.ScrolledTextBox(my_text, height=10) + +.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg + :alt: scrolledtextbox + + scrolledtextbox +Take a moment to look at that last one. It's such a simple API call and +yet the result is awesome. Rather than seeing text scrolling past on +your display, you can capture that text and present it in a scrolled +interface. It's handy enough of an API call that it can also be called +using the name ``sprint`` which is easier to remember than +``ScrollectTextBox``. Your code could contain a line like: + +:: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled +window. + +High Level User Input +^^^^^^^^^^^^^^^^^^^^^ + +There are 3 very basic user input high-level function calls. It's +expected that for most applications, a custom input form will be +created. If you need only 1 value, then perhaps one of these high level +functions will work. - GetTextBox - GetFileBox - GetFolderBox + +``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg + :alt: gettextbox + + gettextbox +:: + + submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg + :alt: getfilebox + + getfilebox +:: + + submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg + :alt: getfolderbox + + getfolderbox +Progress Meter! +^^^^^^^^^^^^^^^ + +We all have loops in our code. 'Isn't it joyful waiting, watching a +counter scrolling past in a text window? How about one line of code to +get a progress meter, that contains statistics about your code? + +.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg + :alt: progress meter 3 + + progress meter 3 +:: + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + +:: + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg + :alt: progress meter 5 + + progress meter 5 +A meter AND fun statistics to watch while your machine grinds away, all +for the price of 1 line of code. With a little trickery you can provide +a way to break out of your loop using the Progress Meter form. The +cancel button results in a ``False`` return value from +``EasyProgressMeter``. It normally returns ``True``. + +:: + + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): + break + +***Be sure and add one to your loop counter*** so that your counter goes +from 1 to the max value. If you do not add one, your counter will never +hit the max value. Instead it will go from 0 to max-1. #### Debug Output +Another call in the 'Easy' families of APIs is ``EasyPrint``. It will +output to a debug window. If the debug window isn't open, then the first +call will open it. No need to do anything but stick a 'print' call in +your code. You can even replace your 'print' calls with calls to +EasyPrint by simply sticking the statement + +:: + + print = SG.EasyPrint + +at the top of your code. There are a number of names for the same +EasyPrint function. ``Print`` is one of the better ones to use as it's +easy to remember. It is simply ``print`` with a capital P. + +:: + + import PySimpleGUI as SG + + for i in range(100): + SG.Print(i) + +|snap0125| Or if you didn't want to change your code: + +:: + + import PySimpleGUI as SG + + print=SG.Print + for i in range(100): + print(i) + +Just like the standard print call, ``EasyPrint`` supports the ``sep`` +and ``end`` keyword arguments. Other names that can be used to call +``EasyPrint`` include Print, ``eprint``, If you want to close the +window, call the function ``EasyPrintClose``. + +A word of caution. There are known problems when multiple PySimpleGUI +windows are opened, particularly if the user closes them in an unusual +way. Not a reason to stay away from using it. Just something to keep in +mind if you encounter a problem. + +You can change the size of the debug window using the ``SetOptions`` +call with the ``debug_win_size`` parameter. + +All Widgets / Elements +---------------------- + +This code utilizes as many of the elements in one form as possible. + +:: + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to +make things line up well. This is code you only have to write once. When +looking at the code, remember that what you're seeing is a list of +lists. Each row contains a list of Graphical Elements that are used to +create the form. + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Clicking the Submit button caused the form call to return. The call to +MsgBox resulted in this dialog box. |results 2| + +**``Note, button value can be None``**. The value for ``button`` will be +the text that is displayed on the button element when it was created. If +the user closed the form using something other than a button, then +``button`` will be ``None``. + +You can see in the MsgBox that the values returned are a list. Each +input field in the form generates one item in the return values list. +All input fields return a ``string`` except for Check Boxes and Radio +Buttons. These return ``bool``. + +ProgressBar +^^^^^^^^^^^ + +The ``ProgressBar`` element is used to build custom Progress Bar forms. +It is HIGHLY recommended that you use the functions that provide a +complete progress meter solution for you. Progress Meters are not easy +to work with because the forms have to be non-blocking and they are +tricky to debug. + +The **easiest** way to get progress meters into your code is to use the +``EasyProgessMeter`` API. This consists of a pair of functions, +``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily +cancel any progress meter by calling it with the current value = max +value. This will mark the meter as expired and close the window. You've +already seen EasyProgressMeter calls presented earlier in this readme. + +:: + + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for ``EasyProgressMeter`` is: ``True`` if meter updated +correctly ``False`` if user clicked the Cancel button, closed the form, +or vale reached the max value. **Customized Progress Bar** If you want a +bit more customization of your meter, then you can go up 1 level and use +the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs +behave like an object we're all used to. First you create the +``ProgressMeter`` object, then you call the ``Update`` method to update +it. + +You setup the progress meter by calling + +:: + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) + +Then to update the bar within your loop + +:: + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): + +Putting it all together you get this design pattern + +:: + + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + +The final way of using a Progress Meter with PySimpleGUI is to build a +custom form with a ``ProgressBar`` Element in the form. You will need to +run your form as a non-blocking form. When you are ready to update your +progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` +element itself. + +Output +^^^^^^ + +The Output Element is a re-direction of Stdout. Anything "printed" will +be displayed in this element. + +:: + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an +Output Element + +:: + + import PySimpleGUI as SG + # Blocking form that doesn't close + def ChatBot(): + with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], + [SG.Output(size=(80, 20))], + [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + +Tabbed Forms +------------ + +Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has +the format + +:: + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken +to create the form as before. A ``FlexForm`` is created, then rows are +filled with Elements, and finally the form is shown. When calling +``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the +format: ``(the form, the rows, a string shown on the tab)`` + +Results are returned as a list of lists. For each form you'll get a list +that's in the same format as a normal form. A single tab's values would +be: + +:: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would +return like this: + +:: + + ((button1, (values1)), (button2, (values2)) + +## Colors ## Starting in version 2.5 you can change the background +colors for the window and the Elements. + +Your forms can go from this: |snap0155| + +to this... with one function call... + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +While you can do it on an element by element or form level basis, the +easiest way, by far, is a call to ``SetOptions``. + +Be aware that once you change these options they are changed for the +rest of your program's execution. All of your forms will have that look +and feel, until you change it to something else (which could be the +system default colors. + +This call sets all of the different color options. + +:: + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + +Global Settings +--------------- + +**Global Settings** Let's have some fun customizing! Make PySimpleGUI +look the way you want it to look. You can set the global settings using +the function ``PySimpleGUI.SetOptions``. Each option has an optional +parameter that's used to set it. + +:: + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + +:: + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + +These settings apply to all forms ``SetOptions``. The Row options and +Element options will take precedence over these settings. Settings can +be thought of as levels of settings with the Form-level being the +highest and the Element-level the lowest. Thus the levels are: + +- Form level +- Row level +- Element level + +Each lower level overrides the settings of the higher level. Once +settings have been changed, they remain changed for the duration of the +program (unless changed again). + +Asynchronous (Non-Blocking) Forms +--------------------------------- + +So you want to be a wizard do ya? Well go boldly! While the majority of +GUIs are a simple exercise to "collect input values and return with +them", there are instances where we want to continue executing while the +form is open. These are "asynchronous" forms and require special +options, new SDK calls, and **great care**. With asynchronous forms the +form is shown, user input is read, but your code keeps right on +chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` +on a periodic basis. Once a second or more will produce a reasonably +snappy GUI. + +When do you use a non-blocking form? A couple of examples are \* A media +file player like an MP3 player \* A status dashboard that's periodically +updated \* Progress Meters - when you want to make your own progress +meters \* Output using print to a scrolled text element. Good for +debugging. + +Word of warning... version 2.2, the currently released, and upcoming +version 2.3 differ in the return code for the ``ReadNonBlocking`` call. +Previously the function returned 2 values, except when the form is +closed using the "X" which returned a single value of ``None``. The +*new* way is that ``ReadNonBlocking`` always returns 2 values. If the +user closed the form with the "X" then the return values will be None, +None. You will want to key off the second value to catch this case. The +proper code to check if the user has exited the form will be a +polling-loop that looks something like this: + +:: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update +our form with a running clock. + +The basic flow and functions you will be calling are: Setup + +:: + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + +Periodic refresh + +:: + + form.ReadNonBlocking() + +If you need to close the form + +:: + + form.CloseNonBlockingForm() + +Rather than the usual ``form.LayoutAndRead()`` call, we're manually +adding the rows (doing the layout) and then showing the form. After the +form is shown, you simply call ``form.ReadNonBlocking()`` every now and +then. + +When you are ready to close the form (assuming the form wasn't closed by +the user or a button click) you simply call +``form.CloseNonBlockingForm()`` + +**Example - Running timer that updates** See the sample code on the +GitHub named Demo Media Player for another example of Async Forms. We're +going to make a form and update one of the elements of that form every +.01 seconds. Here's the entire code to do that. + +:: + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + +What we have here is the same sequence of function calls as in the +description. Get a form, add rows to it, show the form, and then refresh +it every now and then. + +The new thing in this example is the call use of the Update method for +the Text Element. The first thing we do inside the loop is "update" the +text element that we made earlier. This changes the value of the text +field on the form. The new value will be displayed when +``form.ReadNonBlocking()`` is called. + +Note the ``else`` statement on the for loop. This is needed because +we're about to exit the loop while the form is still open. The user has +not closed the form using the X nor a button so it's up to the caller to +close the form using ``CloseNonBlockingForm``. + +That's it... this example follows the async design pattern well. + +Sample Applications +------------------- + +Use the example programs as a starting basis for your GUI. Copy, paste, +modify and run! The demo files are: + +``Demo Recipes.py`` - Sample forms for all major form types and +situations. This is the place to get your code template from. Includes +asynchronous forms, etc. + +``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls +to get a filename + +``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a +folder & Easy Progress Meter to show progress of the file scanning + +``Demo HowDoI.py`` - An amazing little application. Acts as a front-end +to HowDoI. This one program could forever change how you code. It does +searches on Stack Overflow and returns the CODE found in the best answer +for your query. If anyone wants to help me package this application up, +I could use a hand. + +Fun Stuff +--------- + +Here are some things to try if you're bored or want to further customize + +**Colors - Random and predefined** To set a button or text to a random +color, use the string ``'random'`` as the color value. You can also call +``PySimpleGUI.GetRandomColor``. To get a random color pair call +``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a +random color and that color's compliment. + +**Debug Output** Be sure and check out the EasyPrint (Print) function +described in the high-level API section. Leave your code the way it is, +route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + +:: + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in +a window on your screen rather than to the terminal. + +**Look and Feel** Dial in the look and feel that you like with the +``SetOptions`` function. You can change all of the defaults in one +function call. One line of code to customize the entire GUI. + +**ObjToString** Ever wanted to easily display an objects contents +easily? Use ObjToString to get a nicely formatted recursive walk of your +objects. This statement: + +:: + + print(sg.ObjToSting(x)) + +And this was the output + +:: + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +-------------- + +Known Issues +============ + +While not an "issue" this is a ***stern warning*** + +**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads +----------------------------------------------------------------------------------------------------------------------------------------- + +**Progress Meters** - the visual graphic portion of the meter may be +off. May return to the native tkinter progress meter solution in the +future. Right now a "custom" progress meter is used. On the bright side, +the statistics shown are extremely accurate and can tell you something +about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and +EasyPrint/Print). If you start overlapping having Async forms open with +normal forms then things get a littler squirrelly. Still tracking down +the issues and am making it more solid every day possible. You'll know +there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You +print and the output goes to a window, with a scroll bar, that you can +copy and paste from. Being a new feature, it's got some potential +problems. There are known interaction problems with other GUI windows. +For example, closing a Print window can also close other windows you +have open. For now, don't close your debug print window until other +windows are closed too. + +Contributing +------------ + +A MikeTheWatchGuy production... entirely responsible for this code.... +unless it causes you trouble in which case I'm not at all responsible. + +Versions +-------- + ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| Version | Description | ++===========+==================================================================================================================================================+ +| 1.0.9 | July 10, 2018 - Initial Release | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 1.0.21 | July 13, 2018 - Readme updates | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.2.0 | July 20, 2018 - Image Elements, Print output | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.5 | Aug XX, 2018 - window\_location default setting | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + +Release Notes +~~~~~~~~~~~~~ + +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another +window open. It could lead to future windows being blank. It's being +worked on. + +New debug printing capability. ``sg.Print`` + +2.5 Discovered issue with scroll bar on ``Output`` elements. The bar +will match size of ROW not the size of the element. Normally you never +notice this due to where on a form the ``Output`` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more +items. The mouse scrollwheel will also scroll the list and will +``page up`` and ``page down`` keys. + +Upcoming +~~~~~~~~ + +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface +are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a +backend other than tkinter. Qt, WxPython, etc. + +Code Condition +-------------- + +:: + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the +"Make it run" phase. It's far from "right" in many ways. These are being +worked on. The module is particularly poor for PEP 8 compliance. It was +a learning exercise that turned into a somewhat complete GUI solution +for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public +interfaces into the SDK are more strictly defined and comply with PEP 8 +for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the +code stronger and better in the end, a good thing for us all, right? + +Design +------ + +A moment about the design-spirit of ``PySimpleGUI``. From the beginning, +this package was meant to take advantage of Python's capabilities with +the goal of programming ease. + +**Single File** While not the best programming practice, the +implementation resulted in a single file solution. Only one file is +needed, PySimpleGUI.py. You can post this file, email it, and easily +import it using one statement. + +**Functions as objects** In Python, functions behave just like object. +When you're placing a Text Element into your form, you may be sometimes +calling a function and other times declaring an object. If you use the +word Text, then you're getting an object. If you're using ``Txt``, then +you're calling a function that returns a ``Text`` object. + +**Lists** It seemed quite natural to use Python's powerful list +constructs when possible. The form is specified as a series of lists. +Each "row" of the GUI is represented as a list of Elements. When the +form read returns the results to the user, all of the results are +presented as a single list. This makes reading a form's values +super-simple to do in a single line of Python code. + +Authors +------- + +MikeTheWatchGuy + +License +------- + +GNU Lesser General Public License (LGPL 3) + + +Acknowledgments +--------------- + +- Jorj McKie was the motivator behind the entire project. His + wxsimpleGUI concepts sparked PySimpleGUI into existence +- `Fredrik Lundh `__ for his + work on ``tkinter`` + +How Do I +-------- + +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi Their utility has forever changed the +way and pace in which I can program. I urge you to try the HowDoI.py +application here on GitHub. Trust me, **it's going to be worth the +effort!** Here are the steps to run that application + +:: + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through +stack overflow posts. It finds the best answer, gets the code from the +answer, and presents it as a response. It gives you the correct answer +OFTEN. It's a miracle that it work SO well. For Python questions, I +simply start my query with 'Python'. Let's say you forgot how to reverse +a list in Python. When you run HowDoI and ask this question, this is +what you'll see. |snap0109| + +In the hands of a competent programmer, this tool is **amazing**. It's a +must-try kind of program that has completely changed my programming +process. I'm not afraid of asking for help! You just have to be smart +about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field +which means you can copy and paste the results right into your code. + +.. |Downloads| image:: http://pepy.tech/badge/pysimplegui + :target: http://pepy.tech/project/pysimplegui +.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg +.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg +.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg +.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg From 46858be048dd5464c7523f8b57a7647a5788a75a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 2 Aug 2018 22:48:05 -0400 Subject: [PATCH 094/521] index.rst --- docs/index.rst | 1174 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1174 insertions(+) create mode 100644 docs/index.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..d7260a069 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,1174 @@ +.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png + :alt: pysimplegui\_logo + + pysimplegui\_logo +|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of +some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and +into the convenience of a GUI? Have a Raspberry Pi with a touchscreen +that's going to waste because you don't have the time to learn a GUI +SDK? Look no further, you've found your GUI package. + +:: + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + +.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg + :alt: snap0136 + + snap0136 +Build beautiful customized forms that fit your specific problem. Let +PySimpleGUI solve your GUI problem while you solve the real problems. Do +you really want to plod through the mountains of code required to +program tkinter? + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +Perhaps you're looking for a way to interact with your Raspberry Pi in a +more friendly way. The is the same form as above, except shown on a Pi. + +.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg + :alt: raspberry pi + + raspberry pi +In addition to a primary GUI, you can add a Progress Meter to your code +with ONE LINE of code. Slide this into any of your ``for`` loops and get +a nice meter like this: + +:: + + EasyProgressMeter('My meter title', current_value, max value) + +.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg + :alt: progress meter 2 + + progress meter 2 +You can build an async media player GUI with custom buttons in 30 lines +of code. + +.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg + :alt: media file player + + media file player +I was frustrated by having to deal with the dos prompt when I had a +powerful Windows machine right in front of me. Why is it SO difficult to +do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** +limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and +``WxSimpleGUI`` , both really handy but limited. The primary difference +between these and PySimpleGUI is that in addition to getting the simple +Message Boxes you also get the ability to make your own forms that are +highly customizeable. Don't like the standard Message Box? Then make +your own! + +Every call has optional parameters so that you can change the look and +feel. Don't like the button color? It's easy to change by adding a +button\_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require +configuring and can take a ***week*** to get *reasonably familiar* with +the interfaces. Clearly there needs to be a middle ground between forms +with 1 or two input fields and a full-blown GUI. You'll be making your +own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with +the python interpreter on Windows. Double click a py file and up pops a +GUI window, a more pleasant experience than opening a dos Window and +typing a command line. + +The ``PySimpleGUI`` package is focused on the ***developer***. How can +the desired result be achieved in as little and as simple code as +possible? This was the mantra used to create PySimpleGUI. How can it be +done is a Python-like way? + +:: + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + +An example of many widgets used on a single form. A little further down +you'll find the TWENTY lines of code required to create this complex +form. Try it if you don't believe it. Start Python, copy and paste the +code below into the >>> prompt and hit enter. This will pop up... + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Here is the code that produced the above screenshot. + +:: + + import PySimpleGUI as SG + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +**A note on screen shots** You will see a number of different styles of +buttons, data entry fields, etc, in this readme. They were all made with +the same SDK, the only difference is in the settings that are specified +on a per-element, row, form, or global basis. One setting in particular, +border\_width, can make a big difference on the look of the form. Some +of the screenshots had a border\_width of 6, others a value of 1. + +APIs +---- + +PySimpleGUI can be broken down into 2 types of API's: \* High Level +single call functions \* Custom form functions + +Python Language Features +~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a couple of Python language features that PySimpleGUI utilizes +heavily that should be understood first... \* Variable number of +arguments to a function call \* Optional parameters to a function call + +Variable Number of Arguments +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The "High Level" API calls that *output* values take a variable number +of arguments so that they match a "print" statement as much as possible. +The idea is to make it simple for the programmer to output as many items +as desired and in any format. The user need not convert the variables to +be output into the strings. The PySimpleGUI functions do that for the +user. + +:: + + SG.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + +.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg + :alt: snap0104 + + snap0104 +Optional Parameters to a Function Call +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This feature of the Python language is utilized ***heavily*** as a +method of customizing forms and form Elements. Rather than requiring the +programmer to specify every possible option for a widget, instead only +the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details +aren't important. What is important is seeing that there is a long list +of potential tweaks that a caller can make. However, they don't *have* +to be specified on each and every call. + +:: + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, +the call would look something like this: + +:: + + SG.MsgBox('This box has a custom button color', + button_color=('black', 'yellow')) + +.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg + :alt: snap0105 + + snap0105 + +-------------- + +High Level API Calls +~~~~~~~~~~~~~~~~~~~~ + +The classic "input a value, print result" example. Often command line +programs simply take some value as input on the command line, do +something with it and then display the results. Moving from the command +line to a GUI is very simple. This code prompts user to input a line of +text and then displays that text in a messages box: + +:: + + import PySimpleGUI_local as SG + + rc = SG.GetTextBox('Title', 'Please input something') + SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + +.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg + :alt: GetTextBox + + GetTextBox +.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg + :alt: MsgBox + + MsgBox +Message Boxes +^^^^^^^^^^^^^ + +In addition to MsgBox, you'll find a several API calls that are +shortcuts to common messages boxes. You can achieve similar results by +calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the +calls and the windows that are created. + +:: + + import PySimpleGUI as SG + +``SG.MsgBoxOK('This is an OK MsgBox')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg + :alt: msgboxok + + msgboxok +:: + + SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg + :alt: msgboxokcancel + + msgboxokcancel +:: + + SG.MsgBoxCancel('This is a Cancel MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg + :alt: msgboxcancel + + msgboxcancel +:: + + SG.MsgBoxYesNo('This is a Yes No MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg + :alt: msgboxyesno + + msgboxyesno +:: + + SG.MsgBoxError('This is an error MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg + :alt: msgbox error + + msgbox error +:: + + SG.MsgBoxAutoClose('This is an autoclose MsgBox') + +.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg + :alt: msgbox autoclose + + msgbox autoclose +:: + + SG.ScrolledTextBox(my_text, height=10) + +.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg + :alt: scrolledtextbox + + scrolledtextbox +Take a moment to look at that last one. It's such a simple API call and +yet the result is awesome. Rather than seeing text scrolling past on +your display, you can capture that text and present it in a scrolled +interface. It's handy enough of an API call that it can also be called +using the name ``sprint`` which is easier to remember than +``ScrollectTextBox``. Your code could contain a line like: + +:: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled +window. + +High Level User Input +^^^^^^^^^^^^^^^^^^^^^ + +There are 3 very basic user input high-level function calls. It's +expected that for most applications, a custom input form will be +created. If you need only 1 value, then perhaps one of these high level +functions will work. - GetTextBox - GetFileBox - GetFolderBox + +``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` + +.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg + :alt: gettextbox + + gettextbox +:: + + submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg + :alt: getfilebox + + getfilebox +:: + + submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') + +.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg + :alt: getfolderbox + + getfolderbox +Progress Meter! +^^^^^^^^^^^^^^^ + +We all have loops in our code. 'Isn't it joyful waiting, watching a +counter scrolling past in a text window? How about one line of code to +get a progress meter, that contains statistics about your code? + +.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg + :alt: progress meter 3 + + progress meter 3 +:: + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + +:: + + for i in range(1,10000): + SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg + :alt: progress meter 5 + + progress meter 5 +A meter AND fun statistics to watch while your machine grinds away, all +for the price of 1 line of code. With a little trickery you can provide +a way to break out of your loop using the Progress Meter form. The +cancel button results in a ``False`` return value from +``EasyProgressMeter``. It normally returns ``True``. + +:: + + if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): + break + +***Be sure and add one to your loop counter*** so that your counter goes +from 1 to the max value. If you do not add one, your counter will never +hit the max value. Instead it will go from 0 to max-1. #### Debug Output +Another call in the 'Easy' families of APIs is ``EasyPrint``. It will +output to a debug window. If the debug window isn't open, then the first +call will open it. No need to do anything but stick a 'print' call in +your code. You can even replace your 'print' calls with calls to +EasyPrint by simply sticking the statement + +:: + + print = SG.EasyPrint + +at the top of your code. There are a number of names for the same +EasyPrint function. ``Print`` is one of the better ones to use as it's +easy to remember. It is simply ``print`` with a capital P. + +:: + + import PySimpleGUI as SG + + for i in range(100): + SG.Print(i) + +|snap0125| Or if you didn't want to change your code: + +:: + + import PySimpleGUI as SG + + print=SG.Print + for i in range(100): + print(i) + +Just like the standard print call, ``EasyPrint`` supports the ``sep`` +and ``end`` keyword arguments. Other names that can be used to call +``EasyPrint`` include Print, ``eprint``, If you want to close the +window, call the function ``EasyPrintClose``. + +A word of caution. There are known problems when multiple PySimpleGUI +windows are opened, particularly if the user closes them in an unusual +way. Not a reason to stay away from using it. Just something to keep in +mind if you encounter a problem. + +You can change the size of the debug window using the ``SetOptions`` +call with the ``debug_win_size`` parameter. + +All Widgets / Elements +---------------------- + +This code utilizes as many of the elements in one form as possible. + +:: + + with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [SG.Text('Here is some text.... and a place to enter text')], + [SG.InputText()], + [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], + [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], + [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [SG.Text('_' * 100, size=(70, 1))], + [SG.Text('Choose Source and Destination Folders', size=(35, 1))], + [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], + [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), + SG.FolderBrowse()], + [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to +make things line up well. This is code you only have to write once. When +looking at the code, remember that what you're seeing is a list of +lists. Each row contains a list of Graphical Elements that are used to +create the form. + +.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg + :alt: everything example + + everything example +Clicking the Submit button caused the form call to return. The call to +MsgBox resulted in this dialog box. |results 2| + +**``Note, button value can be None``**. The value for ``button`` will be +the text that is displayed on the button element when it was created. If +the user closed the form using something other than a button, then +``button`` will be ``None``. + +You can see in the MsgBox that the values returned are a list. Each +input field in the form generates one item in the return values list. +All input fields return a ``string`` except for Check Boxes and Radio +Buttons. These return ``bool``. + +ProgressBar +^^^^^^^^^^^ + +The ``ProgressBar`` element is used to build custom Progress Bar forms. +It is HIGHLY recommended that you use the functions that provide a +complete progress meter solution for you. Progress Meters are not easy +to work with because the forms have to be non-blocking and they are +tricky to debug. + +The **easiest** way to get progress meters into your code is to use the +``EasyProgessMeter`` API. This consists of a pair of functions, +``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily +cancel any progress meter by calling it with the current value = max +value. This will mark the meter as expired and close the window. You've +already seen EasyProgressMeter calls presented earlier in this readme. + +:: + + SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for ``EasyProgressMeter`` is: ``True`` if meter updated +correctly ``False`` if user clicked the Cancel button, closed the form, +or vale reached the max value. **Customized Progress Bar** If you want a +bit more customization of your meter, then you can go up 1 level and use +the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs +behave like an object we're all used to. First you create the +``ProgressMeter`` object, then you call the ``Update`` method to update +it. + +You setup the progress meter by calling + +:: + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) + +Then to update the bar within your loop + +:: + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): + +Putting it all together you get this design pattern + +:: + + my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + +The final way of using a Progress Meter with PySimpleGUI is to build a +custom form with a ``ProgressBar`` Element in the form. You will need to +run your form as a non-blocking form. When you are ready to update your +progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` +element itself. + +Output +^^^^^^ + +The Output Element is a re-direction of Stdout. Anything "printed" will +be displayed in this element. + +:: + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an +Output Element + +:: + + import PySimpleGUI as SG + # Blocking form that doesn't close + def ChatBot(): + with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], + [SG.Output(size=(80, 20))], + [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + +Tabbed Forms +------------ + +Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has +the format + +:: + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken +to create the form as before. A ``FlexForm`` is created, then rows are +filled with Elements, and finally the form is shown. When calling +``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the +format: ``(the form, the rows, a string shown on the tab)`` + +Results are returned as a list of lists. For each form you'll get a list +that's in the same format as a normal form. A single tab's values would +be: + +:: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would +return like this: + +:: + + ((button1, (values1)), (button2, (values2)) + +## Colors ## Starting in version 2.5 you can change the background +colors for the window and the Elements. + +Your forms can go from this: |snap0155| + +to this... with one function call... + +.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg + :alt: snap0156 + + snap0156 +While you can do it on an element by element or form level basis, the +easiest way, by far, is a call to ``SetOptions``. + +Be aware that once you change these options they are changed for the +rest of your program's execution. All of your forms will have that look +and feel, until you change it to something else (which could be the +system default colors. + +This call sets all of the different color options. + +:: + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + +Global Settings +--------------- + +**Global Settings** Let's have some fun customizing! Make PySimpleGUI +look the way you want it to look. You can set the global settings using +the function ``PySimpleGUI.SetOptions``. Each option has an optional +parameter that's used to set it. + +:: + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + +:: + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + +These settings apply to all forms ``SetOptions``. The Row options and +Element options will take precedence over these settings. Settings can +be thought of as levels of settings with the Form-level being the +highest and the Element-level the lowest. Thus the levels are: + +- Form level +- Row level +- Element level + +Each lower level overrides the settings of the higher level. Once +settings have been changed, they remain changed for the duration of the +program (unless changed again). + +Asynchronous (Non-Blocking) Forms +--------------------------------- + +So you want to be a wizard do ya? Well go boldly! While the majority of +GUIs are a simple exercise to "collect input values and return with +them", there are instances where we want to continue executing while the +form is open. These are "asynchronous" forms and require special +options, new SDK calls, and **great care**. With asynchronous forms the +form is shown, user input is read, but your code keeps right on +chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` +on a periodic basis. Once a second or more will produce a reasonably +snappy GUI. + +When do you use a non-blocking form? A couple of examples are \* A media +file player like an MP3 player \* A status dashboard that's periodically +updated \* Progress Meters - when you want to make your own progress +meters \* Output using print to a scrolled text element. Good for +debugging. + +Word of warning... version 2.2, the currently released, and upcoming +version 2.3 differ in the return code for the ``ReadNonBlocking`` call. +Previously the function returned 2 values, except when the form is +closed using the "X" which returned a single value of ``None``. The +*new* way is that ``ReadNonBlocking`` always returns 2 values. If the +user closed the form with the "X" then the return values will be None, +None. You will want to key off the second value to catch this case. The +proper code to check if the user has exited the form will be a +polling-loop that looks something like this: + +:: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update +our form with a running clock. + +The basic flow and functions you will be calling are: Setup + +:: + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + +Periodic refresh + +:: + + form.ReadNonBlocking() + +If you need to close the form + +:: + + form.CloseNonBlockingForm() + +Rather than the usual ``form.LayoutAndRead()`` call, we're manually +adding the rows (doing the layout) and then showing the form. After the +form is shown, you simply call ``form.ReadNonBlocking()`` every now and +then. + +When you are ready to close the form (assuming the form wasn't closed by +the user or a button click) you simply call +``form.CloseNonBlockingForm()`` + +**Example - Running timer that updates** See the sample code on the +GitHub named Demo Media Player for another example of Async Forms. We're +going to make a form and update one of the elements of that form every +.01 seconds. Here's the entire code to do that. + +:: + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + +What we have here is the same sequence of function calls as in the +description. Get a form, add rows to it, show the form, and then refresh +it every now and then. + +The new thing in this example is the call use of the Update method for +the Text Element. The first thing we do inside the loop is "update" the +text element that we made earlier. This changes the value of the text +field on the form. The new value will be displayed when +``form.ReadNonBlocking()`` is called. + +Note the ``else`` statement on the for loop. This is needed because +we're about to exit the loop while the form is still open. The user has +not closed the form using the X nor a button so it's up to the caller to +close the form using ``CloseNonBlockingForm``. + +That's it... this example follows the async design pattern well. + +Sample Applications +------------------- + +Use the example programs as a starting basis for your GUI. Copy, paste, +modify and run! The demo files are: + +``Demo Recipes.py`` - Sample forms for all major form types and +situations. This is the place to get your code template from. Includes +asynchronous forms, etc. + +``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls +to get a filename + +``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a +folder & Easy Progress Meter to show progress of the file scanning + +``Demo HowDoI.py`` - An amazing little application. Acts as a front-end +to HowDoI. This one program could forever change how you code. It does +searches on Stack Overflow and returns the CODE found in the best answer +for your query. If anyone wants to help me package this application up, +I could use a hand. + +Fun Stuff +--------- + +Here are some things to try if you're bored or want to further customize + +**Colors - Random and predefined** To set a button or text to a random +color, use the string ``'random'`` as the color value. You can also call +``PySimpleGUI.GetRandomColor``. To get a random color pair call +``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a +random color and that color's compliment. + +**Debug Output** Be sure and check out the EasyPrint (Print) function +described in the high-level API section. Leave your code the way it is, +route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + +:: + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in +a window on your screen rather than to the terminal. + +**Look and Feel** Dial in the look and feel that you like with the +``SetOptions`` function. You can change all of the defaults in one +function call. One line of code to customize the entire GUI. + +**ObjToString** Ever wanted to easily display an objects contents +easily? Use ObjToString to get a nicely formatted recursive walk of your +objects. This statement: + +:: + + print(sg.ObjToSting(x)) + +And this was the output + +:: + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +-------------- + +Known Issues +============ + +While not an "issue" this is a ***stern warning*** + +**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads +----------------------------------------------------------------------------------------------------------------------------------------- + +**Progress Meters** - the visual graphic portion of the meter may be +off. May return to the native tkinter progress meter solution in the +future. Right now a "custom" progress meter is used. On the bright side, +the statistics shown are extremely accurate and can tell you something +about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and +EasyPrint/Print). If you start overlapping having Async forms open with +normal forms then things get a littler squirrelly. Still tracking down +the issues and am making it more solid every day possible. You'll know +there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You +print and the output goes to a window, with a scroll bar, that you can +copy and paste from. Being a new feature, it's got some potential +problems. There are known interaction problems with other GUI windows. +For example, closing a Print window can also close other windows you +have open. For now, don't close your debug print window until other +windows are closed too. + +Contributing +------------ + +A MikeTheWatchGuy production... entirely responsible for this code.... +unless it causes you trouble in which case I'm not at all responsible. + +Versions +-------- + ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| Version | Description | ++===========+==================================================================================================================================================+ +| 1.0.9 | July 10, 2018 - Initial Release | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 1.0.21 | July 13, 2018 - Readme updates | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.2.0 | July 20, 2018 - Image Elements, Print output | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2.6.5 | Aug XX, 2018 - window\_location default setting | ++-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + +Release Notes +~~~~~~~~~~~~~ + +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another +window open. It could lead to future windows being blank. It's being +worked on. + +New debug printing capability. ``sg.Print`` + +2.5 Discovered issue with scroll bar on ``Output`` elements. The bar +will match size of ROW not the size of the element. Normally you never +notice this due to where on a form the ``Output`` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more +items. The mouse scrollwheel will also scroll the list and will +``page up`` and ``page down`` keys. + +Upcoming +~~~~~~~~ + +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface +are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a +backend other than tkinter. Qt, WxPython, etc. + +Code Condition +-------------- + +:: + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the +"Make it run" phase. It's far from "right" in many ways. These are being +worked on. The module is particularly poor for PEP 8 compliance. It was +a learning exercise that turned into a somewhat complete GUI solution +for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public +interfaces into the SDK are more strictly defined and comply with PEP 8 +for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the +code stronger and better in the end, a good thing for us all, right? + +Design +------ + +A moment about the design-spirit of ``PySimpleGUI``. From the beginning, +this package was meant to take advantage of Python's capabilities with +the goal of programming ease. + +**Single File** While not the best programming practice, the +implementation resulted in a single file solution. Only one file is +needed, PySimpleGUI.py. You can post this file, email it, and easily +import it using one statement. + +**Functions as objects** In Python, functions behave just like object. +When you're placing a Text Element into your form, you may be sometimes +calling a function and other times declaring an object. If you use the +word Text, then you're getting an object. If you're using ``Txt``, then +you're calling a function that returns a ``Text`` object. + +**Lists** It seemed quite natural to use Python's powerful list +constructs when possible. The form is specified as a series of lists. +Each "row" of the GUI is represented as a list of Elements. When the +form read returns the results to the user, all of the results are +presented as a single list. This makes reading a form's values +super-simple to do in a single line of Python code. + +Authors +------- + +MikeTheWatchGuy + +License +------- + +GNU Lesser General Public License (LGPL 3) + + +Acknowledgments +--------------- + +- Jorj McKie was the motivator behind the entire project. His + wxsimpleGUI concepts sparked PySimpleGUI into existence +- `Fredrik Lundh `__ for his + work on ``tkinter`` + +How Do I +-------- + +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi Their utility has forever changed the +way and pace in which I can program. I urge you to try the HowDoI.py +application here on GitHub. Trust me, **it's going to be worth the +effort!** Here are the steps to run that application + +:: + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through +stack overflow posts. It finds the best answer, gets the code from the +answer, and presents it as a response. It gives you the correct answer +OFTEN. It's a miracle that it work SO well. For Python questions, I +simply start my query with 'Python'. Let's say you forgot how to reverse +a list in Python. When you run HowDoI and ask this question, this is +what you'll see. |snap0109| + +In the hands of a competent programmer, this tool is **amazing**. It's a +must-try kind of program that has completely changed my programming +process. I'm not afraid of asking for help! You just have to be smart +about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field +which means you can copy and paste the results right into your code. + +.. |Downloads| image:: http://pepy.tech/badge/pysimplegui + :target: http://pepy.tech/project/pysimplegui +.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg +.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg +.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg +.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg From 1b19c4e546d688f7bb72b68c448c8a60f52b98d9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 12:35:46 -0400 Subject: [PATCH 095/521] Removed format literal string --- Demo_DuplicateFileFinder.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Demo_DuplicateFileFinder.py b/Demo_DuplicateFileFinder.py index 40cef6996..958e5f8f4 100644 --- a/Demo_DuplicateFileFinder.py +++ b/Demo_DuplicateFileFinder.py @@ -36,8 +36,7 @@ def FindDuplicatesFilesInFolder(path): continue shatab.append(f_sha) - msg = f'{total} Files processed\n'\ - f'{dup_count} Duplicates found\n' + msg = '{} Files processed\n {} Duplicates found'.format(total_files, dup_count) sg.MsgBox('Duplicate Finder Ended', msg) # ====____====____==== Pseudo-MAIN program ====____====____==== # From 71a60dd80978d5531f663fb2af2ed8da16cbf2af Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 16:45:51 -0400 Subject: [PATCH 096/521] Removed f-string --- Demo_Tabbed_Form.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index 4305a003d..00ac6fd58 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -1,7 +1,5 @@ import PySimpleGUI as sg -MAX_NUMBER_OF_THREADS = 12 - def eBaySuperSearcherGUI(): # Drop Down list of options configs = ('0 - Gruen - Started 2 days ago in Watches', @@ -55,7 +53,7 @@ def eBaySuperSearcherGUI(): [sg.Text('_'*100, size=(80,1))], [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], [sg.Text('_'*100, size=(80,1))], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue')), sg.Text(f'{MAX_NUMBER_OF_THREADS} Threads will be started')]] + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] # First category is default (need to special case this) From 089c6124b8c52ce8b8a082a2bcd118f2ac492275 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 18:40:54 -0400 Subject: [PATCH 097/521] Updated screenshots Fresh screenshots so that the flatter buttons are in the readme. Changed all SG. to sg. --- readme.md | 280 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 144 insertions(+), 136 deletions(-) diff --git a/readme.md b/readme.md index 9b29f3d3d..f03d65375 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,5 @@ + ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 @@ -31,7 +32,7 @@ In addition to a primary GUI, you can add a Progress Meter to your code with ONE EasyProgressMeter('My meter title', current_value, max value) -![progress meter 2](https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg) + ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) You can build an async media player GUI with custom buttons in 30 lines of code. @@ -83,29 +84,29 @@ An example of many widgets used on a single form. A little further down you'll Here is the code that produced the above screenshot. - import PySimpleGUI as SG + import PySimpleGUI as sg - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] ] button, values = form.LayoutAndRead(layout) @@ -145,17 +146,19 @@ Simply download the file - PySimpleGUI.py and import it into your code Python 3 tkinter -Should run on all Python platforms that have tkinter running on them. Has been thoroughly tested on Windows. While not tested elsewhere, should work on Linux, Mac, Pi, etc. +Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### Using To use in your code, simply import.... - `import PySimpleGUI as SG` + `import PySimpleGUI as sg` Then use either "high level" API calls or build your own forms. - SG.MsgBox('This is my first message box') -![snap0103](https://user-images.githubusercontent.com/13696193/42844641-a04bb798-89e1-11e8-8a37-50ddd9905772.jpg) + sg.MsgBox('This is my first message box') + +![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) + Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. @@ -177,11 +180,12 @@ PySimpleGUI can be broken down into 2 types of API's: The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") + sg.MsgBox('Variable number of parameters example', var1, var2, "etc") Each new item begins on a new line in the Message Box - ![snap0104](https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg) + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + #### Optional Parameters to a Function Call @@ -201,11 +205,10 @@ Here is the function definition for the MsgBox function. The details aren't impo If the caller wanted to change the button color to be black on yellow, the call would look something like this: - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) + sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) -![snap0105](https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg) +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) --- @@ -216,53 +219,64 @@ The classic "input a value, print result" example. Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. This code prompts user to input a line of text and then displays that text in a messages box: - import PySimpleGUI_local as SG - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) + import PySimpleGUI as sg + + rc = sg.GetTextBox('Title', 'Please input something') + sg.MsgBox('Results', 'The value returned from GetTextBox', rc) + + + ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) -![GetTextBox](https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg) +![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) -![MsgBox](https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg) #### Message Boxes In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - import PySimpleGUI as SG + import PySimpleGUI as sg + + `sg.MsgBoxOK('This is an OK MsgBox')` + + ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + - `SG.MsgBoxOK('This is an OK MsgBox')` + sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') - ![msgboxok](https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg) +![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') + sg.MsgBoxCancel('This is a Cancel MsgBox') -![msgboxokcancel](https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg) +![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) - SG.MsgBoxCancel('This is a Cancel MsgBox') -![msgboxcancel](https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg) + sg.MsgBoxYesNo('This is a Yes No MsgBox') - SG.MsgBoxYesNo('This is a Yes No MsgBox') -![msgboxyesno](https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg) +![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) - SG.MsgBoxError('This is an error MsgBox') -![msgbox error](https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg) - SG.MsgBoxAutoClose('This is an autoclose MsgBox') + sg.MsgBoxError('This is an error MsgBox') -![msgbox autoclose](https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg) +![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) - SG.ScrolledTextBox(my_text, height=10) + sg.MsgBoxAutoClose('This is an autoclose MsgBox') -![scrolledtextbox](https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg) +![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + sg.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: sprint(f'My variables values include x={x}', f'y={y}') This becomes a debug print of sorts that will route to a scrolled window. +See also the `EasyPrint` and `Print` functions. + #### High Level User Input There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. @@ -270,23 +284,22 @@ There are 3 very basic user input high-level function calls. It's expected that - GetFileBox - GetFolderBox - `submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')` + `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` -![gettextbox](https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg) +![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') + submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') -![getfilebox](https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg) +![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') + submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') + +![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) -![getfolderbox](https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg) #### Progress Meter! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? -![progress meter 3](https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg) - EasyProgressMeter(title, current_value, @@ -302,38 +315,36 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') That line of code resulted in this window popping up and updating. -![progress meter 5](https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg) +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + #### Debug Output Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - print = SG.EasyPrint + print = sg.EasyPrint at the top of your code. There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - import PySimpleGUI as SG + import PySimpleGUI as sg for i in range(100): - SG.Print(i) + sg.Print(i) ![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) Or if you didn't want to change your code: - import PySimpleGUI as SG + import PySimpleGUI as sg - print=SG.Print + print=sg.Print for i in range(100): print(i) @@ -450,16 +461,16 @@ Turning back to our example. This GUI roughly looks like this: Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: This creates a new form, storing it in the variable `form`. - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - [SG.InputText(), SG.FileBrowse()], + [sg.InputText(), sg.FileBrowse()], Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - [SG.Submit(), SG.Cancel()]] + [sg.Submit(), sg.Cancel()]] The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. @@ -498,27 +509,27 @@ If you have a SINGLE value being returned, it is written this way: ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] ] button, values = form.LayoutAndRead(layout) @@ -647,7 +658,7 @@ Building a form is simply making lists of Elements. Each list is a row in the o The code is a crude representation of the GUI, laid out in text. #### Text Element - layout = [[SG.Text('This is what a Text Element looks like')]] + layout = [[sg.Text('This is what a Text Element looks like')]] ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) @@ -698,7 +709,7 @@ The shorthand functions for `Text` are `Txt` and `T` #### Multiline Text Element - layout = [[SG.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] ![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. @@ -734,7 +745,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. #### Text Input Element - layout = [[SG.InputText('Default text')]] + layout = [[sg.InputText('Default text')]] ![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) def InputText(default_text = '', @@ -756,7 +767,7 @@ Shorthand functions that are equivalent to `InputText` are `Input` and `In` #### Combo Element Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - layout = [[SG.InputCombo(['choice 1', 'choice 2'])]] + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] ![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) @@ -774,7 +785,7 @@ Also known as a drop-down list. Only required parameter is the list of choices. #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - layout = [[SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] ![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) @@ -809,7 +820,7 @@ The `select_mode` option can be a string or a constant value defined as a variab #### Slider Element Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - layout = [[SG.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] ![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) @@ -841,7 +852,7 @@ Sliders have a couple of slider-specific settings as well as appearance settings #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - layout = [[SG.Radio('My first Radio!', "RADIO1", default=True), SG.Radio('My second radio!', "RADIO1")]] + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] ![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) @@ -867,7 +878,7 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o #### Checkbox Element Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - layout = [[SG.Checkbox('My first Checkbox!', default=True), SG.Checkbox('My second Checkbox!')]] + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] ![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) @@ -891,7 +902,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating #### Spin Element An up/down spinner control. The valid values are passed in as a list. - layout = [[SG.Spin([i for i in range(1,11)], initial_value=1), SG.Text('Volume level')]] + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] ![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) @@ -951,7 +962,7 @@ Pre-made buttons include: FileBrowse FolderBrowse . - layout = [[SG.OK(), SG.Cancel()]] + layout = [[sg.OK(), sg.Cancel()]] ![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) @@ -969,14 +980,14 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (-1,0) The code for the entire form could be: - layout = [[SG.T('Source Folder')], - [SG.In()], - [SG.FolderBrowse(Target=(-1,0)), SG.OK()]] + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] **Custom Buttons** Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. -layout = [[SG.SimpleButton('My Button')]] +layout = [[sg.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) @@ -1052,20 +1063,19 @@ The `FileBrowse` button has an additional setting named `file_types`. This vari This code produces a form where the Browse button only shows files of type .TXT - layout = [[SG.In() ,SG.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - ---- + --- #### ProgressBar The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen EasyProgressMeter calls presented earlier in this readme. - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') The return value for `EasyProgressMeter` is: `True` if meter updated correctly @@ -1091,10 +1101,10 @@ Then to update the bar within your loop *args): Putting it all together you get this design pattern - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') + my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. @@ -1108,13 +1118,13 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Here's a complete solution for a chat-window using an Async form with an Output Element - import PySimpleGUI as SG + import PySimpleGUI as sg # Blocking form that doesn't close def ChatBot(): - with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], - [SG.Output(size=(80, 20))], - [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form # if you call LayoutAndRead from here, then you will miss the first button click form.Layout(layout) @@ -1178,14 +1188,14 @@ This call sets all of the different color options. Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None slider_border_width=None slider_relief=None slider_orientation=None @@ -1268,9 +1278,9 @@ The basic flow and functions you will be calling are: Setup - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) Periodic refresh @@ -1344,10 +1354,6 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify ## Fun Stuff Here are some things to try if you're bored or want to further customize -**Colors - Random and predefined** -To set a button or text to a random color, use the string `'random'` as the color value. You can also call `PySimpleGUI.GetRandomColor`. -To get a random color pair call `PySimpleGUI.GetRandomColorPair`. This returns a tuple containing a random color and that color's compliment. - **Debug Output** Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. @@ -1411,7 +1417,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.6.5 | Aug XX, 2018 - window_location default setting +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -1424,6 +1431,9 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. +2.7 Is the "feature complete" release. Pretty much all features are done and in the code + + ### Upcoming Make suggestions people! Future release features @@ -1493,6 +1503,4 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. - - +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From a8b8e146a018c5e4b4394d8dc3ab9842003e87fe Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 18:56:30 -0400 Subject: [PATCH 098/521] Removeed rst docs from docs folder --- docs/README.rst | 1174 ------------------------------------ docs/index.rst | 1174 ------------------------------------ docs/readme.md | 1506 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1506 insertions(+), 2348 deletions(-) delete mode 100644 docs/README.rst delete mode 100644 docs/index.rst create mode 100644 docs/readme.md diff --git a/docs/README.rst b/docs/README.rst deleted file mode 100644 index d7260a069..000000000 --- a/docs/README.rst +++ /dev/null @@ -1,1174 +0,0 @@ -.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png - :alt: pysimplegui\_logo - - pysimplegui\_logo -|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of -some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and -into the convenience of a GUI? Have a Raspberry Pi with a touchscreen -that's going to waste because you don't have the time to learn a GUI -SDK? Look no further, you've found your GUI package. - -:: - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - -.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg - :alt: snap0136 - - snap0136 -Build beautiful customized forms that fit your specific problem. Let -PySimpleGUI solve your GUI problem while you solve the real problems. Do -you really want to plod through the mountains of code required to -program tkinter? - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -Perhaps you're looking for a way to interact with your Raspberry Pi in a -more friendly way. The is the same form as above, except shown on a Pi. - -.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg - :alt: raspberry pi - - raspberry pi -In addition to a primary GUI, you can add a Progress Meter to your code -with ONE LINE of code. Slide this into any of your ``for`` loops and get -a nice meter like this: - -:: - - EasyProgressMeter('My meter title', current_value, max value) - -.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg - :alt: progress meter 2 - - progress meter 2 -You can build an async media player GUI with custom buttons in 30 lines -of code. - -.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg - :alt: media file player - - media file player -I was frustrated by having to deal with the dos prompt when I had a -powerful Windows machine right in front of me. Why is it SO difficult to -do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** -limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and -``WxSimpleGUI`` , both really handy but limited. The primary difference -between these and PySimpleGUI is that in addition to getting the simple -Message Boxes you also get the ability to make your own forms that are -highly customizeable. Don't like the standard Message Box? Then make -your own! - -Every call has optional parameters so that you can change the look and -feel. Don't like the button color? It's easy to change by adding a -button\_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require -configuring and can take a ***week*** to get *reasonably familiar* with -the interfaces. Clearly there needs to be a middle ground between forms -with 1 or two input fields and a full-blown GUI. You'll be making your -own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with -the python interpreter on Windows. Double click a py file and up pops a -GUI window, a more pleasant experience than opening a dos Window and -typing a command line. - -The ``PySimpleGUI`` package is focused on the ***developer***. How can -the desired result be achieved in as little and as simple code as -possible? This was the mantra used to create PySimpleGUI. How can it be -done is a Python-like way? - -:: - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - -An example of many widgets used on a single form. A little further down -you'll find the TWENTY lines of code required to create this complex -form. Try it if you don't believe it. Start Python, copy and paste the -code below into the >>> prompt and hit enter. This will pop up... - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Here is the code that produced the above screenshot. - -:: - - import PySimpleGUI as SG - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -**A note on screen shots** You will see a number of different styles of -buttons, data entry fields, etc, in this readme. They were all made with -the same SDK, the only difference is in the settings that are specified -on a per-element, row, form, or global basis. One setting in particular, -border\_width, can make a big difference on the look of the form. Some -of the screenshots had a border\_width of 6, others a value of 1. - -APIs ----- - -PySimpleGUI can be broken down into 2 types of API's: \* High Level -single call functions \* Custom form functions - -Python Language Features -~~~~~~~~~~~~~~~~~~~~~~~~ - -There are a couple of Python language features that PySimpleGUI utilizes -heavily that should be understood first... \* Variable number of -arguments to a function call \* Optional parameters to a function call - -Variable Number of Arguments -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The "High Level" API calls that *output* values take a variable number -of arguments so that they match a "print" statement as much as possible. -The idea is to make it simple for the programmer to output as many items -as desired and in any format. The user need not convert the variables to -be output into the strings. The PySimpleGUI functions do that for the -user. - -:: - - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - -.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg - :alt: snap0104 - - snap0104 -Optional Parameters to a Function Call -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This feature of the Python language is utilized ***heavily*** as a -method of customizing forms and form Elements. Rather than requiring the -programmer to specify every possible option for a widget, instead only -the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details -aren't important. What is important is seeing that there is a long list -of potential tweaks that a caller can make. However, they don't *have* -to be specified on each and every call. - -:: - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, -the call would look something like this: - -:: - - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) - -.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg - :alt: snap0105 - - snap0105 - --------------- - -High Level API Calls -~~~~~~~~~~~~~~~~~~~~ - -The classic "input a value, print result" example. Often command line -programs simply take some value as input on the command line, do -something with it and then display the results. Moving from the command -line to a GUI is very simple. This code prompts user to input a line of -text and then displays that text in a messages box: - -:: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg - :alt: GetTextBox - - GetTextBox -.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg - :alt: MsgBox - - MsgBox -Message Boxes -^^^^^^^^^^^^^ - -In addition to MsgBox, you'll find a several API calls that are -shortcuts to common messages boxes. You can achieve similar results by -calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the -calls and the windows that are created. - -:: - - import PySimpleGUI as SG - -``SG.MsgBoxOK('This is an OK MsgBox')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg - :alt: msgboxok - - msgboxok -:: - - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg - :alt: msgboxokcancel - - msgboxokcancel -:: - - SG.MsgBoxCancel('This is a Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg - :alt: msgboxcancel - - msgboxcancel -:: - - SG.MsgBoxYesNo('This is a Yes No MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg - :alt: msgboxyesno - - msgboxyesno -:: - - SG.MsgBoxError('This is an error MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg - :alt: msgbox error - - msgbox error -:: - - SG.MsgBoxAutoClose('This is an autoclose MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg - :alt: msgbox autoclose - - msgbox autoclose -:: - - SG.ScrolledTextBox(my_text, height=10) - -.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg - :alt: scrolledtextbox - - scrolledtextbox -Take a moment to look at that last one. It's such a simple API call and -yet the result is awesome. Rather than seeing text scrolling past on -your display, you can capture that text and present it in a scrolled -interface. It's handy enough of an API call that it can also be called -using the name ``sprint`` which is easier to remember than -``ScrollectTextBox``. Your code could contain a line like: - -:: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled -window. - -High Level User Input -^^^^^^^^^^^^^^^^^^^^^ - -There are 3 very basic user input high-level function calls. It's -expected that for most applications, a custom input form will be -created. If you need only 1 value, then perhaps one of these high level -functions will work. - GetTextBox - GetFileBox - GetFolderBox - -``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg - :alt: gettextbox - - gettextbox -:: - - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg - :alt: getfilebox - - getfilebox -:: - - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg - :alt: getfolderbox - - getfolderbox -Progress Meter! -^^^^^^^^^^^^^^^ - -We all have loops in our code. 'Isn't it joyful waiting, watching a -counter scrolling past in a text window? How about one line of code to -get a progress meter, that contains statistics about your code? - -.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg - :alt: progress meter 3 - - progress meter 3 -:: - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - -:: - - for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg - :alt: progress meter 5 - - progress meter 5 -A meter AND fun statistics to watch while your machine grinds away, all -for the price of 1 line of code. With a little trickery you can provide -a way to break out of your loop using the Progress Meter form. The -cancel button results in a ``False`` return value from -``EasyProgressMeter``. It normally returns ``True``. - -:: - - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - -***Be sure and add one to your loop counter*** so that your counter goes -from 1 to the max value. If you do not add one, your counter will never -hit the max value. Instead it will go from 0 to max-1. #### Debug Output -Another call in the 'Easy' families of APIs is ``EasyPrint``. It will -output to a debug window. If the debug window isn't open, then the first -call will open it. No need to do anything but stick a 'print' call in -your code. You can even replace your 'print' calls with calls to -EasyPrint by simply sticking the statement - -:: - - print = SG.EasyPrint - -at the top of your code. There are a number of names for the same -EasyPrint function. ``Print`` is one of the better ones to use as it's -easy to remember. It is simply ``print`` with a capital P. - -:: - - import PySimpleGUI as SG - - for i in range(100): - SG.Print(i) - -|snap0125| Or if you didn't want to change your code: - -:: - - import PySimpleGUI as SG - - print=SG.Print - for i in range(100): - print(i) - -Just like the standard print call, ``EasyPrint`` supports the ``sep`` -and ``end`` keyword arguments. Other names that can be used to call -``EasyPrint`` include Print, ``eprint``, If you want to close the -window, call the function ``EasyPrintClose``. - -A word of caution. There are known problems when multiple PySimpleGUI -windows are opened, particularly if the user closes them in an unusual -way. Not a reason to stay away from using it. Just something to keep in -mind if you encounter a problem. - -You can change the size of the debug window using the ``SetOptions`` -call with the ``debug_win_size`` parameter. - -All Widgets / Elements ----------------------- - -This code utilizes as many of the elements in one form as possible. - -:: - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to -make things line up well. This is code you only have to write once. When -looking at the code, remember that what you're seeing is a list of -lists. Each row contains a list of Graphical Elements that are used to -create the form. - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Clicking the Submit button caused the form call to return. The call to -MsgBox resulted in this dialog box. |results 2| - -**``Note, button value can be None``**. The value for ``button`` will be -the text that is displayed on the button element when it was created. If -the user closed the form using something other than a button, then -``button`` will be ``None``. - -You can see in the MsgBox that the values returned are a list. Each -input field in the form generates one item in the return values list. -All input fields return a ``string`` except for Check Boxes and Radio -Buttons. These return ``bool``. - -ProgressBar -^^^^^^^^^^^ - -The ``ProgressBar`` element is used to build custom Progress Bar forms. -It is HIGHLY recommended that you use the functions that provide a -complete progress meter solution for you. Progress Meters are not easy -to work with because the forms have to be non-blocking and they are -tricky to debug. - -The **easiest** way to get progress meters into your code is to use the -``EasyProgessMeter`` API. This consists of a pair of functions, -``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily -cancel any progress meter by calling it with the current value = max -value. This will mark the meter as expired and close the window. You've -already seen EasyProgressMeter calls presented earlier in this readme. - -:: - - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for ``EasyProgressMeter`` is: ``True`` if meter updated -correctly ``False`` if user clicked the Cancel button, closed the form, -or vale reached the max value. **Customized Progress Bar** If you want a -bit more customization of your meter, then you can go up 1 level and use -the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs -behave like an object we're all used to. First you create the -``ProgressMeter`` object, then you call the ``Update`` method to update -it. - -You setup the progress meter by calling - -:: - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) - -Then to update the bar within your loop - -:: - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): - -Putting it all together you get this design pattern - -:: - - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - -The final way of using a Progress Meter with PySimpleGUI is to build a -custom form with a ``ProgressBar`` Element in the form. You will need to -run your form as a non-blocking form. When you are ready to update your -progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` -element itself. - -Output -^^^^^^ - -The Output Element is a re-direction of Stdout. Anything "printed" will -be displayed in this element. - -:: - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an -Output Element - -:: - - import PySimpleGUI as SG - # Blocking form that doesn't close - def ChatBot(): - with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], - [SG.Output(size=(80, 20))], - [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - -Tabbed Forms ------------- - -Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has -the format - -:: - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken -to create the form as before. A ``FlexForm`` is created, then rows are -filled with Elements, and finally the form is shown. When calling -``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the -format: ``(the form, the rows, a string shown on the tab)`` - -Results are returned as a list of lists. For each form you'll get a list -that's in the same format as a normal form. A single tab's values would -be: - -:: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would -return like this: - -:: - - ((button1, (values1)), (button2, (values2)) - -## Colors ## Starting in version 2.5 you can change the background -colors for the window and the Elements. - -Your forms can go from this: |snap0155| - -to this... with one function call... - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -While you can do it on an element by element or form level basis, the -easiest way, by far, is a call to ``SetOptions``. - -Be aware that once you change these options they are changed for the -rest of your program's execution. All of your forms will have that look -and feel, until you change it to something else (which could be the -system default colors. - -This call sets all of the different color options. - -:: - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - -Global Settings ---------------- - -**Global Settings** Let's have some fun customizing! Make PySimpleGUI -look the way you want it to look. You can set the global settings using -the function ``PySimpleGUI.SetOptions``. Each option has an optional -parameter that's used to set it. - -:: - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - -:: - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - -These settings apply to all forms ``SetOptions``. The Row options and -Element options will take precedence over these settings. Settings can -be thought of as levels of settings with the Form-level being the -highest and the Element-level the lowest. Thus the levels are: - -- Form level -- Row level -- Element level - -Each lower level overrides the settings of the higher level. Once -settings have been changed, they remain changed for the duration of the -program (unless changed again). - -Asynchronous (Non-Blocking) Forms ---------------------------------- - -So you want to be a wizard do ya? Well go boldly! While the majority of -GUIs are a simple exercise to "collect input values and return with -them", there are instances where we want to continue executing while the -form is open. These are "asynchronous" forms and require special -options, new SDK calls, and **great care**. With asynchronous forms the -form is shown, user input is read, but your code keeps right on -chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` -on a periodic basis. Once a second or more will produce a reasonably -snappy GUI. - -When do you use a non-blocking form? A couple of examples are \* A media -file player like an MP3 player \* A status dashboard that's periodically -updated \* Progress Meters - when you want to make your own progress -meters \* Output using print to a scrolled text element. Good for -debugging. - -Word of warning... version 2.2, the currently released, and upcoming -version 2.3 differ in the return code for the ``ReadNonBlocking`` call. -Previously the function returned 2 values, except when the form is -closed using the "X" which returned a single value of ``None``. The -*new* way is that ``ReadNonBlocking`` always returns 2 values. If the -user closed the form with the "X" then the return values will be None, -None. You will want to key off the second value to catch this case. The -proper code to check if the user has exited the form will be a -polling-loop that looks something like this: - -:: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update -our form with a running clock. - -The basic flow and functions you will be calling are: Setup - -:: - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - -Periodic refresh - -:: - - form.ReadNonBlocking() - -If you need to close the form - -:: - - form.CloseNonBlockingForm() - -Rather than the usual ``form.LayoutAndRead()`` call, we're manually -adding the rows (doing the layout) and then showing the form. After the -form is shown, you simply call ``form.ReadNonBlocking()`` every now and -then. - -When you are ready to close the form (assuming the form wasn't closed by -the user or a button click) you simply call -``form.CloseNonBlockingForm()`` - -**Example - Running timer that updates** See the sample code on the -GitHub named Demo Media Player for another example of Async Forms. We're -going to make a form and update one of the elements of that form every -.01 seconds. Here's the entire code to do that. - -:: - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - -What we have here is the same sequence of function calls as in the -description. Get a form, add rows to it, show the form, and then refresh -it every now and then. - -The new thing in this example is the call use of the Update method for -the Text Element. The first thing we do inside the loop is "update" the -text element that we made earlier. This changes the value of the text -field on the form. The new value will be displayed when -``form.ReadNonBlocking()`` is called. - -Note the ``else`` statement on the for loop. This is needed because -we're about to exit the loop while the form is still open. The user has -not closed the form using the X nor a button so it's up to the caller to -close the form using ``CloseNonBlockingForm``. - -That's it... this example follows the async design pattern well. - -Sample Applications -------------------- - -Use the example programs as a starting basis for your GUI. Copy, paste, -modify and run! The demo files are: - -``Demo Recipes.py`` - Sample forms for all major form types and -situations. This is the place to get your code template from. Includes -asynchronous forms, etc. - -``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls -to get a filename - -``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a -folder & Easy Progress Meter to show progress of the file scanning - -``Demo HowDoI.py`` - An amazing little application. Acts as a front-end -to HowDoI. This one program could forever change how you code. It does -searches on Stack Overflow and returns the CODE found in the best answer -for your query. If anyone wants to help me package this application up, -I could use a hand. - -Fun Stuff ---------- - -Here are some things to try if you're bored or want to further customize - -**Colors - Random and predefined** To set a button or text to a random -color, use the string ``'random'`` as the color value. You can also call -``PySimpleGUI.GetRandomColor``. To get a random color pair call -``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a -random color and that color's compliment. - -**Debug Output** Be sure and check out the EasyPrint (Print) function -described in the high-level API section. Leave your code the way it is, -route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - -:: - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in -a window on your screen rather than to the terminal. - -**Look and Feel** Dial in the look and feel that you like with the -``SetOptions`` function. You can change all of the defaults in one -function call. One line of code to customize the entire GUI. - -**ObjToString** Ever wanted to easily display an objects contents -easily? Use ObjToString to get a nicely formatted recursive walk of your -objects. This statement: - -:: - - print(sg.ObjToSting(x)) - -And this was the output - -:: - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - --------------- - -Known Issues -============ - -While not an "issue" this is a ***stern warning*** - -**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads ------------------------------------------------------------------------------------------------------------------------------------------ - -**Progress Meters** - the visual graphic portion of the meter may be -off. May return to the native tkinter progress meter solution in the -future. Right now a "custom" progress meter is used. On the bright side, -the statistics shown are extremely accurate and can tell you something -about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and -EasyPrint/Print). If you start overlapping having Async forms open with -normal forms then things get a littler squirrelly. Still tracking down -the issues and am making it more solid every day possible. You'll know -there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You -print and the output goes to a window, with a scroll bar, that you can -copy and paste from. Being a new feature, it's got some potential -problems. There are known interaction problems with other GUI windows. -For example, closing a Print window can also close other windows you -have open. For now, don't close your debug print window until other -windows are closed too. - -Contributing ------------- - -A MikeTheWatchGuy production... entirely responsible for this code.... -unless it causes you trouble in which case I'm not at all responsible. - -Versions --------- - -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| Version | Description | -+===========+==================================================================================================================================================+ -| 1.0.9 | July 10, 2018 - Initial Release | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 1.0.21 | July 13, 2018 - Readme updates | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.2.0 | July 20, 2018 - Image Elements, Print output | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.5 | Aug XX, 2018 - window\_location default setting | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - -Release Notes -~~~~~~~~~~~~~ - -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another -window open. It could lead to future windows being blank. It's being -worked on. - -New debug printing capability. ``sg.Print`` - -2.5 Discovered issue with scroll bar on ``Output`` elements. The bar -will match size of ROW not the size of the element. Normally you never -notice this due to where on a form the ``Output`` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more -items. The mouse scrollwheel will also scroll the list and will -``page up`` and ``page down`` keys. - -Upcoming -~~~~~~~~ - -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface -are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a -backend other than tkinter. Qt, WxPython, etc. - -Code Condition --------------- - -:: - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the -"Make it run" phase. It's far from "right" in many ways. These are being -worked on. The module is particularly poor for PEP 8 compliance. It was -a learning exercise that turned into a somewhat complete GUI solution -for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public -interfaces into the SDK are more strictly defined and comply with PEP 8 -for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the -code stronger and better in the end, a good thing for us all, right? - -Design ------- - -A moment about the design-spirit of ``PySimpleGUI``. From the beginning, -this package was meant to take advantage of Python's capabilities with -the goal of programming ease. - -**Single File** While not the best programming practice, the -implementation resulted in a single file solution. Only one file is -needed, PySimpleGUI.py. You can post this file, email it, and easily -import it using one statement. - -**Functions as objects** In Python, functions behave just like object. -When you're placing a Text Element into your form, you may be sometimes -calling a function and other times declaring an object. If you use the -word Text, then you're getting an object. If you're using ``Txt``, then -you're calling a function that returns a ``Text`` object. - -**Lists** It seemed quite natural to use Python's powerful list -constructs when possible. The form is specified as a series of lists. -Each "row" of the GUI is represented as a list of Elements. When the -form read returns the results to the user, all of the results are -presented as a single list. This makes reading a form's values -super-simple to do in a single line of Python code. - -Authors -------- - -MikeTheWatchGuy - -License -------- - -GNU Lesser General Public License (LGPL 3) + - -Acknowledgments ---------------- - -- Jorj McKie was the motivator behind the entire project. His - wxsimpleGUI concepts sparked PySimpleGUI into existence -- `Fredrik Lundh `__ for his - work on ``tkinter`` - -How Do I --------- - -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi Their utility has forever changed the -way and pace in which I can program. I urge you to try the HowDoI.py -application here on GitHub. Trust me, **it's going to be worth the -effort!** Here are the steps to run that application - -:: - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through -stack overflow posts. It finds the best answer, gets the code from the -answer, and presents it as a response. It gives you the correct answer -OFTEN. It's a miracle that it work SO well. For Python questions, I -simply start my query with 'Python'. Let's say you forgot how to reverse -a list in Python. When you run HowDoI and ask this question, this is -what you'll see. |snap0109| - -In the hands of a competent programmer, this tool is **amazing**. It's a -must-try kind of program that has completely changed my programming -process. I'm not afraid of asking for help! You just have to be smart -about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field -which means you can copy and paste the results right into your code. - -.. |Downloads| image:: http://pepy.tech/badge/pysimplegui - :target: http://pepy.tech/project/pysimplegui -.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg -.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg -.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg -.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index d7260a069..000000000 --- a/docs/index.rst +++ /dev/null @@ -1,1174 +0,0 @@ -.. figure:: https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png - :alt: pysimplegui\_logo - - pysimplegui\_logo -|Downloads| since Jul 11, 2018 # PySimpleGUI (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of -some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and -into the convenience of a GUI? Have a Raspberry Pi with a touchscreen -that's going to waste because you don't have the time to learn a GUI -SDK? Look no further, you've found your GUI package. - -:: - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - -.. figure:: https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg - :alt: snap0136 - - snap0136 -Build beautiful customized forms that fit your specific problem. Let -PySimpleGUI solve your GUI problem while you solve the real problems. Do -you really want to plod through the mountains of code required to -program tkinter? - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -Perhaps you're looking for a way to interact with your Raspberry Pi in a -more friendly way. The is the same form as above, except shown on a Pi. - -.. figure:: https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg - :alt: raspberry pi - - raspberry pi -In addition to a primary GUI, you can add a Progress Meter to your code -with ONE LINE of code. Slide this into any of your ``for`` loops and get -a nice meter like this: - -:: - - EasyProgressMeter('My meter title', current_value, max value) - -.. figure:: https://user-images.githubusercontent.com/13696193/42695896-a37eff5c-8684-11e8-8fbb-3d756655a44b.jpg - :alt: progress meter 2 - - progress meter 2 -You can build an async media player GUI with custom buttons in 30 lines -of code. - -.. figure:: https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg - :alt: media file player - - media file player -I was frustrated by having to deal with the dos prompt when I had a -powerful Windows machine right in front of me. Why is it SO difficult to -do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** -limiting. PySimpleGUI takes the best of packages like ``EasyGUI``\ and -``WxSimpleGUI`` , both really handy but limited. The primary difference -between these and PySimpleGUI is that in addition to getting the simple -Message Boxes you also get the ability to make your own forms that are -highly customizeable. Don't like the standard Message Box? Then make -your own! - -Every call has optional parameters so that you can change the look and -feel. Don't like the button color? It's easy to change by adding a -button\_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require -configuring and can take a ***week*** to get *reasonably familiar* with -the interfaces. Clearly there needs to be a middle ground between forms -with 1 or two input fields and a full-blown GUI. You'll be making your -own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with -the python interpreter on Windows. Double click a py file and up pops a -GUI window, a more pleasant experience than opening a dos Window and -typing a command line. - -The ``PySimpleGUI`` package is focused on the ***developer***. How can -the desired result be achieved in as little and as simple code as -possible? This was the mantra used to create PySimpleGUI. How can it be -done is a Python-like way? - -:: - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - -An example of many widgets used on a single form. A little further down -you'll find the TWENTY lines of code required to create this complex -form. Try it if you don't believe it. Start Python, copy and paste the -code below into the >>> prompt and hit enter. This will pop up... - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Here is the code that produced the above screenshot. - -:: - - import PySimpleGUI as SG - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -**A note on screen shots** You will see a number of different styles of -buttons, data entry fields, etc, in this readme. They were all made with -the same SDK, the only difference is in the settings that are specified -on a per-element, row, form, or global basis. One setting in particular, -border\_width, can make a big difference on the look of the form. Some -of the screenshots had a border\_width of 6, others a value of 1. - -APIs ----- - -PySimpleGUI can be broken down into 2 types of API's: \* High Level -single call functions \* Custom form functions - -Python Language Features -~~~~~~~~~~~~~~~~~~~~~~~~ - -There are a couple of Python language features that PySimpleGUI utilizes -heavily that should be understood first... \* Variable number of -arguments to a function call \* Optional parameters to a function call - -Variable Number of Arguments -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The "High Level" API calls that *output* values take a variable number -of arguments so that they match a "print" statement as much as possible. -The idea is to make it simple for the programmer to output as many items -as desired and in any format. The user need not convert the variables to -be output into the strings. The PySimpleGUI functions do that for the -user. - -:: - - SG.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - -.. figure:: https://user-images.githubusercontent.com/13696193/42844739-ebea22ac-89e1-11e8-8dd1-e61441325701.jpg - :alt: snap0104 - - snap0104 -Optional Parameters to a Function Call -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This feature of the Python language is utilized ***heavily*** as a -method of customizing forms and form Elements. Rather than requiring the -programmer to specify every possible option for a widget, instead only -the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details -aren't important. What is important is seeing that there is a long list -of potential tweaks that a caller can make. However, they don't *have* -to be specified on each and every call. - -:: - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, -the call would look something like this: - -:: - - SG.MsgBox('This box has a custom button color', - button_color=('black', 'yellow')) - -.. figure:: https://user-images.githubusercontent.com/13696193/42844830-2d7e8b9a-89e2-11e8-8ef4-5af9e36f30f3.jpg - :alt: snap0105 - - snap0105 - --------------- - -High Level API Calls -~~~~~~~~~~~~~~~~~~~~ - -The classic "input a value, print result" example. Often command line -programs simply take some value as input on the command line, do -something with it and then display the results. Moving from the command -line to a GUI is very simple. This code prompts user to input a line of -text and then displays that text in a messages box: - -:: - - import PySimpleGUI_local as SG - - rc = SG.GetTextBox('Title', 'Please input something') - SG.MsgBox('Results', 'The value returned from GetTextBox', rc) - -.. figure:: https://user-images.githubusercontent.com/13696193/42592930-1ca1370a-8519-11e8-907e-ad73e9be7749.jpg - :alt: GetTextBox - - GetTextBox -.. figure:: https://user-images.githubusercontent.com/13696193/42592929-1c7361ae-8519-11e8-8adc-411c1afee69f.jpg - :alt: MsgBox - - MsgBox -Message Boxes -^^^^^^^^^^^^^ - -In addition to MsgBox, you'll find a several API calls that are -shortcuts to common messages boxes. You can achieve similar results by -calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the -calls and the windows that are created. - -:: - - import PySimpleGUI as SG - -``SG.MsgBoxOK('This is an OK MsgBox')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42599852-8dd6914e-852e-11e8-888f-f133d787210b.jpg - :alt: msgboxok - - msgboxok -:: - - SG.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599858-8e8eff22-852e-11e8-8d5c-3fe99237eb7f.jpg - :alt: msgboxokcancel - - msgboxokcancel -:: - - SG.MsgBoxCancel('This is a Cancel MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599857-8e53dc4e-852e-11e8-8e83-6a8cccf8e706.jpg - :alt: msgboxcancel - - msgboxcancel -:: - - SG.MsgBoxYesNo('This is a Yes No MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599856-8e304540-852e-11e8-975d-fb2b62e94300.jpg - :alt: msgboxyesno - - msgboxyesno -:: - - SG.MsgBoxError('This is an error MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599853-8df8e078-852e-11e8-90dc-7815d69bff7e.jpg - :alt: msgbox error - - msgbox error -:: - - SG.MsgBoxAutoClose('This is an autoclose MsgBox') - -.. figure:: https://user-images.githubusercontent.com/13696193/42599855-8e147572-852e-11e8-8c23-7ec771909062.jpg - :alt: msgbox autoclose - - msgbox autoclose -:: - - SG.ScrolledTextBox(my_text, height=10) - -.. figure:: https://user-images.githubusercontent.com/13696193/42600800-a44f4562-8531-11e8-8c21-51dd70316879.jpg - :alt: scrolledtextbox - - scrolledtextbox -Take a moment to look at that last one. It's such a simple API call and -yet the result is awesome. Rather than seeing text scrolling past on -your display, you can capture that text and present it in a scrolled -interface. It's handy enough of an API call that it can also be called -using the name ``sprint`` which is easier to remember than -``ScrollectTextBox``. Your code could contain a line like: - -:: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled -window. - -High Level User Input -^^^^^^^^^^^^^^^^^^^^^ - -There are 3 very basic user input high-level function calls. It's -expected that for most applications, a custom input form will be -created. If you need only 1 value, then perhaps one of these high level -functions will work. - GetTextBox - GetFileBox - GetFolderBox - -``submit_clicked, value = SG.GetTextBox('Title', 'Please enter anything')`` - -.. figure:: https://user-images.githubusercontent.com/13696193/42600399-1ef66a5e-8530-11e8-9bc4-78ea839213cd.jpg - :alt: gettextbox - - gettextbox -:: - - submit_clicked, value = SG.GetFileBox('Title', 'Choose a file') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600398-1ed8a122-8530-11e8-9f74-88b101efcea4.jpg - :alt: getfilebox - - getfilebox -:: - - submit_clicked, value = SG.GetPathBox('Title', 'Choose a folder') - -.. figure:: https://user-images.githubusercontent.com/13696193/42600397-1ea7cef8-8530-11e8-8d43-e1000c0933cd.jpg - :alt: getfolderbox - - getfolderbox -Progress Meter! -^^^^^^^^^^^^^^^ - -We all have loops in our code. 'Isn't it joyful waiting, watching a -counter scrolling past in a text window? How about one line of code to -get a progress meter, that contains statistics about your code? - -.. figure:: https://user-images.githubusercontent.com/13696193/42696332-dca3ca6e-8685-11e8-846b-6bee8362ee5f.jpg - :alt: progress meter 3 - - progress meter 3 -:: - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - -:: - - for i in range(1,10000): - SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -.. figure:: https://user-images.githubusercontent.com/13696193/42696912-a5c958b8-8687-11e8-9a7d-a390a465407a.jpg - :alt: progress meter 5 - - progress meter 5 -A meter AND fun statistics to watch while your machine grinds away, all -for the price of 1 line of code. With a little trickery you can provide -a way to break out of your loop using the Progress Meter form. The -cancel button results in a ``False`` return value from -``EasyProgressMeter``. It normally returns ``True``. - -:: - - if not SG.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message'): - break - -***Be sure and add one to your loop counter*** so that your counter goes -from 1 to the max value. If you do not add one, your counter will never -hit the max value. Instead it will go from 0 to max-1. #### Debug Output -Another call in the 'Easy' families of APIs is ``EasyPrint``. It will -output to a debug window. If the debug window isn't open, then the first -call will open it. No need to do anything but stick a 'print' call in -your code. You can even replace your 'print' calls with calls to -EasyPrint by simply sticking the statement - -:: - - print = SG.EasyPrint - -at the top of your code. There are a number of names for the same -EasyPrint function. ``Print`` is one of the better ones to use as it's -easy to remember. It is simply ``print`` with a capital P. - -:: - - import PySimpleGUI as SG - - for i in range(100): - SG.Print(i) - -|snap0125| Or if you didn't want to change your code: - -:: - - import PySimpleGUI as SG - - print=SG.Print - for i in range(100): - print(i) - -Just like the standard print call, ``EasyPrint`` supports the ``sep`` -and ``end`` keyword arguments. Other names that can be used to call -``EasyPrint`` include Print, ``eprint``, If you want to close the -window, call the function ``EasyPrintClose``. - -A word of caution. There are known problems when multiple PySimpleGUI -windows are opened, particularly if the user closes them in an unusual -way. Not a reason to stay away from using it. Just something to keep in -mind if you encounter a problem. - -You can change the size of the debug window using the ``SetOptions`` -call with the ``debug_win_size`` parameter. - -All Widgets / Elements ----------------------- - -This code utilizes as many of the elements in one form as possible. - -:: - - with SG.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [SG.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [SG.Text('Here is some text.... and a place to enter text')], - [SG.InputText()], - [SG.Checkbox('My first checkbox!'), SG.Checkbox('My second checkbox!', default=True)], - [SG.Radio('My first Radio! ', "RADIO1", default=True), SG.Radio('My second Radio!', "RADIO1")], - [SG.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [SG.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - SG.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [SG.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - SG.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [SG.Text('_' * 100, size=(70, 1))], - [SG.Text('Choose Source and Destination Folders', size=(35, 1))], - [SG.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Source'), SG.FolderBrowse()], - [SG.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), SG.InputText('Dest'), - SG.FolderBrowse()], - [SG.Submit(), SG.Cancel(), SG.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to -make things line up well. This is code you only have to write once. When -looking at the code, remember that what you're seeing is a list of -lists. Each row contains a list of Graphical Elements that are used to -create the form. - -.. figure:: https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg - :alt: everything example - - everything example -Clicking the Submit button caused the form call to return. The call to -MsgBox resulted in this dialog box. |results 2| - -**``Note, button value can be None``**. The value for ``button`` will be -the text that is displayed on the button element when it was created. If -the user closed the form using something other than a button, then -``button`` will be ``None``. - -You can see in the MsgBox that the values returned are a list. Each -input field in the form generates one item in the return values list. -All input fields return a ``string`` except for Check Boxes and Radio -Buttons. These return ``bool``. - -ProgressBar -^^^^^^^^^^^ - -The ``ProgressBar`` element is used to build custom Progress Bar forms. -It is HIGHLY recommended that you use the functions that provide a -complete progress meter solution for you. Progress Meters are not easy -to work with because the forms have to be non-blocking and they are -tricky to debug. - -The **easiest** way to get progress meters into your code is to use the -``EasyProgessMeter`` API. This consists of a pair of functions, -``EasyProgessMeter`` and ``EasyProgressMeterCancel``. You can easily -cancel any progress meter by calling it with the current value = max -value. This will mark the meter as expired and close the window. You've -already seen EasyProgressMeter calls presented earlier in this readme. - -:: - - SG.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for ``EasyProgressMeter`` is: ``True`` if meter updated -correctly ``False`` if user clicked the Cancel button, closed the form, -or vale reached the max value. **Customized Progress Bar** If you want a -bit more customization of your meter, then you can go up 1 level and use -the calls to ``ProgressMeter`` and ``ProgressMeterUpdate``. These APIs -behave like an object we're all used to. First you create the -``ProgressMeter`` object, then you call the ``Update`` method to update -it. - -You setup the progress meter by calling - -:: - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) - -Then to update the bar within your loop - -:: - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): - -Putting it all together you get this design pattern - -:: - - my_meter = SG.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - SG.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - -The final way of using a Progress Meter with PySimpleGUI is to build a -custom form with a ``ProgressBar`` Element in the form. You will need to -run your form as a non-blocking form. When you are ready to update your -progress bar, you call the ``UpdateBar`` method for the ``ProgressBar`` -element itself. - -Output -^^^^^^ - -The Output Element is a re-direction of Stdout. Anything "printed" will -be displayed in this element. - -:: - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an -Output Element - -:: - - import PySimpleGUI as SG - # Blocking form that doesn't close - def ChatBot(): - with SG.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(SG.Text('This is where standard out is being routed', size=[40, 1]))], - [SG.Output(size=(80, 20))], - [SG.Multiline(size=(70, 5), enter_submits=True), SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - -Tabbed Forms ------------- - -Tabbed forms are shown using the ``ShowTabbedForm`` call. The call has -the format - -:: - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken -to create the form as before. A ``FlexForm`` is created, then rows are -filled with Elements, and finally the form is shown. When calling -``ShowTabbedForm``, each form is passed in as a tuple. The tuple has the -format: ``(the form, the rows, a string shown on the tab)`` - -Results are returned as a list of lists. For each form you'll get a list -that's in the same format as a normal form. A single tab's values would -be: - -:: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would -return like this: - -:: - - ((button1, (values1)), (button2, (values2)) - -## Colors ## Starting in version 2.5 you can change the background -colors for the window and the Elements. - -Your forms can go from this: |snap0155| - -to this... with one function call... - -.. figure:: https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg - :alt: snap0156 - - snap0156 -While you can do it on an element by element or form level basis, the -easiest way, by far, is a call to ``SetOptions``. - -Be aware that once you change these options they are changed for the -rest of your program's execution. All of your forms will have that look -and feel, until you change it to something else (which could be the -system default colors. - -This call sets all of the different color options. - -:: - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - -Global Settings ---------------- - -**Global Settings** Let's have some fun customizing! Make PySimpleGUI -look the way you want it to look. You can set the global settings using -the function ``PySimpleGUI.SetOptions``. Each option has an optional -parameter that's used to set it. - -:: - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - -:: - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - -These settings apply to all forms ``SetOptions``. The Row options and -Element options will take precedence over these settings. Settings can -be thought of as levels of settings with the Form-level being the -highest and the Element-level the lowest. Thus the levels are: - -- Form level -- Row level -- Element level - -Each lower level overrides the settings of the higher level. Once -settings have been changed, they remain changed for the duration of the -program (unless changed again). - -Asynchronous (Non-Blocking) Forms ---------------------------------- - -So you want to be a wizard do ya? Well go boldly! While the majority of -GUIs are a simple exercise to "collect input values and return with -them", there are instances where we want to continue executing while the -form is open. These are "asynchronous" forms and require special -options, new SDK calls, and **great care**. With asynchronous forms the -form is shown, user input is read, but your code keeps right on -chugging. YOUR responsibility is to call ``PySimpleGUI.ReadNonBlocking`` -on a periodic basis. Once a second or more will produce a reasonably -snappy GUI. - -When do you use a non-blocking form? A couple of examples are \* A media -file player like an MP3 player \* A status dashboard that's periodically -updated \* Progress Meters - when you want to make your own progress -meters \* Output using print to a scrolled text element. Good for -debugging. - -Word of warning... version 2.2, the currently released, and upcoming -version 2.3 differ in the return code for the ``ReadNonBlocking`` call. -Previously the function returned 2 values, except when the form is -closed using the "X" which returned a single value of ``None``. The -*new* way is that ``ReadNonBlocking`` always returns 2 values. If the -user closed the form with the "X" then the return values will be None, -None. You will want to key off the second value to catch this case. The -proper code to check if the user has exited the form will be a -polling-loop that looks something like this: - -:: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update -our form with a running clock. - -The basic flow and functions you will be calling are: Setup - -:: - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - -Periodic refresh - -:: - - form.ReadNonBlocking() - -If you need to close the form - -:: - - form.CloseNonBlockingForm() - -Rather than the usual ``form.LayoutAndRead()`` call, we're manually -adding the rows (doing the layout) and then showing the form. After the -form is shown, you simply call ``form.ReadNonBlocking()`` every now and -then. - -When you are ready to close the form (assuming the form wasn't closed by -the user or a button click) you simply call -``form.CloseNonBlockingForm()`` - -**Example - Running timer that updates** See the sample code on the -GitHub named Demo Media Player for another example of Async Forms. We're -going to make a form and update one of the elements of that form every -.01 seconds. Here's the entire code to do that. - -:: - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - -What we have here is the same sequence of function calls as in the -description. Get a form, add rows to it, show the form, and then refresh -it every now and then. - -The new thing in this example is the call use of the Update method for -the Text Element. The first thing we do inside the loop is "update" the -text element that we made earlier. This changes the value of the text -field on the form. The new value will be displayed when -``form.ReadNonBlocking()`` is called. - -Note the ``else`` statement on the for loop. This is needed because -we're about to exit the loop while the form is still open. The user has -not closed the form using the X nor a button so it's up to the caller to -close the form using ``CloseNonBlockingForm``. - -That's it... this example follows the async design pattern well. - -Sample Applications -------------------- - -Use the example programs as a starting basis for your GUI. Copy, paste, -modify and run! The demo files are: - -``Demo Recipes.py`` - Sample forms for all major form types and -situations. This is the place to get your code template from. Includes -asynchronous forms, etc. - -``Demo DisplayHash1and256.py`` - Demonstrates using High Level API calls -to get a filename - -``Demo DupliucateFileFinder.py`` - Demonstrates High Level API to get a -folder & Easy Progress Meter to show progress of the file scanning - -``Demo HowDoI.py`` - An amazing little application. Acts as a front-end -to HowDoI. This one program could forever change how you code. It does -searches on Stack Overflow and returns the CODE found in the best answer -for your query. If anyone wants to help me package this application up, -I could use a hand. - -Fun Stuff ---------- - -Here are some things to try if you're bored or want to further customize - -**Colors - Random and predefined** To set a button or text to a random -color, use the string ``'random'`` as the color value. You can also call -``PySimpleGUI.GetRandomColor``. To get a random color pair call -``PySimpleGUI.GetRandomColorPair``. This returns a tuple containing a -random color and that color's compliment. - -**Debug Output** Be sure and check out the EasyPrint (Print) function -described in the high-level API section. Leave your code the way it is, -route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - -:: - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in -a window on your screen rather than to the terminal. - -**Look and Feel** Dial in the look and feel that you like with the -``SetOptions`` function. You can change all of the defaults in one -function call. One line of code to customize the entire GUI. - -**ObjToString** Ever wanted to easily display an objects contents -easily? Use ObjToString to get a nicely formatted recursive walk of your -objects. This statement: - -:: - - print(sg.ObjToSting(x)) - -And this was the output - -:: - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - --------------- - -Known Issues -============ - -While not an "issue" this is a ***stern warning*** - -**Do not attempt** to call ``PySimpleGUI`` from multiple threads! It's ``tkinter`` based and ``tkinter`` has issues with multiple threads ------------------------------------------------------------------------------------------------------------------------------------------ - -**Progress Meters** - the visual graphic portion of the meter may be -off. May return to the native tkinter progress meter solution in the -future. Right now a "custom" progress meter is used. On the bright side, -the statistics shown are extremely accurate and can tell you something -about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and -EasyPrint/Print). If you start overlapping having Async forms open with -normal forms then things get a littler squirrelly. Still tracking down -the issues and am making it more solid every day possible. You'll know -there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You -print and the output goes to a window, with a scroll bar, that you can -copy and paste from. Being a new feature, it's got some potential -problems. There are known interaction problems with other GUI windows. -For example, closing a Print window can also close other windows you -have open. For now, don't close your debug print window until other -windows are closed too. - -Contributing ------------- - -A MikeTheWatchGuy production... entirely responsible for this code.... -unless it causes you trouble in which case I'm not at all responsible. - -Versions --------- - -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| Version | Description | -+===========+==================================================================================================================================================+ -| 1.0.9 | July 10, 2018 - Initial Release | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 1.0.21 | July 13, 2018 - Readme updates | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all\_lower\_case | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.2.0 | July 20, 2018 - Image Elements, Print output | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.0 | July 27, 2018 - auto\_size\_button setting. License changed to LGPL 3+ | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ -| 2.6.5 | Aug XX, 2018 - window\_location default setting | -+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - -Release Notes -~~~~~~~~~~~~~ - -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another -window open. It could lead to future windows being blank. It's being -worked on. - -New debug printing capability. ``sg.Print`` - -2.5 Discovered issue with scroll bar on ``Output`` elements. The bar -will match size of ROW not the size of the element. Normally you never -notice this due to where on a form the ``Output`` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more -items. The mouse scrollwheel will also scroll the list and will -``page up`` and ``page down`` keys. - -Upcoming -~~~~~~~~ - -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface -are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a -backend other than tkinter. Qt, WxPython, etc. - -Code Condition --------------- - -:: - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the -"Make it run" phase. It's far from "right" in many ways. These are being -worked on. The module is particularly poor for PEP 8 compliance. It was -a learning exercise that turned into a somewhat complete GUI solution -for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public -interfaces into the SDK are more strictly defined and comply with PEP 8 -for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the -code stronger and better in the end, a good thing for us all, right? - -Design ------- - -A moment about the design-spirit of ``PySimpleGUI``. From the beginning, -this package was meant to take advantage of Python's capabilities with -the goal of programming ease. - -**Single File** While not the best programming practice, the -implementation resulted in a single file solution. Only one file is -needed, PySimpleGUI.py. You can post this file, email it, and easily -import it using one statement. - -**Functions as objects** In Python, functions behave just like object. -When you're placing a Text Element into your form, you may be sometimes -calling a function and other times declaring an object. If you use the -word Text, then you're getting an object. If you're using ``Txt``, then -you're calling a function that returns a ``Text`` object. - -**Lists** It seemed quite natural to use Python's powerful list -constructs when possible. The form is specified as a series of lists. -Each "row" of the GUI is represented as a list of Elements. When the -form read returns the results to the user, all of the results are -presented as a single list. This makes reading a form's values -super-simple to do in a single line of Python code. - -Authors -------- - -MikeTheWatchGuy - -License -------- - -GNU Lesser General Public License (LGPL 3) + - -Acknowledgments ---------------- - -- Jorj McKie was the motivator behind the entire project. His - wxsimpleGUI concepts sparked PySimpleGUI into existence -- `Fredrik Lundh `__ for his - work on ``tkinter`` - -How Do I --------- - -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi Their utility has forever changed the -way and pace in which I can program. I urge you to try the HowDoI.py -application here on GitHub. Trust me, **it's going to be worth the -effort!** Here are the steps to run that application - -:: - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through -stack overflow posts. It finds the best answer, gets the code from the -answer, and presents it as a response. It gives you the correct answer -OFTEN. It's a miracle that it work SO well. For Python questions, I -simply start my query with 'Python'. Let's say you forgot how to reverse -a list in Python. When you run HowDoI and ask this question, this is -what you'll see. |snap0109| - -In the hands of a competent programmer, this tool is **amazing**. It's a -must-try kind of program that has completely changed my programming -process. I'm not afraid of asking for help! You just have to be smart -about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field -which means you can copy and paste the results right into your code. - -.. |Downloads| image:: http://pepy.tech/badge/pysimplegui - :target: http://pepy.tech/project/pysimplegui -.. |snap0125| image:: https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg -.. |results 2| image:: https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg -.. |snap0155| image:: https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg -.. |snap0109| image:: https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 000000000..f03d65375 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,1506 @@ + + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +# PySimpleGUI + (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + +![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) + + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + +Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. + +![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: + + EasyProgressMeter('My meter title', current_value, max value) + + ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! + +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + + +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Here is the code that produced the above screenshot. + + import PySimpleGUI as sg + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + **A note on screen shots** +You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. + +It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. + + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.MsgBox('This is my first message box') + +![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + +--- + +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + + import PySimpleGUI as sg + + rc = sg.GetTextBox('Title', 'Please input something') + sg.MsgBox('Results', 'The value returned from GetTextBox', rc) + + + ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) + +![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) + + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. + + import PySimpleGUI as sg + + `sg.MsgBoxOK('This is an OK MsgBox')` + + ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + + + sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) + + sg.MsgBoxCancel('This is a Cancel MsgBox') + +![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) + + sg.MsgBoxYesNo('This is a Yes No MsgBox') + +![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) + + + sg.MsgBoxError('This is an error MsgBox') + +![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + + sg.MsgBoxAutoClose('This is an autoclose MsgBox') + +![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) + + sg.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. + +See also the `EasyPrint` and `Print` functions. + +#### High Level User Input + +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. + - GetTextBox + - GetFileBox + - GetFolderBox + + `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` + +![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) + + submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + +![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) + + submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') + +![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + + +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + + import PySimpleGUI as sg + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + + import PySimpleGUI as sg + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +# Copy these design patterns! +## Pattern 1 - With Context Manager + + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + +## Pattern 2 - No Context Manager + + + form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + + + +These 2 design patters both produce this custom form: + +![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) + +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + +The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### How GUI Programming in Python Should Look + +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. + +Let's look at this one. + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### Laying out your form +Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. + + layout = [ [row 1], + [row 2], + [row 3] ] + +Simple enough... a list of lists. +A row is a list of Elements. For example this could be a row with a couple of elements on it. + + [ Input, Button] + +Turning back to our example. This GUI roughly looks like this: + + layout = [ [Text], + [InputText, FileBrowse] + [Submit, Cancel] ] + + Now let's put it all together into an entire program. + + +### Line by line explanation + +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [sg.InputText(), sg.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [sg.Submit(), sg.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. + + button, (source_filename, ) = form.LayoutAndRead(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. + + +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + + Another way of parsing the return values is to store the list of values into a variable representing the list of values. + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... + +--- +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the FlexForm object: + + def FlexForm(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=None, + auto_size_buttons=None, + scale=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True if elements should size themselves according to contents + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None, + justification=None) +. + + Text - The text that's displayed + size - Element's size + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color + justification - Justification for the text. String - 'left', 'right', 'center' + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(scale=(None, None), + size=(None, None)) +. + + scale - How much to scale size of element + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None, + password_char='') +. + + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) + + + Listbox(values, + select_mode=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +#### Slider Element +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + scale=(None, None), + size=(None, None), + font=None): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text + +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): +. + + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display + + +#### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + +#### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form +* Realtime + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_button=None, + button_color=None, + font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. + +layout = [[sg.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. + + + sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + +![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. + +**File Types** +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + +You setup the progress meter by calling + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): +Putting it all together you get this design pattern + + my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + # Blocking form that doesn't close + def ChatBot(): + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + +When do you use a non-blocking form? A couple of examples are +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + + form.ReadNonBlocking() +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + +That's it... this example follows the async design pattern well. + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + +`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. + +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. + +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. + +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code + + +### Upcoming +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + +## Authors +MikeTheWatchGuy + +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. +![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From e2385939c7260fbee23ab6751958e2d0f5b9efee Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:00:21 -0400 Subject: [PATCH 099/521] Delete readme.md --- docs/readme.md | 1506 ------------------------------------------------ 1 file changed, 1506 deletions(-) delete mode 100644 docs/readme.md diff --git a/docs/readme.md b/docs/readme.md deleted file mode 100644 index f03d65375..000000000 --- a/docs/readme.md +++ /dev/null @@ -1,1506 +0,0 @@ - - -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 -# PySimpleGUI - (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - -![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) - - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - -Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. - -![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: - - EasyProgressMeter('My meter title', current_value, max value) - - ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! - -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - - -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Here is the code that produced the above screenshot. - - import PySimpleGUI as sg - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - **A note on screen shots** -You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. - - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. - -It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. - - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. - -### Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.MsgBox('This is my first message box') - -![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - - -### Python Language Features - - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call - * Optional parameters to a function call - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - ---- - -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - - import PySimpleGUI as sg - - rc = sg.GetTextBox('Title', 'Please input something') - sg.MsgBox('Results', 'The value returned from GetTextBox', rc) - - - ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) - -![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) - - -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - - import PySimpleGUI as sg - - `sg.MsgBoxOK('This is an OK MsgBox')` - - ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) - - - sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) - - sg.MsgBoxCancel('This is a Cancel MsgBox') - -![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) - - sg.MsgBoxYesNo('This is a Yes No MsgBox') - -![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) - - - sg.MsgBoxError('This is an error MsgBox') - -![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) - - sg.MsgBoxAutoClose('This is an autoclose MsgBox') - -![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) - - sg.ScrolledTextBox(my_text, height=10) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled window. - -See also the `EasyPrint` and `Print` functions. - -#### High Level User Input - -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox - - `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` - -![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - - submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') - -![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) - - submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') - -![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) - - -#### Progress Meter! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - - import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - - import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# Copy these design patterns! -## Pattern 1 - With Context Manager - - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - -## Pattern 2 - No Context Manager - - - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - - - -These 2 design patters both produce this custom form: - -![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) - -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. - -The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. - -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. - -### How GUI Programming in Python Should Look - -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. - -Let's look at this one. - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -### Laying out your form -Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. - - layout = [ [row 1], - [row 2], - [row 3] ] - -Simple enough... a list of lists. -A row is a list of Elements. For example this could be a row with a couple of elements on it. - - [ Input, Button] - -Turning back to our example. This GUI roughly looks like this: - - layout = [ [Text], - [InputText, FileBrowse] - [Submit, Cancel] ] - - Now let's put it all together into an entire program. - - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [sg.InputText(), sg.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [sg.Submit(), sg.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - button, (source_filename, ) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. - - -## Return values - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - - Another way of parsing the return values is to store the list of values into a variable representing the list of values. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... - ---- -## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=None, - auto_size_buttons=None, - scale=(None, None), - location=(None, None), - button_color=None,Font=None, - progress_bar_color=(None,None), - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True if elements should size themselves according to contents - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None, - justification=None) -. - - Text - The text that's displayed - size - Element's size - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color - justification - Justification for the text. String - 'left', 'right', 'center' - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -**auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. - -**Shorthand functions** -The shorthand functions for `Text` are `Txt` and `T` - - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - - Output(scale=(None, None), - size=(None, None)) -. - - scale - How much to scale size of element - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(default_text = '', - scale=(None, None), - size=(None, None), - auto_size_text=None, - password_char='') -. - - default_text - Text initially shown in the input box - scale - Amount size is scaled by - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(values, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - values - Choices to be displayed. List of strings - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) - - - Listbox(values, - select_mode=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. - -#### Slider Element -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - scale=(None, None), - size=(None, None), - font=None): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text - -#### Radio Button Element -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - - Radio(text, - group_id, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - scale - Amount to scale size of element - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] - -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - - - Checkbox(text, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None): -. - - text - Text to display next to checkbox - default- Bool. Initial state - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display - - -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - - Spin(values, - intiial_value=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - List of valid values - initial_value - String with initial value - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - -#### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse -* Close Form -* Read Form -* Realtime - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. - -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - scale=(None, None), - size=(None, None), - auto_size_button=None, - button_color=None, - font=None) - -Pre-made buttons include: - - OK - Ok - Submit - Cancel - Yes - No - FileBrowse - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) - -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. - -Let's examine this form as an example: - -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], - [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. - -layout = [[sg.SimpleButton('My Button')]] - -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. - - - sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - -![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. - -**File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. - - sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for `EasyProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - # Blocking form that doesn't close - def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - - -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - -When do you use a non-blocking form? A couple of examples are -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. - -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - - -Periodic refresh - - form.ReadNonBlocking() -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - -That's it... this example follows the async design pattern well. - - - -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - -`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. - -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename - -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning - -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. - -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. - -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting - - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code - - -### Upcoming -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. - - -## Authors -MikeTheWatchGuy - -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. -![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From c58066c167a6fad04d2ef18ad65d5dd88712f0bf Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:01:16 -0400 Subject: [PATCH 100/521] Renamed to README --- docs/README.md | 1506 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1506 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..f03d65375 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,1506 @@ + + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +# PySimpleGUI + (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + +![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) + + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + +Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. + +![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: + + EasyProgressMeter('My meter title', current_value, max value) + + ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! + +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + + +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Here is the code that produced the above screenshot. + + import PySimpleGUI as sg + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + **A note on screen shots** +You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. + +It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. + + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.MsgBox('This is my first message box') + +![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + +--- + +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + + import PySimpleGUI as sg + + rc = sg.GetTextBox('Title', 'Please input something') + sg.MsgBox('Results', 'The value returned from GetTextBox', rc) + + + ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) + +![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) + + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. + + import PySimpleGUI as sg + + `sg.MsgBoxOK('This is an OK MsgBox')` + + ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + + + sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) + + sg.MsgBoxCancel('This is a Cancel MsgBox') + +![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) + + sg.MsgBoxYesNo('This is a Yes No MsgBox') + +![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) + + + sg.MsgBoxError('This is an error MsgBox') + +![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + + sg.MsgBoxAutoClose('This is an autoclose MsgBox') + +![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) + + sg.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. + +See also the `EasyPrint` and `Print` functions. + +#### High Level User Input + +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. + - GetTextBox + - GetFileBox + - GetFolderBox + + `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` + +![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) + + submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + +![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) + + submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') + +![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + + +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + + import PySimpleGUI as sg + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + + import PySimpleGUI as sg + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +# Copy these design patterns! +## Pattern 1 - With Context Manager + + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + +## Pattern 2 - No Context Manager + + + form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + + + +These 2 design patters both produce this custom form: + +![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) + +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + +The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### How GUI Programming in Python Should Look + +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. + +Let's look at this one. + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### Laying out your form +Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. + + layout = [ [row 1], + [row 2], + [row 3] ] + +Simple enough... a list of lists. +A row is a list of Elements. For example this could be a row with a couple of elements on it. + + [ Input, Button] + +Turning back to our example. This GUI roughly looks like this: + + layout = [ [Text], + [InputText, FileBrowse] + [Submit, Cancel] ] + + Now let's put it all together into an entire program. + + +### Line by line explanation + +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [sg.InputText(), sg.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [sg.Submit(), sg.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. + + button, (source_filename, ) = form.LayoutAndRead(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. + + +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + + Another way of parsing the return values is to store the list of values into a variable representing the list of values. + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... + +--- +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the FlexForm object: + + def FlexForm(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=None, + auto_size_buttons=None, + scale=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True if elements should size themselves according to contents + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None, + justification=None) +. + + Text - The text that's displayed + size - Element's size + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color + justification - Justification for the text. String - 'left', 'right', 'center' + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(scale=(None, None), + size=(None, None)) +. + + scale - How much to scale size of element + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None, + password_char='') +. + + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) + + + Listbox(values, + select_mode=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +#### Slider Element +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + scale=(None, None), + size=(None, None), + font=None): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text + +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): +. + + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display + + +#### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + +#### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form +* Realtime + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_button=None, + button_color=None, + font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. + +layout = [[sg.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. + + + sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + +![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. + +**File Types** +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + +You setup the progress meter by calling + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): +Putting it all together you get this design pattern + + my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + # Blocking form that doesn't close + def ChatBot(): + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + +When do you use a non-blocking form? A couple of examples are +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + + form.ReadNonBlocking() +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + +That's it... this example follows the async design pattern well. + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + +`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. + +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. + +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. + +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code + + +### Upcoming +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + +## Authors +MikeTheWatchGuy + +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. +![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From dd23c814c5c509708f996b915928efae0e6c7fcb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:02:57 -0400 Subject: [PATCH 101/521] Deleted --- docs/README.md | 1506 ------------------------------------------------ 1 file changed, 1506 deletions(-) delete mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index f03d65375..000000000 --- a/docs/README.md +++ /dev/null @@ -1,1506 +0,0 @@ - - -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 -# PySimpleGUI - (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - -![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) - - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - -Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. - -![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: - - EasyProgressMeter('My meter title', current_value, max value) - - ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! - -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - - -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Here is the code that produced the above screenshot. - - import PySimpleGUI as sg - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - **A note on screen shots** -You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. - - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. - -It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. - - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. - -### Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.MsgBox('This is my first message box') - -![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - - -### Python Language Features - - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call - * Optional parameters to a function call - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - ---- - -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - - import PySimpleGUI as sg - - rc = sg.GetTextBox('Title', 'Please input something') - sg.MsgBox('Results', 'The value returned from GetTextBox', rc) - - - ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) - -![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) - - -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - - import PySimpleGUI as sg - - `sg.MsgBoxOK('This is an OK MsgBox')` - - ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) - - - sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) - - sg.MsgBoxCancel('This is a Cancel MsgBox') - -![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) - - sg.MsgBoxYesNo('This is a Yes No MsgBox') - -![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) - - - sg.MsgBoxError('This is an error MsgBox') - -![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) - - sg.MsgBoxAutoClose('This is an autoclose MsgBox') - -![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) - - sg.ScrolledTextBox(my_text, height=10) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled window. - -See also the `EasyPrint` and `Print` functions. - -#### High Level User Input - -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox - - `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` - -![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - - submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') - -![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) - - submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') - -![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) - - -#### Progress Meter! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - - import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - - import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# Copy these design patterns! -## Pattern 1 - With Context Manager - - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - -## Pattern 2 - No Context Manager - - - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - - - -These 2 design patters both produce this custom form: - -![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) - -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. - -The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. - -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. - -### How GUI Programming in Python Should Look - -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. - -Let's look at this one. - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -### Laying out your form -Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. - - layout = [ [row 1], - [row 2], - [row 3] ] - -Simple enough... a list of lists. -A row is a list of Elements. For example this could be a row with a couple of elements on it. - - [ Input, Button] - -Turning back to our example. This GUI roughly looks like this: - - layout = [ [Text], - [InputText, FileBrowse] - [Submit, Cancel] ] - - Now let's put it all together into an entire program. - - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [sg.InputText(), sg.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [sg.Submit(), sg.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - button, (source_filename, ) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. - - -## Return values - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - - Another way of parsing the return values is to store the list of values into a variable representing the list of values. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... - ---- -## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=None, - auto_size_buttons=None, - scale=(None, None), - location=(None, None), - button_color=None,Font=None, - progress_bar_color=(None,None), - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True if elements should size themselves according to contents - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None, - justification=None) -. - - Text - The text that's displayed - size - Element's size - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color - justification - Justification for the text. String - 'left', 'right', 'center' - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -**auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. - -**Shorthand functions** -The shorthand functions for `Text` are `Txt` and `T` - - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - - Output(scale=(None, None), - size=(None, None)) -. - - scale - How much to scale size of element - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(default_text = '', - scale=(None, None), - size=(None, None), - auto_size_text=None, - password_char='') -. - - default_text - Text initially shown in the input box - scale - Amount size is scaled by - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(values, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - values - Choices to be displayed. List of strings - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) - - - Listbox(values, - select_mode=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. - -#### Slider Element -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - scale=(None, None), - size=(None, None), - font=None): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text - -#### Radio Button Element -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - - Radio(text, - group_id, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - scale - Amount to scale size of element - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] - -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - - - Checkbox(text, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None): -. - - text - Text to display next to checkbox - default- Bool. Initial state - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display - - -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - - Spin(values, - intiial_value=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - List of valid values - initial_value - String with initial value - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - -#### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse -* Close Form -* Read Form -* Realtime - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. - -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - scale=(None, None), - size=(None, None), - auto_size_button=None, - button_color=None, - font=None) - -Pre-made buttons include: - - OK - Ok - Submit - Cancel - Yes - No - FileBrowse - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) - -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. - -Let's examine this form as an example: - -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], - [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. - -layout = [[sg.SimpleButton('My Button')]] - -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. - - - sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - -![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. - -**File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. - - sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for `EasyProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - # Blocking form that doesn't close - def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - - -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - -When do you use a non-blocking form? A couple of examples are -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. - -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - - -Periodic refresh - - form.ReadNonBlocking() -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - -That's it... this example follows the async design pattern well. - - - -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - -`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. - -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename - -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning - -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. - -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. - -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting - - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code - - -### Upcoming -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. - - -## Authors -MikeTheWatchGuy - -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. -![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From 7d17007418c67b29534eedef50362208a55d70dd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:03:11 -0400 Subject: [PATCH 102/521] Readme --- docs/readme.md | 1506 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1506 insertions(+) create mode 100644 docs/readme.md diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 000000000..f03d65375 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,1506 @@ + + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +# PySimpleGUI + (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + +![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) + + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + +Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. + +![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: + + EasyProgressMeter('My meter title', current_value, max value) + + ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! + +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + + +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Here is the code that produced the above screenshot. + + import PySimpleGUI as sg + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + **A note on screen shots** +You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. + +It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. + + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.MsgBox('This is my first message box') + +![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + +--- + +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + + import PySimpleGUI as sg + + rc = sg.GetTextBox('Title', 'Please input something') + sg.MsgBox('Results', 'The value returned from GetTextBox', rc) + + + ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) + +![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) + + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. + + import PySimpleGUI as sg + + `sg.MsgBoxOK('This is an OK MsgBox')` + + ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + + + sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) + + sg.MsgBoxCancel('This is a Cancel MsgBox') + +![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) + + sg.MsgBoxYesNo('This is a Yes No MsgBox') + +![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) + + + sg.MsgBoxError('This is an error MsgBox') + +![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + + sg.MsgBoxAutoClose('This is an autoclose MsgBox') + +![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) + + sg.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. + +See also the `EasyPrint` and `Print` functions. + +#### High Level User Input + +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. + - GetTextBox + - GetFileBox + - GetFolderBox + + `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` + +![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) + + submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + +![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) + + submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') + +![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + + +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + + import PySimpleGUI as sg + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + + import PySimpleGUI as sg + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +# Copy these design patterns! +## Pattern 1 - With Context Manager + + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + +## Pattern 2 - No Context Manager + + + form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + + + +These 2 design patters both produce this custom form: + +![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) + +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + +The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### How GUI Programming in Python Should Look + +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. + +Let's look at this one. + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### Laying out your form +Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. + + layout = [ [row 1], + [row 2], + [row 3] ] + +Simple enough... a list of lists. +A row is a list of Elements. For example this could be a row with a couple of elements on it. + + [ Input, Button] + +Turning back to our example. This GUI roughly looks like this: + + layout = [ [Text], + [InputText, FileBrowse] + [Submit, Cancel] ] + + Now let's put it all together into an entire program. + + +### Line by line explanation + +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [sg.InputText(), sg.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [sg.Submit(), sg.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. + + button, (source_filename, ) = form.LayoutAndRead(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. + + +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + + Another way of parsing the return values is to store the list of values into a variable representing the list of values. + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... + +--- +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the FlexForm object: + + def FlexForm(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=None, + auto_size_buttons=None, + scale=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True if elements should size themselves according to contents + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None, + justification=None) +. + + Text - The text that's displayed + size - Element's size + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color + justification - Justification for the text. String - 'left', 'right', 'center' + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(scale=(None, None), + size=(None, None)) +. + + scale - How much to scale size of element + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None, + password_char='') +. + + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) + + + Listbox(values, + select_mode=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +#### Slider Element +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + scale=(None, None), + size=(None, None), + font=None): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text + +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): +. + + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display + + +#### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + +#### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form +* Realtime + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_button=None, + button_color=None, + font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. + +layout = [[sg.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. + + + sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + +![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. + +**File Types** +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + +You setup the progress meter by calling + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): +Putting it all together you get this design pattern + + my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + # Blocking form that doesn't close + def ChatBot(): + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + +When do you use a non-blocking form? A couple of examples are +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + + form.ReadNonBlocking() +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + +That's it... this example follows the async design pattern well. + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + +`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. + +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. + +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. + +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code + + +### Upcoming +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + +## Authors +MikeTheWatchGuy + +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. +![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From eafc4f7822309ca6874be600ff74650d03bc6c52 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:15:28 -0400 Subject: [PATCH 103/521] Manually building an index.rst --- docs/index.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/index.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..910d80470 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. PySimpleGUI documentation master file, created by + sphinx-quickstart on Fri Aug 3 19:09:46 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to PySimpleGUI's documentation! +======================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: +README.md + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` From b714ea56d5df79a47b63068a8beec0f68fbe4beb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:16:43 -0400 Subject: [PATCH 104/521] Added copy of readme as index --- docs/index.md | 1506 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1506 insertions(+) create mode 100644 docs/index.md diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..f03d65375 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,1506 @@ + + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +# PySimpleGUI + (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + +![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) + + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + +Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. + +![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: + + EasyProgressMeter('My meter title', current_value, max value) + + ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! + +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + + +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Here is the code that produced the above screenshot. + + import PySimpleGUI as sg + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + **A note on screen shots** +You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. + +It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. + + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.MsgBox('This is my first message box') + +![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + +--- + +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + + import PySimpleGUI as sg + + rc = sg.GetTextBox('Title', 'Please input something') + sg.MsgBox('Results', 'The value returned from GetTextBox', rc) + + + ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) + +![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) + + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. + + import PySimpleGUI as sg + + `sg.MsgBoxOK('This is an OK MsgBox')` + + ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + + + sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) + + sg.MsgBoxCancel('This is a Cancel MsgBox') + +![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) + + sg.MsgBoxYesNo('This is a Yes No MsgBox') + +![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) + + + sg.MsgBoxError('This is an error MsgBox') + +![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + + sg.MsgBoxAutoClose('This is an autoclose MsgBox') + +![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) + + sg.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. + +See also the `EasyPrint` and `Print` functions. + +#### High Level User Input + +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. + - GetTextBox + - GetFileBox + - GetFolderBox + + `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` + +![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) + + submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + +![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) + + submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') + +![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + + +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + + import PySimpleGUI as sg + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + + import PySimpleGUI as sg + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +# Copy these design patterns! +## Pattern 1 - With Context Manager + + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + +## Pattern 2 - No Context Manager + + + form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + + + +These 2 design patters both produce this custom form: + +![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) + +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + +The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### How GUI Programming in Python Should Look + +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. + +Let's look at this one. + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### Laying out your form +Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. + + layout = [ [row 1], + [row 2], + [row 3] ] + +Simple enough... a list of lists. +A row is a list of Elements. For example this could be a row with a couple of elements on it. + + [ Input, Button] + +Turning back to our example. This GUI roughly looks like this: + + layout = [ [Text], + [InputText, FileBrowse] + [Submit, Cancel] ] + + Now let's put it all together into an entire program. + + +### Line by line explanation + +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [sg.InputText(), sg.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [sg.Submit(), sg.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. + + button, (source_filename, ) = form.LayoutAndRead(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. + + +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + + Another way of parsing the return values is to store the list of values into a variable representing the list of values. + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... + +--- +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the FlexForm object: + + def FlexForm(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=None, + auto_size_buttons=None, + scale=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True if elements should size themselves according to contents + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None, + justification=None) +. + + Text - The text that's displayed + size - Element's size + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color + justification - Justification for the text. String - 'left', 'right', 'center' + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(scale=(None, None), + size=(None, None)) +. + + scale - How much to scale size of element + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None, + password_char='') +. + + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) + + + Listbox(values, + select_mode=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +#### Slider Element +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + scale=(None, None), + size=(None, None), + font=None): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text + +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): +. + + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display + + +#### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + +#### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form +* Realtime + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_button=None, + button_color=None, + font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. + +layout = [[sg.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. + + + sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + +![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. + +**File Types** +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + +You setup the progress meter by calling + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): +Putting it all together you get this design pattern + + my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + # Blocking form that doesn't close + def ChatBot(): + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + +When do you use a non-blocking form? A couple of examples are +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + + form.ReadNonBlocking() +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + +That's it... this example follows the async design pattern well. + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + +`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. + +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. + +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. + +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code + + +### Upcoming +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + +## Authors +MikeTheWatchGuy + +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. +![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From 0b0e589aaf32c8203bc3cfe9e88ec5562d9897c9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:28:33 -0400 Subject: [PATCH 105/521] Trying different readme import --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 910d80470..88bb4950f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,7 +9,7 @@ Welcome to PySimpleGUI's documentation! .. toctree:: :maxdepth: 2 :caption: Contents: -README.md +../readme.md Indices and tables From e4f369261b223b1303453ed70246557d47507f28 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:29:04 -0400 Subject: [PATCH 106/521] Removed from docs folder --- docs/index.md | 1506 ------------------------------------------------ docs/readme.md | 1506 ------------------------------------------------ 2 files changed, 3012 deletions(-) delete mode 100644 docs/index.md delete mode 100644 docs/readme.md diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index f03d65375..000000000 --- a/docs/index.md +++ /dev/null @@ -1,1506 +0,0 @@ - - -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 -# PySimpleGUI - (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - -![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) - - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - -Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. - -![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: - - EasyProgressMeter('My meter title', current_value, max value) - - ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! - -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - - -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Here is the code that produced the above screenshot. - - import PySimpleGUI as sg - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - **A note on screen shots** -You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. - - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. - -It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. - - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. - -### Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.MsgBox('This is my first message box') - -![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - - -### Python Language Features - - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call - * Optional parameters to a function call - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - ---- - -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - - import PySimpleGUI as sg - - rc = sg.GetTextBox('Title', 'Please input something') - sg.MsgBox('Results', 'The value returned from GetTextBox', rc) - - - ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) - -![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) - - -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - - import PySimpleGUI as sg - - `sg.MsgBoxOK('This is an OK MsgBox')` - - ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) - - - sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) - - sg.MsgBoxCancel('This is a Cancel MsgBox') - -![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) - - sg.MsgBoxYesNo('This is a Yes No MsgBox') - -![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) - - - sg.MsgBoxError('This is an error MsgBox') - -![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) - - sg.MsgBoxAutoClose('This is an autoclose MsgBox') - -![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) - - sg.ScrolledTextBox(my_text, height=10) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled window. - -See also the `EasyPrint` and `Print` functions. - -#### High Level User Input - -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox - - `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` - -![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - - submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') - -![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) - - submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') - -![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) - - -#### Progress Meter! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - - import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - - import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# Copy these design patterns! -## Pattern 1 - With Context Manager - - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - -## Pattern 2 - No Context Manager - - - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - - - -These 2 design patters both produce this custom form: - -![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) - -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. - -The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. - -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. - -### How GUI Programming in Python Should Look - -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. - -Let's look at this one. - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -### Laying out your form -Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. - - layout = [ [row 1], - [row 2], - [row 3] ] - -Simple enough... a list of lists. -A row is a list of Elements. For example this could be a row with a couple of elements on it. - - [ Input, Button] - -Turning back to our example. This GUI roughly looks like this: - - layout = [ [Text], - [InputText, FileBrowse] - [Submit, Cancel] ] - - Now let's put it all together into an entire program. - - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [sg.InputText(), sg.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [sg.Submit(), sg.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - button, (source_filename, ) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. - - -## Return values - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - - Another way of parsing the return values is to store the list of values into a variable representing the list of values. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... - ---- -## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=None, - auto_size_buttons=None, - scale=(None, None), - location=(None, None), - button_color=None,Font=None, - progress_bar_color=(None,None), - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True if elements should size themselves according to contents - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None, - justification=None) -. - - Text - The text that's displayed - size - Element's size - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color - justification - Justification for the text. String - 'left', 'right', 'center' - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -**auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. - -**Shorthand functions** -The shorthand functions for `Text` are `Txt` and `T` - - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - - Output(scale=(None, None), - size=(None, None)) -. - - scale - How much to scale size of element - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(default_text = '', - scale=(None, None), - size=(None, None), - auto_size_text=None, - password_char='') -. - - default_text - Text initially shown in the input box - scale - Amount size is scaled by - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(values, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - values - Choices to be displayed. List of strings - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) - - - Listbox(values, - select_mode=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. - -#### Slider Element -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - scale=(None, None), - size=(None, None), - font=None): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text - -#### Radio Button Element -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - - Radio(text, - group_id, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - scale - Amount to scale size of element - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] - -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - - - Checkbox(text, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None): -. - - text - Text to display next to checkbox - default- Bool. Initial state - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display - - -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - - Spin(values, - intiial_value=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - List of valid values - initial_value - String with initial value - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - -#### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse -* Close Form -* Read Form -* Realtime - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. - -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - scale=(None, None), - size=(None, None), - auto_size_button=None, - button_color=None, - font=None) - -Pre-made buttons include: - - OK - Ok - Submit - Cancel - Yes - No - FileBrowse - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) - -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. - -Let's examine this form as an example: - -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], - [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. - -layout = [[sg.SimpleButton('My Button')]] - -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. - - - sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - -![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. - -**File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. - - sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for `EasyProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - # Blocking form that doesn't close - def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - - -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - -When do you use a non-blocking form? A couple of examples are -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. - -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - - -Periodic refresh - - form.ReadNonBlocking() -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - -That's it... this example follows the async design pattern well. - - - -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - -`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. - -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename - -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning - -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. - -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. - -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting - - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code - - -### Upcoming -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. - - -## Authors -MikeTheWatchGuy - -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. -![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md deleted file mode 100644 index f03d65375..000000000 --- a/docs/readme.md +++ /dev/null @@ -1,1506 +0,0 @@ - - -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 -# PySimpleGUI - (Ver 2.7) - -Super-simple GUI to grasp... Powerfully customizable. - -Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. - - import PySimpleGUI as sg - - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - -![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) - - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - -Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. - -![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: - - EasyProgressMeter('My meter title', current_value, max value) - - ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! - -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? - - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print - Complete control of colors, look and feel - Button images - - -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Here is the code that produced the above screenshot. - - import PySimpleGUI as sg - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - **A note on screen shots** -You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. - - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. - -It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. - - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code - - -### Prerequisites - -Python 3 -tkinter - -Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. - -### Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.MsgBox('This is my first message box') - -![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions - * Custom form functions - - -### Python Language Features - - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... - * Variable number of arguments to a function call - * Optional parameters to a function call - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.MsgBox('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Message Box - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def MsgBox(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - ---- - -### High Level API Calls - -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: - - - import PySimpleGUI as sg - - rc = sg.GetTextBox('Title', 'Please input something') - sg.MsgBox('Results', 'The value returned from GetTextBox', rc) - - - ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) - -![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) - - -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. - -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. - - import PySimpleGUI as sg - - `sg.MsgBoxOK('This is an OK MsgBox')` - - ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) - - - sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') - -![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) - - sg.MsgBoxCancel('This is a Cancel MsgBox') - -![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) - - sg.MsgBoxYesNo('This is a Yes No MsgBox') - -![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) - - - sg.MsgBoxError('This is an error MsgBox') - -![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) - - sg.MsgBoxAutoClose('This is an autoclose MsgBox') - -![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) - - sg.ScrolledTextBox(my_text, height=10) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: - - sprint(f'My variables values include x={x}', f'y={y}') - -This becomes a debug print of sorts that will route to a scrolled window. - -See also the `EasyPrint` and `Print` functions. - -#### High Level User Input - -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox - - `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` - -![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - - submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') - -![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) - - submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') - -![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) - - -#### Progress Meter! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - EasyProgressMeter(title, - current_value, - max_value, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - - import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - - import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. -# Copy these design patterns! -## Pattern 1 - With Context Manager - - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - -## Pattern 2 - No Context Manager - - - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) - - - -These 2 design patters both produce this custom form: - -![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) - -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. - -The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. - -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. - -### How GUI Programming in Python Should Look - -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. - -Let's look at this one. - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -### Laying out your form -Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. - - layout = [ [row 1], - [row 2], - [row 3] ] - -Simple enough... a list of lists. -A row is a list of Elements. For example this could be a row with a couple of elements on it. - - [ Input, Button] - -Turning back to our example. This GUI roughly looks like this: - - layout = [ [Text], - [InputText, FileBrowse] - [Submit, Cancel] ] - - Now let's put it all together into an entire program. - - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [sg.InputText(), sg.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [sg.Submit(), sg.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - button, (source_filename, ) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. - - -## Return values - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - - Another way of parsing the return values is to store the list of values into a variable representing the list of values. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... - ---- -## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. -![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), - auto_size_text=None, - auto_size_buttons=None, - scale=(None, None), - location=(None, None), - button_color=None,Font=None, - progress_bar_color=(None,None), - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True if elements should size themselves according to contents - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar - - -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. - -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar - - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse - Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. - - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None, - justification=None) -. - - Text - The text that's displayed - size - Element's size - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color - justification - Justification for the text. String - 'left', 'right', 'center' - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are always in this format: - - (foreground, background) - -The values foreground and background can be the color names or the hex value formatted as a string: - - "#RRGGBB" - -**auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. - -**Shorthand functions** -The shorthand functions for `Text` are `Txt` and `T` - - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) - - Output(scale=(None, None), - size=(None, None)) -. - - scale - How much to scale size of element - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) - - def InputText(default_text = '', - scale=(None, None), - size=(None, None), - auto_size_text=None, - password_char='') -. - - default_text - Text initially shown in the input box - scale - Amount size is scaled by - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) - - InputCombo(values, - scale=(None, None), - size=(None, None), - auto_size_text=None) -. - - values - Choices to be displayed. List of strings - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) - - - Listbox(values, - select_mode=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. - -#### Slider Element -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - scale=(None, None), - size=(None, None), - font=None): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - scale - Amount to scale size by - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text - -#### Radio Button Element -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) - - Radio(text, - group_id, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - scale - Amount to scale size of element - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] - -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) - - - Checkbox(text, - default=False, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None): -. - - text - Text to display next to checkbox - default- Bool. Initial state - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display - - -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) - - Spin(values, - intiial_value=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None) -. - - values - List of valid values - initial_value - String with initial value - scale - Amount to scale size of element - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display - -#### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse -* Close Form -* Read Form -* Realtime - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. - -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - scale=(None, None), - size=(None, None), - auto_size_button=None, - button_color=None, - font=None) - -Pre-made buttons include: - - OK - Ok - Submit - Cancel - Yes - No - FileBrowse - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) - -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. - -Let's examine this form as an example: - -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], - [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. - -layout = [[sg.SimpleButton('My Button')]] - -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. - - - sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - -![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. - -**File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. - - sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') - -The return value for `EasyProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(scale=(None, None), - size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - # Blocking form that doesn't close - def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - - -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - -When do you use a non-blocking form? A couple of examples are -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. - -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - - -Periodic refresh - - form.ReadNonBlocking() -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - -That's it... this example follows the async design pattern well. - - - -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - -`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. - -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename - -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning - -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. - -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. - -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. - -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting - - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code - - -### Upcoming -Make suggestions people! Future release features - -Columns. How multiple columns would be specified in the SDK interface are still being designed. - -Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. - - -## Authors -MikeTheWatchGuy - -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. -![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From 344c14a59835c4fe92e443f4b00699d0f945944a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:30:01 -0400 Subject: [PATCH 107/521] / to \ --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 88bb4950f..301abe654 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,7 +9,7 @@ Welcome to PySimpleGUI's documentation! .. toctree:: :maxdepth: 2 :caption: Contents: -../readme.md +..\readme.md Indices and tables From dbc7caeea6c914927a019eeb9786739ab6ed5667 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:30:57 -0400 Subject: [PATCH 108/521] readme --- docs/readme.md | 1506 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1506 insertions(+) create mode 100644 docs/readme.md diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 000000000..f03d65375 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,1506 @@ + + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +# PySimpleGUI + (Ver 2.7) + +Super-simple GUI to grasp... Powerfully customizable. + +Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. + + import PySimpleGUI as sg + + sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + +![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) + + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + +Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. + +![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: + + EasyProgressMeter('My meter title', current_value, max value) + + ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! + +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. + +GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? + + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Coide Proress Bar & Debug Print + Complete control of colors, look and feel + Button images + + +An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Here is the code that produced the above screenshot. + + import PySimpleGUI as sg + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + + **A note on screen shots** +You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + + +--- +### Design Goals +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. + +It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. + + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install PySimpleGUI + or +Simply download the file - PySimpleGUI.py and import it into your code + + +### Prerequisites + +Python 3 +tkinter + +Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.MsgBox('This is my first message box') + +![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: + * High Level single call functions + * Custom form functions + + +### Python Language Features + + There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + * Variable number of arguments to a function call + * Optional parameters to a function call + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Message Box + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def MsgBox(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + +--- + +### High Level API Calls + +The classic "input a value, print result" example. +Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. +This code prompts user to input a line of text and then displays that text in a messages box: + + + import PySimpleGUI as sg + + rc = sg.GetTextBox('Title', 'Please input something') + sg.MsgBox('Results', 'The value returned from GetTextBox', rc) + + + ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) + +![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) + + +#### Message Boxes +In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. + +The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. + + import PySimpleGUI as sg + + `sg.MsgBoxOK('This is an OK MsgBox')` + + ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + + + sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') + +![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) + + sg.MsgBoxCancel('This is a Cancel MsgBox') + +![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) + + sg.MsgBoxYesNo('This is a Yes No MsgBox') + +![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) + + + sg.MsgBoxError('This is an error MsgBox') + +![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + + sg.MsgBoxAutoClose('This is an autoclose MsgBox') + +![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) + + sg.ScrolledTextBox(my_text, height=10) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + +Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: + + sprint(f'My variables values include x={x}', f'y={y}') + +This becomes a debug print of sorts that will route to a scrolled window. + +See also the `EasyPrint` and `Print` functions. + +#### High Level User Input + +There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. + - GetTextBox + - GetFileBox + - GetFolderBox + + `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` + +![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) + + submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + +![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) + + submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') + +![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + + +#### Progress Meter! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + EasyProgressMeter(title, + current_value, + max_value, + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + + import PySimpleGUI as sg + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + + import PySimpleGUI as sg + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +# Copy these design patterns! +## Pattern 1 - With Context Manager + + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + +## Pattern 2 - No Context Manager + + + form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = form.LayoutAndRead(form_rows) + + + +These 2 design patters both produce this custom form: + +![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) + +It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + +The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + +You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. + +### How GUI Programming in Python Should Look + +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. + +Let's look at this one. + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### Laying out your form +Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. + + layout = [ [row 1], + [row 2], + [row 3] ] + +Simple enough... a list of lists. +A row is a list of Elements. For example this could be a row with a couple of elements on it. + + [ Input, Button] + +Turning back to our example. This GUI roughly looks like this: + + layout = [ [Text], + [InputText, FileBrowse] + [Submit, Cancel] ] + + Now let's put it all together into an entire program. + + +### Line by line explanation + +Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: +This creates a new form, storing it in the variable `form`. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], +The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. + + [sg.InputText(), sg.FileBrowse()], +Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. + + [sg.Submit(), sg.Cancel()]] + +The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. + + button, (source_filename, ) = form.LayoutAndRead(form_rows) +This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. + + +## Return values + + Return information from FlexForm, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + + Another way of parsing the return values is to store the list of values into a variable representing the list of values. + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... + +--- +## All Widgets / Elements +This code utilizes as many of the elements in one form as possible. + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', + scale=(2, 10))], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + ] + + button, values = form.LayoutAndRead(layout) + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + +Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the FlexForm object: + + def FlexForm(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + auto_size_text=None, + auto_size_buttons=None, + scale=(None, None), + location=(None, None), + button_color=None,Font=None, + progress_bar_color=(None,None), + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + icon=DEFAULT_WINDOW_ICON): + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) + auto_size_text - Bool. True if elements should size themselves according to contents + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + scale - Set size of element to be a multiple of the Element size + location - Location to place window in pixels + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar + + +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. + +#### FlexForm - form-level variables overview +A summary of the variables that can be changed when a FlexForm is created + + default_element_size - set default size for all elements in the form + auto_size_text- true/false autosizing turned on / off + scale - set scale value for all elements + button_color- default button color (foreground, background) + font - font name and size for all text items + progress_bar_color - progress bar colors + is_tabbed_form - true/false indicates form is a tabbed or normal form + border_depth - style setting for buttons, input fields + auto_close - true/false indicates if form will automatically close + auto_close_duration - how long in seconds before closing form + icon - filename for icon that's displayed on the window on taskbar + + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse + Folder Browse + Non-closing return + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + + ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. + + Text(Text, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None, + text_color=None, + justification=None) +. + + Text - The text that's displayed + size - Element's size + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color + justification - Justification for the text. String - 'left', 'right', 'center' + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are always in this format: + + (foreground, background) + +The values foreground and background can be the color names or the hex value formatted as a string: + + "#RRGGBB" + +**auto_size_text** +A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. + +**Shorthand functions** +The shorthand functions for `Text` are `Txt` and `T` + + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] +![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + scale - Element's scale + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) + + Output(scale=(None, None), + size=(None, None)) +. + + scale - How much to scale size of element + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] +![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + + def InputText(default_text = '', + scale=(None, None), + size=(None, None), + auto_size_text=None, + password_char='') +. + + default_text - Text initially shown in the input box + scale - Amount size is scaled by + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) + + InputCombo(values, + scale=(None, None), + size=(None, None), + auto_size_text=None) +. + + values - Choices to be displayed. List of strings + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) + + + Listbox(values, + select_mode=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +#### Slider Element +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + scale=(None, None), + size=(None, None), + font=None): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + scale - Amount to scale size by + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text + +#### Radio Button Element +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) + + Radio(text, + group_id, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + scale - Amount to scale size of element + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + +![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + + + Checkbox(text, + default=False, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None): +. + + text - Text to display next to checkbox + default- Bool. Initial state + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display + + +#### Spin Element +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) + + Spin(values, + intiial_value=None, + scale=(None, None), + size=(None, None), + auto_size_text=None, + font=None) +. + + values - List of valid values + initial_value - String with initial value + scale - Amount to scale size of element + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display + +#### Button Element +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse +* Close Form +* Read Form +* Realtime + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + +Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + +While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` + + SimpleButton(text, + scale=(None, None), + size=(None, None), + auto_size_button=None, + button_color=None, + font=None) + +Pre-made buttons include: + + OK + Ok + Submit + Cancel + Yes + No + FileBrowse + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + +![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) + +The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. + +Let's examine this form as an example: + +![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. + +layout = [[sg.SimpleButton('My Button')]] + +![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. + + + sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + +![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. + +**File Types** +The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen EasyProgressMeter calls presented earlier in this readme. + + sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + +The return value for `EasyProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +**Customized Progress Bar** +If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + +You setup the progress meter by calling + + my_meter = ProgressMeter(title, + max_value, + *args, + orientantion=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + scale=(None, None), + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) +Then to update the bar within your loop + + return_code = ProgressMeterUpdate(my_meter, + value, + *args): +Putting it all together you get this design pattern + + my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') + + for i in range(0, 100000): + sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') + + +The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(scale=(None, None), + size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + # Blocking form that doesn't close + def ChatBot(): + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form + # if you call LayoutAndRead from here, then you will miss the first button click + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + +When do you use a non-blocking form? A couple of examples are +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + + form.ReadNonBlocking() +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', auto_size_text=True) + # 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)) + # Create the rows + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [output_element], + [sg.SimpleButton('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + +That's it... this example follows the async design pattern well. + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + +`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. + +`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + +`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. + +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. + +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. + +**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code + + +### Upcoming +Make suggestions people! Future release features + +Columns. How multiple columns would be specified in the SDK interface are still being designed. + +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + +## Authors +MikeTheWatchGuy + +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. +![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From cb3975083b848e3186ad7ba501361bbdfd47f9b9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:32:07 -0400 Subject: [PATCH 109/521] remvoved import of readme --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 301abe654..4bd996253 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,7 +9,7 @@ Welcome to PySimpleGUI's documentation! .. toctree:: :maxdepth: 2 :caption: Contents: -..\readme.md + Indices and tables From 453c07b62edcb7cb743e5773b49a8ea77f92af7f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 3 Aug 2018 19:33:43 -0400 Subject: [PATCH 110/521] renamed readme to index --- docs/{readme.md => index.md} | 0 docs/index.rst | 20 -------------------- 2 files changed, 20 deletions(-) rename docs/{readme.md => index.md} (100%) delete mode 100644 docs/index.rst diff --git a/docs/readme.md b/docs/index.md similarity index 100% rename from docs/readme.md rename to docs/index.md diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 4bd996253..000000000 --- a/docs/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. PySimpleGUI documentation master file, created by - sphinx-quickstart on Fri Aug 3 19:09:46 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to PySimpleGUI's documentation! -======================================= - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` From 31a85377093a66be27e0180e91f996b626023ab1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 4 Aug 2018 07:38:36 -0400 Subject: [PATCH 111/521] New Demo Func Callback Sim --- Demo_Func_Callback_Simulation.py | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Demo_Func_Callback_Simulation.py diff --git a/Demo_Func_Callback_Simulation.py b/Demo_Func_Callback_Simulation.py new file mode 100644 index 000000000..618ff94ea --- /dev/null +++ b/Demo_Func_Callback_Simulation.py @@ -0,0 +1,36 @@ +import PySimpleGUI as sg + +# This design pattern simulates button callbacks +# Note that callbacks are NOT a part of the package's interface to the +# caller intentionally. The underlying implementation actually does use +# tkinter callbacks. They are simply hidden from the user. + +# The callback functions +def button1(): + print('Button 1 callback') + +def button2(): + print('Button 2 callback') + +# Create a standard form +form = sg.FlexForm('Button callback example') +# Layout the design of the GUI +layout = [[sg.Text('Please click a button', auto_size_text=True)], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] +# Show the form to the user +form.Layout(layout) + +# Event loop. Read buttons, make callbacks +while True: + # Read the form + button, value = form.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break + +# All done! +sg.MsgBoxOK('Done') From 41561e8d54532f5ce6f4430e0499204fc4519345 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 5 Aug 2018 23:17:42 -0400 Subject: [PATCH 112/521] Super Simple Demo initial checkin --- Demo_Super_Simple_Form.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Demo_Super_Simple_Form.py diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py new file mode 100644 index 000000000..0d13708e8 --- /dev/null +++ b/Demo_Super_Simple_Form.py @@ -0,0 +1,13 @@ +import PySimpleGUI as sg + +form = sg.FlexForm('Simple data entry form') # begin with a blank form + +layout = [[sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()]] + +button, (name, address, phone) = form.LayoutAndRead(layout) + +print(name, address, phone) \ No newline at end of file From 99035fb5e8cca8fcb4a646511864844fb4d74ed2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 6 Aug 2018 12:20:18 -0400 Subject: [PATCH 113/521] A bunch of fixes Removed some color defaults Added _ to some class methods so users won't get confused and call them. _close in particular. Fix for combobox problem Fixed CRASH when using tabbed forms demo due to rename _ Removed random colors --- PySimpleGUI.py | 74 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b6c0d7380..d547fc0cd 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -9,7 +9,7 @@ import sys import textwrap -# ----====----====----==== Constants the use CAN safely change ====----====----====----# +# ----====----====----==== Constants the user CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = '' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term @@ -34,8 +34,8 @@ COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") -DEFAULT_CANCEL_BUTTON_COLOR = (GREENS[3], TANS[0]) DEFAULT_BACKGROUND_COLOR = None DEFAULT_ELEMENT_BACKGROUND_COLOR = None DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = None @@ -646,9 +646,9 @@ def ButtonCallBack(self): self.ParentForm.Results[r][c] = True # mark this button's location in results # if the form is tabbed, must collect all form's results and destroy all forms if self.ParentForm.IsTabbedForm: - self.ParentForm.UberParent.Close() + self.ParentForm.UberParent._Close() else: - self.ParentForm.Close() + self.ParentForm._Close() self.ParentForm.TKroot.quit() if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() @@ -718,8 +718,6 @@ def UpdateBar(self, current_count): target_element = self.ParentForm.GetElementAtLocation(target) strvar = target_element.TKStringVar rc = strvar.set(self.TextToDisplay) - # update the progress bar counter - # self.TKProgressBar['value'] = self.CurrentValue self.TKProgressBar.Update(current_count) try: @@ -848,7 +846,7 @@ def AddRow(self, *args, auto_size_text=None): ''' Parms are a variable number of Elements ''' NumRows = len(self.Rows) # number of existing rows is our row number CurrentRowNumber = NumRows # this row's number - CurrentRow = Row(auto_size_text) # start with a blank row and build up + CurrentRow = Row(auto_size_text=auto_size_text) # start with a blank row and build up # ------------------------- Add the elements to a row ------------------------- # for i, element in enumerate(args): # Loop through list of elements and add them to the row element.Position = (CurrentRowNumber, i) @@ -900,17 +898,17 @@ def GetElementAtLocation(self, location): element = row.Elements[col_num] return element - def GetDefaultElementSize(self): + def _GetDefaultElementSize(self): return self.DefaultElementSize - def AutoCloseAlarmCallback(self): + def _AutoCloseAlarmCallback(self): try: if self.UberParent: window = self.UberParent else: window = self if window: - window.Close() + window._Close() self.TKroot.quit() self.RootNeedsDestroying = True except: @@ -953,7 +951,7 @@ def Refresh(self, Message=''): _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 return BuildResults(self) - def Close(self): + def _Close(self): try: self.TKroot.update() except: pass @@ -1008,10 +1006,10 @@ def __init__(self): def AddForm(self, form): self.FormList.append(form) - def Close(self): + def _Close(self): self.FormReturnValues = [] for form in self.FormList: - form.Close() + form._Close() self.FormReturnValues.append(form.ReturnValues) if not self.TKrootDestroyed: self.TKrootDestroyed = True @@ -1033,8 +1031,8 @@ def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_tex return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text) # ------------------------- INPUT COMBO Element lazy functions ------------------------- # -def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None): - return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) +def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): + return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text, background_color=background_color) def DropDown(values, scale=(None, None), size=(None, None), auto_size_text=None): return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) @@ -1331,15 +1329,15 @@ def CharWidthInPixels(): bc = MyFlexForm.ButtonColor else: bc = DEFAULT_BUTTON_COLOR - if bc == 'Random' or bc == 'random': - bc = GetRandomColorPair() border_depth = element.BorderWidth if btype != BUTTON_TYPE_REALTIME: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth) else: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, foreground=bc[0], background=bc[1], bd=border_depth) + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth) tkbutton.bind('', element.ButtonReleaseCallBack) tkbutton.bind('', element.ButtonPressCallBack) + if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: + tkbutton.config(foreground=bc[0], background=bc[1]) element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels if element.ImageFilename: # if button has an image on it @@ -1389,7 +1387,16 @@ def CharWidthInPixels(): 'fieldbackground': element.BackgroundColor, 'background': element.BackgroundColor} }}) - except: pass + except: + try: + combostyle.theme_settings('combostyle', + settings={'TCombobox': + {'configure': + {'selectbackground': element.BackgroundColor, + 'fieldbackground': element.BackgroundColor, + 'background': element.BackgroundColor} + }}) + except: pass # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox combostyle.theme_use('combostyle') element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) @@ -1602,7 +1609,7 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A uber.FormReturnValues.append(form.ReturnValues) # dangerous?? or clever? use the final form as a callback for autoclose - id = root.after(auto_close_duration * 1000, form.AutoCloseAlarmCallback) if auto_close else 0 + id = root.after(auto_close_duration * 1000, form._AutoCloseAlarmCallback) if auto_close else 0 icon = fav_icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon try: uber.TKroot.iconbitmap(icon) except: pass @@ -1631,7 +1638,7 @@ def StartupTK(my_flex_form): if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration - my_flex_form.TKAfterID = root.after(duration * 1000, my_flex_form.AutoCloseAlarmCallback) + my_flex_form.TKAfterID = root.after(duration * 1000, my_flex_form._AutoCloseAlarmCallback) if my_flex_form.NonBlocking: my_flex_form.TKroot.protocol("WM_WINDOW_DESTROYED", my_flex_form.OnClosingCallback()) pass @@ -1766,7 +1773,7 @@ def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False # ============================== MsgBoxCancel =====# # # # ===================================================# -def MsgBoxCancel(*args, button_color=DEFAULT_CANCEL_BUTTON_COLOR, auto_close=False, auto_close_duration=None, font=None): +def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): ''' Display a MsgBox with a single "Cancel" button. :param args: @@ -1782,7 +1789,7 @@ def MsgBoxCancel(*args, button_color=DEFAULT_CANCEL_BUTTON_COLOR, auto_close=Fal # ============================== MsgBoxOK =====# # Like MsgBox but only 1 button # # ===================================================# -def MsgBoxOK(*args, button_color=('white', 'black'), auto_close=False, auto_close_duration=None, font=None): +def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): ''' Display a MsgBox with a single buttoned labelled "OK" :param args: @@ -1908,7 +1915,7 @@ def ProgressMeterUpdate(bar, value, *args): rc = bar.UpdateBar(value) if value >= bar.MaxValue or not rc: bar.BarExpired = True - bar.ParentForm.Close() + bar.ParentForm._Close() if bar.ParentForm.RootNeedsDestroying: try: _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 @@ -2102,6 +2109,15 @@ def eprint(*args, size=(None,None), end=None, sep=None): EasyPrint(*args, size=size, end=end, sep=sep) def EasyPrint(*args, size=(None,None), end=None, sep=None): + global _easy_print_data + + if _easy_print_data is None: + _easy_print_data = DebugWin(size=size) + _easy_print_data.Print(*args, end=end, sep=sep) + + + +def EasyPrintold(*args, size=(None,None), end=None, sep=None): if 'easy_print_data' not in EasyPrint.__dict__: # use a function property to save DebugWin object (static variable) EasyPrint.easy_print_data = DebugWin(size=size) if EasyPrint.easy_print_data is None: @@ -2111,7 +2127,7 @@ def EasyPrint(*args, size=(None,None), end=None, sep=None): def EasyPrintClose(): if 'easy_print_data' in EasyPrint.__dict__: if EasyPrint.easy_print_data is not None: - EasyPrint.easy_print_data.Close() + EasyPrint.easy_print_data._Close() EasyPrint.easy_print_data = None # del EasyPrint.easy_print_data @@ -2224,7 +2240,7 @@ def SetGlobalIcon(icon): # ============================== SetOptions =========# # Sets the icon to be used by default # # ===================================================# -def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), margins=(None,None), +def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=(None,None), element_padding=(None,None),auto_size_text=None, auto_size_buttons=None, font=None, border_width=None, slider_border_width=None, slider_relief=None, slider_orientation=None, autoclose_time=None, message_box_line_width=None, @@ -2271,8 +2287,8 @@ def SetOptions(icon=None, button_color=(None,None), element_size=(None,None), ma raise FileNotFoundError _my_windows.user_defined_icon = icon - if button_color != (None,None): - DEFAULT_BUTTON_COLOR = (button_color[0], button_color[1]) + if button_color != None: + DEFAULT_BUTTON_COLOR = button_color if element_size != (None,None): DEFAULT_ELEMENT_SIZE = element_size From d603ab04bd55873792020fa2bfcc2fe02cccf303 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 7 Aug 2018 07:30:51 -0400 Subject: [PATCH 114/521] Text color option for all elements, New None value for checkbox initial value --- PySimpleGUI.py | 140 ++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d547fc0cd..1d98d7da1 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -38,8 +38,9 @@ DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_BACKGROUND_COLOR = None DEFAULT_ELEMENT_BACKGROUND_COLOR = None +DEFAULT_ELEMENT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = None -DEFAULT_TEXT_COLOR = 'black' +DEFAULT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT DEFAULT_INPUT_ELEMENTS_COLOR = COLOR_SYSTEM_DEFAULT DEFAULT_SCROLLBAR_COLOR = None # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember @@ -72,7 +73,7 @@ DEFAULT_METER_ORIENTATION = 'Horizontal' DEFAULT_SLIDER_ORIENTATION = 'vertical' DEFAULT_SLIDER_BORDER_WIDTH=1 -DEFAULT_SLIDER_RELIEF = tk.SUNKEN +DEFAULT_SLIDER_RELIEF = tk.FLAT DEFAULT_LISTBOX_SELECT_MODE = tk.SINGLE SELECT_MODE_MULTIPLE = tk.MULTIPLE @@ -153,7 +154,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # Element CLASS # # ------------------------------------------------------------------------- # class Element(): - def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): self.Size = size self.Type = type self.AutoSizeText = auto_size_text @@ -171,7 +172,7 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.TextInputDefault = None self.Position = (0,0) # Default position Row 0, Col 0 self.BackgroundColor = background_color if background_color is not None else DEFAULT_ELEMENT_BACKGROUND_COLOR - return + self.TextColor = text_color if text_color is not None else DEFAULT_ELEMENT_TEXT_COLOR def __del__(self): try: @@ -195,7 +196,7 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None): ''' Input a line of text Element :param default_text: Default value to display @@ -208,14 +209,13 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto self.DefaultText = default_text self.PasswordCharacter = password_char bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg) - return + super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color) def ReturnKeyHandler(self, event): MyForm = self.ParentForm # search through this form and find the first button that will exit the form for row in MyForm.Rows: - for element in row.Elements: + for element in row: if element.Type == ELEM_TYPE_BUTTON: if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: element.ButtonCallBack() @@ -229,7 +229,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): + def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -241,8 +241,7 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text self.Values = values self.TKComboBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg) - return + super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color) def __del__(self): try: @@ -257,7 +256,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): ''' Listbox Element :param values: @@ -280,8 +279,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non else: self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg) - return + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=text_color) def __del__(self): try: @@ -296,7 +294,7 @@ def __del__(self): # Radio # # ---------------------------------------------------------------------- # class Radio(Element): - def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, font=None): + def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None): ''' Radio Button Element :param text: @@ -313,8 +311,7 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None self.TKRadio = None self.GroupID = group_id self.Value = None - super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color) - return + super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color) def __del__(self): try: @@ -327,7 +324,7 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): ''' Check Box Element :param text: @@ -343,8 +340,7 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.Value = None self.TKCheckbox = None - super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color) - return + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color) def __del__(self): try: @@ -360,7 +356,7 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None): + def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): ''' Spin Box Element :param values: @@ -375,7 +371,7 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N self.DefaultValue = initial_value self.TKSpinBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg) + super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=text_color) return def __del__(self): @@ -389,7 +385,7 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None): ''' Input Multi-line Element :param default_text: @@ -402,14 +398,14 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s self.DefaultText = default_text self.EnterSubmits = enter_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg) + super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color) return def ReturnKeyHandler(self, event): MyForm = self.ParentForm # search through this form and find the first button that will exit the form for row in MyForm.Rows: - for element in row.Elements: + for element in row: if element.Type == ELEM_TYPE_BUTTON: if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: element.ButtonCallBack() @@ -443,7 +439,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N bg = background_color # self.Font = Font if Font else DEFAULT_FONT # i=1/0 - super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT) + super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor) return def Update(self, NewValue): @@ -508,11 +504,13 @@ def __del__(self): # Scroll bar will span the length of the frame # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): - def __init__(self, parent, width, height, bd, background_color=None): + def __init__(self, parent, width, height, bd, background_color=None, text_color=None): tk.Frame.__init__(self, parent) self.output = tk.Text(parent, width=width, height=height, bd=bd) if background_color and background_color != COLOR_SYSTEM_DEFAULT: self.output.configure(background=background_color) + if text_color and text_color != COLOR_SYSTEM_DEFAULT: + self.output.configure(fg=text_color) self.vsb = tk.Scrollbar(parent, orient="vertical", command=self.output.yview) self.output.configure(yscrollcommand=self.vsb.set) self.output.pack(side="left", fill="both", expand=True) @@ -548,7 +546,7 @@ def __del__(self): # Routes stdout, stderr to a scrolled window # # ---------------------------------------------------------------------- # class Output(Element): - def __init__(self, scale=(None, None), size=(None, None), background_color=None): + def __init__(self, scale=(None, None), size=(None, None), background_color=None, text_color=None): ''' Output Element - reroutes stdout, stderr to this window :param scale: Adds multiplier to size (w,h) @@ -557,7 +555,7 @@ def __init__(self, scale=(None, None), size=(None, None), background_color=None) ''' self.TKOut = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg) + super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=text_color) def __del__(self): try: @@ -665,7 +663,7 @@ def ReturnKeyHandler(self, event): MyForm = self.ParentForm # search through this form and find the first button that will exit the form for row in MyForm.Rows: - for element in row.Elements: + for element in row: if element.Type == ELEM_TYPE_BUTTON: if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: element.ButtonCallBack() @@ -756,7 +754,7 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None): + def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None): ''' Slider Element :param range: @@ -775,7 +773,7 @@ def __init__(self, range=(None,None), default_value=None, orientation=None, bord self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF - super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color) + super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color) return def __del__(self): @@ -783,28 +781,6 @@ def __del__(self): -# ------------------------------------------------------------------------- # -# Row CLASS # -# ------------------------------------------------------------------------- # -class Row(): - def __init__(self, auto_size_text = None): - self.AutoSizeText = auto_size_text # Setting to override the form's policy on autosizing. - self.Elements = [] # List of Elements in this Rrow - return - - # ------------------------- AddElement ------------------------- # - def AddElement(self, element): - self.Elements.append(element) - return - - # ------------------------- Print ------------------------- # - def __str__(self): - outstr = '' - for i, element in enumerate(self.Elements): - outstr += 'Element #%i = %s'%(i,element) - # outstr += f'Element #{i} = {element}' - return outstr - # ------------------------------------------------------------------------- # # FlexForm CLASS # # ------------------------------------------------------------------------- # @@ -842,16 +818,15 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.ResultsBuilt = False # ------------------------- Add ONE Row to Form ------------------------- # - def AddRow(self, *args, auto_size_text=None): + def AddRow(self, *args): ''' Parms are a variable number of Elements ''' NumRows = len(self.Rows) # number of existing rows is our row number CurrentRowNumber = NumRows # this row's number - CurrentRow = Row(auto_size_text=auto_size_text) # start with a blank row and build up + CurrentRow = [] # start with a blank row and build up # ------------------------- Add the elements to a row ------------------------- # for i, element in enumerate(args): # Loop through list of elements and add them to the row element.Position = (CurrentRowNumber, i) - CurrentRow.Elements.append(element) - CurrentRow.AutoSizeText = auto_size_text + CurrentRow.append(element) # ------------------------- Append the row to list of Rows ------------------------- # self.Rows.append(CurrentRow) @@ -878,7 +853,7 @@ def Show(self, non_blocking=False): self.Shown = True # Compute num rows & num cols (it'll come in handy debugging) self.NumRows = len(self.Rows) - self.NumCols = max(len(row.Elements) for row in self.Rows) + self.NumCols = max(len(row) for row in self.Rows) self.NonBlocking=non_blocking # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## @@ -895,7 +870,7 @@ def SetIcon(self, icon): def GetElementAtLocation(self, location): (row_num,col_num) = location row = self.Rows[row_num] - element = row.Elements[col_num] + element = row[col_num] return element def _GetDefaultElementSize(self): @@ -981,7 +956,7 @@ def __exit__(self, *a): def __del__(self): for row in self.Rows: - for element in row.Elements: + for element in row: element.__del__() try: del(self.TKroot) @@ -1106,7 +1081,7 @@ def InitializeResults(form): return_vals = [] for row_num,row in enumerate(form.Rows): r = [] - for element in row.Elements: + for element in row: if element.Type == ELEM_TYPE_TEXT: r.append(None) if element.Type == ELEM_TYPE_IMAGE: @@ -1169,7 +1144,7 @@ def BuildResults(form): button_pressed_text = None input_values = [] for row_num,row in enumerate(form.Rows): - for col_num, element in enumerate(row.Elements): + for col_num, element in enumerate(row): if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() results[row_num][col_num] = value @@ -1253,7 +1228,7 @@ def CharWidthInPixels(): # *********** ------- Loop through ELEMENTS ------- ***********# # *********** Make TK Row ***********# tk_row_frame = tk.Frame(master) - for col_num, element in enumerate(flex_row.Elements): + for col_num, element in enumerate(flex_row): element.ParentForm = MyFlexForm # save the button's parent form object if MyFlexForm.Font and (element.Font == DEFAULT_FONT or not element.Font): font = MyFlexForm.Font @@ -1262,8 +1237,6 @@ def CharWidthInPixels(): # ------- Determine Auto-Size setting on a cascading basis ------- # if element.AutoSizeText is not None: # if element overide auto_size_text = element.AutoSizeText - elif flex_row.AutoSizeText is not None: # if Row override - auto_size_text = flex_row.AutoSizeText elif MyFlexForm.AutoSizeText is not None: # if form override auto_size_text = MyFlexForm.AutoSizeText else: @@ -1278,6 +1251,8 @@ def CharWidthInPixels(): element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) elif MyFlexForm.Scale != (None, None): element_size = (int(element_size[0] * MyFlexForm.Scale[0]), int(element_size[1] * MyFlexForm.Scale[1])) + # Set foreground color + text_color = element.TextColor # ------------------------- TEXT element ------------------------- # element_type = element.Type if element_type == ELEM_TYPE_TEXT: @@ -1301,13 +1276,16 @@ def CharWidthInPixels(): width = 0 justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE - tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth, fg=element.TextColor) + tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + tktext_label.configure(fg=element.TextColor) + tktext_label.pack(side=tk.LEFT) # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: @@ -1367,6 +1345,8 @@ def CharWidthInPixels(): element.TKEntry.bind('', element.ReturnKeyHandler) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKEntry.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKEntry.configure(fg=text_color) element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) if not focus_set: focus_set = True @@ -1385,6 +1365,7 @@ def CharWidthInPixels(): {'configure': {'selectbackground': element.BackgroundColor, 'fieldbackground': element.BackgroundColor, + 'foreground': text_color, 'background': element.BackgroundColor} }}) except: @@ -1394,6 +1375,7 @@ def CharWidthInPixels(): {'configure': {'selectbackground': element.BackgroundColor, 'fieldbackground': element.BackgroundColor, + 'foreground': text_color, 'background': element.BackgroundColor} }}) except: pass @@ -1419,6 +1401,8 @@ def CharWidthInPixels(): element.TKListbox.selection_set(0,0) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKListbox.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKListbox.configure(fg=text_color) # vsb = tk.Scrollbar(tk_row_frame, orient="vertical", command=element.TKListbox.yview) # element.TKListbox.configure(yscrollcommand=vsb.set) element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) @@ -1438,15 +1422,21 @@ def CharWidthInPixels(): if not focus_set: focus_set = True element.TKText.focus_set() + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKText.configure(fg=text_color) # ------------------------- INPUT CHECKBOX element ------------------------- # elif element_type == ELEM_TYPE_INPUT_CHECKBOX: width = 0 if auto_size_text else element_size[0] default_value = element.InitialState element.TKIntVar = tk.IntVar() - element.TKIntVar.set(default_value) + element.TKIntVar.set(default_value if default_value is not None else 0) element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) + if default_value is None: + element.TKCheckbutton.configure(state='disable') if element.BackgroundColor is not None: element.TKCheckbutton.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKCheckbutton.configure(fg=text_color) element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- PROGRESS BAR element ------------------------- # elif element_type == ELEM_TYPE_PROGRESS_BAR: @@ -1485,6 +1475,8 @@ def CharWidthInPixels(): variable=element.TKIntVar, value=value, bd=border_depth, font=font) if element.BackgroundColor is not None: element.TKRadio.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKRadio.configure(fg=text_color) element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) # ------------------------- INPUT SPIN Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SPIN: @@ -1497,10 +1489,12 @@ def CharWidthInPixels(): if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKSpinBox.configure(background=element.BackgroundColor) element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKSpinBox.configure(fg=text_color) # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor) + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color) element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: @@ -1530,6 +1524,8 @@ def CharWidthInPixels(): if element.BackgroundColor is not None: tkscale.configure(background=element.BackgroundColor) tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + tkscale.configure(fg=text_color) tkscale.pack(side=tk.LEFT) #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets @@ -2248,7 +2244,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None, text_justification=None, background_color=None, element_background_color=None, text_element_background_color=None, input_elements_background_color=None, - scrollbar_color=None, text_color=None, debug_win_size=(None,None), window_location=(None,None)): + scrollbar_color=None, text_color=None, element_text_color = None, debug_win_size=(None,None), window_location=(None,None)): global DEFAULT_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term @@ -2277,6 +2273,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( global DEFAULT_SCROLLBAR_COLOR global DEFAULT_TEXT_COLOR global DEFAULT_WINDOW_LOCATION + global DEFAULT_ELEMENT_TEXT_COLOR global _my_windows if icon: @@ -2368,6 +2365,9 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( if scrollbar_color != None: DEFAULT_SCROLLBAR_COLOR = scrollbar_color + if element_text_color != None: + DEFAULT_ELEMENT_TEXT_COLOR = element_text_color + return True # ============================== sprint ======# From 984f4b6d72fb1e872348876c2a0f7b23d5024912 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 8 Aug 2018 10:40:40 -0400 Subject: [PATCH 115/521] Dictionary Return Values! Return values in dictionary form, removed random colors capability --- PySimpleGUI.py | 94 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1d98d7da1..8082c2024 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -4,7 +4,6 @@ from tkinter import ttk import tkinter.scrolledtext as tkst import tkinter.font -from random import randint import datetime import sys import textwrap @@ -154,7 +153,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # Element CLASS # # ------------------------------------------------------------------------- # class Element(): - def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): + def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): self.Size = size self.Type = type self.AutoSizeText = auto_size_text @@ -173,6 +172,7 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.Position = (0,0) # Default position Row 0, Col 0 self.BackgroundColor = background_color if background_color is not None else DEFAULT_ELEMENT_BACKGROUND_COLOR self.TextColor = text_color if text_color is not None else DEFAULT_ELEMENT_TEXT_COLOR + self.Key = key # dictionary key for return values def __del__(self): try: @@ -196,7 +196,7 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, key=None): ''' Input a line of text Element :param default_text: Default value to display @@ -209,7 +209,7 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto self.DefaultText = default_text self.PasswordCharacter = password_char bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) def ReturnKeyHandler(self, event): MyForm = self.ParentForm @@ -229,7 +229,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None): + def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -241,7 +241,7 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text self.Values = values self.TKComboBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) def __del__(self): try: @@ -256,7 +256,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): + def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): ''' Listbox Element :param values: @@ -279,7 +279,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non else: self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=text_color, key=key) def __del__(self): try: @@ -294,7 +294,7 @@ def __del__(self): # Radio # # ---------------------------------------------------------------------- # class Radio(Element): - def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None): + def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None, key=None): ''' Radio Button Element :param text: @@ -311,7 +311,7 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None self.TKRadio = None self.GroupID = group_id self.Value = None - super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key) def __del__(self): try: @@ -324,7 +324,7 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): + def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): ''' Check Box Element :param text: @@ -340,7 +340,7 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.Value = None self.TKCheckbox = None - super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key) def __del__(self): try: @@ -356,7 +356,7 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None): + def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): ''' Spin Box Element :param values: @@ -371,7 +371,7 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N self.DefaultValue = initial_value self.TKSpinBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=text_color, key=key) return def __del__(self): @@ -385,7 +385,7 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None): + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None): ''' Input Multi-line Element :param default_text: @@ -398,7 +398,7 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s self.DefaultText = default_text self.EnterSubmits = enter_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) return def ReturnKeyHandler(self, event): @@ -754,7 +754,7 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None): + def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None): ''' Slider Element :param range: @@ -773,7 +773,7 @@ def __init__(self, range=(None,None), default_value=None, orientation=None, bord self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF - super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color) + super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key) return def __del__(self): @@ -788,7 +788,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, use_dictionary=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -815,7 +815,9 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.RootNeedsDestroying = False self.Shown = False self.ReturnValues = None + self.ReturnValuesDictionary = None self.ResultsBuilt = False + self.UseDictionary = use_dictionary # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -1143,22 +1145,32 @@ def BuildResults(form): results=form.Results button_pressed_text = None input_values = [] + input_values_dictionary = {} for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: value=element.TKIntVar.get() results[row_num][col_num] = value input_values.append(value != 0) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_RADIO: RadVar=element.TKIntVar.get() this_rowcol = EncodeRadioRowCol(row_num,col_num) value = RadVar == this_rowcol results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_BUTTON: if results[row_num][col_num] is True: button_pressed_text = element.ButtonText @@ -1168,11 +1180,17 @@ def BuildResults(form): value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_LISTBOX: items=element.TKListbox.curselection() value = [element.Values[int(item)] for item in items] results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_SPIN: try: value=element.TKStringVar.get() @@ -1180,6 +1198,9 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_SLIDER: try: value=element.TKIntVar.get() @@ -1187,6 +1208,9 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) @@ -1196,11 +1220,21 @@ def BuildResults(form): value = None results[row_num][col_num] = value input_values.append(value) + try: + input_values_dictionary[element.Key] = value + except: pass - return_value = button_pressed_text,input_values - form.ReturnValues = return_value + try: + input_values_dictionary.pop(None, None) # clean up dictionary include None was included + except: pass + + if not form.UseDictionary: + form.ReturnValues = button_pressed_text, input_values + else: + form.ReturnValues = button_pressed_text, input_values_dictionary + form.ReturnValuesDictionary = button_pressed_text, input_values_dictionary form.ResultsBuilt = True - return return_value + return form.ReturnValues # ------------------------------------------------------------------------------------------------------------------ # @@ -1447,9 +1481,7 @@ def CharWidthInPixels(): progress_length = width*char_width progress_width = element_size[1] direction = element.Orientation - if element.BarColor == 'Random' or element.BarColor == 'random': - bar_color = GetRandomColorPair() - elif element.BarColor != (None, None): # if element has a bar color, use it + if element.BarColor != (None, None): # if element has a bar color, use it bar_color = element.BarColor else: bar_color = DEFAULT_PROGRESS_BAR_COLOR @@ -2034,18 +2066,6 @@ def EasyProgressMeterCancel(title, *args): return True -def GetRandomColor(): - nums = randint(0,255), randint(0,255), randint(0,255) - color_code ='#' + ''.join('{:02X}'.format(a) for a in nums) - return color_code - - -def GetRandomColorPair(): - fg = GetRandomColor() - bg = GetComplimentaryHex(fg) - color_code = (fg, bg) - return color_code - # input is #RRGGBB # output is #RRGGBB def GetComplimentaryHex(color): From 5cf0d26ac095f29fa3f2ca955414435ac42374b2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 8 Aug 2018 10:44:11 -0400 Subject: [PATCH 116/521] Demo Dictionary Feature Requires latest PySimpleGUI.py file --- Demo_Dictionary.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Demo_Dictionary.py diff --git a/Demo_Dictionary.py b/Demo_Dictionary.py new file mode 100644 index 000000000..c1a060da4 --- /dev/null +++ b/Demo_Dictionary.py @@ -0,0 +1,22 @@ +import PySimpleGUI as sg + +# THIS FILE REQIRES THE LATEST PySimpleGUI.py FILE +# IT WILL NOT WORK WITH CURRENT PIP RELEASE (2.7) + +# Shows how to use return values in dictionary form + +form = sg.FlexForm('Simple data entry form', use_dictionary=True) # begin with a blank form + +layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + +button, values = form.LayoutAndRead(layout) + +sg.MsgBox(button, values, values['name'], values['address'], values['phone']) + +print(values) From 90925af23ede07fe0dff455e872bb14e9a7c918c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 8 Aug 2018 12:42:58 -0400 Subject: [PATCH 117/521] Support for Dictionary return values --- readme.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index f03d65375..b433cf533 100644 --- a/readme.md +++ b/readme.md @@ -2,15 +2,19 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 + +![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) + + # PySimpleGUI (Ver 2.7) Super-simple GUI to grasp... Powerfully customizable. -Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. +Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, **you've found your GUI package**. import PySimpleGUI as sg @@ -23,7 +27,7 @@ Looking to take your Python code from the world of command lines and into the co ![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) -Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. +Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. ![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) @@ -40,7 +44,7 @@ You can build an async media player GUI with custom buttons in 30 lines of code. I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and `PySimpleGUI` is that in addition to getting the simple Message Boxes you also get the ability to **make your own forms** that are highly customizeable. Don't like the standard Message Box? Then make your own! Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. @@ -73,7 +77,7 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Persistent Windows Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print + Single-Line-Of-Code Proress Bar & Debug Print Complete control of colors, look and feel Button images @@ -480,6 +484,10 @@ This is the code that **displays** the form, collects the information and return ## Return values + As of version 2.8 there are 2 forms of return values, list and dictionary. +### Return values as a list + By default return values are a list of values, one entry for each input field. + Return information from FlexForm, SG's primary form builder interface, is in this format: button, (value1, value2, ...) @@ -498,14 +506,40 @@ If you have a SINGLE value being returned, it is written this way: button, (value1,) = form.LayoutAndRead(form_rows) - Another way of parsing the return values is to store the list of values into a variable representing the list of values. + Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. button, value_list = form.LayoutAndRead(form_rows) value1 = value_list[0] value2 = value_list[1] ... +### Return values as a dictionary + +If you wish to receive the return values as a dictionary rather than a simple list, then you'll have to do 2 things: +1. Indicate in the form creation that the return should be a dictionary by setting `use_dictionary = True` +2. Mark each input element you wish to be in the dictionary with the keyword `key`. + +This sample program demonstrates these 2 steps as well as how to address the return values (e.g. `values['name']`) + + + import PySimpleGUI as sg + form = sg.FlexForm('Simple data entry form', use_dictionary=True) + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + sg.MsgBox(button, values, values['name'], values['address'], values['phone']) + + --- + + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. @@ -588,7 +622,7 @@ Parameter Descriptions. You will find these same parameters specified for each auto_size_text - Bool. True if elements should size themselves according to contents auto_size_buttons - Bool. True if button elements should size themselves according to their text label scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels + location - (x,y) Location to place window in pixels button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars is_tabbed_form - Bool. If True then form is a tabbed form @@ -598,6 +632,9 @@ Parameter Descriptions. You will find these same parameters specified for each icon - .ICO file that will appear on the Task Bar and end of Title Bar +#### Window Location +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. + #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. @@ -892,7 +929,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating . text - Text to display next to checkbox - default- Bool. Initial state + default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) scale - Amount to scale size of element size - (width, height) size of element in characters auto_size_text- Bool. True if should size width to fit text @@ -1418,6 +1455,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting +| 2.8.0 | Aug xx, 2018 - PLANNED - New None default option for Checkbox element, text color option for all elements, return values as a dictionary ### Release Notes From 4962b02799ab621bd54fb73b2d69bcd37be933c3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 06:53:13 -0400 Subject: [PATCH 118/521] New "launcher" demo program Initial checkin --- Demo_Script_Launcher.py | 36 ++++++++++++++++++++++++++++++++++++ SimScript_.py | 4 ++++ 2 files changed, 40 insertions(+) create mode 100644 Demo_Script_Launcher.py create mode 100644 SimScript_.py diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py new file mode 100644 index 000000000..bcc06b004 --- /dev/null +++ b/Demo_Script_Launcher.py @@ -0,0 +1,36 @@ +import PySimpleGUI as sg +import os + +def Launcher(): + + form = sg.FlexForm('Script launcher') + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')] + ] + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandOS('python SimScript.py') + elif button == 'script2': + ExecuteCommandOS('python SimScript.py') + elif button == 'Enter': + ExecuteCommandOS(value[0]) # send string without carriage return on end + + +def ExecuteCommandOS(command): + output = os.popen(command).read() + print(output) + + +if __name__ == '__main__': + Launcher() + diff --git a/SimScript_.py b/SimScript_.py new file mode 100644 index 000000000..2185935b3 --- /dev/null +++ b/SimScript_.py @@ -0,0 +1,4 @@ +import time + +for i in range(100): + print(i,'', end='') From 49e89c787577483a2fda4b2428de6220e8c30ff9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 09:35:21 -0400 Subject: [PATCH 119/521] Focus set and return key handling options Exposed the ability to set where the initial forus is as well as which elements should be bound to the return key. --- PySimpleGUI.py | 135 +++++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 8082c2024..c75a160fe 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -174,6 +174,15 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.TextColor = text_color if text_color is not None else DEFAULT_ELEMENT_TEXT_COLOR self.Key = key # dictionary key for return values + def ReturnKeyHandler(self, event): + MyForm = self.ParentForm + # search through this form and find the first button that will exit the form + for row in MyForm.Rows: + for element in row: + if element.Type == ELEM_TYPE_BUTTON: + if element.BindReturnKey: + element.ButtonCallBack() + def __del__(self): try: self.TKStringVar.__del__() @@ -196,7 +205,7 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, key=None): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, key=None, focus=False): ''' Input a line of text Element :param default_text: Default value to display @@ -209,17 +218,10 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto self.DefaultText = default_text self.PasswordCharacter = password_char bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + self.Focus = focus super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) - def ReturnKeyHandler(self, event): - MyForm = self.ParentForm - # search through this form and find the first button that will exit the form - for row in MyForm.Rows: - for element in row: - if element.Type == ELEM_TYPE_BUTTON: - if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: - element.ButtonCallBack() - return + def __del__(self): super().__del__() @@ -385,7 +387,7 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None): + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, focus=False): ''' Input Multi-line Element :param default_text: @@ -398,18 +400,10 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s self.DefaultText = default_text self.EnterSubmits = enter_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + self.Focus = focus super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) return - def ReturnKeyHandler(self, event): - MyForm = self.ParentForm - # search through this form and find the first button that will exit the form - for row in MyForm.Rows: - for element in row: - if element.Type == ELEM_TYPE_BUTTON: - if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: - element.ButtonCallBack() - return def __del__(self): super().__del__() @@ -568,7 +562,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): ''' Button Element - Specifies all types of buttons :param button_type: @@ -597,6 +591,8 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.ImageSubsample = image_subsample self.UserData = None self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH + self.BindReturnKey = bind_return_key + self.Focus = focus super().__init__(ELEM_TYPE_BUTTON, scale, size, font=font) return @@ -659,16 +655,6 @@ def ButtonCallBack(self): self.ParentForm.TKroot.quit() # kick the users out of the mainloop return - def ReturnKeyHandler(self, event): - MyForm = self.ParentForm - # search through this form and find the first button that will exit the form - for row in MyForm.Rows: - for element in row: - if element.Type == ELEM_TYPE_BUTTON: - if element.BType == BUTTON_TYPE_CLOSES_WIN or element.BType == BUTTON_TYPE_READ_FORM: - element.ButtonCallBack() - return - def __del__(self): try: self.TKButton.__del__() @@ -818,6 +804,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.ReturnValuesDictionary = None self.ResultsBuilt = False self.UseDictionary = use_dictionary + self.UseDefaultFocus = False # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -858,6 +845,19 @@ def Show(self, non_blocking=False): self.NumCols = max(len(row) for row in self.Rows) self.NonBlocking=non_blocking + # Search through entire form to see if any elements set the focus + # if not, then will set the focus to the first input element + found_focus = False + for row in self.Rows: + for element in row: + try: + if element.Focus: + found_focus = True + break + except: + pass + if not found_focus: + self.UseDefaultFocus = True # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## StartupTK(self) return self.ReturnValues @@ -1001,11 +1001,11 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text) +def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus) -def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text) +def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus) # ------------------------- INPUT COMBO Element lazy functions ------------------------- # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): @@ -1032,45 +1032,44 @@ def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_ return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # -def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # -def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) - +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) -def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) #------------------------------------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix ------- # @@ -1152,6 +1151,8 @@ def BuildResults(form): value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) + if not form.NonBlocking: + element.TKStringVar.set('') try: input_values_dictionary[element.Key] = value except: pass @@ -1364,7 +1365,7 @@ def CharWidthInPixels(): tkbutton.image = photo tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - if not focus_set and btype == BUTTON_TYPE_CLOSES_WIN: + if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): focus_set = True element.TKButton.bind('', element.ReturnKeyHandler) element.TKButton.focus_set() @@ -1382,7 +1383,7 @@ def CharWidthInPixels(): if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKEntry.configure(fg=text_color) element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - if not focus_set: + if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): focus_set = True element.TKEntry.focus_set() # ------------------------- COMBO BOX (Drop Down) element ------------------------- # @@ -1453,7 +1454,7 @@ def CharWidthInPixels(): element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) if element.EnterSubmits: element.TKText.bind('', element.ReturnKeyHandler) - if not focus_set: + if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): focus_set = True element.TKText.focus_set() if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: @@ -1748,19 +1749,19 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a pad =1 # show either an OK or Yes/No depending on paramater if button_type is MSG_BOX_YES_NO: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(button_color=button_color), No( + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(button_color=button_color, focus=True, bind_return_key=True), No( button_color=button_color)) (button_text, values) = form.Show() return button_text == 'Yes' elif button_type is MSG_BOX_CANCELLED: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('Cancelled', button_color=button_color)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) elif button_type is MSG_BOX_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('ERROR', size=(5, 1), button_color=button_color)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) elif button_type is MSG_BOX_OK_CANCEL: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color), + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), SimpleButton('Cancel', size=(5, 1), button_color=button_color)) else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) button, values = form.Show() return button @@ -2169,7 +2170,7 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au height_computed = MAX_SCROLLED_TEXT_BOX_HEIGHT if height_computed > MAX_SCROLLED_TEXT_BOX_HEIGHT else height_computed if height: height_computed = height - form.AddRow(Multiline(complete_output, size=(max_line_width, height_computed)), auto_size_text=True) + form.AddRow(Multiline(complete_output, size=(max_line_width, height_computed))) pad = max_line_total-15 if max_line_total > 15 else 1 # show either an OK or Yes/No depending on paramater if yes_no: @@ -2415,9 +2416,9 @@ def main(): form_rows = [[Text('You are running the PySimpleGUI.py file itself')], [Text('You should be importing it rather than running it\n')], [Text('Here is your sample input form....')], - [Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source'),FolderBrowse()], + [Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source', focus=True),FolderBrowse()], [Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Dest'), FolderBrowse()], - [Submit(), Cancel()]] + [Submit(bind_return_key=True), Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) From 9c1ebeb0b4d3bb2a41c6f20adf06eeb2f77b45d6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 11:37:44 -0400 Subject: [PATCH 120/521] Removed need to flag a form as one returning a dictionary --- Demo_Dictionary.py | 13 +++++++---- PySimpleGUI.py | 54 +++++++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/Demo_Dictionary.py b/Demo_Dictionary.py index c1a060da4..9b001eae6 100644 --- a/Demo_Dictionary.py +++ b/Demo_Dictionary.py @@ -2,14 +2,19 @@ # THIS FILE REQIRES THE LATEST PySimpleGUI.py FILE # IT WILL NOT WORK WITH CURRENT PIP RELEASE (2.7) +# +# If you want to use the return values as Dictionary feature, you need to download the PySimpleGUI.py file +# from GitHub and then place it in your project's folder. This SHOULD cause it to use this downloaded version +# instead of the pip installed one, if you've pip installed it. You can always uninstall the pip one :-) -# Shows how to use return values in dictionary form -form = sg.FlexForm('Simple data entry form', use_dictionary=True) # begin with a blank form +# This design pattern shows how to use return values in dictionary form + +form = sg.FlexForm('Simple data entry form') # begin with a blank form layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] @@ -17,6 +22,6 @@ button, values = form.LayoutAndRead(layout) -sg.MsgBox(button, values, values['name'], values['address'], values['phone']) +sg.MsgBox(button, values, values[0], values['address'], values['phone']) print(values) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c75a160fe..07bbc3afe 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -774,7 +774,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, use_dictionary=False): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -803,7 +803,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.ReturnValues = None self.ReturnValuesDictionary = None self.ResultsBuilt = False - self.UseDictionary = use_dictionary + self.UseDictionary = False self.UseDefaultFocus = False # ------------------------- Add ONE Row to Form ------------------------- # @@ -853,9 +853,14 @@ def Show(self, non_blocking=False): try: if element.Focus: found_focus = True - break except: pass + try: + if element.Key is not None: + self.UseDictionary = True + except: + pass + if not found_focus: self.UseDefaultFocus = True # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## @@ -1145,6 +1150,7 @@ def BuildResults(form): button_pressed_text = None input_values = [] input_values_dictionary = {} + key_counter = 0 for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): if element.Type == ELEM_TYPE_INPUT_TEXT: @@ -1153,25 +1159,31 @@ def BuildResults(form): input_values.append(value) if not form.NonBlocking: element.TKStringVar.set('') - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: value=element.TKIntVar.get() results[row_num][col_num] = value input_values.append(value != 0) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_RADIO: RadVar=element.TKIntVar.get() this_rowcol = EncodeRadioRowCol(row_num,col_num) value = RadVar == this_rowcol results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_BUTTON: if results[row_num][col_num] is True: button_pressed_text = element.ButtonText @@ -1181,17 +1193,21 @@ def BuildResults(form): value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_LISTBOX: items=element.TKListbox.curselection() value = [element.Values[int(item)] for item in items] results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_SPIN: try: value=element.TKStringVar.get() @@ -1199,9 +1215,11 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_SLIDER: try: value=element.TKIntVar.get() @@ -1221,9 +1239,11 @@ def BuildResults(form): value = None results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass try: input_values_dictionary.pop(None, None) # clean up dictionary include None was included From 4bb89514cb9b7f4e59358cfa00561bf3c43cb4f1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 11:53:42 -0400 Subject: [PATCH 121/521] Changed what gets executed when buttons pushed --- Demo_Script_Launcher.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index bcc06b004..50370a42e 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -1,5 +1,5 @@ import PySimpleGUI as sg -import os +import subprocess def Launcher(): @@ -8,7 +8,8 @@ def Launcher(): layout = [ [sg.Text('Script output....', size=(40, 1))], [sg.Output(size=(88, 20))], - [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')] + [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], + [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] ] form.Layout(layout) @@ -19,16 +20,22 @@ def Launcher(): if button == 'EXIT' or button is None: break # exit button clicked if button == 'script1': - ExecuteCommandOS('python SimScript.py') + ExecuteCommandSubprocess('pip','list') elif button == 'script2': - ExecuteCommandOS('python SimScript.py') - elif button == 'Enter': - ExecuteCommandOS(value[0]) # send string without carriage return on end - - -def ExecuteCommandOS(command): - output = os.popen(command).read() - print(output) + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) # send string without carriage return on end + + +def ExecuteCommandSubprocess(command, *args): + try: + sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass if __name__ == '__main__': From 644c441fbebce5005a4d95a08e4a9abddfaf0972 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 12:07:22 -0400 Subject: [PATCH 122/521] Updates for Version 2.8 --- docs/index.md | 70 +++++++++++++++++++++++++++++++++++++++++++-------- readme.md | 30 ++++++++++++++-------- 2 files changed, 79 insertions(+), 21 deletions(-) diff --git a/docs/index.md b/docs/index.md index f03d65375..785197977 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,15 +2,20 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 + +![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) + + # PySimpleGUI - (Ver 2.7) + (Ver 2.8) +[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) Super-simple GUI to grasp... Powerfully customizable. -Note - *Python3* is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. +Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, you've found your GUI package. +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? Look no further, **you've found your GUI package**. import PySimpleGUI as sg @@ -21,9 +26,11 @@ Looking to take your Python code from the world of command lines and into the co Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? +PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. + ![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) -Perhaps you're looking for a way to interact with your Raspberry Pi in a more friendly way. The is the same form as above, except shown on a Pi. +Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. ![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) @@ -40,7 +47,7 @@ You can build an async media player GUI with custom buttons in 30 lines of code. I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and PySimpleGUI is that in addition to getting the simple Message Boxes you also get the ability to make your own forms that are highly customizeable. Don't like the standard Message Box? Then make your own! +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and `PySimpleGUI` is that in addition to getting the simple Message Boxes you also get the ability to **make your own forms** that are highly customizeable. Don't like the standard Message Box? Then make your own! Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. @@ -73,9 +80,12 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Persistent Windows Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Coide Proress Bar & Debug Print + Single-Line-Of-Code Proress Bar & Debug Print Complete control of colors, look and feel Button images + Return values as dictionary + Set focus + Bind return key to buttons An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -480,6 +490,10 @@ This is the code that **displays** the form, collects the information and return ## Return values + As of version 2.8 there are 2 forms of return values, list and dictionary. +### Return values as a list + By default return values are a list of values, one entry for each input field. + Return information from FlexForm, SG's primary form builder interface, is in this format: button, (value1, value2, ...) @@ -498,14 +512,41 @@ If you have a SINGLE value being returned, it is written this way: button, (value1,) = form.LayoutAndRead(form_rows) - Another way of parsing the return values is to store the list of values into a variable representing the list of values. + Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. button, value_list = form.LayoutAndRead(form_rows) value1 = value_list[0] value2 = value_list[1] ... +### Return values as a dictionary + +If you wish to receive the return values as a dictionary rather than a simple list, then you'll have to one thing... + * Mark each input element you wish to be in the dictionary with the keyword `key`. + +If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. + +This sample program demonstrates these 2 steps as well as how to address the return values (e.g. `values['name']`) + + + import PySimpleGUI as sg + form = sg.FlexForm('Simple data entry form') + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + sg.MsgBox(button, values, values[0], values['address'], values['phone']) + + --- + + ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. @@ -588,7 +629,7 @@ Parameter Descriptions. You will find these same parameters specified for each auto_size_text - Bool. True if elements should size themselves according to contents auto_size_buttons - Bool. True if button elements should size themselves according to their text label scale - Set size of element to be a multiple of the Element size - location - Location to place window in pixels + location - (x,y) Location to place window in pixels button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars is_tabbed_form - Bool. If True then form is a tabbed form @@ -598,6 +639,9 @@ Parameter Descriptions. You will find these same parameters specified for each icon - .ICO file that will appear on the Task Bar and end of Title Bar +#### Window Location +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. + #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. @@ -892,7 +936,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating . text - Text to display next to checkbox - default- Bool. Initial state + default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) scale - Amount to scale size of element size - (width, height) size of element in characters auto_size_text- Bool. True if should size width to fit text @@ -1158,11 +1202,13 @@ Recall that values is a list as well. Multiple tabs in the form would return li Starting in version 2.5 you can change the background colors for the window and the Elements. Your forms can go from this: + ![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) to this... with one function call... + ![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) @@ -1418,6 +1464,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting +| 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key ### Release Notes @@ -1432,6 +1479,7 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. 2.7 Is the "feature complete" release. Pretty much all features are done and in the code +2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) ### Upcoming @@ -1497,7 +1545,7 @@ Here are the steps to run that application The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) diff --git a/readme.md b/readme.md index b433cf533..785197977 100644 --- a/readme.md +++ b/readme.md @@ -8,13 +8,14 @@ # PySimpleGUI - (Ver 2.7) + (Ver 2.8) +[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) Super-simple GUI to grasp... Powerfully customizable. Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Look no further, **you've found your GUI package**. +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? Look no further, **you've found your GUI package**. import PySimpleGUI as sg @@ -25,6 +26,8 @@ Looking to take your Python code from the world of command lines and into the co Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? +PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. + ![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. @@ -80,6 +83,9 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Single-Line-Of-Code Proress Bar & Debug Print Complete control of colors, look and feel Button images + Return values as dictionary + Set focus + Bind return key to buttons An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -515,18 +521,19 @@ If you have a SINGLE value being returned, it is written this way: ### Return values as a dictionary -If you wish to receive the return values as a dictionary rather than a simple list, then you'll have to do 2 things: -1. Indicate in the form creation that the return should be a dictionary by setting `use_dictionary = True` -2. Mark each input element you wish to be in the dictionary with the keyword `key`. +If you wish to receive the return values as a dictionary rather than a simple list, then you'll have to one thing... + * Mark each input element you wish to be in the dictionary with the keyword `key`. + +If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. This sample program demonstrates these 2 steps as well as how to address the return values (e.g. `values['name']`) import PySimpleGUI as sg - form = sg.FlexForm('Simple data entry form', use_dictionary=True) + form = sg.FlexForm('Simple data entry form') layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] @@ -534,7 +541,7 @@ This sample program demonstrates these 2 steps as well as how to address the ret button, values = form.LayoutAndRead(layout) - sg.MsgBox(button, values, values['name'], values['address'], values['phone']) + sg.MsgBox(button, values, values[0], values['address'], values['phone']) --- @@ -1195,11 +1202,13 @@ Recall that values is a list as well. Multiple tabs in the form would return li Starting in version 2.5 you can change the background colors for the window and the Elements. Your forms can go from this: + ![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) to this... with one function call... + ![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) @@ -1455,7 +1464,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting -| 2.8.0 | Aug xx, 2018 - PLANNED - New None default option for Checkbox element, text color option for all elements, return values as a dictionary +| 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key ### Release Notes @@ -1470,6 +1479,7 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. 2.7 Is the "feature complete" release. Pretty much all features are done and in the code +2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) ### Upcoming @@ -1535,7 +1545,7 @@ Here are the steps to run that application The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) From 7e1ff1d543c66630dcce60a8c5e0b6d9a14c101d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 13:00:50 -0400 Subject: [PATCH 123/521] New Multi-line update option --- PySimpleGUI.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 07bbc3afe..b36063675 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -404,6 +404,8 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) return + def Update(self, NewValue): + self.TKText.insert(1.0, NewValue) def __del__(self): super().__del__() @@ -1006,11 +1008,11 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus) +def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False, key=None): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus, key=key) -def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus) +def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False, key=None): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus, key=key) # ------------------------- INPUT COMBO Element lazy functions ------------------------- # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): From 8f220a7ac19696be5a88a3eaef12690ff39859f8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 13:18:04 -0400 Subject: [PATCH 124/521] Refresh of Demo applications --- Demo_Compare_Files.py | 2 +- Demo_GoodColors.py | 10 +++--- Demo_HowDoI.py | 31 ++++++++++-------- Demo_Machine_Learning.py | 50 ++++++++++++++++++++++++++++ Demo_Media_Player.py | 16 +++++---- Demo_NonBlocking_Form.py | 22 +++---------- Demo_Pi_Robotics.py | 2 +- Demo_Recipes.py | 69 +++++++++++++++++++++------------------ Demo_Super_Simple_Form.py | 18 ++++++---- 9 files changed, 136 insertions(+), 84 deletions(-) create mode 100644 Demo_Machine_Learning.py diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index 25077a9a3..c5ecf7f23 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -1,7 +1,7 @@ import PySimpleGUI as sg def GetFilesToCompare(): - with sg.FlexForm('File Compare', auto_size_text=True) as form: + with sg.FlexForm('File Compare') as form: form_rows = [[sg.Text('Enter 2 files to comare')], [sg.Text('File 1', size=(15, 1)), sg.InputText(), sg.FileBrowse()], [sg.Text('File 2', size=(15, 1)), sg.InputText(), sg.FileBrowse()], diff --git a/Demo_GoodColors.py b/Demo_GoodColors.py index 7d0402f8d..f1c0a09c3 100644 --- a/Demo_GoodColors.py +++ b/Demo_GoodColors.py @@ -9,33 +9,33 @@ def main(): #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# text_color = gg.YELLOWS[0] - buttons = (gg.SimpleButton(f'BLUES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) + buttons = (gg.SimpleButton('BLUES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton(f'PURPLES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) + buttons = (gg.SimpleButton('PURPLES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton(f'GREENS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) + buttons = (gg.SimpleButton('GREENS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# text_color = gg.GREENS[0] # let's use GREEN text on the tan - buttons = (gg.SimpleButton(f'TANS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) + buttons = (gg.SimpleButton('TANS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# text_color = 'black' # let's use black text on the tan - buttons = (gg.SimpleButton(f'YELLOWS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) + buttons = (gg.SimpleButton('YELLOWS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index 257a06561..2d260e8b6 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,9 +1,9 @@ -import PySimpleGUI as SG +import PySimpleGUI as sg import subprocess import howdoi # Test this command in a dos window if you are having trouble. -HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' +HOW_DO_I_COMMAND = 'python -m howdoi.howdoi -n 2' # if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' @@ -18,25 +18,29 @@ def HowDoI(): ''' # ------- Make a new FlexForm ------- # # Set system-wide options that will affect all future forms. Give our form a spiffy look and feel - SG.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841')) - form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) - form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) - form.AddRow(SG.Output(size=(90, 20))) - form.AddRow(SG.Multiline(size=(85, 5), enter_submits=True), - SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), - SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) - + sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white', '#475841')) + form = sg.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) + layout = [ + [sg.Text('Ask and your answer will appear here....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [ sg.Spin(values=(1, 2, 3, 4), initial_value=1, size=(2, 1), key='Num Answers'), sg.T('Num Answers'), sg.Checkbox('Display Full Text', key='full text')], + [sg.Multiline(size=(85, 5), enter_submits=True, key='query'), + 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]))] + ] + form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # while True: (button, value) = form.Read() + if button == 'SEND': - QueryHowDoI(value[0][:-1]) # send string without carriage return on end + QueryHowDoI(value['query'], value['Num Answers'], value['full text']) # send string without carriage return on end else: break # exit button clicked exit(69) -def QueryHowDoI(Query): +def QueryHowDoI(Query, num_answers, full_text): ''' Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window @@ -44,7 +48,8 @@ def QueryHowDoI(Query): :return: nothing ''' howdoi_command = HOW_DO_I_COMMAND - t = subprocess.Popen(howdoi_command + ' '+ Query, stdout=subprocess.PIPE) + full_text_option = ' -a' if full_text else '' + t = subprocess.Popen(howdoi_command + ' '+ Query + ' -n ' + str(num_answers)+full_text_option, stdout=subprocess.PIPE) (output, err) = t.communicate() print('You asked: '+ Query) print('_______________________________________') diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py new file mode 100644 index 000000000..6de6283f9 --- /dev/null +++ b/Demo_Machine_Learning.py @@ -0,0 +1,50 @@ +import PySimpleGUI as sg + +def MachineLearningGUI(): + sg.SetOptions(text_justification='right') + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + button, values = form.LayoutAndRead(layout) + del(form) + sg.SetOptions(text_justification='left') + + return button, values + + +def CustomMeter(): + + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + form = sg.FlexForm('Custom Progress Meter') + form.LayoutAndRead(layout, non_blocking=True) + + for i in range(10000): + button, values = form.ReadNonBlocking() + progress_bar.UpdateBar(i) + + +if __name__ == '__main__': + CustomMeter() + MachineLearningGUI() diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index fdc014346..87e5586e4 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -7,7 +7,9 @@ # https://user-images.githubusercontent.com/13696193/43159403-45c9726e-8f50-11e8-9da0-0d272e20c579.jpg # def MediaPlayerGUI(): - + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) # Images are located in a subfolder in the Demo Media Player.py folder image_pause = './ButtonGraphics/Pause.png' image_restart = './ButtonGraphics/Restart.png' @@ -22,18 +24,18 @@ def MediaPlayerGUI(): font=("Helvetica", 25)) # define layout of the rows layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))], - [TextElem], - [sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=(background,background), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + sg.ReadFormButton('Pause', button_color=(background,background), image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=sg.TRANSPARENT_BUTTON, + sg.ReadFormButton('Next', button_color=(background,background), image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background,background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], [sg.Text('_'*30)], [sg.Text(' '*30)], [ diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 6121e7254..79693a25f 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -44,18 +44,14 @@ def StatusOutputExample(): def RemoteControlExample(): # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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') - + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) form_rows = [[sg.Text('Robotics Remote Control')], - [output_element], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], [sg.T('')], - [sg.Quit()] + [sg.Quit(button_color=('black', 'orange'))] ] form.LayoutAndRead(form_rows, non_blocking=True) @@ -66,25 +62,15 @@ def RemoteControlExample(): # else it won't refresh. # # your program's main loop - i=0 while (True): # 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)) button, values = form.ReadNonBlocking() if button is not None: - print(button) + sg.Print(button) if button == 'Quit' or values is None: break - if button == 'LED On': - print('Turning on the LED') - elif button == 'LED Off': - print('Turning off the LED') - - i += 1 - # Your code begins here - time.sleep(.01) + # time.sleep(.01) - # Broke out of main loop. Close the window. form.CloseNonBlockingForm() diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index e04d5458a..607fa3661 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -88,7 +88,7 @@ def RemoteControlExample_NoGraphics(): def main(): RemoteControlExample_NoGraphics() # Uncomment to get the fancy graphics version. Be sure and download the button images! - # RemoteControlExample() + RemoteControlExample() sg.MsgBox('End of non-blocking demonstration') if __name__ == '__main__': diff --git a/Demo_Recipes.py b/Demo_Recipes.py index 9653247f7..d34fac495 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -5,10 +5,10 @@ # A simple blocking form. Your best starter-form def SourceDestFolders(): with sg.FlexForm('Demo Source / Destination Folders') as form: - form_rows = [[sg.Text('Enter the Source and Destination folders')], + form_rows = ([sg.Text('Enter the Source and Destination folders')], [sg.Text('Source Folder', size=(15, 1), justification='right'), sg.InputText('Source'), sg.FolderBrowse()], [sg.Text('Destination Folder', size=(15, 1), justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] + [sg.Submit(), sg.Cancel()]) button, (source, dest) = form.LayoutAndRead(form_rows) if button == 'Submit': @@ -39,7 +39,7 @@ def MachineLearningGUI(): [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], [sg.Submit(), sg.Cancel()]] - button, values = form.LayoutAndShow(layout) + button, values = form.LayoutAndRead(layout) del(form) sg.SetOptions(text_justification='left') @@ -70,10 +70,8 @@ def Everything(): sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))] - ] + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))] ] button, values = form.LayoutAndRead(layout) @@ -113,8 +111,8 @@ def Everything_NoContextManager(): def ProgressMeter(): - for i in range(1,100): - if not sg.EasyProgressMeter('My Meter', i + 1, 100, orientation='v'): break + for i in range(1,1000): + if not sg.EasyProgressMeter('My Meter', i + 1, 1000, orientation='h'): break time.sleep(.01) # Blocking form that doesn't close @@ -122,7 +120,7 @@ def ChatBot(): with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + [sg.Multiline(size=(70, 5), enter_submits=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]))]] # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form # if you call LayoutAndRead from here, then you will miss the first button click form.Layout(layout) @@ -181,39 +179,46 @@ def NonBlockingPeriodicUpdateForm(): def DebugTest(): # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) for i in range (1,300): - sg.Print(i, randint(1, 1000), end='', sep='-') + sg.Print('Here are 300 random numbers', i, randint(1, 1000), sep='-') + +# Change the colors and set borders to 0 for a flat look +def ChangeLookAndFeel(colors): + sg.SetOptions(background_color=colors['BACKGROUND'], + text_element_background_color=colors['BACKGROUND'], + element_background_color=colors['BACKGROUND'], + text_color=colors['TEXT'], + input_elements_background_color=colors['INPUT'], + button_color=colors['BUTTON'], + progress_meter_color=colors['PROGRESS'], + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color=(colors['INPUT']), + element_text_color=colors['TEXT']) #=---------------------------------- main ------------------------------ def main(): - # sg.MsgBox('Changing look and feel.', 'Done by calling SetOptions') - SourceDestFolders() - - sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841'), border_width=0, slider_border_width=0, progress_meter_border_depth=0) - - MachineLearningGUI() - - Everything_NoContextManager() - - # sg.SetOptions(background_color='#B89FB6', text_element_background_color='#B89FB6', element_background_color='#B89FB6', button_color=('white','#7E6C92'), text_color='#3F403F',border_width=0, slider_border_width=0, progress_meter_border_depth=0) - - sg.SetOptions(background_color='#A5CADD', input_elements_background_color='#E0F5FF', text_element_background_color='#A5CADD', element_background_color='#A5CADD', button_color=('white','#303952'), text_color='#822E45',border_width=0, progress_meter_color=('#3D8255','white'), slider_border_width=0, progress_meter_border_depth=0) + # Green & tan color scheme + colors1 = {'BACKGROUND' : '#9FB8AD', 'TEXT': sg.COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'),'PROGRESS':sg.DEFAULT_PROGRESS_BAR_COLOR } + # light green with tan + colors2 = {'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')} + # blue with light blue color scheme + colors3 = {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':sg.DEFAULT_PROGRESS_BAR_COLOR} + ChatBot() Everything() + SourceDestFolders() + ChangeLookAndFeel(colors2) ProgressMeter() - - # Set system-wide options that will affect all future forms - - + ChangeLookAndFeel(colors3) + Everything() + ChangeLookAndFeel(colors2) + MachineLearningGUI() + Everything_NoContextManager() NonBlockingPeriodicUpdateForm_ContextManager() - - NonBlockingPeriodicUpdateForm() - - - ChatBot() - DebugTest() sg.MsgBox('Done with all recipes') diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index 0d13708e8..54726258a 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -2,12 +2,16 @@ form = sg.FlexForm('Simple data entry form') # begin with a blank form -layout = [[sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], - [sg.Submit(), sg.Cancel()]] +layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] -button, (name, address, phone) = form.LayoutAndRead(layout) +button, values = form.LayoutAndRead(layout) -print(name, address, phone) \ No newline at end of file +sg.MsgBox(button, values['name'], values['address'], values['phone']) + +print(values) From 2b98a234349e4271ed4e8f1af9f1ac0edf70cfe5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 10 Aug 2018 09:15:19 -0400 Subject: [PATCH 125/521] NEW cookbook! New do_not_clear option for inputs, fix for window flash problem --- PySimpleGUI.py | 24 ++- docs/cookbook.md | 456 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 471 insertions(+), 9 deletions(-) create mode 100644 docs/cookbook.md diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b36063675..9b54e9ca4 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -205,7 +205,7 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, key=None, focus=False): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): ''' Input a line of text Element :param default_text: Default value to display @@ -219,6 +219,7 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto self.PasswordCharacter = password_char bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR self.Focus = focus + self.do_not_clear = do_not_clear super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) @@ -387,7 +388,7 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, focus=False): + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): ''' Input Multi-line Element :param default_text: @@ -401,6 +402,7 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s self.EnterSubmits = enter_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR self.Focus = focus + self.do_not_clear = do_not_clear super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) return @@ -913,6 +915,8 @@ def Read(self): def ReadNonBlocking(self, Message=''): if self.TKrootDestroyed: return None, None + if not self.Shown: + self.Show(non_blocking=True) if Message: print(Message) try: @@ -1008,11 +1012,11 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False, key=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus, key=key) +def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, do_not_clear=False, focus=False, key=None): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, do_not_clear = do_not_clear, focus=focus, key=key) -def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, focus=False, key=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, focus=focus, key=key) +def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, do_not_clear = False, focus=False, key=None): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, do_not_clear=do_not_clear, focus=focus, key=key) # ------------------------- INPUT COMBO Element lazy functions ------------------------- # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): @@ -1159,7 +1163,7 @@ def BuildResults(form): value=element.TKStringVar.get() results[row_num][col_num] = value input_values.append(value) - if not form.NonBlocking: + if not form.NonBlocking and not element.do_not_clear: element.TKStringVar.set('') if element.Key is None: input_values_dictionary[key_counter] = value @@ -1235,7 +1239,7 @@ def BuildResults(form): elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) - if not form.NonBlocking: + if not form.NonBlocking and not element.do_not_clear: element.TKText.delete('1.0', tk.END) except: value = None @@ -1593,7 +1597,8 @@ def CharWidthInPixels(): #....................................... DONE creating and laying out window ..........................# if MyFlexForm.IsTabbedForm: master = MyFlexForm.ParentWindow - screen_width = master.winfo_screenwidth() # get window info to move to middle of screen + master.attributes('-alpha', 0) # hide window while getting info and moving + screen_width = master.winfo_screenwidth() # get window info to move to middle of screen screen_height = master.winfo_screenheight() if MyFlexForm.Location != (None, None): x,y = MyFlexForm.Location @@ -1612,6 +1617,7 @@ def CharWidthInPixels(): move_string = '+%i+%i'%(int(x),int(y)) master.geometry(move_string) + master.attributes('-alpha', 255) # Make window visible again master.update_idletasks() # don't forget return diff --git a/docs/cookbook.md b/docs/cookbook.md new file mode 100644 index 000000000..b6f58c2f5 --- /dev/null +++ b/docs/cookbook.md @@ -0,0 +1,456 @@ + +# The PySimpleGUI Cookbook + +## Simple Data Entry - Return Values As List +Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + + import PySimpleGUI as sg + + # Very basic form. Return values as a list + form = sg.FlexForm('Simple data entry form') # begin with a blank form + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + print(button, values[0], values[1], values[2]) + +## Simple data entry - Return Values As Dictionary +A simple form with default values. Results returned in a dictionary. Does not use a context manager + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + + import PySimpleGUI as sg + + # Very basic form. Return values as a dictionary + form = sg.FlexForm('Simple data entry form') # begin with a blank form + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + print(button, values['name'], values['address'], values['phone']) + +--------------------- + + + +----------- +## Simple File Browse +Browse for a filename that is populated into the input field. + +![simple file browse](https://user-images.githubusercontent.com/13696193/43934539-d8bd9490-9c1d-11e8-927f-98b523776fcb.jpg) + + import PySimpleGUI as sg + + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + (button, (source_filename,)) = form.LayoutAndShow(form_rows) + + print(button, source_filename) + +-------------------------- +## Compare 2 Files + +Browse to get 2 file names that can be then compared. Uses a context manager + +![compare 2 files](https://user-images.githubusercontent.com/13696193/43934659-60dc5fbe-9c1e-11e8-8d2b-07c0e3b61892.jpg) + + import PySimpleGUI as sg + + with sg.FlexForm('File Compare') as form: + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, values = form.LayoutAndShow(form_rows) + + print(button, values) + +--------------- +## Nearly All Widgets with Green Color Theme with Context Manager +Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method. + +![green everything](https://user-images.githubusercontent.com/13696193/43937043-7d0794be-9c29-11e8-8591-31373ddd5c34.jpg) + + # Green & tan color scheme + sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))]] + + button, values = form.LayoutAndRead(layout) +------------- +### All Widgets No Context Manager + +![green everything](https://user-images.githubusercontent.com/13696193/43937043-7d0794be-9c29-11e8-8591-31373ddd5c34.jpg) + + import PySimpleGUI as sg + + # Green & tan color scheme + sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + + form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] + ] + + button, values = form.LayoutAndRead(layout) + +---- +## Non-Blocking Form With Periodic Update +An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. + +![non-blocking](https://user-images.githubusercontent.com/13696193/43955295-70f6ac48-9c6d-11e8-8ea2-e6729ba9330c.jpg) + + import PySimpleGUI as sg + import time + + form = sg.FlexForm('Running Timer', auto_size_text=True) + # create a text element that will be updated periodically + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') + + form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], + [text_element], + [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] + + form.LayoutAndRead(form_rows, non_blocking=True) + + timer_running = True + i = 0 + # loop to process user clicks + while True: + i += 1 * (timer_running is True) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + elif button == 'Start/Stop': + timer_running = not timer_running + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + + time.sleep(.01) + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + del (form) +---- +## Async Form (Non-Blocking) with Context Manager +Like the previous recipe, this form is an async form. The difference is that this form uses a context manager. + +![non-blocking 2](https://user-images.githubusercontent.com/13696193/43955456-4d5d9ef8-9c6e-11e8-8598-80dddf8eba6f.jpg) + + import PySimpleGUI as sg + import time + + with sg.FlexForm('Running Timer', auto_size_text=True) as form: + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') + layout = [[sg.Text('Non blocking GUI with updates', justification='center')], + [text_element], + [sg.T(' ' * 15), sg.Quit()]] + form.LayoutAndRead(layout, non_blocking=True) + + for i in range(1, 500): + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() +---- +## Callback Function Simulation +The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. + +![button callback 2](https://user-images.githubusercontent.com/13696193/43955588-e139ddc6-9c6e-11e8-8c78-c1c226b8d9b1.jpg) + + import PySimpleGUI as sg + + # This design pattern simulates button callbacks + # Note that callbacks are NOT a part of the package's interface to the + # caller intentionally. The underlying implementation actually does use + # tkinter callbacks. They are simply hidden from the user. + + # The callback functions + def button1(): + print('Button 1 callback') + + def button2(): + print('Button 2 callback') + + # Create a standard form + form = sg.FlexForm('Button callback example') + # Layout the design of the GUI + layout = [[sg.Text('Please click a button', auto_size_text=True)], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] + # Show the form to the user + form.Layout(layout) + + # Event loop. Read buttons, make callbacks + while True: + # Read the form + button, value = form.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break + + # All done! + sg.MsgBoxOK('Done') + +----- +## Realtime Buttons (Good For Raspberry Pi) +This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. + + + import PySimpleGUI as sg + + # Make a form, but don't use context manager + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' ' * 10), sg.RealtimeButton('Forward')], + [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], + [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh. + # + # your program's main loop + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + print(button) + if button == 'Quit' or values is None: + break + + form.CloseNonBlockingForm() + +--------- + +## Easy Progress Meter +This recipe shows just how easy it is to add a progress meter to your code. + + import PySimpleGUI as sg + + for i in range(1000): + sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) + +![progress meter 6](https://user-images.githubusercontent.com/13696193/43955982-73b33b38-9c70-11e8-8b07-cc1473a58a73.jpg) +----- +## Tabbed Form +Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single form. + + +![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg) + + import PySimpleGUI as sg + + with sg.FlexForm('', auto_size_text=True) as form: + with sg.FlexForm('', auto_size_text=True) as form2: + + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2,'Second Tab')) + + sg.MsgBox(results) +----- +## Button Graphics (Media Player) +Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. + +![media player](https://user-images.githubusercontent.com/13696193/43958418-5dd133f2-9c79-11e8-9432-0a67007e85ac.jpg) + + import PySimpleGUI as sg + + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # 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 + form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)) + # define layout of the rows + layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=(background, background), + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Pause', button_color=(background, background), + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Next', button_color=(background, background), + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, + border_width=0)], + [sg.Text('_' * 30)], + [sg.Text(' ' * 30)], + [ + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] + + ] + + # Call the same LayoutAndRead but indicate the form is non-blocking + form.LayoutAndRead(layout, non_blocking=True) + # Our event loop + while (True): + # Read the form (this call will not block) + button, values = form.ReadNonBlocking() + if button == 'Exit' or values is None: + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + TextElem.Update(button) +---- +## Script Launcher - Persistent Form +This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadFormButton` instead of `sg.SimpleButton`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. + +![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) + + import PySimpleGUI as sg + import subprocess + + def Launcher(): + + form = sg.FlexForm('Script launcher') + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], + [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] + ] + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip','list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) # send string without carriage return on end + + + def ExecuteCommandSubprocess(command, *args): + try: + sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + + if __name__ == '__main__': + Launcher() From 800f929e6b869e9bd4847c9cd44c1c8d50a2f303 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 10 Aug 2018 09:20:30 -0400 Subject: [PATCH 126/521] Readme changes --- readme.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 785197977..d8438d555 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,9 @@ # PySimpleGUI (Ver 2.8) + [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) +[COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) Super-simple GUI to grasp... Powerfully customizable. @@ -138,6 +140,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in - A form is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. +- Return values can also be represented as a dictionary It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. @@ -409,7 +412,7 @@ You will use these design patterns or code templates for all of your "normal" (b ### How GUI Programming in Python Should Look -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. @@ -1465,6 +1468,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key +| 2.9.0 | Aug XX,2018 - Screen flash fix, do_not_clear input field option, ### Release Notes @@ -1545,7 +1549,7 @@ Here are the steps to run that application The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) From 0d202246d364d3b90d8606982bdea5911f6d6bc8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 10 Aug 2018 09:21:26 -0400 Subject: [PATCH 127/521] Readme formatting --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index d8438d555..0d55aa851 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,7 @@ (Ver 2.8) [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) + [COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) Super-simple GUI to grasp... Powerfully customizable. From 9d3d3f4bc1daf7b715e2dc7cd7f920f68ab8c570 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 10 Aug 2018 16:10:07 -0400 Subject: [PATCH 128/521] Machine Learning Recipe added --- docs/cookbook.md | 49 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index b6f58c2f5..8052b7d48 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -432,13 +432,13 @@ This form doesn't close after button clicks. To achieve this the buttons are sp while True: (button, value) = form.Read() if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': + break # exit button clicked + if button == 'script1': ExecuteCommandSubprocess('pip','list') elif button == 'script2': ExecuteCommandSubprocess('python', '--version') elif button == 'Run': - ExecuteCommandSubprocess(value[0]) # send string without carriage return on end + ExecuteCommandSubprocess(value[0]) def ExecuteCommandSubprocess(command, *args): @@ -454,3 +454,46 @@ This form doesn't close after button clicks. To achieve this the buttons are sp if __name__ == '__main__': Launcher() +---- +## Machine Learning GUI +A standard non-blocking GUI with lots of inputs. + +![machine learning green](https://user-images.githubusercontent.com/13696193/43979000-408b77ba-9cb7-11e8-9ffd-24c156767532.jpg) + + import PySimpleGUI as sg + + # Green & tan color scheme + sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + + sg.SetOptions(text_justification='right') + + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + + button, values = form.LayoutAndRead(layout) From 5abcd7c54624e046def8ec41f3faa9c3dad1624d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 10 Aug 2018 16:16:16 -0400 Subject: [PATCH 129/521] ListDict always returned now.... hybrid list & dictionary Now all return values are through a new class called ListDict. It's an ordered dictionary that allows access like a dictionary and a list. --- PySimpleGUI.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 9b54e9ca4..2933ef0d9 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -4,6 +4,7 @@ from tkinter import ttk import tkinter.scrolledtext as tkst import tkinter.font +from collections import OrderedDict import datetime import sys import textwrap @@ -1142,6 +1143,27 @@ def EncodeRadioRowCol(row, col): RadValue = row * 1000 + col return RadValue +#===== ListDict - New data type for returning values ===== +class ListDict(OrderedDict): + def __iter__(self): + for v in self.values(): + yield v + + def __getitem__(self, item): + if isinstance(item, slice): + return list(self.values())[item] + else: + return super().__getitem__(item) + + def __str__(self): + return str(self.ToList()) + + def ToList(self): + output = [] + for item in self.values(): + output.append(item) + return output + # ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # # format of return values is # (Button Pressed, input_values) @@ -1155,7 +1177,8 @@ def BuildResults(form): results=form.Results button_pressed_text = None input_values = [] - input_values_dictionary = {} + # input_values_dictionary = {} + input_values_dictionary = ListDict() key_counter = 0 for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): @@ -1255,10 +1278,9 @@ def BuildResults(form): input_values_dictionary.pop(None, None) # clean up dictionary include None was included except: pass - if not form.UseDictionary: - form.ReturnValues = button_pressed_text, input_values - else: - form.ReturnValues = button_pressed_text, input_values_dictionary + # return values are always a list dictionary now (ordered dict with added features) + form.ReturnValues = button_pressed_text, input_values_dictionary + form.ReturnValuesDictionary = button_pressed_text, input_values_dictionary form.ResultsBuilt = True return form.ReturnValues From d6ff296d9f5ac12ba2348cda2fbc2d0b48a18ed8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 10 Aug 2018 17:38:31 -0400 Subject: [PATCH 130/521] Better results printing --- PySimpleGUI.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 2933ef0d9..4a898e839 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1156,7 +1156,17 @@ def __getitem__(self, item): return super().__getitem__(item) def __str__(self): - return str(self.ToList()) + listlike = True + for i, key in enumerate(self.keys()): + if i != key: + listlike = False + + if listlike: + return str(list(self.values())) + else: + output = [("'" + k + "'" if isinstance(k, str) else str(k)) + ': ' + ( + "'" + v + "'" if isinstance(v, str) else str(v)) for k, v in self.items()] + return '{' + ', '.join(output) + '}' def ToList(self): output = [] From 14ca11a795d132c223c50baf2328344ec2277544 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 05:33:14 -0400 Subject: [PATCH 131/521] Autosize text now defaults to True! --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4a898e839..eb51663fa 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -14,7 +14,7 @@ DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels -DEFAULT_AUTOSIZE_TEXT = False +DEFAULT_AUTOSIZE_TEXT = True DEFAULT_AUTOSIZE_BUTTONS = True DEFAULT_FONT = ("Helvetica", 10) DEFAULT_TEXT_JUSTIFICATION = 'left' From a4e345741507bb13fbeb83ac259450836c543cc5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 08:15:18 -0400 Subject: [PATCH 132/521] Updated Readme file --- docs/index.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 785197977..0d55aa851 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,8 +9,11 @@ # PySimpleGUI (Ver 2.8) + [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) +[COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) + Super-simple GUI to grasp... Powerfully customizable. Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. @@ -138,6 +141,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in - A form is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. +- Return values can also be represented as a dictionary It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. @@ -409,7 +413,7 @@ You will use these design patterns or code templates for all of your "normal" (b ### How GUI Programming in Python Should Look -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list? +GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. @@ -1465,6 +1469,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key +| 2.9.0 | Aug XX,2018 - Screen flash fix, do_not_clear input field option, ### Release Notes @@ -1545,7 +1550,7 @@ Here are the steps to run that application The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) From 86f2f601205b997ce2ef657f63b889754e53c604 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 19:29:38 -0400 Subject: [PATCH 133/521] Fix for missing slider results, ChangeLookAndFeel feature --- PySimpleGUI.py | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index eb51663fa..094ef19b2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1266,9 +1266,11 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) @@ -2451,6 +2453,40 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( return True +#################### ChangeLookAndFeel ####################### +# Predefined settings that will change the colors and styles # +# of the elements. # +############################################################## +def ChangeLookAndFeel(index): + # look and feel table + look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'), + 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, + + 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}} + + + try: + colors = look_and_feel[index] + + SetOptions(background_color=colors['BACKGROUND'], + text_element_background_color=colors['BACKGROUND'], + element_background_color=colors['BACKGROUND'], + text_color=colors['TEXT'], + input_elements_background_color=colors['INPUT'], + button_color=colors['BUTTON'], + progress_meter_color=colors['PROGRESS'], + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color=(colors['INPUT']), + element_text_color=colors['TEXT']) + except: # most likely an index out of range + pass + + + # ============================== sprint ======# # Is identical to the Scrolled Text Box # # Provides a crude 'print' mechanism but in a # @@ -2472,12 +2508,12 @@ def ObjToString(obj, extra=' '): def main(): - with FlexForm('Demo form..', auto_size_text=True) as form: + with FlexForm('Demo form..') as form: form_rows = [[Text('You are running the PySimpleGUI.py file itself')], [Text('You should be importing it rather than running it\n')], [Text('Here is your sample input form....')], - [Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source', focus=True),FolderBrowse()], - [Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Dest'), FolderBrowse()], + [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], + [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], [Submit(bind_return_key=True), Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) From 1e9a052f27ed71f66eca2a4bf1589e0096b08fbc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 19:36:07 -0400 Subject: [PATCH 134/521] Commented and fixed progress bar --- Demo_Machine_Learning.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index 6de6283f9..3d2eeb0b5 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -30,20 +30,27 @@ def MachineLearningGUI(): def CustomMeter(): - + # create the progress bar element progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) - + # layout the form layout = [[sg.Text('A custom progress meter')], [progress_bar], [sg.Cancel()]] + # create the form form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form form.LayoutAndRead(layout, non_blocking=True) - + # loop that would normally do something useful for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked button, values = form.ReadNonBlocking() - progress_bar.UpdateBar(i) - + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() if __name__ == '__main__': CustomMeter() From b104c97a1ee3572141588b8d9f14bff9c6fd0e07 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 19:48:49 -0400 Subject: [PATCH 135/521] Readme updates --- readme.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 0d55aa851..32008eb50 100644 --- a/readme.md +++ b/readme.md @@ -116,13 +116,14 @@ Here is the code that produced the above screenshot. sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], [sg.Text('_' * 100, size=(70, 1))], [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] + ] - button, values = form.LayoutAndRead(layout) + button, values = form.LayoutAndRead(layout) **A note on screen shots** You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. @@ -1469,7 +1470,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, do_not_clear input field option, +| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, ### Release Notes @@ -1533,6 +1534,7 @@ GNU Lesser General Public License (LGPL 3) + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` +* [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example ## How Do I From 36b12763a6b349255b8e5a2fc99b3266d29f00b6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 22:31:42 -0400 Subject: [PATCH 136/521] ROLLING BACK to Aug 10 before ListDict --- PySimpleGUI.py | 93 +++++++------------------------------------------- 1 file changed, 13 insertions(+), 80 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 094ef19b2..e4cacc309 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,10 +1,10 @@ + #!/usr/bin/env Python3 import tkinter as tk from tkinter import filedialog from tkinter import ttk import tkinter.scrolledtext as tkst import tkinter.font -from collections import OrderedDict import datetime import sys import textwrap @@ -14,7 +14,7 @@ DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels -DEFAULT_AUTOSIZE_TEXT = True +DEFAULT_AUTOSIZE_TEXT = False DEFAULT_AUTOSIZE_BUTTONS = True DEFAULT_FONT = ("Helvetica", 10) DEFAULT_TEXT_JUSTIFICATION = 'left' @@ -1143,37 +1143,6 @@ def EncodeRadioRowCol(row, col): RadValue = row * 1000 + col return RadValue -#===== ListDict - New data type for returning values ===== -class ListDict(OrderedDict): - def __iter__(self): - for v in self.values(): - yield v - - def __getitem__(self, item): - if isinstance(item, slice): - return list(self.values())[item] - else: - return super().__getitem__(item) - - def __str__(self): - listlike = True - for i, key in enumerate(self.keys()): - if i != key: - listlike = False - - if listlike: - return str(list(self.values())) - else: - output = [("'" + k + "'" if isinstance(k, str) else str(k)) + ': ' + ( - "'" + v + "'" if isinstance(v, str) else str(v)) for k, v in self.items()] - return '{' + ', '.join(output) + '}' - - def ToList(self): - output = [] - for item in self.values(): - output.append(item) - return output - # ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # # format of return values is # (Button Pressed, input_values) @@ -1187,8 +1156,7 @@ def BuildResults(form): results=form.Results button_pressed_text = None input_values = [] - # input_values_dictionary = {} - input_values_dictionary = ListDict() + input_values_dictionary = {} key_counter = 0 for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): @@ -1266,11 +1234,9 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: + try: input_values_dictionary[element.Key] = value + except: pass elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) @@ -1290,9 +1256,10 @@ def BuildResults(form): input_values_dictionary.pop(None, None) # clean up dictionary include None was included except: pass - # return values are always a list dictionary now (ordered dict with added features) - form.ReturnValues = button_pressed_text, input_values_dictionary - + if not form.UseDictionary: + form.ReturnValues = button_pressed_text, input_values + else: + form.ReturnValues = button_pressed_text, input_values_dictionary form.ReturnValuesDictionary = button_pressed_text, input_values_dictionary form.ResultsBuilt = True return form.ReturnValues @@ -2453,40 +2420,6 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( return True -#################### ChangeLookAndFeel ####################### -# Predefined settings that will change the colors and styles # -# of the elements. # -############################################################## -def ChangeLookAndFeel(index): - # look and feel table - look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'), - 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, - - 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, - - 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}} - - - try: - colors = look_and_feel[index] - - SetOptions(background_color=colors['BACKGROUND'], - text_element_background_color=colors['BACKGROUND'], - element_background_color=colors['BACKGROUND'], - text_color=colors['TEXT'], - input_elements_background_color=colors['INPUT'], - button_color=colors['BUTTON'], - progress_meter_color=colors['PROGRESS'], - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color=(colors['INPUT']), - element_text_color=colors['TEXT']) - except: # most likely an index out of range - pass - - - # ============================== sprint ======# # Is identical to the Scrolled Text Box # # Provides a crude 'print' mechanism but in a # @@ -2508,16 +2441,16 @@ def ObjToString(obj, extra=' '): def main(): - with FlexForm('Demo form..') as form: + with FlexForm('Demo form..', auto_size_text=True) as form: form_rows = [[Text('You are running the PySimpleGUI.py file itself')], [Text('You should be importing it rather than running it\n')], [Text('Here is your sample input form....')], - [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], - [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], + [Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source', focus=True),FolderBrowse()], + [Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Dest'), FolderBrowse()], [Submit(bind_return_key=True), Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) if __name__ == '__main__': main() - exit(69) + exit(69) \ No newline at end of file From 148a1049baea736f26b4ce527b0ea6f7c5538441 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 11 Aug 2018 22:43:09 -0400 Subject: [PATCH 137/521] Fix for sliders (again) --- PySimpleGUI.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e4cacc309..948c557f2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1234,9 +1234,11 @@ def BuildResults(form): value = 0 results[row_num][col_num] = value input_values.append(value) - try: + if element.Key is None: + input_values_dictionary[key_counter] = value + key_counter +=1 + else: input_values_dictionary[element.Key] = value - except: pass elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) From 72e9c2246ee9bbe0aa1172a090c901a60e8dea86 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 12 Aug 2018 17:43:19 -0400 Subject: [PATCH 138/521] Custom Progress Bar --- docs/cookbook.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 8052b7d48..821d5065a 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -273,6 +273,7 @@ The architecture of some programs works better with button callbacks instead of ## Realtime Buttons (Good For Raspberry Pi) This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. +![robot control](https://user-images.githubusercontent.com/13696193/44006710-d227f23e-9e56-11e8-89a3-2be5b2726199.jpg) import PySimpleGUI as sg @@ -310,12 +311,14 @@ This recipe implements a remote control interface for a robot. There are 4 dire ## Easy Progress Meter This recipe shows just how easy it is to add a progress meter to your code. +![progress meter 6](https://user-images.githubusercontent.com/13696193/43955982-73b33b38-9c70-11e8-8b07-cc1473a58a73.jpg) + import PySimpleGUI as sg for i in range(1000): sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) -![progress meter 6](https://user-images.githubusercontent.com/13696193/43955982-73b33b38-9c70-11e8-8b07-cc1473a58a73.jpg) + ----- ## Tabbed Form Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single form. @@ -497,3 +500,40 @@ A standard non-blocking GUI with lots of inputs. [sg.Submit(), sg.Cancel()]] button, values = form.LayoutAndRead(layout) + +------- +## Custom Progress Meter / Progress Bar +Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. + +![custom progress meter](https://user-images.githubusercontent.com/13696193/43982958-3393b23e-9cc6-11e8-8b49-e7f4890cbc4b.jpg) + + + import PySimpleGUI as sg + + def CustomMeter(): + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + + ---- + + + From d0ab0c42c5f47ac56cac2213f29d029c28557213 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 12 Aug 2018 17:45:12 -0400 Subject: [PATCH 139/521] Autosize text now TRUE by default, Remove progress bar target, cleanup how return values made, ChangeLookAndFeel func --- PySimpleGUI.py | 311 +++++++++++++++++++++---------------------------- 1 file changed, 132 insertions(+), 179 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 948c557f2..7e277293c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -14,7 +14,7 @@ DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels -DEFAULT_AUTOSIZE_TEXT = False +DEFAULT_AUTOSIZE_TEXT = True DEFAULT_AUTOSIZE_BUTTONS = True DEFAULT_FONT = ("Helvetica", 10) DEFAULT_TEXT_JUSTIFICATION = 'left' @@ -603,11 +603,11 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt def ButtonReleaseCallBack(self, parm): r, c = self.Position - self.ParentForm.Results[r][c] = False # mark this button's location in results + self.ParentForm.LastButtonClicked = None def ButtonPressCallBack(self, parm): r, c = self.Position - self.ParentForm.Results[r][c] = True # mark this button's location in results + self.ParentForm.LastButtonClicked = self.ButtonText # ------- Button Callback ------- # def ButtonCallBack(self): @@ -642,7 +642,7 @@ def ButtonCallBack(self): # first, get the results table built # modify the Results table in the parent FlexForm object r,c = self.Position - self.ParentForm.Results[r][c] = True # mark this button's location in results + self.ParentForm.LastButtonClicked = self.ButtonText # if the form is tabbed, must collect all form's results and destroy all forms if self.ParentForm.IsTabbedForm: self.ParentForm.UberParent._Close() @@ -656,7 +656,7 @@ def ButtonCallBack(self): # first, get the results table built # modify the Results table in the parent FlexForm object r,c = self.Position - self.ParentForm.Results[r][c] = True # mark this button's location in results + self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.TKroot.quit() # kick the users out of the mainloop return @@ -671,12 +671,11 @@ def __del__(self): # ProgreessBar # # ---------------------------------------------------------------------- # class ProgressBar(Element): - def __init__(self, max_value, orientation=None, target=(None, None), scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None): + def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None): ''' Progress Bar Element :param max_value: :param orientation: - :param target: :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text @@ -692,7 +691,6 @@ def __init__(self, max_value, orientation=None, target=(None, None), scale=(None self.Orientation = orientation if orientation else DEFAULT_METER_ORIENTATION self.BarColor = bar_color self.BarStyle = style if style else DEFAULT_PROGRESS_BAR_STYLE - self.Target = target self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False @@ -702,12 +700,6 @@ def __init__(self, max_value, orientation=None, target=(None, None), scale=(None def UpdateBar(self, current_count): if self.ParentForm.TKrootDestroyed: return False - target = self.Target - if target[0] != None: # if there's a target, get it and update the strvar - target_element = self.ParentForm.GetElementAtLocation(target) - strvar = target_element.TKStringVar - rc = strvar.set(self.TextToDisplay) - self.TKProgressBar.Update(current_count) try: self.ParentForm.TKroot.update() @@ -806,8 +798,10 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.RootNeedsDestroying = False self.Shown = False self.ReturnValues = None - self.ReturnValuesDictionary = None - self.ResultsBuilt = False + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.LastButtonClicked = None self.UseDictionary = False self.UseDefaultFocus = False @@ -911,7 +905,7 @@ def Read(self): if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return BuildResults(self) + return BuildResults(self, False) def ReadNonBlocking(self, Message=''): if self.TKrootDestroyed: @@ -925,7 +919,7 @@ def ReadNonBlocking(self, Message=''): except: self.TKrootDestroyed = True _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return BuildResults(self) + return BuildResults(self, False) # LEGACY version of ReadNonBlocking def Refresh(self, Message=''): @@ -938,14 +932,14 @@ def Refresh(self, Message=''): except: self.TKrootDestroyed = True _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return BuildResults(self) + return BuildResults(self, False) def _Close(self): try: self.TKroot.update() except: pass if not self.NonBlocking: - results = BuildResults(self) + results = BuildResults(self, False) if self.TKrootDestroyed: return None self.TKrootDestroyed = True @@ -1083,53 +1077,23 @@ def ReadFormButton(button_text, image_filename=None, image_size=(None, None),ima def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) -#------------------------------------------------------------------------------------------------------# -# ------- FUNCTION InitializeResults. Sets up form results matrix ------- # +##################################### ----- RESULTS ------ ################################################## + +def AddToReturnDictionary(form, element, value): + if element.Key is None: + form.ReturnValuesDictionary[form.DictionaryKeyCounter] = value + form.DictionaryKeyCounter += 1 + else: + form.ReturnValuesDictionary[element.Key] = value + +def AddToReturnList(form, value): + form.ReturnValuesList.append(value) + + +#----------------------------------------------------------------------------# +# ------- FUNCTION InitializeResults. Sets up form results matrix --------# def InitializeResults(form): - # initial results for elements are: - # TEXT - None - # INPUT - Initial value - # Button - False - results = [] - return_vals = [] - for row_num,row in enumerate(form.Rows): - r = [] - for element in row: - if element.Type == ELEM_TYPE_TEXT: - r.append(None) - if element.Type == ELEM_TYPE_IMAGE: - r.append(None) - elif element.Type == ELEM_TYPE_INPUT_TEXT: - r.append(element.TextInputDefault) - return_vals.append(None) - elif element.Type == ELEM_TYPE_INPUT_MULTILINE: - r.append(element.TextInputDefault) - return_vals.append(None) - elif element.Type == ELEM_TYPE_BUTTON: - r.append(False) - elif element.Type == ELEM_TYPE_PROGRESS_BAR: - r.append(None) - elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: - r.append(element.InitialState) - return_vals.append(element.InitialState) - elif element.Type == ELEM_TYPE_INPUT_RADIO: - r.append(element.InitialState) - return_vals.append(element.InitialState) - elif element.Type == ELEM_TYPE_INPUT_COMBO: - r.append(element.TextInputDefault) - return_vals.append(None) - elif element.Type == ELEM_TYPE_INPUT_LISTBOX: - r.append(None) - return_vals.append(None) - elif element.Type == ELEM_TYPE_INPUT_SPIN: - r.append(element.DefaultValue) - return_vals.append(None) - elif element.Type == ELEM_TYPE_INPUT_SLIDER: - r.append(element.DefaultValue) - return_vals.append(None) - results.append(r) - form.Results=results - form.ReturnValues = (None, return_vals) + BuildResults(form, True) return #===== Radio Button RadVar encoding and decoding =====# @@ -1146,124 +1110,76 @@ def EncodeRadioRowCol(row, col): # ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # # format of return values is # (Button Pressed, input_values) -def BuildResults(form): +def BuildResults(form, initialize_only): # Results for elements are: # TEXT - Nothing # INPUT - Read value from TK # Button - Button Text and position as a Tuple # Get the initialized results so we don't have to rebuild - results=form.Results button_pressed_text = None input_values = [] - input_values_dictionary = {} + form.DictionaryKeyCounter = 0 + form.ReturnValuesDictionary = {} + form.ReturnValuesList = [] key_counter = 0 for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): - if element.Type == ELEM_TYPE_INPUT_TEXT: - value=element.TKStringVar.get() - results[row_num][col_num] = value - input_values.append(value) - if not form.NonBlocking and not element.do_not_clear: - element.TKStringVar.set('') - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: - value=element.TKIntVar.get() - results[row_num][col_num] = value - input_values.append(value != 0) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_INPUT_RADIO: - RadVar=element.TKIntVar.get() - this_rowcol = EncodeRadioRowCol(row_num,col_num) - value = RadVar == this_rowcol - results[row_num][col_num] = value - input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_BUTTON: - if results[row_num][col_num] is True: - button_pressed_text = element.ButtonText - if element.BType != BUTTON_TYPE_REALTIME: # Do not clear realtime buttons - results[row_num][col_num] = False - elif element.Type == ELEM_TYPE_INPUT_COMBO: - value=element.TKStringVar.get() - results[row_num][col_num] = value - input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_INPUT_LISTBOX: - items=element.TKListbox.curselection() - value = [element.Values[int(item)] for item in items] - results[row_num][col_num] = value - input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_INPUT_SPIN: - try: + if not initialize_only: + if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() - except: - value = 0 - results[row_num][col_num] = value - input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_INPUT_SLIDER: - try: - value=element.TKIntVar.get() - except: - value = 0 - results[row_num][col_num] = value - input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value - elif element.Type == ELEM_TYPE_INPUT_MULTILINE: - try: - value=element.TKText.get(1.0, tk.END) if not form.NonBlocking and not element.do_not_clear: - element.TKText.delete('1.0', tk.END) - except: - value = None - results[row_num][col_num] = value - input_values.append(value) - if element.Key is None: - input_values_dictionary[key_counter] = value - key_counter +=1 - else: - input_values_dictionary[element.Key] = value + element.TKStringVar.set('') + elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: + value=element.TKIntVar.get() + elif element.Type == ELEM_TYPE_INPUT_RADIO: + RadVar=element.TKIntVar.get() + this_rowcol = EncodeRadioRowCol(row_num,col_num) + value = RadVar == this_rowcol + elif element.Type == ELEM_TYPE_BUTTON: + if form.LastButtonClicked == element.ButtonText: + button_pressed_text = form.LastButtonClicked + if element.BType != BUTTON_TYPE_REALTIME: # Do not clear realtime buttons + form.LastButtonClicked = None + elif element.Type == ELEM_TYPE_INPUT_COMBO: + value=element.TKStringVar.get() + elif element.Type == ELEM_TYPE_INPUT_LISTBOX: + items=element.TKListbox.curselection() + value = [element.Values[int(item)] for item in items] + elif element.Type == ELEM_TYPE_INPUT_SPIN: + try: + value=element.TKStringVar.get() + except: + value = 0 + elif element.Type == ELEM_TYPE_INPUT_SLIDER: + try: + value=element.TKIntVar.get() + except: + value = 0 + elif element.Type == ELEM_TYPE_INPUT_MULTILINE: + try: + value=element.TKText.get(1.0, tk.END) + if not form.NonBlocking and not element.do_not_clear: + element.TKText.delete('1.0', tk.END) + except: + value = None + else: + value = None + # if an input type element, update the results + if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ + element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR: + AddToReturnList(form, value) + AddToReturnDictionary(form, element, value) try: - input_values_dictionary.pop(None, None) # clean up dictionary include None was included + form.ReturnValuesDictionary.pop(None, None) # clean up dictionary include None was included except: pass if not form.UseDictionary: - form.ReturnValues = button_pressed_text, input_values + form.ReturnValues = button_pressed_text, form.ReturnValuesList else: - form.ReturnValues = button_pressed_text, input_values_dictionary - form.ReturnValuesDictionary = button_pressed_text, input_values_dictionary - form.ResultsBuilt = True + form.ReturnValues = button_pressed_text, form.ReturnValuesDictionary + return form.ReturnValues @@ -1916,7 +1832,7 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): +def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): ''' Create and show a form on tbe caller's behalf. :param title: @@ -1932,8 +1848,7 @@ def ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,Non ''' local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width - target = (0,0) if local_orientation[0].lower() == 'h' else (0,1) - bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, target=target, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) + bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) form = FlexForm(title, auto_size_text=True) # Form using a horizontal bar @@ -1942,7 +1857,8 @@ def ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,Non bar2.TextToDisplay = single_line_message bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(Text(single_line_message, size=(width, height + 3), auto_size_text=True)) + bar_text = Text(single_line_message, size=(width, height + 3), auto_size_text=True) + form.AddRow(bar_text) form.AddRow((bar2)) form.AddRow((Cancel(button_color=button_color))) else: @@ -1950,15 +1866,16 @@ def ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,Non bar2.TextToDisplay = single_line_message bar2.MaxValue = max_value bar2.CurrentValue = 0 - form.AddRow(bar2, Text(single_line_message, size=(width, height + 3), auto_size_text=True)) + bar_text = Text(single_line_message, size=(width, height + 3), auto_size_text=True) + form.AddRow(bar2, bar_text) form.AddRow((Cancel(button_color=button_color))) form.NonBlocking = True form.Show(non_blocking= True) - return bar2 + return bar2, bar_text # ============================== ProgressMeterUpdate =====# -def ProgressMeterUpdate(bar, value, *args): +def _ProgressMeterUpdate(bar, value, text_elem, *args): ''' Update the progress meter for a form :param form: class ProgressBar @@ -1969,8 +1886,8 @@ def ProgressMeterUpdate(bar, value, *args): if bar == None: return False if bar.BarExpired: return False message, w, h = ConvertArgsToSingleString(*args) - - bar.TextToDisplay = message + text_elem.Update(message) + # bar.TextToDisplay = message bar.CurrentValue = value rc = bar.UpdateBar(value) if value >= bar.MaxValue or not rc: @@ -1998,6 +1915,7 @@ def __init__(self, title='', current_value=1, max_value=10, start_time=None, sta self.StatMessages = stat_messages self.ParentForm = None self.MeterID = None + self.MeterText = None # =========================== COMPUTE PROGRESS STATS ======================# def ComputeProgressStats(self): @@ -2059,7 +1977,7 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() message = "\n".join([line for line in EasyProgressMeter.EasyProgressMeterData.StatMessages]) - EasyProgressMeter.EasyProgressMeterData.MeterID = ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) + EasyProgressMeter.EasyProgressMeterData.MeterID, EasyProgressMeter.EasyProgressMeterData.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) EasyProgressMeter.EasyProgressMeterData.ParentForm = EasyProgressMeter.EasyProgressMeterData.MeterID.ParentForm return True # if exactly the same values as before, then ignore. @@ -2079,7 +1997,8 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, message = message + str(line) + '\n' message = "\n".join(EasyProgressMeter.EasyProgressMeterData.StatMessages) args= args + (message,) - rc = ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, current_value, *args) + rc = _ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, current_value, + EasyProgressMeter.EasyProgressMeterData.MeterText, *args) # if counter >= max then the progress meter is all done. Indicate none running if current_value >= EasyProgressMeter.EasyProgressMeterData.MaxValue or not rc: EasyProgressMeter.EasyProgressMeterData.MeterID = None @@ -2422,6 +2341,40 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( return True + +#################### ChangeLookAndFeel ####################### +# Predefined settings that will change the colors and styles # +# of the elements. # +############################################################## +def ChangeLookAndFeel(index): + # look and feel table + look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'), + 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, + + 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}} + try: + colors = look_and_feel[index] + + SetOptions(background_color=colors['BACKGROUND'], + text_element_background_color=colors['BACKGROUND'], + element_background_color=colors['BACKGROUND'], + text_color=colors['TEXT'], + input_elements_background_color=colors['INPUT'], + button_color=colors['BUTTON'], + progress_meter_color=colors['PROGRESS'], + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color=(colors['INPUT']), + element_text_color=colors['TEXT']) + except: # most likely an index out of range + pass + + + + # ============================== sprint ======# # Is identical to the Scrolled Text Box # # Provides a crude 'print' mechanism but in a # @@ -2443,12 +2396,12 @@ def ObjToString(obj, extra=' '): def main(): - with FlexForm('Demo form..', auto_size_text=True) as form: + with FlexForm('Demo form..') as form: form_rows = [[Text('You are running the PySimpleGUI.py file itself')], [Text('You should be importing it rather than running it\n')], [Text('Here is your sample input form....')], - [Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source', focus=True),FolderBrowse()], - [Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Dest'), FolderBrowse()], + [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], + [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], [Submit(bind_return_key=True), Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) From b757caa18d34068fb93719eaa94934a591a8efc2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 14 Aug 2018 16:49:36 -0400 Subject: [PATCH 140/521] Columns!! Columns feature, fix for opening multiple windows. --- PySimpleGUI.py | 515 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 476 insertions(+), 39 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7e277293c..64753abbb 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -133,6 +133,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_INPUT_SLIDER = 10 ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 +ELEM_TYPE_COLUMN = 555 ELEM_TYPE_PROGRESS_BAR = 200 ELEM_TYPE_BLANK = 100 @@ -643,6 +644,7 @@ def ButtonCallBack(self): # modify the Results table in the parent FlexForm object r,c = self.Position self.ParentForm.LastButtonClicked = self.ButtonText + self.ParentForm.FormRemainedOpen = False # if the form is tabbed, must collect all form's results and destroy all forms if self.ParentForm.IsTabbedForm: self.ParentForm.UberParent._Close() @@ -651,12 +653,13 @@ def ButtonCallBack(self): self.ParentForm.TKroot.quit() if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + # _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE # first, get the results table built # modify the Results table in the parent FlexForm object r,c = self.Position self.ParentForm.LastButtonClicked = self.ButtonText + self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop return @@ -763,6 +766,54 @@ def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# Column # +# ---------------------------------------------------------------------- # +class Column(Element): + def __init__(self, layout, background_color = None): + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + self.ParentForm = None + self.TKFrame = None + + self.Layout(layout) + + super().__init__(ELEM_TYPE_COLUMN, background_color=background_color) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + try: + del(self.TKroot) + except: + pass + super().__del__() + # ------------------------------------------------------------------------- # # FlexForm CLASS # @@ -791,6 +842,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.NonBlocking = False self.TKroot = None self.TKrootDestroyed = False + self.FormRemainedOpen = False self.TKAfterID = None self.ProgressBarColor = progress_bar_color self.AutoCloseDuration = auto_close_duration @@ -905,7 +957,7 @@ def Read(self): if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return BuildResults(self, False) + return BuildResults(self, False, self) def ReadNonBlocking(self, Message=''): if self.TKrootDestroyed: @@ -919,27 +971,15 @@ def ReadNonBlocking(self, Message=''): except: self.TKrootDestroyed = True _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return BuildResults(self, False) + return BuildResults(self, False, self) - # LEGACY version of ReadNonBlocking - def Refresh(self, Message=''): - if self.TKrootDestroyed: - return None, None - if Message: - print(Message) - try: - rc = self.TKroot.update() - except: - self.TKrootDestroyed = True - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 - return BuildResults(self, False) def _Close(self): try: self.TKroot.update() except: pass if not self.NonBlocking: - results = BuildResults(self, False) + results = BuildResults(self, False, self) if self.TKrootDestroyed: return None self.TKrootDestroyed = True @@ -966,10 +1006,10 @@ def __del__(self): for row in self.Rows: for element in row: element.__del__() - try: - del(self.TKroot) - except: - pass + # try: + # del(self.TKroot) + # except: + # pass # ------------------------------------------------------------------------- # # UberForm CLASS # @@ -1093,7 +1133,7 @@ def AddToReturnList(form, value): #----------------------------------------------------------------------------# # ------- FUNCTION InitializeResults. Sets up form results matrix --------# def InitializeResults(form): - BuildResults(form, True) + BuildResults(form, True, form) return #===== Radio Button RadVar encoding and decoding =====# @@ -1110,42 +1150,64 @@ def EncodeRadioRowCol(row, col): # ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # # format of return values is # (Button Pressed, input_values) -def BuildResults(form, initialize_only): +def BuildResults(form, initialize_only, top_level_form): # Results for elements are: # TEXT - Nothing # INPUT - Read value from TK # Button - Button Text and position as a Tuple # Get the initialized results so we don't have to rebuild - button_pressed_text = None - input_values = [] form.DictionaryKeyCounter = 0 form.ReturnValuesDictionary = {} form.ReturnValuesList = [] - key_counter = 0 + BuildResultsForSubform(form, initialize_only, top_level_form) + return form.ReturnValues + +def BuildResultsForSubform(form, initialize_only, top_level_form): + button_pressed_text = None for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): + value = None + if element.Type == ELEM_TYPE_COLUMN: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + # for key in element.ReturnValuesDictionary: + # top_level_form.ReturnValuesDictionary[key] = element.ReturnValuesDictionary[key] + # top_level_form.DictionaryKeyCounter += element.DictionaryKeyCounter + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + if not initialize_only: if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() - if not form.NonBlocking and not element.do_not_clear: + if not top_level_form.NonBlocking and not element.do_not_clear: element.TKStringVar.set('') elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: - value=element.TKIntVar.get() + value = element.TKIntVar.get() + value = (value != 0) elif element.Type == ELEM_TYPE_INPUT_RADIO: RadVar=element.TKIntVar.get() this_rowcol = EncodeRadioRowCol(row_num,col_num) value = RadVar == this_rowcol elif element.Type == ELEM_TYPE_BUTTON: - if form.LastButtonClicked == element.ButtonText: - button_pressed_text = form.LastButtonClicked + if top_level_form.LastButtonClicked == element.ButtonText: + button_pressed_text = top_level_form.LastButtonClicked if element.BType != BUTTON_TYPE_REALTIME: # Do not clear realtime buttons - form.LastButtonClicked = None + top_level_form.LastButtonClicked = None elif element.Type == ELEM_TYPE_INPUT_COMBO: value=element.TKStringVar.get() elif element.Type == ELEM_TYPE_INPUT_LISTBOX: - items=element.TKListbox.curselection() - value = [element.Values[int(item)] for item in items] + try: + items=element.TKListbox.curselection() + value = [element.Values[int(item)] for item in items] + except: + value = '' elif element.Type == ELEM_TYPE_INPUT_SPIN: try: value=element.TKStringVar.get() @@ -1159,17 +1221,18 @@ def BuildResults(form, initialize_only): elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) - if not form.NonBlocking and not element.do_not_clear: + if not top_level_form.NonBlocking and not element.do_not_clear: element.TKText.delete('1.0', tk.END) except: value = None else: value = None + # if an input type element, update the results if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ - element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR: + element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and element.Type!= ELEM_TYPE_COLUMN: AddToReturnList(form, value) - AddToReturnDictionary(form, element, value) + AddToReturnDictionary(top_level_form, element, value) try: form.ReturnValuesDictionary.pop(None, None) # clean up dictionary include None was included @@ -1186,7 +1249,379 @@ def BuildResults(form, initialize_only): # ------------------------------------------------------------------------------------------------------------------ # # ===================================== TK CODE STARTS HERE ====================================================== # # ------------------------------------------------------------------------------------------------------------------ # + +def PackFormIntoFrame(form, containing_frame, toplevel_form): + def CharWidthInPixels(): + return tkinter.font.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 + # --------------------------------------------------------------------------- # + # **************** Use FlexForm to build the tkinter window ********** ----- # + # Building is done row by row. # + # --------------------------------------------------------------------------- # + focus_set = False + ######################### LOOP THROUGH ROWS ######################### + # *********** ------- Loop through ROWS ------- ***********# + for row_num, flex_row in enumerate(form.Rows): + ######################### LOOP THROUGH ELEMENTS ON ROW ######################### + # *********** ------- Loop through ELEMENTS ------- ***********# + # *********** Make TK Row ***********# + tk_row_frame = tk.Frame(containing_frame) + for col_num, element in enumerate(flex_row): + element.ParentForm = toplevel_form # save the button's parent form object + if toplevel_form.Font and (element.Font == DEFAULT_FONT or not element.Font): + font = toplevel_form.Font + elif element.Font is not None: + font = element.Font + else: + font = DEFAULT_FONT + # ------- Determine Auto-Size setting on a cascading basis ------- # + if element.AutoSizeText is not None: # if element overide + auto_size_text = element.AutoSizeText + elif toplevel_form.AutoSizeText is not None: # if form override + auto_size_text = toplevel_form.AutoSizeText + else: + auto_size_text = DEFAULT_AUTOSIZE_TEXT + # Determine Element size + element_size = element.Size + if (element_size == (None, None)): # user did not specify a size + element_size = toplevel_form.DefaultElementSize + else: auto_size_text = False # if user has specified a size then it shouldn't autosize + # Apply scaling... Element scaling is higher priority than form level + if element.Scale != (None, None): + element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) + elif toplevel_form.Scale != (None, None): + element_size = (int(element_size[0] * toplevel_form.Scale[0]), int(element_size[1] * toplevel_form.Scale[1])) + # Set foreground color + text_color = element.TextColor + element_type = element.Type + # ------------------------- COLUMN element ------------------------- # + if element_type == ELEM_TYPE_COLUMN: + col_frame = tk.Frame(tk_row_frame) + PackFormIntoFrame(element, col_frame, toplevel_form) + col_frame.pack(side=tk.LEFT) + if element.BackgroundColor is not None: + col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) + # ------------------------- TEXT element ------------------------- # + elif element_type == ELEM_TYPE_TEXT: + display_text = element.DisplayText # text to display + if auto_size_text is False: + width, height=element_size + else: + lines = display_text.split('\n') + max_line_len = max([len(l) for l in lines]) + num_lines = len(lines) + if max_line_len > element_size[0]: # if text exceeds element size, the will have to wrap + width = element_size[0] + else: + width=max_line_len + height=num_lines + # ---===--- LABEL widget create and place --- # + stringvar = tk.StringVar() + element.TKStringVar = stringvar + stringvar.set(display_text) + if auto_size_text: + width = 0 + justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT + anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE + tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) + # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) + # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS + wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels + tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget + if element.BackgroundColor is not None: + tktext_label.configure(background=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + tktext_label.configure(fg=element.TextColor) + tktext_label.pack(side=tk.LEFT) + # ------------------------- BUTTON element ------------------------- # + elif element_type == ELEM_TYPE_BUTTON: + element.Location = (row_num, col_num) + btext = element.ButtonText + btype = element.BType + if element.AutoSizeButton is not None: + auto_size = element.AutoSizeButton + else: auto_size = toplevel_form.AutoSizeButtons + if auto_size is False: width=element_size[0] + else: width = 0 + height=element_size[1] + lines = btext.split('\n') + max_line_len = max([len(l) for l in lines]) + num_lines = len(lines) + if element.ButtonColor != (None, None)and element.ButtonColor != DEFAULT_BUTTON_COLOR: + bc = element.ButtonColor + elif toplevel_form.ButtonColor != (None, None) and toplevel_form.ButtonColor != DEFAULT_BUTTON_COLOR: + bc = toplevel_form.ButtonColor + else: + bc = DEFAULT_BUTTON_COLOR + border_depth = element.BorderWidth + if btype != BUTTON_TYPE_REALTIME: + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth) + else: + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth) + tkbutton.bind('', element.ButtonReleaseCallBack) + tkbutton.bind('', element.ButtonPressCallBack) + if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: + tkbutton.config(foreground=bc[0], background=bc[1]) + element.TKButton = tkbutton # not used yet but save the TK button in case + wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels + if element.ImageFilename: # if button has an image on it + print('Button Image Filename being placed', element.ImageFilename) + photo = tk.PhotoImage(file=element.ImageFilename) + print('PhotoImage object', ObjToString(photo)) + if element.ImageSize != (None, None): + width, height = element.ImageSize + if element.ImageSubsample: + photo = photo.subsample(element.ImageSubsample) + else: + width, height = photo.width(), photo.height() + tkbutton.config(image=photo, width=width, height=height) + tkbutton.image = photo + tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget + tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): + focus_set = True + element.TKButton.bind('', element.ReturnKeyHandler) + element.TKButton.focus_set() + toplevel_form.TKroot.focus_force() + # ------------------------- INPUT (Single Line) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_TEXT: + default_text = element.DefaultText + element.TKStringVar = tk.StringVar() + element.TKStringVar.set(default_text) + show = element.PasswordCharacter if element.PasswordCharacter else "" + element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show) + element.TKEntry.bind('', element.ReturnKeyHandler) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKEntry.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKEntry.configure(fg=text_color) + element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): + focus_set = True + element.TKEntry.focus_set() + # ------------------------- COMBO BOX (Drop Down) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_COMBO: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + element.TKStringVar = tk.StringVar() + if element.BackgroundColor and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + combostyle = ttk.Style() + try: + combostyle.theme_create('combostyle', + settings={'TCombobox': + {'configure': + {'selectbackground': element.BackgroundColor, + 'fieldbackground': element.BackgroundColor, + 'foreground': text_color, + 'background': element.BackgroundColor} + }}) + except: + try: + combostyle.theme_settings('combostyle', + settings={'TCombobox': + {'configure': + {'selectbackground': element.BackgroundColor, + 'fieldbackground': element.BackgroundColor, + 'foreground': text_color, + 'background': element.BackgroundColor} + }}) + except: pass + # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox + combostyle.theme_use('combostyle') + element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) + # element.TKCombo['state']='readonly' + element.TKCombo['values'] = element.Values + # if element.BackgroundColor is not None: + # element.TKCombo.configure(background=element.BackgroundColor) + element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKCombo.current(0) + # ------------------------- LISTBOX element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_LISTBOX: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + + element.TKStringVar = tk.StringVar() + element.TKListbox= tk.Listbox(tk_row_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) + for item in element.Values: + element.TKListbox.insert(tk.END, item) + element.TKListbox.selection_set(0,0) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKListbox.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKListbox.configure(fg=text_color) + # vsb = tk.Scrollbar(tk_row_frame, orient="vertical", command=element.TKListbox.yview) + # element.TKListbox.configure(yscrollcommand=vsb.set) + element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + # vsb.pack(side=tk.LEFT, fill='y') + # ------------------------- INPUT MULTI LINE element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_MULTILINE: + default_text = element.DefaultText + width, height = element_size + element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) + element.TKText.insert(1.0, default_text) # set the default text + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKText.configure(background=element.BackgroundColor) + element.TKText.vbar.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) + element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.EnterSubmits: + element.TKText.bind('', element.ReturnKeyHandler) + if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): + focus_set = True + element.TKText.focus_set() + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKText.configure(fg=text_color) + # ------------------------- INPUT CHECKBOX element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_CHECKBOX: + width = 0 if auto_size_text else element_size[0] + default_value = element.InitialState + element.TKIntVar = tk.IntVar() + element.TKIntVar.set(default_value if default_value is not None else 0) + element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) + if default_value is None: + element.TKCheckbutton.configure(state='disable') + if element.BackgroundColor is not None: + element.TKCheckbutton.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKCheckbutton.configure(fg=text_color) + element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- PROGRESS BAR element ------------------------- # + elif element_type == ELEM_TYPE_PROGRESS_BAR: + # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar + width = element_size[0] + fnt = tkinter.font.Font() + char_width = fnt.measure('A') # single character width + progress_length = width*char_width + progress_width = element_size[1] + direction = element.Orientation + if element.BarColor != (None, None): # if element has a bar color, use it + bar_color = element.BarColor + else: + bar_color = DEFAULT_PROGRESS_BAR_COLOR + element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief, style=element.BarStyle ) + # element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) + element.TKProgressBar.TKProgressBarForReal.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- INPUT RADIO BUTTON element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_RADIO: + width = 0 if auto_size_text else element_size[0] + default_value = element.InitialState + ID = element.GroupID + # see if ID has already been placed + value = EncodeRadioRowCol(row_num, col_num) # value to set intvar to if this radio is selected + if ID in toplevel_form.RadioDict: + RadVar = toplevel_form.RadioDict[ID] + else: + RadVar = tk.IntVar() + toplevel_form.RadioDict[ID] = RadVar + element.TKIntVar = RadVar # store the RadVar in Radio object + if default_value: # if this radio is the one selected, set RadVar to match + element.TKIntVar.set(value) + element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, + variable=element.TKIntVar, value=value, bd=border_depth, font=font) + if element.BackgroundColor is not None: + element.TKRadio.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKRadio.configure(fg=text_color) + element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + # ------------------------- INPUT SPIN Box element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_SPIN: + width, height = element_size + width = 0 if auto_size_text else element_size[0] + element.TKStringVar = tk.StringVar() + element.TKSpinBox = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth) + element.TKStringVar.set(element.DefaultValue) + element.TKSpinBox.configure(font=font) # set wrap to width of widget + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKSpinBox.configure(background=element.BackgroundColor) + element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKSpinBox.configure(fg=text_color) + # ------------------------- OUTPUT element ------------------------- # + elif element_type == ELEM_TYPE_OUTPUT: + width, height = element_size + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color) + element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- IMAGE Box element ------------------------- # + elif element_type == ELEM_TYPE_IMAGE: + photo = tk.PhotoImage(file=element.Filename) + if element_size == (None, None) or element_size == None or element_size == toplevel_form.DefaultElementSize: + width, height = photo.width(), photo.height() + else: + width, height = element_size + tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) + tktext_label.image = photo + # tktext_label.configure(anchor=tk.NW, image=photo) + tktext_label.pack(side=tk.LEFT) + # ------------------------- SLIDER Box element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_SLIDER: + slider_length = element_size[0] * CharWidthInPixels() + slider_width = element_size[1] + element.TKIntVar = tk.IntVar() + element.TKIntVar.set(element.DefaultValue) + if element.Orientation[0] == 'v': + range_from = element.Range[1] + range_to = element.Range[0] + slider_length += DEFAULT_MARGINS[1]*(element_size[0]*2) # add in the padding + else: + range_from = element.Range[0] + range_to = element.Range[1] + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) + # tktext_label.configure(anchor=tk.NW, image=photo) + if element.BackgroundColor is not None: + tkscale.configure(background=element.BackgroundColor) + tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + tkscale.configure(fg=text_color) + tkscale.pack(side=tk.LEFT) + #............................DONE WITH ROW pack the row of widgets ..........................# + # done with row, pack the row of widgets + tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) + + if form.BackgroundColor is not None: + tk_row_frame.configure(background=form.BackgroundColor) + if not toplevel_form.IsTabbedForm: + toplevel_form.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + else: toplevel_form.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + return + + def ConvertFlexToTK(MyFlexForm): + master = MyFlexForm.TKroot + # only set title on non-tabbed forms + if not MyFlexForm.IsTabbedForm: + master.title(MyFlexForm.Title) + InitializeResults(MyFlexForm) + PackFormIntoFrame(MyFlexForm, master, MyFlexForm) + #....................................... DONE creating and laying out window ..........................# + if MyFlexForm.IsTabbedForm: + master = MyFlexForm.ParentWindow + master.attributes('-alpha', 0) # hide window while getting info and moving + screen_width = master.winfo_screenwidth() # get window info to move to middle of screen + screen_height = master.winfo_screenheight() + if MyFlexForm.Location != (None, None): + x,y = MyFlexForm.Location + elif DEFAULT_WINDOW_LOCATION != (None, None): + x,y = DEFAULT_WINDOW_LOCATION + else: + master.update_idletasks() # don't forget + win_width = master.winfo_width() + win_height = master.winfo_height() + x = screen_width/2 -win_width/2 + y = screen_height/2 - win_height/2 + if y+win_height > screen_height: + y = screen_height-win_height + if x+win_width > screen_width: + x = screen_width-win_width + + move_string = '+%i+%i'%(int(x),int(y)) + master.geometry(move_string) + master.attributes('-alpha', 255) # Make window visible again + master.update_idletasks() # don't forget + return + +def ConvertFlexToTKOld(MyFlexForm): def CharWidthInPixels(): return tkinter.font.Font().measure('A') # single character width master = MyFlexForm.TKroot @@ -1542,6 +1977,7 @@ def CharWidthInPixels(): # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON): + # takes as input (form, rows, tab name) for each tab global _my_windows uber = UberForm() @@ -1617,10 +2053,10 @@ def StartupTK(my_flex_form): my_flex_form.TKAfterID = root.after(duration * 1000, my_flex_form._AutoCloseAlarmCallback) if my_flex_form.NonBlocking: my_flex_form.TKroot.protocol("WM_WINDOW_DESTROYED", my_flex_form.OnClosingCallback()) - pass else: # it's a blocking form my_flex_form.TKroot.mainloop() - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + if not my_flex_form.FormRemainedOpen: + _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 if my_flex_form.RootNeedsDestroying: my_flex_form.TKroot.destroy() my_flex_form.RootNeedsDestroying = False @@ -1673,7 +2109,8 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a local_line_width = line_width else: local_line_width = MESSAGE_BOX_LINE_WIDTH - with FlexForm(args_to_print[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font) as form: + title = args_to_print[0] if args_to_print[0] is not None else 'None' + with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -2060,7 +2497,7 @@ def Print(self, *args, end=None, sep=None): # print(1, 2, 3, sep='-') # if end is None: # print("") - self.form.Refresh() + self.form.ReadNonBlocking() def Close(self): self.form.CloseNonBlockingForm() From 6a6ed02a02181fb691601a49d01b693287e82375 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 09:21:30 -0400 Subject: [PATCH 141/521] Look and feel calls, text colors New values in Look and Feel table. Recipes call the new look and feel func. --- Demo_Recipes.py | 54 ++++++++++++++++++++++------------------ PySimpleGUI.py | 65 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 79 insertions(+), 40 deletions(-) diff --git a/Demo_Recipes.py b/Demo_Recipes.py index d34fac495..529b2480a 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -6,13 +6,13 @@ def SourceDestFolders(): with sg.FlexForm('Demo Source / Destination Folders') as form: form_rows = ([sg.Text('Enter the Source and Destination folders')], - [sg.Text('Source Folder', size=(15, 1), justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], + [sg.Text('Source Folder', size=(15, 1), justification='right'), sg.InputText('Source', key='source'), sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), justification='right'), sg.InputText('Dest', key='dest'), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()]) - button, (source, dest) = form.LayoutAndRead(form_rows) + button, values = form.LayoutAndRead(form_rows) if button == 'Submit': - sg.MsgBox('Submitted', 'The user entered source:', source, 'Destination folder:', dest, 'Using button', button) + sg.MsgBox('Submitted', values, 'The user entered source:', values['source'], 'Destination folder:', values['dest'], 'Using button', button) else: sg.MsgBoxError('Cancelled', 'User Cancelled') @@ -160,20 +160,26 @@ def NonBlockingPeriodicUpdateForm(): # Show a form that's a running counter form = sg.FlexForm('Running Timer', auto_size_text=True) text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') - form_rows = [[sg.Text('Non blocking GUI with updates')], + form_rows = [[sg.Text('Stopwatch')], [text_element], - [sg.T(' ' * 15), sg.Quit()]] + [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] + form.LayoutAndRead(form_rows, non_blocking=True) - for i in range(1,50000): - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) + timer_running = True + i = 0 + while True: + i += 1 * (timer_running is True) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button break + elif button == 'Start/Stop': + timer_running = not timer_running + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) + time.sleep(.01) - else: # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() + form.CloseNonBlockingForm() del(form) def DebugTest(): @@ -199,29 +205,29 @@ def ChangeLookAndFeel(colors): #=---------------------------------- main ------------------------------ def main(): - # Green & tan color scheme - colors1 = {'BACKGROUND' : '#9FB8AD', 'TEXT': sg.COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'),'PROGRESS':sg.DEFAULT_PROGRESS_BAR_COLOR } - # light green with tan - colors2 = {'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')} - # blue with light blue color scheme - colors3 = {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':sg.DEFAULT_PROGRESS_BAR_COLOR} - - ChatBot() Everything() + ChatBot() + sg.ChangeLookAndFeel('BrownBlue') SourceDestFolders() - ChangeLookAndFeel(colors2) - ProgressMeter() - ChangeLookAndFeel(colors3) + sg.ChangeLookAndFeel('BlueMono') Everything() - ChangeLookAndFeel(colors2) + sg.ChangeLookAndFeel('BluePurple') + Everything() + sg.ChangeLookAndFeel('LightGreen') + Everything() + sg.ChangeLookAndFeel('GreenMono') MachineLearningGUI() + sg.ChangeLookAndFeel('TealMono') + NonBlockingPeriodicUpdateForm() + ChatBot() + ProgressMeter() + sg.ChangeLookAndFeel('Purple') Everything_NoContextManager() NonBlockingPeriodicUpdateForm_ContextManager() - NonBlockingPeriodicUpdateForm() - DebugTest() sg.MsgBox('Done with all recipes') + DebugTest() if __name__ == '__main__': main() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 64753abbb..dda7640a9 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -42,6 +42,7 @@ DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = None DEFAULT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT DEFAULT_INPUT_ELEMENTS_COLOR = COLOR_SYSTEM_DEFAULT +DEFAULT_INPUT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT DEFAULT_SCROLLBAR_COLOR = None # DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember # DEFAULT_BUTTON_COLOR = (GREENS[3], TANS[0]) # Foreground, Background (None, None) == System Default @@ -219,10 +220,11 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto ''' self.DefaultText = default_text self.PasswordCharacter = password_char - bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + bg = background_color if background_color is not None else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR self.Focus = focus self.do_not_clear = do_not_clear - super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) + super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) @@ -246,7 +248,9 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text self.Values = values self.TKComboBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) def __del__(self): try: @@ -284,7 +288,8 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non else: self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=text_color, key=key) + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key) def __del__(self): try: @@ -376,7 +381,9 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N self.DefaultValue = initial_value self.TKSpinBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=text_color, key=key) + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key) return def __del__(self): @@ -405,7 +412,9 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR self.Focus = focus self.do_not_clear = do_not_clear - super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=text_color, key=key) + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) return def Update(self, NewValue): @@ -555,7 +564,9 @@ def __init__(self, scale=(None, None), size=(None, None), background_color=None, ''' self.TKOut = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR - super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=text_color) + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=fg) def __del__(self): try: @@ -1366,9 +1377,7 @@ def CharWidthInPixels(): element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels if element.ImageFilename: # if button has an image on it - print('Button Image Filename being placed', element.ImageFilename) photo = tk.PhotoImage(file=element.ImageFilename) - print('PhotoImage object', ObjToString(photo)) if element.ImageSize != (None, None): width, height = element.ImageSize if element.ImageSubsample: @@ -2037,6 +2046,7 @@ def StartupTK(my_flex_form): global _my_windows ow = _my_windows.NumOpenWindows + # print('Starting TK open Windows = {}'.format(ow)) root = tk.Tk() if not ow else tk.Toplevel() if my_flex_form.BackgroundColor is not None: root.configure(background=my_flex_form.BackgroundColor) @@ -2054,7 +2064,9 @@ def StartupTK(my_flex_form): if my_flex_form.NonBlocking: my_flex_form.TKroot.protocol("WM_WINDOW_DESTROYED", my_flex_form.OnClosingCallback()) else: # it's a blocking form + # print('..... CALLING MainLoop') my_flex_form.TKroot.mainloop() + # print('..... BACK from MainLoop') if not my_flex_form.FormRemainedOpen: _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 if my_flex_form.RootNeedsDestroying: @@ -2651,7 +2663,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( progress_meter_border_depth=None, progress_meter_style=None, progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None, text_justification=None, background_color=None, element_background_color=None, - text_element_background_color=None, input_elements_background_color=None, + text_element_background_color=None, input_elements_background_color=None, input_text_color=None, scrollbar_color=None, text_color=None, element_text_color = None, debug_win_size=(None,None), window_location=(None,None)): global DEFAULT_ELEMENT_SIZE @@ -2682,6 +2694,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( global DEFAULT_TEXT_COLOR global DEFAULT_WINDOW_LOCATION global DEFAULT_ELEMENT_TEXT_COLOR + global DEFAULT_INPUT_TEXT_COLOR global _my_windows if icon: @@ -2776,6 +2789,8 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( if element_text_color != None: DEFAULT_ELEMENT_TEXT_COLOR = element_text_color + if input_text_color is not None: + DEFAULT_INPUT_TEXT_COLOR = input_text_color return True @@ -2785,12 +2800,29 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( ############################################################## def ChangeLookAndFeel(index): # look and feel table - look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'), - 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, + + 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + + 'Purple': {'BACKGROUND': '#B0AAC2', 'TEXT': 'black', 'INPUT': '#F2EFE8','SCROLL': '#F2EFE8','TEXT_INPUT' : 'black', + 'BUTTON': ('black', '#C2D4D8'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'BlueMono': {'BACKGROUND': '#AAB6D3', 'TEXT': 'black', 'INPUT': '#F1F4FC','SCROLL': '#F1F4FC','TEXT_INPUT' : 'black', + 'BUTTON': ('white', '#7186C7'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'GreenMono': {'BACKGROUND': '#A8C1B4', 'TEXT': 'black', 'INPUT': '#DDE0DE', 'SCROLL': '#E3E3E3','TEXT_INPUT' : 'black', + 'BUTTON': ('white', '#6D9F85'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', + 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, + 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', + 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}} + 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#3b7f97'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR} + } try: colors = look_and_feel[index] @@ -2804,8 +2836,9 @@ def ChangeLookAndFeel(index): border_width=0, slider_border_width=0, progress_meter_border_depth=0, - scrollbar_color=(colors['INPUT']), - element_text_color=colors['TEXT']) + scrollbar_color=(colors['SCROLL']), + element_text_color=colors['TEXT'], + input_text_color=colors['TEXT_INPUT']) except: # most likely an index out of range pass From 15cd0ed7f3795fc455426f8a0f144bfa03a05db4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 10:03:53 -0400 Subject: [PATCH 142/521] Form Designer, auto packer, new color options, new predefined look and feel Some really cool features for changing how things look. Directions on how to use the new PySimpleGUI Form Designer --- readme.md | 183 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 156 insertions(+), 27 deletions(-) diff --git a/readme.md b/readme.md index 32008eb50..50e12dac2 100644 --- a/readme.md +++ b/readme.md @@ -144,7 +144,6 @@ You will see a number of different styles of buttons, data entry fields, etc, in - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary -It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. ----- ## Getting Started with PySimpleGUI @@ -380,7 +379,89 @@ Two other types of forms exist. 1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. 2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. + +## The Form Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. + +![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) + +It's a manual process, but if you follow the instructions, it will take only a minute to do and the result will be a nice looking GUI. The steps you'll take are: +1. Sketch your GUI on paper +2. Divide your GUI up into rows +3. Label each Element with the Element name +4. Write your Python code using the labels as pseudo-code + +Let's take a couple of examples. + +**Enter a number**.... Popular beginner programs are often based on a game or logic puzzle that requires the user to enter something, like a number. The "high-low" answer game comes to mind where you try to guess the number based on high or low tips. + +**Step 1- Sketch the GUI** +![gui1_1](https://user-images.githubusercontent.com/13696193/44160127-6a584900-a087-11e8-8fec-09099a8e16f6.JPG) + +**Step 2 - Divide into rows** + +![gui2_1](https://user-images.githubusercontent.com/13696193/44160128-6a584900-a087-11e8-9973-af866fb94c56.JPG) + +Step 3 - Label elements + +![gui6_1](https://user-images.githubusercontent.com/13696193/44160116-64626800-a087-11e8-8b57-671c0461b508.JPG) + +Step 4 - Write the code +The code we're writing is the layout of the GUI itself. This tutorial only focuses on getting the window code written, not the stuff to display it, get results. + +We have only 1 element on the first row, some text. Rows are written as a "list of elements", so we'll need [ ] to make a list. Here's the code for row 1 + + [ sg.Text('Enter a number') ] + +Row 2 has 1 elements, an input field. + + [ sg.Input() ] +Row 3 has an OK button + + [ sg.OK() ] + +Now that we've got the 3 rows defined, they are put into a list that represents the entire window. + + layout = [ [sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + +Finally we can put it all together into a program that will display our window. + + import PySimpleGUI as sg + + layout = [[sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + + button, (number,) = sg.FlexForm('Enter a number example').LayoutAndRead(layout) + + sg.MsgBox(button, number) + +### Example 2 - Get a filename +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. + +![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) +![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) + +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + + sg.MsgBox(button, number) + + +Read on for detailed instructions on the calls that show the form and return your results. + + + # Copy these design patterns! ## Pattern 1 - With Context Manager @@ -451,6 +532,24 @@ In the statement that shows and reads the form, the two input fields are directl Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### The Auto-Packer + +Once you've laid out your elements into, it's the job of the Auto-Packer to place your elements into a window frame. + +The layout of custom GUIs is made trivial by the use of the Auto-Packer. GUI frameworks often use a grid system and sometimes have a "pack" function that's used to place widgets into a window. It's almost always a confusing exercise to use them. + +PySimpleGUI uses a "row by row" approach to building GUIs. When you were to sketch your GUI out on a sheet of paper and then draw horizontal lines across the page under each widget then you would have a several "rows" of widgets. + +For each row in your GUI, you will have a list of elements. In Python this list is a simple Python list. An entire GUI window is a list of rows, one after another. + +This is how your GUI is created, one row at a time, with one row stacked on top of another. This visual form of coding makes GUI creation go so much quicker. + + layout = [ [ Row 1 Elements], + [ Row 2 Elements] ] + + ### Laying out your form Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. @@ -1247,24 +1346,27 @@ Let's have some fun customizing! Make PySimpleGUI look the way you want it to l auto_size_buttons=None font=None border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + text_color=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + element_text_color=None + input_text_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) Explanation of parameters @@ -1291,6 +1393,8 @@ Explanation of parameters element_background_color - Background color of the elements text_element_background_color - Text element background color input_elements_background_color - Input fields background color + element_text_color - Text color of elements that have text, like Radio Buttons + input_text_color - Color of the text that you type in scrollbar_color - Color for scrollbars (may not always work) text_color - Text element default text color text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' @@ -1315,7 +1419,7 @@ When do you use a non-blocking form? A couple of examples are * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +Word of warning... starting with version 2.2 there is a change in the return values from the`ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: @@ -1394,13 +1498,19 @@ That's it... this example follows the async design pattern well. ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. +`Demo_Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. Start here! + +`Demo_Compare_Files` - Takes 2 filenames as input. Does a byte for byte compare and returns the results. + + `Demo_Dictionary` - Simple form demonstrating how return values in dictionary form work. -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + `Demo_DisplayHash1and256` - Presents 3 methods of gathering the same user input using both high-level APIs and lower-level. -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning +Demo_Func_Callback_Simulation - Shows how callback functions can be simulated. This is particularly good for the Raspberry Pi and other embedded type applications. -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. +`Demo_DuplicateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo_HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program **could forever change how you code**. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up and release as a standalone application, then speak up on the GitHub! ## Fun Stuff Here are some things to try if you're bored or want to further customize @@ -1417,6 +1527,22 @@ This will turn all of your print statements into prints that display in a window **Look and Feel** Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. +Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. + + sg.ChangeLookAndFeel('GreenTan') + +Valid values for the description string are: + + GreenTan + LightGreen + BluePurple + Purple + BlueMono + GreenMono + BrownBlue + BrightColors + TealMono + **ObjToString** Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. @@ -1470,7 +1596,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, +| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, ### Release Notes @@ -1522,6 +1648,9 @@ In Python, functions behave just like object. When you're placing a Text Element **Lists** It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. +**Dictionaries** +Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. + ## Authors MikeTheWatchGuy @@ -1558,4 +1687,4 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. From db4bb742ff3fde4a7602f1db2b4db14a3d14e875 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 11:01:28 -0400 Subject: [PATCH 143/521] Columns, short form design pattern --- readme.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 50e12dac2..392287c2d 100644 --- a/readme.md +++ b/readme.md @@ -466,7 +466,7 @@ Read on for detailed instructions on the calls that show the form and return you ## Pattern 1 - With Context Manager - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + with sg.FlexForm('SHA-1 & 256 Hash') as form: form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] @@ -475,22 +475,34 @@ Read on for detailed instructions on the calls that show the form and return you ## Pattern 2 - No Context Manager - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form = sg.FlexForm('SHA-1 & 256 Hash') form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] button, (source_filename,) = form.LayoutAndRead(form_rows) + ---- + +## Pattern 3 - Short Form + + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) -These 2 design patters both produce this custom form: + +These 3 design patterns both produce this custom form: ![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. +When you're code leaves forms open or you show many forms, then it's important to use the "with" context manager so that resources are freed as quickly as possible. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. +The third is the 'compact form'. It compacts down into 2 lines of code. One line is your form definition. The next is the call that shows the form and returns the values. You can use this pattern for simple, short programs where resource allocation isn't an issue. + You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. ### How GUI Programming in Python Should Look @@ -1202,7 +1214,7 @@ Somewhere later in your code will be your main event loop. This is where you do break time.sleep(.01) -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is @@ -1283,7 +1295,54 @@ Here's a complete solution for a chat-window using an Async form with an Output print(value) else: break +------------------- +## Columns +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. + +Columns are specified in exactly the same way as a form is, as a list of lists. + +Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: + + +![column example](https://user-images.githubusercontent.com/13696193/44215113-b1097a00-a13f-11e8-96d0-f3511036494e.jpg) +This code produced the above window. + + + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + form = sg.FlexForm('Columns') # blank form + + # Column layout + col = [[sg.Text('col Row 1')], + [sg.Text('col Row 2'), sg.Input('col input 1')], + [sg.Text('col Row 3'), sg.Input('col input 2')], + [sg.Text('col Row 4'), sg.Input('col input 3')], + [sg.Text('col Row 5'), sg.Input('col input 4')], + [sg.Text('col Row 6'), sg.Input('col input 5')], + [sg.Text('col Row 7'), sg.Input('col input 6')]] + + layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], + [sg.In('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + + sg.MsgBox(button, values, line_width=200) + +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. + + Column(layout, background_color=None) + +The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. ## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format @@ -1679,7 +1738,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. @@ -1688,3 +1747,4 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + From 79de9099e9537ca74243dc5aeae961f8e5ea2900 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 12:39:51 -0400 Subject: [PATCH 144/521] Copying readme over --- docs/index.md | 263 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 227 insertions(+), 36 deletions(-) diff --git a/docs/index.md b/docs/index.md index 0d55aa851..392287c2d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -116,13 +116,14 @@ Here is the code that produced the above screenshot. sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], [sg.Text('_' * 100, size=(70, 1))], [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] + ] - button, values = form.LayoutAndRead(layout) + button, values = form.LayoutAndRead(layout) **A note on screen shots** You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. @@ -143,7 +144,6 @@ You will see a number of different styles of buttons, data entry fields, etc, in - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary -It's stunning that after so many years Python still hasn't put forth a GUI framework that truly fits the language's basic data structures, especially lists. It's hard to argue with the success to be had in quickly building GUI applications using this package's syntax. ----- ## Getting Started with PySimpleGUI @@ -379,12 +379,94 @@ Two other types of forms exist. 1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. 2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. Let's start with a basic Browse for a file and do something with it. +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. + +## The Form Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. + +![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) + +It's a manual process, but if you follow the instructions, it will take only a minute to do and the result will be a nice looking GUI. The steps you'll take are: +1. Sketch your GUI on paper +2. Divide your GUI up into rows +3. Label each Element with the Element name +4. Write your Python code using the labels as pseudo-code + +Let's take a couple of examples. + +**Enter a number**.... Popular beginner programs are often based on a game or logic puzzle that requires the user to enter something, like a number. The "high-low" answer game comes to mind where you try to guess the number based on high or low tips. + +**Step 1- Sketch the GUI** +![gui1_1](https://user-images.githubusercontent.com/13696193/44160127-6a584900-a087-11e8-8fec-09099a8e16f6.JPG) + +**Step 2 - Divide into rows** + +![gui2_1](https://user-images.githubusercontent.com/13696193/44160128-6a584900-a087-11e8-9973-af866fb94c56.JPG) + +Step 3 - Label elements + +![gui6_1](https://user-images.githubusercontent.com/13696193/44160116-64626800-a087-11e8-8b57-671c0461b508.JPG) + +Step 4 - Write the code +The code we're writing is the layout of the GUI itself. This tutorial only focuses on getting the window code written, not the stuff to display it, get results. + +We have only 1 element on the first row, some text. Rows are written as a "list of elements", so we'll need [ ] to make a list. Here's the code for row 1 + + [ sg.Text('Enter a number') ] + +Row 2 has 1 elements, an input field. + + [ sg.Input() ] +Row 3 has an OK button + + [ sg.OK() ] + +Now that we've got the 3 rows defined, they are put into a list that represents the entire window. + + layout = [ [sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + +Finally we can put it all together into a program that will display our window. + + import PySimpleGUI as sg + + layout = [[sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + + button, (number,) = sg.FlexForm('Enter a number example').LayoutAndRead(layout) + + sg.MsgBox(button, number) + +### Example 2 - Get a filename +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. + +![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) +![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) + +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + + sg.MsgBox(button, number) + + +Read on for detailed instructions on the calls that show the form and return your results. + + + # Copy these design patterns! ## Pattern 1 - With Context Manager - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + with sg.FlexForm('SHA-1 & 256 Hash') as form: form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] @@ -393,22 +475,34 @@ It's both not enjoyable nor helpful to immediately jump into tweaking each and e ## Pattern 2 - No Context Manager - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form = sg.FlexForm('SHA-1 & 256 Hash') form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] button, (source_filename,) = form.LayoutAndRead(form_rows) + ---- +## Pattern 3 - Short Form -These 2 design patters both produce this custom form: + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) + + + +These 3 design patterns both produce this custom form: ![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) -It's important to use the "with" context manager so that resources are freed as quickly as possible, using the currently executing thread. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. +When you're code leaves forms open or you show many forms, then it's important to use the "with" context manager so that resources are freed as quickly as possible. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. +The third is the 'compact form'. It compacts down into 2 lines of code. One line is your form definition. The next is the call that shows the form and returns the values. You can use this pattern for simple, short programs where resource allocation isn't an issue. + You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. ### How GUI Programming in Python Should Look @@ -450,6 +544,24 @@ In the statement that shows and reads the form, the two input fields are directl Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +### The Auto-Packer + +Once you've laid out your elements into, it's the job of the Auto-Packer to place your elements into a window frame. + +The layout of custom GUIs is made trivial by the use of the Auto-Packer. GUI frameworks often use a grid system and sometimes have a "pack" function that's used to place widgets into a window. It's almost always a confusing exercise to use them. + +PySimpleGUI uses a "row by row" approach to building GUIs. When you were to sketch your GUI out on a sheet of paper and then draw horizontal lines across the page under each widget then you would have a several "rows" of widgets. + +For each row in your GUI, you will have a list of elements. In Python this list is a simple Python list. An entire GUI window is a list of rows, one after another. + +This is how your GUI is created, one row at a time, with one row stacked on top of another. This visual form of coding makes GUI creation go so much quicker. + + layout = [ [ Row 1 Elements], + [ Row 2 Elements] ] + + ### Laying out your form Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. @@ -1102,7 +1214,7 @@ Somewhere later in your code will be your main event loop. This is where you do break time.sleep(.01) -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons ules anutton was clicked. +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is @@ -1183,7 +1295,54 @@ Here's a complete solution for a chat-window using an Async form with an Output print(value) else: break +------------------- +## Columns +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. + +Columns are specified in exactly the same way as a form is, as a list of lists. + +Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: + + +![column example](https://user-images.githubusercontent.com/13696193/44215113-b1097a00-a13f-11e8-96d0-f3511036494e.jpg) +This code produced the above window. + + + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + form = sg.FlexForm('Columns') # blank form + + # Column layout + col = [[sg.Text('col Row 1')], + [sg.Text('col Row 2'), sg.Input('col input 1')], + [sg.Text('col Row 3'), sg.Input('col input 2')], + [sg.Text('col Row 4'), sg.Input('col input 3')], + [sg.Text('col Row 5'), sg.Input('col input 4')], + [sg.Text('col Row 6'), sg.Input('col input 5')], + [sg.Text('col Row 7'), sg.Input('col input 6')]] + + layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], + [sg.In('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + + sg.MsgBox(button, values, line_width=200) + +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. + + Column(layout, background_color=None) + +The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. ## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format @@ -1246,24 +1405,27 @@ Let's have some fun customizing! Make PySimpleGUI look the way you want it to l auto_size_buttons=None font=None border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None + text_color=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None + element_text_color=None + input_text_color=None + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) Explanation of parameters @@ -1290,6 +1452,8 @@ Explanation of parameters element_background_color - Background color of the elements text_element_background_color - Text element background color input_elements_background_color - Input fields background color + element_text_color - Text color of elements that have text, like Radio Buttons + input_text_color - Color of the text that you type in scrollbar_color - Color for scrollbars (may not always work) text_color - Text element default text color text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' @@ -1314,7 +1478,7 @@ When do you use a non-blocking form? A couple of examples are * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -Word of warning... version 2.2, the currently released, and upcoming version 2.3 differ in the return code for the `ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +Word of warning... starting with version 2.2 there is a change in the return values from the`ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: @@ -1393,13 +1557,19 @@ That's it... this example follows the async design pattern well. ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -`Demo Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. +`Demo_Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. Start here! + +`Demo_Compare_Files` - Takes 2 filenames as input. Does a byte for byte compare and returns the results. + + `Demo_Dictionary` - Simple form demonstrating how return values in dictionary form work. -`Demo DisplayHash1and256.py` - Demonstrates using High Level API calls to get a filename + `Demo_DisplayHash1and256` - Presents 3 methods of gathering the same user input using both high-level APIs and lower-level. -`Demo DupliucateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning +Demo_Func_Callback_Simulation - Shows how callback functions can be simulated. This is particularly good for the Raspberry Pi and other embedded type applications. -`Demo HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program could forever change how you code. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up, I could use a hand. +`Demo_DuplicateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning + +`Demo_HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program **could forever change how you code**. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up and release as a standalone application, then speak up on the GitHub! ## Fun Stuff Here are some things to try if you're bored or want to further customize @@ -1416,6 +1586,22 @@ This will turn all of your print statements into prints that display in a window **Look and Feel** Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. +Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. + + sg.ChangeLookAndFeel('GreenTan') + +Valid values for the description string are: + + GreenTan + LightGreen + BluePurple + Purple + BlueMono + GreenMono + BrownBlue + BrightColors + TealMono + **ObjToString** Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. @@ -1469,7 +1655,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, do_not_clear input field option, +| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, ### Release Notes @@ -1521,6 +1707,9 @@ In Python, functions behave just like object. When you're placing a Text Element **Lists** It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. +**Dictionaries** +Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. + ## Authors MikeTheWatchGuy @@ -1533,6 +1722,7 @@ GNU Lesser General Public License (LGPL 3) + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` +* [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example ## How Do I @@ -1548,7 +1738,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. @@ -1556,4 +1746,5 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + From 7295d34df83a33d60b26c67274bf4dbb6946f34e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 14:16:06 -0400 Subject: [PATCH 145/521] Release of Column support --- Demo_Columns.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Demo_Columns.py diff --git a/Demo_Columns.py b/Demo_Columns.py new file mode 100644 index 000000000..ededa3f66 --- /dev/null +++ b/Demo_Columns.py @@ -0,0 +1,24 @@ +import PySimpleGUI as sg + +# Demo of how columns work +# Form has on row 1 a vertical slider followed by a COLUMN with 7 rows +# Prior to the Column element, this layout was not possible +# Columns layouts look identical to form layouts, they are a list of lists of elements. + +# sg.ChangeLookAndFeel('BlueMono') + +# Column layout +col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + +layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + +# Display the form and get values +# If you're willing to not use the "context manager" design pattern, then it's possible +# to collapse the form display and read down to a single line of code. +button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + +sg.MsgBox(button, values, line_width=200) From 523467f7899e29a2011f12f9dae43dfa74703784 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 17:01:26 -0400 Subject: [PATCH 146/521] Columns, single-line GUI --- docs/cookbook.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 8052b7d48..4b86c222c 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -273,6 +273,7 @@ The architecture of some programs works better with button callbacks instead of ## Realtime Buttons (Good For Raspberry Pi) This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. +![robot control](https://user-images.githubusercontent.com/13696193/44006710-d227f23e-9e56-11e8-89a3-2be5b2726199.jpg) import PySimpleGUI as sg @@ -310,12 +311,14 @@ This recipe implements a remote control interface for a robot. There are 4 dire ## Easy Progress Meter This recipe shows just how easy it is to add a progress meter to your code. +![progress meter 6](https://user-images.githubusercontent.com/13696193/43955982-73b33b38-9c70-11e8-8b07-cc1473a58a73.jpg) + import PySimpleGUI as sg for i in range(1000): sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) -![progress meter 6](https://user-images.githubusercontent.com/13696193/43955982-73b33b38-9c70-11e8-8b07-cc1473a58a73.jpg) + ----- ## Tabbed Form Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single form. @@ -497,3 +500,96 @@ A standard non-blocking GUI with lots of inputs. [sg.Submit(), sg.Cancel()]] button, values = form.LayoutAndRead(layout) + +------- +## Custom Progress Meter / Progress Bar +Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. + +![custom progress meter](https://user-images.githubusercontent.com/13696193/43982958-3393b23e-9cc6-11e8-8b49-e7f4890cbc4b.jpg) + + + import PySimpleGUI as sg + + def CustomMeter(): + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + + ---- + + ## The One-Line GUI + +For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `FlexForm` and the call to `LayoutAndRead`. `FlexForm` returns a `FlexForm` object which has the `LayoutAndRead` method. + + +![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) + + +Instead of + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + +you can write this line of code for the exact same result (OK, two lines with the import): + + import PySimpleGUI as sg + + button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) +-------------------- +## Multiple Columns +Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + +This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + +To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. + +![snap0202](https://user-images.githubusercontent.com/13696193/44234671-27749f00-a175-11e8-9e66-a3fccf6c077e.jpg) + + + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + # sg.ChangeLookAndFeel('BlueMono') + + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + + sg.MsgBox(button, values, line_width=200) From b0393723471358729a1bb225a8a6a0bd20fca2a9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 17:07:45 -0400 Subject: [PATCH 147/521] Columns, one-line GUI --- docs/cookbook.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/docs/cookbook.md b/docs/cookbook.md index 15cb14a30..4b86c222c 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -535,4 +535,61 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an ---- + ## The One-Line GUI +For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `FlexForm` and the call to `LayoutAndRead`. `FlexForm` returns a `FlexForm` object which has the `LayoutAndRead` method. + + +![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) + + +Instead of + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + +you can write this line of code for the exact same result (OK, two lines with the import): + + import PySimpleGUI as sg + + button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) +-------------------- +## Multiple Columns +Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + +This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + +To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. + +![snap0202](https://user-images.githubusercontent.com/13696193/44234671-27749f00-a175-11e8-9e66-a3fccf6c077e.jpg) + + + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + # sg.ChangeLookAndFeel('BlueMono') + + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + + sg.MsgBox(button, values, line_width=200) From 6b8729af4c230f299adaa6a1fab8a58e44e9167a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 17:12:25 -0400 Subject: [PATCH 148/521] Header typo --- docs/cookbook.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 4b86c222c..61e581c04 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -535,7 +535,7 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an ---- - ## The One-Line GUI +## The One-Line GUI For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `FlexForm` and the call to `LayoutAndRead`. `FlexForm` returns a `FlexForm` object which has the `LayoutAndRead` method. From 5b78f655bfef921d967c181e59ccd633f5456d34 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 16 Aug 2018 18:17:13 -0400 Subject: [PATCH 149/521] Version 2.9 --- PySimpleGUI.py | 386 +++---------------------------------------------- docs/index.md | 11 +- readme.md | 11 +- 3 files changed, 34 insertions(+), 374 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index dda7640a9..925130a09 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -269,7 +269,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non ''' Listbox Element :param values: - :param select_mode: + :param select_mode: SELECT_MODE_BROWSE, SELECT_MODE_EXTENDED, SELECT_MODE_MULTIPLE, SELECT_MODE_SINGLE :param font: :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters @@ -791,6 +791,7 @@ def __init__(self, layout, background_color = None): self.Rows = [] self.ParentForm = None self.TKFrame = None + bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.Layout(layout) @@ -1058,11 +1059,11 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, do_not_clear=False, focus=False, key=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, do_not_clear = do_not_clear, focus=focus, key=key) +def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) -def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, do_not_clear = False, focus=False, key=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, do_not_clear=do_not_clear, focus=focus, key=key) +def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) # ------------------------- INPUT COMBO Element lazy functions ------------------------- # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): @@ -1311,7 +1312,7 @@ def CharWidthInPixels(): col_frame = tk.Frame(tk_row_frame) PackFormIntoFrame(element, col_frame, toplevel_form) col_frame.pack(side=tk.LEFT) - if element.BackgroundColor is not None: + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # elif element_type == ELEM_TYPE_TEXT: @@ -1630,359 +1631,6 @@ def ConvertFlexToTK(MyFlexForm): master.update_idletasks() # don't forget return -def ConvertFlexToTKOld(MyFlexForm): - def CharWidthInPixels(): - return tkinter.font.Font().measure('A') # single character width - master = MyFlexForm.TKroot - # only set title on non-tabbed forms - if not MyFlexForm.IsTabbedForm: - master.title(MyFlexForm.Title) - font = MyFlexForm.Font - InitializeResults(MyFlexForm) - border_depth = MyFlexForm.BorderDepth if MyFlexForm.BorderDepth is not None else DEFAULT_BORDER_WIDTH - # --------------------------------------------------------------------------- # - # **************** Use FlexForm to build the tkinter window ********** ----- # - # Building is done row by row. # - # --------------------------------------------------------------------------- # - focus_set = False - ######################### LOOP THROUGH ROWS ######################### - # *********** ------- Loop through ROWS ------- ***********# - for row_num, flex_row in enumerate(MyFlexForm.Rows): - ######################### LOOP THROUGH ELEMENTS ON ROW ######################### - # *********** ------- Loop through ELEMENTS ------- ***********# - # *********** Make TK Row ***********# - tk_row_frame = tk.Frame(master) - for col_num, element in enumerate(flex_row): - element.ParentForm = MyFlexForm # save the button's parent form object - if MyFlexForm.Font and (element.Font == DEFAULT_FONT or not element.Font): - font = MyFlexForm.Font - elif element.Font is not None: - font = element.Font - # ------- Determine Auto-Size setting on a cascading basis ------- # - if element.AutoSizeText is not None: # if element overide - auto_size_text = element.AutoSizeText - elif MyFlexForm.AutoSizeText is not None: # if form override - auto_size_text = MyFlexForm.AutoSizeText - else: - auto_size_text = DEFAULT_AUTOSIZE_TEXT - # Determine Element size - element_size = element.Size - if (element_size == (None, None)): # user did not specify a size - element_size = MyFlexForm.DefaultElementSize - else: auto_size_text = False # if user has specified a size then it shouldn't autosize - # Apply scaling... Element scaling is higher priority than form level - if element.Scale != (None, None): - element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) - elif MyFlexForm.Scale != (None, None): - element_size = (int(element_size[0] * MyFlexForm.Scale[0]), int(element_size[1] * MyFlexForm.Scale[1])) - # Set foreground color - text_color = element.TextColor - # ------------------------- TEXT element ------------------------- # - element_type = element.Type - if element_type == ELEM_TYPE_TEXT: - display_text = element.DisplayText # text to display - if auto_size_text is False: - width, height=element_size - else: - lines = display_text.split('\n') - max_line_len = max([len(l) for l in lines]) - num_lines = len(lines) - if max_line_len > element_size[0]: # if text exceeds element size, the will have to wrap - width = element_size[0] - else: - width=max_line_len - height=num_lines - # ---===--- LABEL widget create and place --- # - stringvar = tk.StringVar() - element.TKStringVar = stringvar - stringvar.set(display_text) - if auto_size_text: - width = 0 - justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT - anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE - tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) - # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) - # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS - wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget - if element.BackgroundColor is not None: - tktext_label.configure(background=element.BackgroundColor) - if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - tktext_label.configure(fg=element.TextColor) - - tktext_label.pack(side=tk.LEFT) - # ------------------------- BUTTON element ------------------------- # - elif element_type == ELEM_TYPE_BUTTON: - element.Location = (row_num, col_num) - btext = element.ButtonText - btype = element.BType - if element.AutoSizeButton is not None: - auto_size = element.AutoSizeButton - else: auto_size = MyFlexForm.AutoSizeButtons - if auto_size is False: width=element_size[0] - else: width = 0 - height=element_size[1] - lines = btext.split('\n') - max_line_len = max([len(l) for l in lines]) - num_lines = len(lines) - if element.ButtonColor != (None, None)and element.ButtonColor != DEFAULT_BUTTON_COLOR: - bc = element.ButtonColor - elif MyFlexForm.ButtonColor != (None, None) and MyFlexForm.ButtonColor != DEFAULT_BUTTON_COLOR: - bc = MyFlexForm.ButtonColor - else: - bc = DEFAULT_BUTTON_COLOR - border_depth = element.BorderWidth - if btype != BUTTON_TYPE_REALTIME: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth) - else: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth) - tkbutton.bind('', element.ButtonReleaseCallBack) - tkbutton.bind('', element.ButtonPressCallBack) - if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: - tkbutton.config(foreground=bc[0], background=bc[1]) - element.TKButton = tkbutton # not used yet but save the TK button in case - wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels - if element.ImageFilename: # if button has an image on it - photo = tk.PhotoImage(file=element.ImageFilename) - if element.ImageSize != (None, None): - width, height = element.ImageSize - if element.ImageSubsample: - photo = photo.subsample(element.ImageSubsample) - else: - width, height = photo.width(), photo.height() - tkbutton.config(image=photo, width=width, height=height) - tkbutton.image = photo - tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget - tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): - focus_set = True - element.TKButton.bind('', element.ReturnKeyHandler) - element.TKButton.focus_set() - MyFlexForm.TKroot.focus_force() - # ------------------------- INPUT (Single Line) element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_TEXT: - default_text = element.DefaultText - element.TKStringVar = tk.StringVar() - element.TKStringVar.set(default_text) - show = element.PasswordCharacter if element.PasswordCharacter else "" - element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show) - element.TKEntry.bind('', element.ReturnKeyHandler) - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKEntry.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKEntry.configure(fg=text_color) - element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): - focus_set = True - element.TKEntry.focus_set() - # ------------------------- COMBO BOX (Drop Down) element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_COMBO: - max_line_len = max([len(str(l)) for l in element.Values]) - if auto_size_text is False: width=element_size[0] - else: width = max_line_len - element.TKStringVar = tk.StringVar() - if element.BackgroundColor and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - combostyle = ttk.Style() - try: - combostyle.theme_create('combostyle', - settings={'TCombobox': - {'configure': - {'selectbackground': element.BackgroundColor, - 'fieldbackground': element.BackgroundColor, - 'foreground': text_color, - 'background': element.BackgroundColor} - }}) - except: - try: - combostyle.theme_settings('combostyle', - settings={'TCombobox': - {'configure': - {'selectbackground': element.BackgroundColor, - 'fieldbackground': element.BackgroundColor, - 'foreground': text_color, - 'background': element.BackgroundColor} - }}) - except: pass - # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox - combostyle.theme_use('combostyle') - element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) - # element.TKCombo['state']='readonly' - element.TKCombo['values'] = element.Values - # if element.BackgroundColor is not None: - # element.TKCombo.configure(background=element.BackgroundColor) - element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - element.TKCombo.current(0) - # ------------------------- LISTBOX element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_LISTBOX: - max_line_len = max([len(str(l)) for l in element.Values]) - if auto_size_text is False: width=element_size[0] - else: width = max_line_len - - element.TKStringVar = tk.StringVar() - element.TKListbox= tk.Listbox(tk_row_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) - for item in element.Values: - element.TKListbox.insert(tk.END, item) - element.TKListbox.selection_set(0,0) - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKListbox.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKListbox.configure(fg=text_color) - # vsb = tk.Scrollbar(tk_row_frame, orient="vertical", command=element.TKListbox.yview) - # element.TKListbox.configure(yscrollcommand=vsb.set) - element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # vsb.pack(side=tk.LEFT, fill='y') - # ------------------------- INPUT MULTI LINE element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_MULTILINE: - default_text = element.DefaultText - width, height = element_size - element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) - element.TKText.insert(1.0, default_text) # set the default text - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKText.configure(background=element.BackgroundColor) - element.TKText.vbar.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) - element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - if element.EnterSubmits: - element.TKText.bind('', element.ReturnKeyHandler) - if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): - focus_set = True - element.TKText.focus_set() - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKText.configure(fg=text_color) - # ------------------------- INPUT CHECKBOX element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_CHECKBOX: - width = 0 if auto_size_text else element_size[0] - default_value = element.InitialState - element.TKIntVar = tk.IntVar() - element.TKIntVar.set(default_value if default_value is not None else 0) - element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) - if default_value is None: - element.TKCheckbutton.configure(state='disable') - if element.BackgroundColor is not None: - element.TKCheckbutton.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKCheckbutton.configure(fg=text_color) - element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- PROGRESS BAR element ------------------------- # - elif element_type == ELEM_TYPE_PROGRESS_BAR: - # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar - width = element_size[0] - fnt = tkinter.font.Font() - char_width = fnt.measure('A') # single character width - progress_length = width*char_width - progress_width = element_size[1] - direction = element.Orientation - if element.BarColor != (None, None): # if element has a bar color, use it - bar_color = element.BarColor - else: - bar_color = DEFAULT_PROGRESS_BAR_COLOR - element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief, style=element.BarStyle ) - # element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) - element.TKProgressBar.TKProgressBarForReal.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- INPUT RADIO BUTTON element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_RADIO: - width = 0 if auto_size_text else element_size[0] - default_value = element.InitialState - ID = element.GroupID - # see if ID has already been placed - value = EncodeRadioRowCol(row_num, col_num) # value to set intvar to if this radio is selected - if ID in MyFlexForm.RadioDict: - RadVar = MyFlexForm.RadioDict[ID] - else: - RadVar = tk.IntVar() - MyFlexForm.RadioDict[ID] = RadVar - element.TKIntVar = RadVar # store the RadVar in Radio object - if default_value: # if this radio is the one selected, set RadVar to match - element.TKIntVar.set(value) - element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, - variable=element.TKIntVar, value=value, bd=border_depth, font=font) - if element.BackgroundColor is not None: - element.TKRadio.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKRadio.configure(fg=text_color) - element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) - # ------------------------- INPUT SPIN Box element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_SPIN: - width, height = element_size - width = 0 if auto_size_text else element_size[0] - element.TKStringVar = tk.StringVar() - element.TKSpinBox = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth) - element.TKStringVar.set(element.DefaultValue) - element.TKSpinBox.configure(font=font) # set wrap to width of widget - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKSpinBox.configure(background=element.BackgroundColor) - element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKSpinBox.configure(fg=text_color) - # ------------------------- OUTPUT element ------------------------- # - elif element_type == ELEM_TYPE_OUTPUT: - width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color) - element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- IMAGE Box element ------------------------- # - elif element_type == ELEM_TYPE_IMAGE: - photo = tk.PhotoImage(file=element.Filename) - if element_size == (None, None) or element_size == None or element_size == MyFlexForm.DefaultElementSize: - width, height = photo.width(), photo.height() - else: - width, height = element_size - tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) - tktext_label.image = photo - # tktext_label.configure(anchor=tk.NW, image=photo) - tktext_label.pack(side=tk.LEFT) - # ------------------------- SLIDER Box element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_SLIDER: - slider_length = element_size[0] * CharWidthInPixels() - slider_width = element_size[1] - element.TKIntVar = tk.IntVar() - element.TKIntVar.set(element.DefaultValue) - if element.Orientation[0] == 'v': - range_from = element.Range[1] - range_to = element.Range[0] - else: - range_from = element.Range[0] - range_to = element.Range[1] - tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) - # tktext_label.configure(anchor=tk.NW, image=photo) - if element.BackgroundColor is not None: - tkscale.configure(background=element.BackgroundColor) - tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - tkscale.configure(fg=text_color) - tkscale.pack(side=tk.LEFT) - #............................DONE WITH ROW pack the row of widgets ..........................# - # done with row, pack the row of widgets - tk_row_frame.grid(row=row_num+2, sticky=tk.W, padx=DEFAULT_MARGINS[0]) - if MyFlexForm.BackgroundColor is not None: - tk_row_frame.configure(background=MyFlexForm.BackgroundColor) - if not MyFlexForm.IsTabbedForm: - MyFlexForm.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) - else: MyFlexForm.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) - #....................................... DONE creating and laying out window ..........................# - if MyFlexForm.IsTabbedForm: - master = MyFlexForm.ParentWindow - master.attributes('-alpha', 0) # hide window while getting info and moving - screen_width = master.winfo_screenwidth() # get window info to move to middle of screen - screen_height = master.winfo_screenheight() - if MyFlexForm.Location != (None, None): - x,y = MyFlexForm.Location - elif DEFAULT_WINDOW_LOCATION != (None, None): - x,y = DEFAULT_WINDOW_LOCATION - else: - master.update_idletasks() # don't forget - win_width = master.winfo_width() - win_height = master.winfo_height() - x = screen_width/2 -win_width/2 - y = screen_height/2 - win_height/2 - if y+win_height > screen_height: - y = screen_height-win_height - if x+win_width > screen_width: - x = screen_width-win_width - - move_string = '+%i+%i'%(int(x),int(y)) - master.geometry(move_string) - master.attributes('-alpha', 255) # Make window visible again - master.update_idletasks() # don't forget - return # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON): @@ -2815,13 +2463,23 @@ def ChangeLookAndFeel(index): 'GreenMono': {'BACKGROUND': '#A8C1B4', 'TEXT': 'black', 'INPUT': '#DDE0DE', 'SCROLL': '#E3E3E3','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#6D9F85'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', - 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'NeutralBlue': {'BACKGROUND': '#92aa9d', 'TEXT': 'black', 'INPUT': '#fcfff6', + 'SCROLL': '#fcfff6', 'TEXT_INPUT': 'black', 'BUTTON': ('black', '#d0dbbd'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'Kayak': {'BACKGROUND': '#a7ad7f', 'TEXT': 'black', 'INPUT': '#e6d3a8', + 'SCROLL': '#e6d3a8', 'TEXT_INPUT': 'black', 'BUTTON': ('white', '#5d907d'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', - 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'SandyBeach': {'BACKGROUND': '#efeccb', 'TEXT': '#012f2f', 'INPUT': '#e6d3a8', + 'SCROLL': '#e6d3a8', 'TEXT_INPUT': '#012f2f', 'BUTTON': ('white', '#046380'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#3b7f97'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR} + 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#183440'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR} } try: colors = look_and_feel[index] diff --git a/docs/index.md b/docs/index.md index 392287c2d..c22c0e5a8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@ # PySimpleGUI - (Ver 2.8) + (Ver 2.9) [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) @@ -1655,7 +1655,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, +| 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults ### Release Notes @@ -1670,14 +1670,15 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. 2.7 Is the "feature complete" release. Pretty much all features are done and in the code + 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) +2.9 COLUMNS! This is the biggest feature and had the biggest impact on the code base. It was a difficult feature to add, but it was worth it. Can now make even more layouts. Almost any layout is possible with this addition. + ### Upcoming Make suggestions people! Future release features -Columns. How multiple columns would be specified in the SDK interface are still being designed. - Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. @@ -1738,7 +1739,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. diff --git a/readme.md b/readme.md index 392287c2d..c22c0e5a8 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ # PySimpleGUI - (Ver 2.8) + (Ver 2.9) [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) @@ -1655,7 +1655,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, +| 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults ### Release Notes @@ -1670,14 +1670,15 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. 2.7 Is the "feature complete" release. Pretty much all features are done and in the code + 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) +2.9 COLUMNS! This is the biggest feature and had the biggest impact on the code base. It was a difficult feature to add, but it was worth it. Can now make even more layouts. Almost any layout is possible with this addition. + ### Upcoming Make suggestions people! Future release features -Columns. How multiple columns would be specified in the SDK interface are still being designed. - Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. @@ -1738,7 +1739,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. From 99ae29cd77a3f46e990b1179f303cbb9044f30db Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 16:35:49 -0400 Subject: [PATCH 150/521] Tutorial checkin --- docs/tutorial.md | 253 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 docs/tutorial.md diff --git a/docs/tutorial.md b/docs/tutorial.md new file mode 100644 index 000000000..51cb73c50 --- /dev/null +++ b/docs/tutorial.md @@ -0,0 +1,253 @@ +# Add GUIs to your programs and scripts easily with PySimpleGUI + +## Introduction +Python has dropped the GUI ball. While the rest of the world has been enjoying the use of a mouse, most Python programs continue to be accessed via the command line. Why is this, does anybody care, and what can be done about it? + +## GUI Frameworks +There is no shortage of GUI frameworks for Python. tkinter, WxPython, Qt, Kivy are a few of the major packages. In addition, there are a good number of dumbed down GUI packages that wrap one of the major packages. These include EasyGUI, PyGUI, Pyforms, ... + +The problem is that beginners (those with experience of less than 6 weeks) are not capable of learning even the simplest of the major packages. That leaves the wrapper-packages. Users will quickly find it difficult or impossible to build a custom GUI layout. Or, if it's possible, pages of code are still required. + +PySimpleGUI attempts to address these GUI challenges by providing a super-simple, easy to understand interface to GUIs that can be customized easily. Even the most complex of GUIs are often less than 20 lines of code when PySimpleGUI is used. + +## The Secret + +What makes PySimpleGUI superior for newcomers is that the package contains the majority of the code that the user is normally expected to write. Button callbacks are handled by PySimpleGUI, not the user's code. Beginners struggle to grasp the concept of a function, expecting them to understand a call-back function in the first few weeks is likely a stretch. + +With most GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. + +Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a form layout, it is configured in-place, not several lines of code away. + +## What is a GUI? + +Most GUIs do one thing.... they collect information from the user and return it. From a programmer's viewpoint this could be summed up as a function call that looks like this: + + button, values = GUI_Display(gui_layout) + +What's expected from most GUIs is the button that was clicked (OK, cancel, save, yes, no, etc), and the values that were input by the user. The essence of a GUI can be boiled down into a single line of code. + +This is exactly how PySimpleGUI works (for these simple kinds of GUIs). When the call is made to display the GUI, execution does no return until a button is clicked that closes the form. + +There are more complex GUIs such as those that don't close after a button is clicked. These complex forms can also be created with PySimpleGUI. A remote control interface for a robot and a chat window are a couple of examples. + +## The 5-Minute GUI + +When is PySimpleGUI useful? Immediately, anytime you've got a GUI need. It will take under 5 minutes for you to create and try your GUI. With those kinds of times, what do you have to lose trying it? + +The best way to go about making your GUI in under 5 minutes is to copy one of the GUIs from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/). Follow these steps: +* Find a GUI that looks similar to what you want to create +* Copy code from Cookbook +* Paste into your IDE and run + +Let's look at the first recipe from the book + + import PySimpleGUI as sg + + # Very basic form. Return values as a list + form = sg.FlexForm('Simple data entry form') # begin with a blank form + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + print(button, values[0], values[1], values[2]) + + +It's a reasonable sized form. + + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + +If you only need to collect a few values and they're all basically strings, then you would copy this recipe and modify it to suit your needs. + +## Making Your Custom GUI + +That 5-minute estimate wasn't the time it takes to copy and paste the code from the Cookbook. You should be able to modify the code within 5 minutes in order to get to your layout, assuming you've got a straightforward layout. + +Widgets are called Elements in PySimpleGUI. This list of Elements are spelled exactly as you would type it into your Python code. + +### Core Element list +``` + Text + InputText + Multiline + InputCombo + Listbox + Radio + Checkbox + Spin + Output + SimpleButton + RealtimeButton + ReadFormButton + ProgressBar + Image + Slider + Column +``` + +You can also have short-cut Elements. There are 2 types of shortcuts. One is simply other names for the exact same element (e.g. T instead of Text). The second type configures an Element with particular setting, sparing the programmer from specifying all of the parameters (e.g. Submit is a button with the text "Submit" on it). +### Shortcut list + + T = Text + Txt = Text + In = InputText + Input = IntputText + Combo = InputCombo + DropDown = InputCombo + Drop = InputCombo + +A number of common buttons have been implemented as shortcuts. These include: +### Button Shortcuts + FolderBrowse + FileBrowse + FileSaveAs + Save + Submit + OK + Ok + Cancel + Quit + Exit + Yes + No + +The more generic button functions, that are also shortcuts +### Generic Buttons + SimpleButton + ReadFormButton + RealtimeButton + +These are all of the GUI Widgets you have to choose from. If it's not in this list, it doesn't go in your form layout. + +### GUI Design Pattern + +The stuff that tends not to change in GUIs are the calls that setup and show the Window. It's the layout of the Elements that changes from one program to another. This is the code from above with the layout removed: + + import PySimpleGUI as sg + + form = sg.FlexForm('Simple data entry form') + # Define your form here (it's a list of lists) + button, values = form.LayoutAndRead(layout) + + The flow for most GUIs is: + * Create the Form object + * Define GUI as a list of lists + * Show the GUI and get results + +These are line for line what you see in design pattern. + +### GUI Layout + +To create your custom GUI, first break your form down into "rows". You'll be defining your form one row at a time. Then for each for, you'll be placing one Element after another, working from left to right. + +The result is a "list of lists" that looks something like this: + + layout = [ [Text('Row 1')], + [Text('Row 2'), Checkbox('Checkbox 1', OK()), Checkbox('Checkbox 2'), OK()] ] + +The layout produced this window: + +![tutorial2](https://user-images.githubusercontent.com/13696193/44302312-e5259c00-a2f3-11e8-9c17-63e4eb130a9e.jpg) + + +## Display GUI & Get Results + +Once you have your layout complete and you've copied over the lines of code that setup and show the form, it's time to look at how to display the form and get the values from the user. + +This is the line of code that displays the form and provides the results: + + button, values = form.LayoutAndRead(layout) + + Forms return 2 values, the text of the button that was clicked and a ***list of values*** the user entered into the form. + +If the example form was displayed and the user did nothing other than click the OK button, then the results would have been: + + button == 'OK' + values == [False, False] + +Checkbox Elements return a value of True/False. Because these checkboxes defaulted to unchecked, the values returned were both False. + +## Displaying Results + +Once you have the values from the GUI it would be nice to check what values are in the variables. Rather than print them out using a `print` statement, let's stick with the GUI idea and output to a window. + +PySimpleGUI has a number of Message Boxes to choose from. The data passed to the message box will be displayed in a window. The function takes any number of arguments. Simply indicate all the variables you would like to see in the call. + +The most-commonly used Message Box in PySimpleGUI is MsgBox. To display the results of the previous example, one would write: + + MsgBox('The GUI returned:', button, values) + +## Putting It All Together + +Now that you know the basics, let's put together a form that contains as many PySimpleGUI's elements as possible. Also, just to give it a nice look, we'll change the "look and feel" to a green and tan color scheme. + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + + column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10,1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#d3dfda')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + sg.MsgBox(button, values) + +That may seem like a lot of code, but try coding this same GUI layout directly in tkinter and you'll quickly realize that the length is tiny. + +![everything for tutorial](https://user-images.githubusercontent.com/13696193/44302997-38531b00-a303-11e8-8c45-698ea62590a8.jpg) + +The last line of code opens a message box. This is how it looks: +![tutorial results](https://user-images.githubusercontent.com/13696193/44303004-79e3c600-a303-11e8-8311-2f3726d364ad.jpg) + +Each parameter to the message box call is displayed on a new line. There are actually 2 lines of text in the message box. The second line is very long and wrapped a number of times + +Take a moment and pair up the results values with the GUI to get an understanding of how results are created and returned. + +## Resources + +### Installation +Requires Python 3 + + pip install PySimpleGUI + +Works on all systems that run tkinter, including the Raspberry Pi + +### Documentation +[Main manual](https://pysimplegui.readthedocs.io/en/latest/) + +[Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) + +### Home Page + +www.PySimpleGUI.com From 7392e06cea016678d0e670c63eb576c8dd7101de Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 16:45:55 -0400 Subject: [PATCH 151/521] Fix formatting --- docs/tutorial.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/tutorial.md b/docs/tutorial.md index 51cb73c50..30fab5167 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -228,8 +228,10 @@ That may seem like a lot of code, but try coding this same GUI layout directly i ![everything for tutorial](https://user-images.githubusercontent.com/13696193/44302997-38531b00-a303-11e8-8c45-698ea62590a8.jpg) The last line of code opens a message box. This is how it looks: + ![tutorial results](https://user-images.githubusercontent.com/13696193/44303004-79e3c600-a303-11e8-8311-2f3726d364ad.jpg) + Each parameter to the message box call is displayed on a new line. There are actually 2 lines of text in the message box. The second line is very long and wrapped a number of times Take a moment and pair up the results values with the GUI to get an understanding of how results are created and returned. From cf9b11e75c316d8164eba0ca97938a8bf1630b06 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 16:52:24 -0400 Subject: [PATCH 152/521] Pulling down current Master version --- PySimpleGUI.py | 386 +++---------------------------------------------- 1 file changed, 22 insertions(+), 364 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index dda7640a9..925130a09 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -269,7 +269,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non ''' Listbox Element :param values: - :param select_mode: + :param select_mode: SELECT_MODE_BROWSE, SELECT_MODE_EXTENDED, SELECT_MODE_MULTIPLE, SELECT_MODE_SINGLE :param font: :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters @@ -791,6 +791,7 @@ def __init__(self, layout, background_color = None): self.Rows = [] self.ParentForm = None self.TKFrame = None + bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.Layout(layout) @@ -1058,11 +1059,11 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, do_not_clear=False, focus=False, key=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, do_not_clear = do_not_clear, focus=focus, key=key) +def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) -def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, do_not_clear = False, focus=False, key=None): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, do_not_clear=do_not_clear, focus=focus, key=key) +def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): + return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) # ------------------------- INPUT COMBO Element lazy functions ------------------------- # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): @@ -1311,7 +1312,7 @@ def CharWidthInPixels(): col_frame = tk.Frame(tk_row_frame) PackFormIntoFrame(element, col_frame, toplevel_form) col_frame.pack(side=tk.LEFT) - if element.BackgroundColor is not None: + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # elif element_type == ELEM_TYPE_TEXT: @@ -1630,359 +1631,6 @@ def ConvertFlexToTK(MyFlexForm): master.update_idletasks() # don't forget return -def ConvertFlexToTKOld(MyFlexForm): - def CharWidthInPixels(): - return tkinter.font.Font().measure('A') # single character width - master = MyFlexForm.TKroot - # only set title on non-tabbed forms - if not MyFlexForm.IsTabbedForm: - master.title(MyFlexForm.Title) - font = MyFlexForm.Font - InitializeResults(MyFlexForm) - border_depth = MyFlexForm.BorderDepth if MyFlexForm.BorderDepth is not None else DEFAULT_BORDER_WIDTH - # --------------------------------------------------------------------------- # - # **************** Use FlexForm to build the tkinter window ********** ----- # - # Building is done row by row. # - # --------------------------------------------------------------------------- # - focus_set = False - ######################### LOOP THROUGH ROWS ######################### - # *********** ------- Loop through ROWS ------- ***********# - for row_num, flex_row in enumerate(MyFlexForm.Rows): - ######################### LOOP THROUGH ELEMENTS ON ROW ######################### - # *********** ------- Loop through ELEMENTS ------- ***********# - # *********** Make TK Row ***********# - tk_row_frame = tk.Frame(master) - for col_num, element in enumerate(flex_row): - element.ParentForm = MyFlexForm # save the button's parent form object - if MyFlexForm.Font and (element.Font == DEFAULT_FONT or not element.Font): - font = MyFlexForm.Font - elif element.Font is not None: - font = element.Font - # ------- Determine Auto-Size setting on a cascading basis ------- # - if element.AutoSizeText is not None: # if element overide - auto_size_text = element.AutoSizeText - elif MyFlexForm.AutoSizeText is not None: # if form override - auto_size_text = MyFlexForm.AutoSizeText - else: - auto_size_text = DEFAULT_AUTOSIZE_TEXT - # Determine Element size - element_size = element.Size - if (element_size == (None, None)): # user did not specify a size - element_size = MyFlexForm.DefaultElementSize - else: auto_size_text = False # if user has specified a size then it shouldn't autosize - # Apply scaling... Element scaling is higher priority than form level - if element.Scale != (None, None): - element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) - elif MyFlexForm.Scale != (None, None): - element_size = (int(element_size[0] * MyFlexForm.Scale[0]), int(element_size[1] * MyFlexForm.Scale[1])) - # Set foreground color - text_color = element.TextColor - # ------------------------- TEXT element ------------------------- # - element_type = element.Type - if element_type == ELEM_TYPE_TEXT: - display_text = element.DisplayText # text to display - if auto_size_text is False: - width, height=element_size - else: - lines = display_text.split('\n') - max_line_len = max([len(l) for l in lines]) - num_lines = len(lines) - if max_line_len > element_size[0]: # if text exceeds element size, the will have to wrap - width = element_size[0] - else: - width=max_line_len - height=num_lines - # ---===--- LABEL widget create and place --- # - stringvar = tk.StringVar() - element.TKStringVar = stringvar - stringvar.set(display_text) - if auto_size_text: - width = 0 - justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT - anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE - tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) - # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) - # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS - wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget - if element.BackgroundColor is not None: - tktext_label.configure(background=element.BackgroundColor) - if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - tktext_label.configure(fg=element.TextColor) - - tktext_label.pack(side=tk.LEFT) - # ------------------------- BUTTON element ------------------------- # - elif element_type == ELEM_TYPE_BUTTON: - element.Location = (row_num, col_num) - btext = element.ButtonText - btype = element.BType - if element.AutoSizeButton is not None: - auto_size = element.AutoSizeButton - else: auto_size = MyFlexForm.AutoSizeButtons - if auto_size is False: width=element_size[0] - else: width = 0 - height=element_size[1] - lines = btext.split('\n') - max_line_len = max([len(l) for l in lines]) - num_lines = len(lines) - if element.ButtonColor != (None, None)and element.ButtonColor != DEFAULT_BUTTON_COLOR: - bc = element.ButtonColor - elif MyFlexForm.ButtonColor != (None, None) and MyFlexForm.ButtonColor != DEFAULT_BUTTON_COLOR: - bc = MyFlexForm.ButtonColor - else: - bc = DEFAULT_BUTTON_COLOR - border_depth = element.BorderWidth - if btype != BUTTON_TYPE_REALTIME: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth) - else: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth) - tkbutton.bind('', element.ButtonReleaseCallBack) - tkbutton.bind('', element.ButtonPressCallBack) - if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: - tkbutton.config(foreground=bc[0], background=bc[1]) - element.TKButton = tkbutton # not used yet but save the TK button in case - wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels - if element.ImageFilename: # if button has an image on it - photo = tk.PhotoImage(file=element.ImageFilename) - if element.ImageSize != (None, None): - width, height = element.ImageSize - if element.ImageSubsample: - photo = photo.subsample(element.ImageSubsample) - else: - width, height = photo.width(), photo.height() - tkbutton.config(image=photo, width=width, height=height) - tkbutton.image = photo - tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget - tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): - focus_set = True - element.TKButton.bind('', element.ReturnKeyHandler) - element.TKButton.focus_set() - MyFlexForm.TKroot.focus_force() - # ------------------------- INPUT (Single Line) element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_TEXT: - default_text = element.DefaultText - element.TKStringVar = tk.StringVar() - element.TKStringVar.set(default_text) - show = element.PasswordCharacter if element.PasswordCharacter else "" - element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show) - element.TKEntry.bind('', element.ReturnKeyHandler) - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKEntry.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKEntry.configure(fg=text_color) - element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): - focus_set = True - element.TKEntry.focus_set() - # ------------------------- COMBO BOX (Drop Down) element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_COMBO: - max_line_len = max([len(str(l)) for l in element.Values]) - if auto_size_text is False: width=element_size[0] - else: width = max_line_len - element.TKStringVar = tk.StringVar() - if element.BackgroundColor and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - combostyle = ttk.Style() - try: - combostyle.theme_create('combostyle', - settings={'TCombobox': - {'configure': - {'selectbackground': element.BackgroundColor, - 'fieldbackground': element.BackgroundColor, - 'foreground': text_color, - 'background': element.BackgroundColor} - }}) - except: - try: - combostyle.theme_settings('combostyle', - settings={'TCombobox': - {'configure': - {'selectbackground': element.BackgroundColor, - 'fieldbackground': element.BackgroundColor, - 'foreground': text_color, - 'background': element.BackgroundColor} - }}) - except: pass - # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox - combostyle.theme_use('combostyle') - element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) - # element.TKCombo['state']='readonly' - element.TKCombo['values'] = element.Values - # if element.BackgroundColor is not None: - # element.TKCombo.configure(background=element.BackgroundColor) - element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - element.TKCombo.current(0) - # ------------------------- LISTBOX element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_LISTBOX: - max_line_len = max([len(str(l)) for l in element.Values]) - if auto_size_text is False: width=element_size[0] - else: width = max_line_len - - element.TKStringVar = tk.StringVar() - element.TKListbox= tk.Listbox(tk_row_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) - for item in element.Values: - element.TKListbox.insert(tk.END, item) - element.TKListbox.selection_set(0,0) - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKListbox.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKListbox.configure(fg=text_color) - # vsb = tk.Scrollbar(tk_row_frame, orient="vertical", command=element.TKListbox.yview) - # element.TKListbox.configure(yscrollcommand=vsb.set) - element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # vsb.pack(side=tk.LEFT, fill='y') - # ------------------------- INPUT MULTI LINE element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_MULTILINE: - default_text = element.DefaultText - width, height = element_size - element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) - element.TKText.insert(1.0, default_text) # set the default text - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKText.configure(background=element.BackgroundColor) - element.TKText.vbar.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) - element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - if element.EnterSubmits: - element.TKText.bind('', element.ReturnKeyHandler) - if element.Focus is True or (MyFlexForm.UseDefaultFocus and not focus_set): - focus_set = True - element.TKText.focus_set() - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKText.configure(fg=text_color) - # ------------------------- INPUT CHECKBOX element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_CHECKBOX: - width = 0 if auto_size_text else element_size[0] - default_value = element.InitialState - element.TKIntVar = tk.IntVar() - element.TKIntVar.set(default_value if default_value is not None else 0) - element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) - if default_value is None: - element.TKCheckbutton.configure(state='disable') - if element.BackgroundColor is not None: - element.TKCheckbutton.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKCheckbutton.configure(fg=text_color) - element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- PROGRESS BAR element ------------------------- # - elif element_type == ELEM_TYPE_PROGRESS_BAR: - # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar - width = element_size[0] - fnt = tkinter.font.Font() - char_width = fnt.measure('A') # single character width - progress_length = width*char_width - progress_width = element_size[1] - direction = element.Orientation - if element.BarColor != (None, None): # if element has a bar color, use it - bar_color = element.BarColor - else: - bar_color = DEFAULT_PROGRESS_BAR_COLOR - element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief, style=element.BarStyle ) - # element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) - element.TKProgressBar.TKProgressBarForReal.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- INPUT RADIO BUTTON element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_RADIO: - width = 0 if auto_size_text else element_size[0] - default_value = element.InitialState - ID = element.GroupID - # see if ID has already been placed - value = EncodeRadioRowCol(row_num, col_num) # value to set intvar to if this radio is selected - if ID in MyFlexForm.RadioDict: - RadVar = MyFlexForm.RadioDict[ID] - else: - RadVar = tk.IntVar() - MyFlexForm.RadioDict[ID] = RadVar - element.TKIntVar = RadVar # store the RadVar in Radio object - if default_value: # if this radio is the one selected, set RadVar to match - element.TKIntVar.set(value) - element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, - variable=element.TKIntVar, value=value, bd=border_depth, font=font) - if element.BackgroundColor is not None: - element.TKRadio.configure(background=element.BackgroundColor) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKRadio.configure(fg=text_color) - element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) - # ------------------------- INPUT SPIN Box element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_SPIN: - width, height = element_size - width = 0 if auto_size_text else element_size[0] - element.TKStringVar = tk.StringVar() - element.TKSpinBox = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth) - element.TKStringVar.set(element.DefaultValue) - element.TKSpinBox.configure(font=font) # set wrap to width of widget - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKSpinBox.configure(background=element.BackgroundColor) - element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - element.TKSpinBox.configure(fg=text_color) - # ------------------------- OUTPUT element ------------------------- # - elif element_type == ELEM_TYPE_OUTPUT: - width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color) - element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- IMAGE Box element ------------------------- # - elif element_type == ELEM_TYPE_IMAGE: - photo = tk.PhotoImage(file=element.Filename) - if element_size == (None, None) or element_size == None or element_size == MyFlexForm.DefaultElementSize: - width, height = photo.width(), photo.height() - else: - width, height = element_size - tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) - tktext_label.image = photo - # tktext_label.configure(anchor=tk.NW, image=photo) - tktext_label.pack(side=tk.LEFT) - # ------------------------- SLIDER Box element ------------------------- # - elif element_type == ELEM_TYPE_INPUT_SLIDER: - slider_length = element_size[0] * CharWidthInPixels() - slider_width = element_size[1] - element.TKIntVar = tk.IntVar() - element.TKIntVar.set(element.DefaultValue) - if element.Orientation[0] == 'v': - range_from = element.Range[1] - range_to = element.Range[0] - else: - range_from = element.Range[0] - range_to = element.Range[1] - tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) - # tktext_label.configure(anchor=tk.NW, image=photo) - if element.BackgroundColor is not None: - tkscale.configure(background=element.BackgroundColor) - tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) - if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: - tkscale.configure(fg=text_color) - tkscale.pack(side=tk.LEFT) - #............................DONE WITH ROW pack the row of widgets ..........................# - # done with row, pack the row of widgets - tk_row_frame.grid(row=row_num+2, sticky=tk.W, padx=DEFAULT_MARGINS[0]) - if MyFlexForm.BackgroundColor is not None: - tk_row_frame.configure(background=MyFlexForm.BackgroundColor) - if not MyFlexForm.IsTabbedForm: - MyFlexForm.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) - else: MyFlexForm.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) - #....................................... DONE creating and laying out window ..........................# - if MyFlexForm.IsTabbedForm: - master = MyFlexForm.ParentWindow - master.attributes('-alpha', 0) # hide window while getting info and moving - screen_width = master.winfo_screenwidth() # get window info to move to middle of screen - screen_height = master.winfo_screenheight() - if MyFlexForm.Location != (None, None): - x,y = MyFlexForm.Location - elif DEFAULT_WINDOW_LOCATION != (None, None): - x,y = DEFAULT_WINDOW_LOCATION - else: - master.update_idletasks() # don't forget - win_width = master.winfo_width() - win_height = master.winfo_height() - x = screen_width/2 -win_width/2 - y = screen_height/2 - win_height/2 - if y+win_height > screen_height: - y = screen_height-win_height - if x+win_width > screen_width: - x = screen_width-win_width - - move_string = '+%i+%i'%(int(x),int(y)) - master.geometry(move_string) - master.attributes('-alpha', 255) # Make window visible again - master.update_idletasks() # don't forget - return # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON): @@ -2815,13 +2463,23 @@ def ChangeLookAndFeel(index): 'GreenMono': {'BACKGROUND': '#A8C1B4', 'TEXT': 'black', 'INPUT': '#DDE0DE', 'SCROLL': '#E3E3E3','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#6D9F85'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', - 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'NeutralBlue': {'BACKGROUND': '#92aa9d', 'TEXT': 'black', 'INPUT': '#fcfff6', + 'SCROLL': '#fcfff6', 'TEXT_INPUT': 'black', 'BUTTON': ('black', '#d0dbbd'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + + 'Kayak': {'BACKGROUND': '#a7ad7f', 'TEXT': 'black', 'INPUT': '#e6d3a8', + 'SCROLL': '#e6d3a8', 'TEXT_INPUT': 'black', 'BUTTON': ('white', '#5d907d'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', - 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'SandyBeach': {'BACKGROUND': '#efeccb', 'TEXT': '#012f2f', 'INPUT': '#e6d3a8', + 'SCROLL': '#e6d3a8', 'TEXT_INPUT': '#012f2f', 'BUTTON': ('white', '#046380'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#3b7f97'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR} + 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#183440'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR} } try: colors = look_and_feel[index] From 6ef5af67467ae77931a7a06c428ac3d41562ebf6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 16:55:21 -0400 Subject: [PATCH 153/521] Fixes, listbox scroll bars, more button lazy funcs, Fixed output element scrollbar length Added scroll bar to listbox New FileSaveAs, SaveAs, Save, Exit button functions Fixed button width bug Fixed button outline around images on Raspberry Pi Set border width = 0 for sliders --- PySimpleGUI.py | 110 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 36 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 925130a09..4c36aeec6 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -100,6 +100,14 @@ def __init__(self): self.NumOpenWindows = 0 self.user_defined_icon = None + def Decrement(self): + self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0 + print('---- DECREMENTING Num Open Windows = {} ---'.format(self.NumOpenWindows)) + + def Increment(self): + self.NumOpenWindows += 1 + print('++++ INCREMENTING Num Open Windows = {} ++++'.format(self.NumOpenWindows)) + _my_windows = MyWindows() # terrible hack using globals... means need a class for collecing windows # ====================================================================== # @@ -116,6 +124,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # class ButtonType(Enum): BUTTON_TYPE_BROWSE_FOLDER = 1 BUTTON_TYPE_BROWSE_FILE = 2 +BUTTON_TYPE_SAVEAS_FILE = 3 BUTTON_TYPE_CLOSES_WIN = 5 BUTTON_TYPE_READ_FORM = 7 BUTTON_TYPE_REALTIME = 9 @@ -261,7 +270,7 @@ def __del__(self): # ---------------------------------------------------------------------- # -# Combo # +# Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): @@ -514,16 +523,18 @@ def __del__(self): # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): def __init__(self, parent, width, height, bd, background_color=None, text_color=None): - tk.Frame.__init__(self, parent) - self.output = tk.Text(parent, width=width, height=height, bd=bd) + frame = tk.Frame(parent, width=width, height=height) + tk.Frame.__init__(self, frame) + self.output = tk.Text(frame, width=width, height=height, bd=bd) if background_color and background_color != COLOR_SYSTEM_DEFAULT: self.output.configure(background=background_color) if text_color and text_color != COLOR_SYSTEM_DEFAULT: self.output.configure(fg=text_color) - self.vsb = tk.Scrollbar(parent, orient="vertical", command=self.output.yview) + self.vsb = tk.Scrollbar(frame, orient="vertical", command=self.output.yview) self.output.configure(yscrollcommand=self.vsb.set) - self.output.pack(side="left", fill="both", expand=True) + self.output.pack(side="left", fill="both") self.vsb.pack(side="left", fill="y") + frame.pack(side="left") self.previous_stdout = sys.stdout self.previous_stderr = sys.stderr @@ -650,6 +661,9 @@ def ButtonCallBack(self): elif self.BType == BUTTON_TYPE_BROWSE_FILE: file_name = tk.filedialog.askopenfilename(filetypes=filetypes) # show the 'get file' dialog box strvar.set(file_name) + elif self.BType == BUTTON_TYPE_SAVEAS_FILE: + file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes) # show the 'get file' dialog box + strvar.set(file_name) elif self.BType == BUTTON_TYPE_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window # first, get the results table built # modify the Results table in the parent FlexForm object @@ -664,7 +678,7 @@ def ButtonCallBack(self): self.ParentForm.TKroot.quit() if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() - # _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + _my_windows.Decrement() elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE # first, get the results table built # modify the Results table in the parent FlexForm object @@ -718,7 +732,7 @@ def UpdateBar(self, current_count): try: self.ParentForm.TKroot.update() except: - # _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + # _my_windows.Decrement() return False return True @@ -968,7 +982,7 @@ def Read(self): self.TKroot.mainloop() if self.RootNeedsDestroying: self.TKroot.destroy() - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + _my_windows.Decrement() return BuildResults(self, False, self) def ReadNonBlocking(self, Message=''): @@ -982,7 +996,7 @@ def ReadNonBlocking(self, Message=''): rc = self.TKroot.update() except: self.TKrootDestroyed = True - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + _my_windows.Decrement() return BuildResults(self, False, self) @@ -999,10 +1013,12 @@ def _Close(self): return None def CloseNonBlockingForm(self): + if self.TKrootDestroyed: + return try: self.TKroot.destroy() + _my_windows.Decrement() except: pass - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 def OnClosingCallback(self): return @@ -1049,7 +1065,7 @@ def _Close(self): if not self.TKrootDestroyed: self.TKrootDestroyed = True self.TKroot.destroy() - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + _my_windows.Decrement() def __del__(self): return @@ -1082,24 +1098,36 @@ def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): +def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + +# ------------------------- FILE BROWSE Element lazy function ------------------------- # +def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + +# ------------------------- SAVE AS Element lazy function ------------------------- # +def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): + return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + +# ------------------------- SAVE BUTTON Element lazy function ------------------------- # +def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) +def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) +def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) +def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): @@ -1109,13 +1137,17 @@ def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_siz def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +# ------------------------- Exit BUTTON Element lazy function ------------------------- # +def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) + # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) +def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, bind_return_key=bind_return_key, focus=focus) +def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field @@ -1378,6 +1410,7 @@ def CharWidthInPixels(): element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels if element.ImageFilename: # if button has an image on it + tkbutton.config(highlightthickness=0) photo = tk.PhotoImage(file=element.ImageFilename) if element.ImageSize != (None, None): width, height = element.ImageSize @@ -1387,7 +1420,10 @@ def CharWidthInPixels(): width, height = photo.width(), photo.height() tkbutton.config(image=photo, width=width, height=height) tkbutton.image = photo - tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget + if width != 0: + tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget + else: + tkbutton.configure(font=font) # only set the font, not wraplength tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): focus_set = True @@ -1452,9 +1488,9 @@ def CharWidthInPixels(): max_line_len = max([len(str(l)) for l in element.Values]) if auto_size_text is False: width=element_size[0] else: width = max_line_len - + listbox_frame = tk.Frame(tk_row_frame) element.TKStringVar = tk.StringVar() - element.TKListbox= tk.Listbox(tk_row_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) + element.TKListbox= tk.Listbox(listbox_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) for item in element.Values: element.TKListbox.insert(tk.END, item) element.TKListbox.selection_set(0,0) @@ -1462,10 +1498,11 @@ def CharWidthInPixels(): element.TKListbox.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKListbox.configure(fg=text_color) - # vsb = tk.Scrollbar(tk_row_frame, orient="vertical", command=element.TKListbox.yview) - # element.TKListbox.configure(yscrollcommand=vsb.set) - element.TKListbox.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - # vsb.pack(side=tk.LEFT, fill='y') + vsb = tk.Scrollbar(listbox_frame, orient="vertical", command=element.TKListbox.yview) + element.TKListbox.configure(yscrollcommand=vsb.set) + element.TKListbox.pack(side=tk.LEFT) + vsb.pack(side=tk.LEFT, fill='y') + listbox_frame.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT MULTI LINE element ------------------------- # elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText @@ -1563,7 +1600,7 @@ def CharWidthInPixels(): tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) tktext_label.image = photo # tktext_label.configure(anchor=tk.NW, image=photo) - tktext_label.pack(side=tk.LEFT) + tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() @@ -1579,12 +1616,13 @@ def CharWidthInPixels(): range_to = element.Range[1] tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) # tktext_label.configure(anchor=tk.NW, image=photo) + tkscale.config(highlightthickness=0) if element.BackgroundColor is not None: tkscale.configure(background=element.BackgroundColor) tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: tkscale.configure(fg=text_color) - tkscale.pack(side=tk.LEFT) + tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) @@ -1698,7 +1736,7 @@ def StartupTK(my_flex_form): root = tk.Tk() if not ow else tk.Toplevel() if my_flex_form.BackgroundColor is not None: root.configure(background=my_flex_form.BackgroundColor) - _my_windows.NumOpenWindows += 1 + _my_windows.Increment() my_flex_form.TKroot = root # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) @@ -1716,7 +1754,7 @@ def StartupTK(my_flex_form): my_flex_form.TKroot.mainloop() # print('..... BACK from MainLoop') if not my_flex_form.FormRemainedOpen: - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 + _my_windows.Decrement() if my_flex_form.RootNeedsDestroying: my_flex_form.TKroot.destroy() my_flex_form.RootNeedsDestroying = False @@ -1992,8 +2030,8 @@ def _ProgressMeterUpdate(bar, value, text_elem, *args): bar.ParentForm._Close() if bar.ParentForm.RootNeedsDestroying: try: - _my_windows.NumOpenWindows -= 1 * (_my_windows.NumOpenWindows != 0) # decrement if not 0 bar.ParentForm.TKroot.destroy() + _my_windows.Decrement() except: pass bar.ParentForm.RootNeedsDestroying = False bar.ParentForm.__del__() From 405936978462d0fe66b6a5e75c234d03d13f1454 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 17:22:38 -0400 Subject: [PATCH 154/521] Initial Checkin --- Demo_All_Widgets.py | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Demo_All_Widgets.py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py new file mode 100644 index 000000000..8dcf08ed8 --- /dev/null +++ b/Demo_All_Widgets.py @@ -0,0 +1,65 @@ +import PySimpleGUI as sg + + +def Everything(): + + with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything',size=(35,3)), + sg.Multiline(default_text='A second multi-line',size=(35,3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] ] + + button, values = form.LayoutAndRead(layout) + + sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + +import PySimpleGUI as sg + +sg.ChangeLookAndFeel('GreenTan') + +form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + +column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10,1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] +layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#d3dfda')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] + +button, values = form.LayoutAndRead(layout) +sg.MsgBox(button, values) + +# Everything_NoContextManager() \ No newline at end of file From 9a6661954a4cf40bdb202a5712bd1e035ffd24d9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 21:06:45 -0400 Subject: [PATCH 155/521] Typos --- docs/tutorial.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 30fab5167..edc6b6198 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -12,7 +12,7 @@ PySimpleGUI attempts to address these GUI challenges by providing a super-simple ## The Secret -What makes PySimpleGUI superior for newcomers is that the package contains the majority of the code that the user is normally expected to write. Button callbacks are handled by PySimpleGUI, not the user's code. Beginners struggle to grasp the concept of a function, expecting them to understand a call-back function in the first few weeks is likely a stretch. +What makes PySimpleGUI superior for newcomers is that the package contains the majority of the code that the user is normally expected to write. Button callbacks are handled by PySimpleGUI, not the user's code. Beginners struggle to grasp the concept of a function, expecting them to understand a call-back function in the first few weeks is a stretch. With most GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. @@ -48,9 +48,9 @@ Let's look at the first recipe from the book layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Text('Name', size=(15, 1)), sg.InputText('name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone')], [sg.Submit(), sg.Cancel()] ] From ea2b401801908247233a040a9b1f68a0e903dbce Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 21:07:09 -0400 Subject: [PATCH 156/521] Checkin to match master branch --- docs/tutorial.md | 255 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 docs/tutorial.md diff --git a/docs/tutorial.md b/docs/tutorial.md new file mode 100644 index 000000000..edc6b6198 --- /dev/null +++ b/docs/tutorial.md @@ -0,0 +1,255 @@ +# Add GUIs to your programs and scripts easily with PySimpleGUI + +## Introduction +Python has dropped the GUI ball. While the rest of the world has been enjoying the use of a mouse, most Python programs continue to be accessed via the command line. Why is this, does anybody care, and what can be done about it? + +## GUI Frameworks +There is no shortage of GUI frameworks for Python. tkinter, WxPython, Qt, Kivy are a few of the major packages. In addition, there are a good number of dumbed down GUI packages that wrap one of the major packages. These include EasyGUI, PyGUI, Pyforms, ... + +The problem is that beginners (those with experience of less than 6 weeks) are not capable of learning even the simplest of the major packages. That leaves the wrapper-packages. Users will quickly find it difficult or impossible to build a custom GUI layout. Or, if it's possible, pages of code are still required. + +PySimpleGUI attempts to address these GUI challenges by providing a super-simple, easy to understand interface to GUIs that can be customized easily. Even the most complex of GUIs are often less than 20 lines of code when PySimpleGUI is used. + +## The Secret + +What makes PySimpleGUI superior for newcomers is that the package contains the majority of the code that the user is normally expected to write. Button callbacks are handled by PySimpleGUI, not the user's code. Beginners struggle to grasp the concept of a function, expecting them to understand a call-back function in the first few weeks is a stretch. + +With most GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. + +Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a form layout, it is configured in-place, not several lines of code away. + +## What is a GUI? + +Most GUIs do one thing.... they collect information from the user and return it. From a programmer's viewpoint this could be summed up as a function call that looks like this: + + button, values = GUI_Display(gui_layout) + +What's expected from most GUIs is the button that was clicked (OK, cancel, save, yes, no, etc), and the values that were input by the user. The essence of a GUI can be boiled down into a single line of code. + +This is exactly how PySimpleGUI works (for these simple kinds of GUIs). When the call is made to display the GUI, execution does no return until a button is clicked that closes the form. + +There are more complex GUIs such as those that don't close after a button is clicked. These complex forms can also be created with PySimpleGUI. A remote control interface for a robot and a chat window are a couple of examples. + +## The 5-Minute GUI + +When is PySimpleGUI useful? Immediately, anytime you've got a GUI need. It will take under 5 minutes for you to create and try your GUI. With those kinds of times, what do you have to lose trying it? + +The best way to go about making your GUI in under 5 minutes is to copy one of the GUIs from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/). Follow these steps: +* Find a GUI that looks similar to what you want to create +* Copy code from Cookbook +* Paste into your IDE and run + +Let's look at the first recipe from the book + + import PySimpleGUI as sg + + # Very basic form. Return values as a list + form = sg.FlexForm('Simple data entry form') # begin with a blank form + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + print(button, values[0], values[1], values[2]) + + +It's a reasonable sized form. + + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + +If you only need to collect a few values and they're all basically strings, then you would copy this recipe and modify it to suit your needs. + +## Making Your Custom GUI + +That 5-minute estimate wasn't the time it takes to copy and paste the code from the Cookbook. You should be able to modify the code within 5 minutes in order to get to your layout, assuming you've got a straightforward layout. + +Widgets are called Elements in PySimpleGUI. This list of Elements are spelled exactly as you would type it into your Python code. + +### Core Element list +``` + Text + InputText + Multiline + InputCombo + Listbox + Radio + Checkbox + Spin + Output + SimpleButton + RealtimeButton + ReadFormButton + ProgressBar + Image + Slider + Column +``` + +You can also have short-cut Elements. There are 2 types of shortcuts. One is simply other names for the exact same element (e.g. T instead of Text). The second type configures an Element with particular setting, sparing the programmer from specifying all of the parameters (e.g. Submit is a button with the text "Submit" on it). +### Shortcut list + + T = Text + Txt = Text + In = InputText + Input = IntputText + Combo = InputCombo + DropDown = InputCombo + Drop = InputCombo + +A number of common buttons have been implemented as shortcuts. These include: +### Button Shortcuts + FolderBrowse + FileBrowse + FileSaveAs + Save + Submit + OK + Ok + Cancel + Quit + Exit + Yes + No + +The more generic button functions, that are also shortcuts +### Generic Buttons + SimpleButton + ReadFormButton + RealtimeButton + +These are all of the GUI Widgets you have to choose from. If it's not in this list, it doesn't go in your form layout. + +### GUI Design Pattern + +The stuff that tends not to change in GUIs are the calls that setup and show the Window. It's the layout of the Elements that changes from one program to another. This is the code from above with the layout removed: + + import PySimpleGUI as sg + + form = sg.FlexForm('Simple data entry form') + # Define your form here (it's a list of lists) + button, values = form.LayoutAndRead(layout) + + The flow for most GUIs is: + * Create the Form object + * Define GUI as a list of lists + * Show the GUI and get results + +These are line for line what you see in design pattern. + +### GUI Layout + +To create your custom GUI, first break your form down into "rows". You'll be defining your form one row at a time. Then for each for, you'll be placing one Element after another, working from left to right. + +The result is a "list of lists" that looks something like this: + + layout = [ [Text('Row 1')], + [Text('Row 2'), Checkbox('Checkbox 1', OK()), Checkbox('Checkbox 2'), OK()] ] + +The layout produced this window: + +![tutorial2](https://user-images.githubusercontent.com/13696193/44302312-e5259c00-a2f3-11e8-9c17-63e4eb130a9e.jpg) + + +## Display GUI & Get Results + +Once you have your layout complete and you've copied over the lines of code that setup and show the form, it's time to look at how to display the form and get the values from the user. + +This is the line of code that displays the form and provides the results: + + button, values = form.LayoutAndRead(layout) + + Forms return 2 values, the text of the button that was clicked and a ***list of values*** the user entered into the form. + +If the example form was displayed and the user did nothing other than click the OK button, then the results would have been: + + button == 'OK' + values == [False, False] + +Checkbox Elements return a value of True/False. Because these checkboxes defaulted to unchecked, the values returned were both False. + +## Displaying Results + +Once you have the values from the GUI it would be nice to check what values are in the variables. Rather than print them out using a `print` statement, let's stick with the GUI idea and output to a window. + +PySimpleGUI has a number of Message Boxes to choose from. The data passed to the message box will be displayed in a window. The function takes any number of arguments. Simply indicate all the variables you would like to see in the call. + +The most-commonly used Message Box in PySimpleGUI is MsgBox. To display the results of the previous example, one would write: + + MsgBox('The GUI returned:', button, values) + +## Putting It All Together + +Now that you know the basics, let's put together a form that contains as many PySimpleGUI's elements as possible. Also, just to give it a nice look, we'll change the "look and feel" to a green and tan color scheme. + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + + column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10,1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#d3dfda')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + sg.MsgBox(button, values) + +That may seem like a lot of code, but try coding this same GUI layout directly in tkinter and you'll quickly realize that the length is tiny. + +![everything for tutorial](https://user-images.githubusercontent.com/13696193/44302997-38531b00-a303-11e8-8c45-698ea62590a8.jpg) + +The last line of code opens a message box. This is how it looks: + +![tutorial results](https://user-images.githubusercontent.com/13696193/44303004-79e3c600-a303-11e8-8311-2f3726d364ad.jpg) + + +Each parameter to the message box call is displayed on a new line. There are actually 2 lines of text in the message box. The second line is very long and wrapped a number of times + +Take a moment and pair up the results values with the GUI to get an understanding of how results are created and returned. + +## Resources + +### Installation +Requires Python 3 + + pip install PySimpleGUI + +Works on all systems that run tkinter, including the Raspberry Pi + +### Documentation +[Main manual](https://pysimplegui.readthedocs.io/en/latest/) + +[Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) + +### Home Page + +www.PySimpleGUI.com From a6d375f8a19c73ae4d42fbdb3c348384b5714627 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 18 Aug 2018 23:19:11 -0400 Subject: [PATCH 157/521] New Image features - load from RAM, update with new image --- PySimpleGUI.py | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4c36aeec6..685075f7d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -747,7 +747,7 @@ def __del__(self): # Image # # ---------------------------------------------------------------------- # class Image(Element): - def __init__(self, filename, scale=(None, None), size=(None, None)): + def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None)): ''' Image Element :param filename: @@ -755,9 +755,23 @@ def __init__(self, filename, scale=(None, None), size=(None, None)): :param size: Size of field in characters ''' self.Filename = filename + self.Data = data + self.tktext_label = None + + if data is None and filename is None: + print('* Warning... no image specified in Image Element! *') super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size) return + def Update(self, filename=None, data=None): + if filename is not None: + image = tk.PhotoImage(file=filename) + elif data is not None: + image = tk.PhotoImage(data=data) + else: return + self.tktext_label.configure(image=image) + self.tktext_label.image = image + def __del__(self): super().__del__() @@ -835,7 +849,7 @@ def __del__(self): for element in row: element.__del__() try: - del(self.TKroot) + del(self.TKFrame) except: pass super().__del__() @@ -1592,15 +1606,23 @@ def CharWidthInPixels(): element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: - photo = tk.PhotoImage(file=element.Filename) - if element_size == (None, None) or element_size == None or element_size == toplevel_form.DefaultElementSize: - width, height = photo.width(), photo.height() + if element.Filename is not None: + photo = tk.PhotoImage(file=element.Filename) + elif element.Data is not None: + photo = tk.PhotoImage(data=element.Data) else: - width, height = element_size - tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) - tktext_label.image = photo - # tktext_label.configure(anchor=tk.NW, image=photo) - tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + photo = None + print('*ERROR laying out form.... Image Element has no image specified*') + + if photo is not None: + if element_size == (None, None) or element_size == None or element_size == toplevel_form.DefaultElementSize: + width, height = photo.width(), photo.height() + else: + width, height = element_size + element.tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) + element.tktext_label.image = photo + # tktext_label.configure(anchor=tk.NW, image=photo) + element.tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() From beebcbab0c8594e0d8abd8b601dd259ed0a422cf Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 19 Aug 2018 20:59:08 -0400 Subject: [PATCH 158/521] Turned off 2 debug print statements, incomplete keyboard feature Also has some code for Keyboard handling, but it's incomplete --- PySimpleGUI.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 685075f7d..d20da4b49 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -102,11 +102,11 @@ def __init__(self): def Decrement(self): self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0 - print('---- DECREMENTING Num Open Windows = {} ---'.format(self.NumOpenWindows)) + # print('---- DECREMENTING Num Open Windows = {} ---'.format(self.NumOpenWindows)) def Increment(self): self.NumOpenWindows += 1 - print('++++ INCREMENTING Num Open Windows = {} ++++'.format(self.NumOpenWindows)) + # print('++++ INCREMENTING Num Open Windows = {} ++++'.format(self.NumOpenWindows)) _my_windows = MyWindows() # terrible hack using globals... means need a class for collecing windows @@ -862,7 +862,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -896,6 +896,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.LastButtonClicked = None self.UseDictionary = False self.UseDefaultFocus = False + self.ReturnKeyboardEvents = return_keyboard_events # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -1013,6 +1014,8 @@ def ReadNonBlocking(self, Message=''): _my_windows.Decrement() return BuildResults(self, False, self) + def KeyboardCallback(self, event ): + print("pressed", event) def _Close(self): try: @@ -1765,6 +1768,8 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) + if my_flex_form.ReturnKeyboardEvents: + root.bind("", my_flex_form.KeyboardCallback) if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration From 3af033122b04c521aad19d8430d88f97c90093fb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 19 Aug 2018 21:05:59 -0400 Subject: [PATCH 159/521] 5-line GUI added --- docs/tutorial.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index edc6b6198..ab1e798b7 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -59,13 +59,31 @@ Let's look at the first recipe from the book print(button, values[0], values[1], values[2]) -It's a reasonable sized form. +It's a reasonably sized form. ![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) If you only need to collect a few values and they're all basically strings, then you would copy this recipe and modify it to suit your needs. +## The 5-line GUI + +Not all GUIs take 5 minutes. Some take 5 lines of code. This is a GUI with a custom layout contained in 5 lines of code. + + import PySimpleGUI as sg + + form = sg.FlexForm('My first GUI') + + layout = [ [sg.Text('Enter your name'), sg.InputText()], + [sg.OK()] ] + + button, (name,) = form.LayoutAndRead(layout) + + +![myfirstgui](https://user-images.githubusercontent.com/13696193/44315412-d2918c80-a3f1-11e8-9eda-0d5d9bfefb0f.jpg) + + + ## Making Your Custom GUI That 5-minute estimate wasn't the time it takes to copy and paste the code from the Cookbook. You should be able to modify the code within 5 minutes in order to get to your layout, assuming you've got a straightforward layout. From 1f9247e6ce5e084210d04a9816c60f6313a9d944 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 13:48:02 -0400 Subject: [PATCH 160/521] Keyboard capture! You can now have a form return the keystokes. This is great for page-up page-down, etc. Returned as a string in the button field.. Specified in the FlexForm call. return_keyboard_events is the boolean parameter. --- PySimpleGUI.py | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 685075f7d..2ceb7ac32 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -102,11 +102,11 @@ def __init__(self): def Decrement(self): self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0 - print('---- DECREMENTING Num Open Windows = {} ---'.format(self.NumOpenWindows)) + # print('---- DECREMENTING Num Open Windows = {} ---'.format(self.NumOpenWindows)) def Increment(self): self.NumOpenWindows += 1 - print('++++ INCREMENTING Num Open Windows = {} ++++'.format(self.NumOpenWindows)) + # print('++++ INCREMENTING Num Open Windows = {} ++++'.format(self.NumOpenWindows)) _my_windows = MyWindows() # terrible hack using globals... means need a class for collecing windows @@ -862,7 +862,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -896,6 +896,8 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.LastButtonClicked = None self.UseDictionary = False self.UseDefaultFocus = False + self.ReturnKeyboardEvents = return_keyboard_events + self.LastKeyboardEvent = None # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -993,11 +995,18 @@ def Read(self): if not self.Shown: self.Show() else: + InitializeResults(self) self.TKroot.mainloop() if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.Decrement() - return BuildResults(self, False, self) + # if self.ReturnValues[0] is not None: # keyboard events build their own return values + # return self.ReturnValues + if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + return BuildResults(self, False, self) + else: + return self.ReturnValues + def ReadNonBlocking(self, Message=''): if self.TKrootDestroyed: @@ -1013,6 +1022,19 @@ def ReadNonBlocking(self, Message=''): _my_windows.Decrement() return BuildResults(self, False, self) + def KeyboardCallback(self, event ): + print(".",) + self.LastButtonClicked = None + self.FormRemainedOpen = True + if event.char != '': + self.LastKeyboardEvent = event.char + else: + self.LastKeyboardEvent = str(event.keysym) + ':' + str(event.keycode) + # self.LastKeyboardEvent = event + if not self.NonBlocking: + results = BuildResults(self, False, self) + self.TKroot.quit() + def _Close(self): try: @@ -1125,7 +1147,7 @@ def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_ # ------------------------- SAVE AS Element lazy function ------------------------- # def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False): @@ -1244,7 +1266,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): if not initialize_only: if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() - if not top_level_form.NonBlocking and not element.do_not_clear: + if not top_level_form.NonBlocking and not element.do_not_clear and not top_level_form.ReturnKeyboardEvents: element.TKStringVar.set('') elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: value = element.TKIntVar.get() @@ -1279,7 +1301,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) - if not top_level_form.NonBlocking and not element.do_not_clear: + if not top_level_form.NonBlocking and not element.do_not_clear and not top_level_form.ReturnKeyboardEvents: element.TKText.delete('1.0', tk.END) except: value = None @@ -1292,6 +1314,10 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) + if form.ReturnKeyboardEvents and form.LastKeyboardEvent is not None: + button_pressed_text = form.LastKeyboardEvent + form.LastKeyboardEvent = None + try: form.ReturnValuesDictionary.pop(None, None) # clean up dictionary include None was included except: pass @@ -1765,6 +1791,8 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) + if my_flex_form.ReturnKeyboardEvents: + root.bind("", my_flex_form.KeyboardCallback) if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration @@ -2571,11 +2599,15 @@ def ChangeLookAndFeel(index): sprint=ScrolledTextBox # Converts an object's contents into a nice printable string. Great for dumping debug data -def ObjToString_old(obj): +def ObjToStringSingleObj(obj): + if obj is None: + return 'None' return str(obj.__class__) + '\n' + '\n'.join( (repr(item) + ' = ' + repr(obj.__dict__[item]) for item in sorted(obj.__dict__))) def ObjToString(obj, extra=' '): + if obj is None: + return 'None' return str(obj.__class__) + '\n' + '\n'.join( (extra + (str(item) + ' = ' + (ObjToString(obj.__dict__[item], extra + ' ') if hasattr(obj.__dict__[item], '__dict__') else str( From aa2d31f24bc17ec68c5f58f075d76cdea0186103 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 15:27:12 -0400 Subject: [PATCH 161/521] Added non-blocking form keyboard binding If the form is a non-blocking form, when a key is pressed, the form will continuously return that key as being pressed until it is released. --- PySimpleGUI.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 2ceb7ac32..fc07064a5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1791,8 +1791,10 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) - if my_flex_form.ReturnKeyboardEvents: + if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: root.bind("", my_flex_form.KeyboardCallback) + elif my_flex_form.ReturnKeyboardEvents: + root.bind("", my_flex_form.KeyboardCallback) if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration From 51ea64ce07fbe552e63370f0ab324d99550a9ef1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 15:51:29 -0400 Subject: [PATCH 162/521] Removed print --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index fc07064a5..dae19930c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1023,7 +1023,7 @@ def ReadNonBlocking(self, Message=''): return BuildResults(self, False, self) def KeyboardCallback(self, event ): - print(".",) + # print(".",) self.LastButtonClicked = None self.FormRemainedOpen = True if event.char != '': From 9b190f5cee6dff31eb7682b297eaf25440ec3deb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 18:43:33 -0400 Subject: [PATCH 163/521] Added page-up / page-down --- Demo_PDF_Viewer.py | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Demo_PDF_Viewer.py diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py new file mode 100644 index 000000000..1e933ef84 --- /dev/null +++ b/Demo_PDF_Viewer.py @@ -0,0 +1,92 @@ +import sys +import fitz +import PySimpleGUI as sg + +try: + fname = sys.argv[1] +except: + fname = 'C:/Python/PycharmProjects/GooeyGUI/test.pdf' +doc = fitz.open(fname) +title = "PyMuPDF display of '%s' (%i pages)" % (fname, len(doc)) + +def get_page(pno, zoom = 0): + page = doc[pno] + r = page.rect + mp = r.tl + (r.br - r.tl) * 0.5 + mt = r.tl + (r.tr - r.tl) * 0.5 + ml = r.tl + (r.bl - r.tl) * 0.5 + mr = r.tr + (r.br - r.tr) * 0.5 + mb = r.bl + (r.br - r.bl) * 0.5 + mat = fitz.Matrix(2, 2) + if zoom == 1: + clip = fitz.Rect(r.tl, mp) + elif zoom == 4: + clip = fitz.Rect(mp, r.br) + elif zoom == 2: + clip = fitz.Rect(mt, mr) + elif zoom == 3: + clip = fitz.Rect(ml, mb) + if zoom == 0: + pix = page.getPixmap(alpha = False) + else: + pix = page.getPixmap(alpha = False, matrix = mat, clip = clip) + return pix.getPNGData() + +form = sg.FlexForm(title, return_keyboard_events=True) + +data = get_page(0) +image_elem = sg.Image(data=data) +layout = [ [image_elem], + [sg.ReadFormButton('Next'), + sg.ReadFormButton('Prev'), + sg.ReadFormButton('First'), + sg.ReadFormButton('Last'), + sg.ReadFormButton('Zoom-1'), + sg.ReadFormButton('Zoom-2'), + sg.ReadFormButton('Zoom-3'), + sg.ReadFormButton('Zoom-4'), + sg.Quit()] ] + +form.Layout(layout) + +i = 0 +oldzoom = 0 +while True: + button,value = form.Read() + zoom = 0 + if button in (None, 'Quit'): + break + if button in ("Next", 'Next:34'): + i += 1 + elif button in ("Prev", "Prior:33"): + i -= 1 + elif button == "First": + i = 0 + elif button == "Last": + i = -1 + elif button == "Zoom-1": + if oldzoom == 1: + zoom = oldzoom = 0 + else: + zoom = oldzoom = 1 + elif button == "Zoom-2": + if oldzoom == 2: + zoom = oldzoom = 0 + else: + zoom = oldzoom = 2 + elif button == "Zoom-3": + if oldzoom == 3: + zoom = oldzoom = 0 + else: + zoom = oldzoom = 3 + elif button == "Zoom-4": + if oldzoom == 4: + zoom = oldzoom = 0 + else: + zoom = oldzoom = 4 + try: + data = get_page(i, zoom) + except: + i = 0 + data = get_page(i, zoom) + image_elem.Update(data=data) From 88bdf72d8afa9f8ce2e0bba9282fb9c4cb1b791f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 18:44:33 -0400 Subject: [PATCH 164/521] Removed a commment --- PySimpleGUI.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index dae19930c..18edc84c5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1030,7 +1030,6 @@ def KeyboardCallback(self, event ): self.LastKeyboardEvent = event.char else: self.LastKeyboardEvent = str(event.keysym) + ':' + str(event.keycode) - # self.LastKeyboardEvent = event if not self.NonBlocking: results = BuildResults(self, False, self) self.TKroot.quit() From e0deebea9ea513415428615b8a390c4734068cfc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 19:00:02 -0400 Subject: [PATCH 165/521] Initial checkin of Keyboard Demos --- Demo_Keyboard.py | 26 ++++++++++++++++++++++++++ Demo_Keyboard_Realtime.py | 23 +++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Demo_Keyboard.py create mode 100644 Demo_Keyboard_Realtime.py diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py new file mode 100644 index 000000000..a6bbda996 --- /dev/null +++ b/Demo_Keyboard.py @@ -0,0 +1,26 @@ +import sys +import PySimpleGUI as sg + +# Recipe for getting keys, one at a time as they are released +# If want to use the space bar, then be sure and disable the "default focus" + +with sg.FlexForm('Realtime Keyboard Test', return_keyboard_events=True, use_default_focus=False) as form: + text_elem = sg.Text('', size=(12,1)) + layout = [[sg.Text('Press a key')], + [text_elem], + [sg.SimpleButton('OK')]] + + form.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = form.Read() + + if button == 'OK': + print(button, 'exiting') + break + if button is not None: + text_elem.Update(button) + elif value is None: + break + + diff --git a/Demo_Keyboard_Realtime.py b/Demo_Keyboard_Realtime.py new file mode 100644 index 000000000..bb1d145e5 --- /dev/null +++ b/Demo_Keyboard_Realtime.py @@ -0,0 +1,23 @@ +import PySimpleGUI as sg + +# Recipe for getting a continuous stream of keys when using a non-blocking form +# If want to use the space bar, then be sure and disable the "default focus" + +with sg.FlexForm('Realtime Keyboard Test', return_keyboard_events=True, use_default_focus=False) as form: + layout = [[sg.Text('Hold down a key')], + [sg.SimpleButton('OK')]] + + form.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = form.ReadNonBlocking() + + if button == 'OK': + print(button, value, 'exiting') + break + if button is not None: + print(button) + elif value is None: + break + + From d3d154b8708e27f1e9f1a22f1d301eabdf1e33a3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 19:09:05 -0400 Subject: [PATCH 166/521] Cleaned up code --- Demo_PDF_Viewer.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py index 1e933ef84..85825bcc1 100644 --- a/Demo_PDF_Viewer.py +++ b/Demo_PDF_Viewer.py @@ -49,8 +49,7 @@ def get_page(pno, zoom = 0): form.Layout(layout) -i = 0 -oldzoom = 0 +i = oldzoom = 0 while True: button,value = form.Read() zoom = 0 @@ -65,25 +64,13 @@ def get_page(pno, zoom = 0): elif button == "Last": i = -1 elif button == "Zoom-1": - if oldzoom == 1: - zoom = oldzoom = 0 - else: - zoom = oldzoom = 1 + zoom = oldzoom = 0 if oldzoom == 1 else 1 elif button == "Zoom-2": - if oldzoom == 2: - zoom = oldzoom = 0 - else: - zoom = oldzoom = 2 + zoom = oldzoom = 0 if oldzoom == 2 else 2 elif button == "Zoom-3": - if oldzoom == 3: - zoom = oldzoom = 0 - else: - zoom = oldzoom = 3 + zoom = oldzoom = 0 if oldzoom == 3 else 3 elif button == "Zoom-4": - if oldzoom == 4: - zoom = oldzoom = 0 - else: - zoom = oldzoom = 4 + zoom = oldzoom = 0 if oldzoom == 4 else 4 try: data = get_page(i, zoom) except: From 4667a2f3ffbc9f801f4767bd468d941266587017 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 20:47:24 -0400 Subject: [PATCH 167/521] New use_default_focus option for forms. --- Demo_Keyboard.py | 2 +- PySimpleGUI.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index a6bbda996..85f63b8a9 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -20,7 +20,7 @@ break if button is not None: text_elem.Update(button) - elif value is None: + else: break diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 18edc84c5..eed9167c8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -862,7 +862,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -895,7 +895,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.DictionaryKeyCounter = 0 self.LastButtonClicked = None self.UseDictionary = False - self.UseDefaultFocus = False + self.UseDefaultFocus = use_default_focus self.ReturnKeyboardEvents = return_keyboard_events self.LastKeyboardEvent = None @@ -954,8 +954,10 @@ def Show(self, non_blocking=False): except: pass - if not found_focus: + if not found_focus and self.UseDefaultFocus: self.UseDefaultFocus = True + else: + self.UseDefaultFocus = False # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## StartupTK(self) return self.ReturnValues From c482dee57e958231aa8492bba08071e5e91171d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 21:59:00 -0400 Subject: [PATCH 168/521] Update method for InputText element --- PySimpleGUI.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index eed9167c8..751ef6dec 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -236,6 +236,8 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) + def Update(self, new_value): + self.TKStringVar.set(new_value) def __del__(self): super().__del__() From 240a0a71e40d8fcb6d9a92157202d4d27c85bd3f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 20 Aug 2018 23:45:09 -0400 Subject: [PATCH 169/521] Mouse scroll wheel! New PDF viewer demo --- Demo_PDF_Viewer.py | 222 +++++++++++++++++++++++++++++++++------------ PySimpleGUI.py | 13 ++- 2 files changed, 175 insertions(+), 60 deletions(-) diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py index 85825bcc1..ecd60c9c5 100644 --- a/Demo_PDF_Viewer.py +++ b/Demo_PDF_Viewer.py @@ -1,79 +1,183 @@ +""" +@created: 2018-08-19 18:00:00 + +@author: (c) 2018 Jorj X. McKie + +Display a PyMuPDF Document using Tkinter +------------------------------------------------------------------------------- + +Dependencies: +------------- +PyMuPDF, PySimpleGUI > v2.9.0, Tkinter with Tk v8.6+, Python 3 + + +License: +-------- +GNU GPL V3+ + +Description +------------ +Read filename from command line and start display with page 1. +Pages can be directly jumped to, or buttons for paging can be used. +For experimental / demonstration purposes, we have included options to zoom +into the four page quadrants (top-left, bottom-right, etc.). + +We also interpret keyboard events to support paging by PageDown / PageUp +keys as if the resp. buttons were clicked. Similarly, we do not include +a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the form. + +To improve paging performance, we are not directly creating pixmaps from +pages, but instead from the fitz.DisplayList of the page. A display list +will be stored in a list and looked up by page number. This way, zooming +pixmaps and page re-visits will re-use a once-created display list. + +""" import sys import fitz import PySimpleGUI as sg +from binascii import hexlify -try: +if len(sys.argv) == 1: + rc, fname = sg.GetFileBox('PDF Browser', 'PDF file to open', file_types=(("PDF Files", "*.pdf"),)) + if rc is False: + sg.MsgBoxCancel('Cancelling') + exit(0) +else: fname = sys.argv[1] -except: - fname = 'C:/Python/PycharmProjects/GooeyGUI/test.pdf' + doc = fitz.open(fname) -title = "PyMuPDF display of '%s' (%i pages)" % (fname, len(doc)) - -def get_page(pno, zoom = 0): - page = doc[pno] - r = page.rect - mp = r.tl + (r.br - r.tl) * 0.5 - mt = r.tl + (r.tr - r.tl) * 0.5 - ml = r.tl + (r.bl - r.tl) * 0.5 - mr = r.tr + (r.br - r.tr) * 0.5 - mb = r.bl + (r.br - r.bl) * 0.5 - mat = fitz.Matrix(2, 2) - if zoom == 1: +page_count = len(doc) + +# storage for page display lists +dlist_tab = [None] * page_count + +title = "PyMuPDF display of '%s', pages: %i" % (fname, page_count) + + +def get_page(pno, zoom=0): + """Return a PNG image for a document page number. If zoom is other than 0, one of the 4 page quadrants are zoomed-in instead and the corresponding clip returned. + + """ + dlist = dlist_tab[pno] # get display list + if not dlist: # create if not yet there + dlist_tab[pno] = doc[pno].getDisplayList() + dlist = dlist_tab[pno] + r = dlist.rect # page rectangle + mp = r.tl + (r.br - r.tl) * 0.5 # rect middle point + mt = r.tl + (r.tr - r.tl) * 0.5 # middle of top edge + ml = r.tl + (r.bl - r.tl) * 0.5 # middle of left edge + mr = r.tr + (r.br - r.tr) * 0.5 # middle of right egde + mb = r.bl + (r.br - r.bl) * 0.5 # middle of bottom edge + mat = fitz.Matrix(2, 2) # zoom matrix + if zoom == 1: # top-left quadrant clip = fitz.Rect(r.tl, mp) - elif zoom == 4: + elif zoom == 4: # bot-right quadrant clip = fitz.Rect(mp, r.br) - elif zoom == 2: + elif zoom == 2: # top-right clip = fitz.Rect(mt, mr) - elif zoom == 3: + elif zoom == 3: # bot-left clip = fitz.Rect(ml, mb) - if zoom == 0: - pix = page.getPixmap(alpha = False) + if zoom == 0: # total page + pix = dlist.getPixmap(alpha=False) else: - pix = page.getPixmap(alpha = False, matrix = mat, clip = clip) - return pix.getPNGData() + pix = dlist.getPixmap(alpha=False, matrix=mat, clip=clip) + return pix.getPNGData() # return the PNG image + -form = sg.FlexForm(title, return_keyboard_events=True) +form = sg.FlexForm(title, return_keyboard_events=True, use_default_focus=False) -data = get_page(0) +cur_page = 0 +data = get_page(cur_page) # show page 1 for start image_elem = sg.Image(data=data) -layout = [ [image_elem], - [sg.ReadFormButton('Next'), - sg.ReadFormButton('Prev'), - sg.ReadFormButton('First'), - sg.ReadFormButton('Last'), - sg.ReadFormButton('Zoom-1'), - sg.ReadFormButton('Zoom-2'), - sg.ReadFormButton('Zoom-3'), - sg.ReadFormButton('Zoom-4'), - sg.Quit()] ] +goto = sg.InputText(str(cur_page + 1), size=(5, 1), do_not_clear=True) + +layout = [ + [ + sg.ReadFormButton('Next'), + sg.ReadFormButton('Prev'), + sg.Text('Page:'), + goto, + ], + [ + sg.Text("Zoom:"), + sg.ReadFormButton('Top-L'), + sg.ReadFormButton('Top-R'), + sg.ReadFormButton('Bot-L'), + sg.ReadFormButton('Bot-R'), + ], + [image_elem], +] form.Layout(layout) +my_keys = ("Next", "Next:34", "Prev", "Prior:33", "Top-L", "Top-R", + "Bot-L", "Bot-R", "MouseWheel:Down", "MouseWheel:Up") +zoom_buttons = ("Top-L", "Top-R", "Bot-L", "Bot-R") + +old_page = 0 +old_zoom = 0 # used for zoom on/off +# the zoom buttons work in on/off mode. -i = oldzoom = 0 while True: - button,value = form.Read() + button, value = form.ReadNonBlocking() zoom = 0 - if button in (None, 'Quit'): + force_page = False + if button is None and value is None: break - if button in ("Next", 'Next:34'): - i += 1 - elif button in ("Prev", "Prior:33"): - i -= 1 - elif button == "First": - i = 0 - elif button == "Last": - i = -1 - elif button == "Zoom-1": - zoom = oldzoom = 0 if oldzoom == 1 else 1 - elif button == "Zoom-2": - zoom = oldzoom = 0 if oldzoom == 2 else 2 - elif button == "Zoom-3": - zoom = oldzoom = 0 if oldzoom == 3 else 3 - elif button == "Zoom-4": - zoom = oldzoom = 0 if oldzoom == 4 else 4 - try: - data = get_page(i, zoom) - except: - i = 0 - data = get_page(i, zoom) - image_elem.Update(data=data) + if button is None: + continue + + if button in ("Escape:27"): # this spares me a 'Quit' button! + break + # print("hex(button)", hexlify(button.encode())) + if button[0] == chr(13): # surprise: this is 'Enter'! + try: + cur_page = int(value[0]) - 1 # check if valid + while cur_page < 0: + cur_page += page_count + except: + cur_page = 0 # this guy's trying to fool me + goto.Update(str(cur_page + 1)) + # goto.TKStringVar.set(str(cur_page + 1)) + + elif button in ("Next", "Next:34", "MouseWheel:Down"): + cur_page += 1 + elif button in ("Prev", "Prior:33", "MouseWheel:Up"): + cur_page -= 1 + elif button == "Top-L": + zoom = 1 + elif button == "Top-R": + zoom = 2 + elif button == "Bot-L": + zoom = 3 + elif button == "Bot-R": + zoom = 4 + + # sanitize page number + if cur_page >= page_count: # wrap around + cur_page = 0 + while cur_page < 0: # we show conventional page numbers + cur_page += page_count + + # prevent creating same data again + if cur_page != old_page: + zoom = old_zoom = 0 + force_page = True + + if button in zoom_buttons: + if 0 < zoom == old_zoom: + zoom = 0 + force_page = True + + if zoom != old_zoom: + force_page = True + + if force_page: + data = get_page(cur_page, zoom) + image_elem.Update(data=data) + old_page = cur_page + old_zoom = zoom + + # update page number field + if button in my_keys or not value[0]: + goto.Update(str(cur_page + 1)) + # goto.TKStringVar.set(str(cur_page + 1)) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 751ef6dec..c69c74d13 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1027,7 +1027,6 @@ def ReadNonBlocking(self, Message=''): return BuildResults(self, False, self) def KeyboardCallback(self, event ): - # print(".",) self.LastButtonClicked = None self.FormRemainedOpen = True if event.char != '': @@ -1038,6 +1037,16 @@ def KeyboardCallback(self, event ): results = BuildResults(self, False, self) self.TKroot.quit() + def MouseWheelCallback(self, event ): + self.LastButtonClicked = None + self.FormRemainedOpen = True + # print(ObjToStringSingleObj(event)) + direction = 'Down' if event.delta < 0 else 'Up' + self.LastKeyboardEvent = 'MouseWheel:' + direction + if not self.NonBlocking: + results = BuildResults(self, False, self) + self.TKroot.quit() + def _Close(self): try: @@ -1796,8 +1805,10 @@ def StartupTK(my_flex_form): my_flex_form.SetIcon(my_flex_form.WindowIcon) if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: root.bind("", my_flex_form.KeyboardCallback) + root.bind("", my_flex_form.MouseWheelCallback) elif my_flex_form.ReturnKeyboardEvents: root.bind("", my_flex_form.KeyboardCallback) + root.bind("", my_flex_form.MouseWheelCallback) if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration From 23123c532062400683784c80cb9295a6f6e62d73 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 10:33:42 -0400 Subject: [PATCH 170/521] Fix for missing results on persistent form --- PySimpleGUI.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c69c74d13..c26ae0305 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -962,6 +962,9 @@ def Show(self, non_blocking=False): self.UseDefaultFocus = False # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## StartupTK(self) + # If a button or keyboard event happened but no results have been built, build the results + if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + return BuildResults(self, False, self) return self.ReturnValues # ------------------------- SetIcon - set the window's fav icon ------------------------- # From 1d61773df611124e26f3ae1cc5d2143799a2b619 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 13:10:05 -0400 Subject: [PATCH 171/521] Option added to Image.UIpdate to create a new PhotoImage --- PySimpleGUI.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c26ae0305..fc1c59dab 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -769,7 +769,10 @@ def Update(self, filename=None, data=None): if filename is not None: image = tk.PhotoImage(file=filename) elif data is not None: - image = tk.PhotoImage(data=data) + if type(data) is bytes: + image = tk.PhotoImage(data=data) + else: + image = data else: return self.tktext_label.configure(image=image) self.tktext_label.image = image From a4461313aef6fbc7b63a397902a9d7860f360151 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 18:29:32 -0400 Subject: [PATCH 172/521] Added text justification setting to FlexForm --- PySimpleGUI.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index fc1c59dab..8cbed783d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -452,7 +452,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N ''' self.DisplayText = text self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR - self.Justification = justification if justification else DEFAULT_TEXT_JUSTIFICATION + self.Justification = justification if background_color is None: bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: @@ -867,7 +867,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -903,6 +903,7 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.UseDefaultFocus = use_default_focus self.ReturnKeyboardEvents = return_keyboard_events self.LastKeyboardEvent = None + self.TextJustification = text_justification # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -1040,17 +1041,15 @@ def KeyboardCallback(self, event ): else: self.LastKeyboardEvent = str(event.keysym) + ':' + str(event.keycode) if not self.NonBlocking: - results = BuildResults(self, False, self) + BuildResults(self, False, self) self.TKroot.quit() def MouseWheelCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True - # print(ObjToStringSingleObj(event)) - direction = 'Down' if event.delta < 0 else 'Up' - self.LastKeyboardEvent = 'MouseWheel:' + direction + self.LastKeyboardEvent = 'MouseWheel:' + 'Down' if event.delta < 0 else 'Up' if not self.NonBlocking: - results = BuildResults(self, False, self) + BuildResults(self, False, self) self.TKroot.quit() @@ -1059,7 +1058,7 @@ def _Close(self): self.TKroot.update() except: pass if not self.NonBlocking: - results = BuildResults(self, False, self) + BuildResults(self, False, self) if self.TKrootDestroyed: return None self.TKrootDestroyed = True @@ -1424,8 +1423,14 @@ def CharWidthInPixels(): stringvar.set(display_text) if auto_size_text: width = 0 - justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT - anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE + if element.Justification is not None: + justification = element.Justification + elif toplevel_form.TextJustification is not None: + justification = toplevel_form.TextJustification + else: + justification = DEFAULT_TEXT_JUSTIFICATION + justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT + anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS From 5f2740055e560ab83a0140ff516dcee3f0ec0f40 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 18:56:10 -0400 Subject: [PATCH 173/521] Updated readme with new FlexForm options --- docs/index.md | 61 ++++++++++++++++++++++++++++++++++++++++++++------- readme.md | 61 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 106 insertions(+), 16 deletions(-) diff --git a/docs/index.md b/docs/index.md index 392287c2d..2efe1958f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,16 +6,28 @@ ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +[![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) + # PySimpleGUI - (Ver 2.8) + (Ver 2.9) +Lots of documentation available in addition to this Readme File. [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) [COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Brief Tutorial on PySimpleGUI](https://pysimplegui.readthedocs.io/en/latest/tutorial/) + +[See Wiki for latest news about development branch + new features](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) + + Super-simple GUI to grasp... Powerfully customizable. +Create a custom GUI in 5 lines of code. + +Can create a custom GUI in 1 line of code if desired. + Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? Look no further, **you've found your GUI package**. @@ -27,6 +39,14 @@ Looking to take your Python code from the world of command lines and into the co ![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) +Or how about a ***custom GUI*** in 1 line of code? + + import PySimpleGUI as sg + + button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + +![simple](https://user-images.githubusercontent.com/13696193/44279378-2f891900-a21f-11e8-89d1-52d935a4f5f5.jpg) + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. @@ -35,7 +55,8 @@ PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkin Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. -![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) +![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) + In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: @@ -48,6 +69,7 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and `PySimpleGUI` is that in addition to getting the simple Message Boxes you also get the ability to **make your own forms** that are highly customizeable. Don't like the standard Message Box? Then make your own! @@ -60,6 +82,8 @@ With a simple GUI, it becomes practical to "associate" .py files with the python The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? +## Features + Features of PySimpleGUI include: Text Single Line Input @@ -89,6 +113,7 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Return values as dictionary Set focus Bind return key to buttons + Group widgets into a column and place into form anywhere An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -143,6 +168,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary +- The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values ----- @@ -733,11 +759,19 @@ This is the definition of the FlexForm object: location=(None, None), button_color=None,Font=None, progress_bar_color=(None,None), + background_color=None is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): + icon=DEFAULT_WINDOW_ICON, + return_keyboard_events=False, + use_default_focus=True, + text_justification=None): + + + + Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. @@ -748,11 +782,15 @@ Parameter Descriptions. You will find these same parameters specified for each location - (x,y) Location to place window in pixels button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars + background_color - Color of the window background is_tabbed_form - Bool. If True then form is a tabbed form border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. auto_close - Bool. If True form will autoclose auto_close_duration - Duration in seconds before form closes icon - .ICO file that will appear on the Task Bar and end of Title Bar + return_keyboard_events - if True key presses are returned as buttons + use_default_focus - if True and no focus set, then automatically set a focus + text_justification - Justification to use for Text Elements in this form #### Window Location @@ -1111,7 +1149,7 @@ While it's possible to build forms using the Button Element directly, you should button_color=None, font=None) -Pre-made buttons include: +These Pre-made buttons are some of the most important elements of all because they are used so much. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. (hmmm Save already comes to mind). They include: OK Ok @@ -1600,8 +1638,14 @@ Valid values for the description string are: GreenMono BrownBlue BrightColors + NeutralBlue + Kayak + SandyBeach TealMono +To see the latest list of color choices, take a look at the bottom of the `PySimpleGUI.py` file where you'll find the `ChangLookAndFeel` function. + +You can also combine the `ChangeLookAndFeel` function with the `SetOptions` function to quickly modify one of the canned color schemes. Maybe you like the colors but was more depth to your bezels. You can dial in exactly what you want. **ObjToString** Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. @@ -1655,7 +1699,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, +| 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults ### Release Notes @@ -1670,14 +1714,15 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. 2.7 Is the "feature complete" release. Pretty much all features are done and in the code + 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) +2.9 COLUMNS! This is the biggest feature and had the biggest impact on the code base. It was a difficult feature to add, but it was worth it. Can now make even more layouts. Almost any layout is possible with this addition. + ### Upcoming Make suggestions people! Future release features -Columns. How multiple columns would be specified in the SDK interface are still being designed. - Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. @@ -1738,7 +1783,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. diff --git a/readme.md b/readme.md index 392287c2d..2efe1958f 100644 --- a/readme.md +++ b/readme.md @@ -6,16 +6,28 @@ ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +[![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) + # PySimpleGUI - (Ver 2.8) + (Ver 2.9) +Lots of documentation available in addition to this Readme File. [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) [COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Brief Tutorial on PySimpleGUI](https://pysimplegui.readthedocs.io/en/latest/tutorial/) + +[See Wiki for latest news about development branch + new features](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) + + Super-simple GUI to grasp... Powerfully customizable. +Create a custom GUI in 5 lines of code. + +Can create a custom GUI in 1 line of code if desired. + Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? Look no further, **you've found your GUI package**. @@ -27,6 +39,14 @@ Looking to take your Python code from the world of command lines and into the co ![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) +Or how about a ***custom GUI*** in 1 line of code? + + import PySimpleGUI as sg + + button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + +![simple](https://user-images.githubusercontent.com/13696193/44279378-2f891900-a21f-11e8-89d1-52d935a4f5f5.jpg) + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. @@ -35,7 +55,8 @@ PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkin Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. -![raspberry pi](https://user-images.githubusercontent.com/13696193/43298356-9cfe9008-9123-11e8-9612-14649a2f6c7f.jpg) +![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) + In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: @@ -48,6 +69,7 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and `PySimpleGUI` is that in addition to getting the simple Message Boxes you also get the ability to **make your own forms** that are highly customizeable. Don't like the standard Message Box? Then make your own! @@ -60,6 +82,8 @@ With a simple GUI, it becomes practical to "associate" .py files with the python The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? +## Features + Features of PySimpleGUI include: Text Single Line Input @@ -89,6 +113,7 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Return values as dictionary Set focus Bind return key to buttons + Group widgets into a column and place into form anywhere An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -143,6 +168,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary +- The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values ----- @@ -733,11 +759,19 @@ This is the definition of the FlexForm object: location=(None, None), button_color=None,Font=None, progress_bar_color=(None,None), + background_color=None is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, - icon=DEFAULT_WINDOW_ICON): + icon=DEFAULT_WINDOW_ICON, + return_keyboard_events=False, + use_default_focus=True, + text_justification=None): + + + + Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. @@ -748,11 +782,15 @@ Parameter Descriptions. You will find these same parameters specified for each location - (x,y) Location to place window in pixels button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars + background_color - Color of the window background is_tabbed_form - Bool. If True then form is a tabbed form border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. auto_close - Bool. If True form will autoclose auto_close_duration - Duration in seconds before form closes icon - .ICO file that will appear on the Task Bar and end of Title Bar + return_keyboard_events - if True key presses are returned as buttons + use_default_focus - if True and no focus set, then automatically set a focus + text_justification - Justification to use for Text Elements in this form #### Window Location @@ -1111,7 +1149,7 @@ While it's possible to build forms using the Button Element directly, you should button_color=None, font=None) -Pre-made buttons include: +These Pre-made buttons are some of the most important elements of all because they are used so much. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. (hmmm Save already comes to mind). They include: OK Ok @@ -1600,8 +1638,14 @@ Valid values for the description string are: GreenMono BrownBlue BrightColors + NeutralBlue + Kayak + SandyBeach TealMono +To see the latest list of color choices, take a look at the bottom of the `PySimpleGUI.py` file where you'll find the `ChangLookAndFeel` function. + +You can also combine the `ChangeLookAndFeel` function with the `SetOptions` function to quickly modify one of the canned color schemes. Maybe you like the colors but was more depth to your bezels. You can dial in exactly what you want. **ObjToString** Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. @@ -1655,7 +1699,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key -| 2.9.0 | Aug XX,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, +| 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults ### Release Notes @@ -1670,14 +1714,15 @@ New debug printing capability. `sg.Print` Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. 2.7 Is the "feature complete" release. Pretty much all features are done and in the code + 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) +2.9 COLUMNS! This is the biggest feature and had the biggest impact on the code base. It was a difficult feature to add, but it was worth it. Can now make even more layouts. Almost any layout is possible with this addition. + ### Upcoming Make suggestions people! Future release features -Columns. How multiple columns would be specified in the SDK interface are still being designed. - Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. @@ -1738,7 +1783,7 @@ Here are the steps to run that application To run it: Python HowDoI.py -The pip command is all there is to the setup. +The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. From 038ce5eb6a3f16fbaf50590ec8358bff899b997a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 19:05:55 -0400 Subject: [PATCH 174/521] Manually submitting the file from dev branch --- PySimpleGUI.py | 84 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d20da4b49..8cbed783d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -236,6 +236,8 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) + def Update(self, new_value): + self.TKStringVar.set(new_value) def __del__(self): super().__del__() @@ -450,7 +452,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N ''' self.DisplayText = text self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR - self.Justification = justification if justification else DEFAULT_TEXT_JUSTIFICATION + self.Justification = justification if background_color is None: bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: @@ -767,7 +769,10 @@ def Update(self, filename=None, data=None): if filename is not None: image = tk.PhotoImage(file=filename) elif data is not None: - image = tk.PhotoImage(data=data) + if type(data) is bytes: + image = tk.PhotoImage(data=data) + else: + image = data else: return self.tktext_label.configure(image=image) self.tktext_label.image = image @@ -862,7 +867,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False): + def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -895,8 +900,10 @@ def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT self.DictionaryKeyCounter = 0 self.LastButtonClicked = None self.UseDictionary = False - self.UseDefaultFocus = False + self.UseDefaultFocus = use_default_focus self.ReturnKeyboardEvents = return_keyboard_events + self.LastKeyboardEvent = None + self.TextJustification = text_justification # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -953,10 +960,15 @@ def Show(self, non_blocking=False): except: pass - if not found_focus: + if not found_focus and self.UseDefaultFocus: self.UseDefaultFocus = True + else: + self.UseDefaultFocus = False # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## StartupTK(self) + # If a button or keyboard event happened but no results have been built, build the results + if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + return BuildResults(self, False, self) return self.ReturnValues # ------------------------- SetIcon - set the window's fav icon ------------------------- # @@ -994,11 +1006,18 @@ def Read(self): if not self.Shown: self.Show() else: + InitializeResults(self) self.TKroot.mainloop() if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.Decrement() - return BuildResults(self, False, self) + # if self.ReturnValues[0] is not None: # keyboard events build their own return values + # return self.ReturnValues + if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + return BuildResults(self, False, self) + else: + return self.ReturnValues + def ReadNonBlocking(self, Message=''): if self.TKrootDestroyed: @@ -1015,14 +1034,31 @@ def ReadNonBlocking(self, Message=''): return BuildResults(self, False, self) def KeyboardCallback(self, event ): - print("pressed", event) + self.LastButtonClicked = None + self.FormRemainedOpen = True + if event.char != '': + self.LastKeyboardEvent = event.char + else: + self.LastKeyboardEvent = str(event.keysym) + ':' + str(event.keycode) + if not self.NonBlocking: + BuildResults(self, False, self) + self.TKroot.quit() + + def MouseWheelCallback(self, event ): + self.LastButtonClicked = None + self.FormRemainedOpen = True + self.LastKeyboardEvent = 'MouseWheel:' + 'Down' if event.delta < 0 else 'Up' + if not self.NonBlocking: + BuildResults(self, False, self) + self.TKroot.quit() + def _Close(self): try: self.TKroot.update() except: pass if not self.NonBlocking: - results = BuildResults(self, False, self) + BuildResults(self, False, self) if self.TKrootDestroyed: return None self.TKrootDestroyed = True @@ -1128,7 +1164,7 @@ def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_ # ------------------------- SAVE AS Element lazy function ------------------------- # def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False): @@ -1247,7 +1283,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): if not initialize_only: if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() - if not top_level_form.NonBlocking and not element.do_not_clear: + if not top_level_form.NonBlocking and not element.do_not_clear and not top_level_form.ReturnKeyboardEvents: element.TKStringVar.set('') elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: value = element.TKIntVar.get() @@ -1282,7 +1318,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): elif element.Type == ELEM_TYPE_INPUT_MULTILINE: try: value=element.TKText.get(1.0, tk.END) - if not top_level_form.NonBlocking and not element.do_not_clear: + if not top_level_form.NonBlocking and not element.do_not_clear and not top_level_form.ReturnKeyboardEvents: element.TKText.delete('1.0', tk.END) except: value = None @@ -1295,6 +1331,10 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) + if form.ReturnKeyboardEvents and form.LastKeyboardEvent is not None: + button_pressed_text = form.LastKeyboardEvent + form.LastKeyboardEvent = None + try: form.ReturnValuesDictionary.pop(None, None) # clean up dictionary include None was included except: pass @@ -1383,8 +1423,14 @@ def CharWidthInPixels(): stringvar.set(display_text) if auto_size_text: width = 0 - justify = tk.LEFT if element.Justification == 'left' else tk.CENTER if element.Justification == 'center' else tk.RIGHT - anchor = tk.NW if element.Justification == 'left' else tk.N if element.Justification == 'center' else tk.NE + if element.Justification is not None: + justification = element.Justification + elif toplevel_form.TextJustification is not None: + justification = toplevel_form.TextJustification + else: + justification = DEFAULT_TEXT_JUSTIFICATION + justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT + anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS @@ -1768,8 +1814,12 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) - if my_flex_form.ReturnKeyboardEvents: + if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: + root.bind("", my_flex_form.KeyboardCallback) + root.bind("", my_flex_form.MouseWheelCallback) + elif my_flex_form.ReturnKeyboardEvents: root.bind("", my_flex_form.KeyboardCallback) + root.bind("", my_flex_form.MouseWheelCallback) if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration @@ -2576,11 +2626,15 @@ def ChangeLookAndFeel(index): sprint=ScrolledTextBox # Converts an object's contents into a nice printable string. Great for dumping debug data -def ObjToString_old(obj): +def ObjToStringSingleObj(obj): + if obj is None: + return 'None' return str(obj.__class__) + '\n' + '\n'.join( (repr(item) + ' = ' + repr(obj.__dict__[item]) for item in sorted(obj.__dict__))) def ObjToString(obj, extra=' '): + if obj is None: + return 'None' return str(obj.__class__) + '\n' + '\n'.join( (extra + (str(item) + ' = ' + (ObjToString(obj.__dict__[item], extra + ' ') if hasattr(obj.__dict__[item], '__dict__') else str( From c765f1f6f754fe8d6a6fd3321c5dd474c9ebf2e8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 19:10:26 -0400 Subject: [PATCH 175/521] Manually moving from Dev Latest on PC --- Demo_Keyboard.py | 17 +++++++---------- Demo_Keyboard_Realtime.py | 15 ++++++--------- Demo_PDF_Viewer.py | 4 +++- PySimpleGUI.py | 16 ---------------- 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index 85f63b8a9..88c5fc5dc 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -1,26 +1,23 @@ -import sys import PySimpleGUI as sg # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" -with sg.FlexForm('Realtime Keyboard Test', return_keyboard_events=True, use_default_focus=False) as form: - text_elem = sg.Text('', size=(12,1)) - layout = [[sg.Text('Press a key')], +with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], - [sg.SimpleButton('OK')]] + [sg.SimpleButton("OK")]] form.Layout(layout) # ---===--- Loop taking in user input --- # while True: - button, value = form.Read() + button, value = form.ReadNonBlocking() - if button == 'OK': - print(button, 'exiting') + if button == "OK" or (button is None and value is None): + print(button, "exiting") break if button is not None: text_elem.Update(button) - else: - break diff --git a/Demo_Keyboard_Realtime.py b/Demo_Keyboard_Realtime.py index bb1d145e5..258120240 100644 --- a/Demo_Keyboard_Realtime.py +++ b/Demo_Keyboard_Realtime.py @@ -1,19 +1,16 @@ import PySimpleGUI as sg -# Recipe for getting a continuous stream of keys when using a non-blocking form -# If want to use the space bar, then be sure and disable the "default focus" - -with sg.FlexForm('Realtime Keyboard Test', return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text('Hold down a key')], - [sg.SimpleButton('OK')]] +with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + layout = [[sg.Text("Hold down a key")], + [sg.SimpleButton("OK")]] form.Layout(layout) - # ---===--- Loop taking in user input --- # + while True: button, value = form.ReadNonBlocking() - if button == 'OK': - print(button, value, 'exiting') + if button == "OK": + print(button, value, "exiting") break if button is not None: print(button) diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py index ecd60c9c5..6fd5fb424 100644 --- a/Demo_PDF_Viewer.py +++ b/Demo_PDF_Viewer.py @@ -37,6 +37,8 @@ import PySimpleGUI as sg from binascii import hexlify +sg.ChangeLookAndFeel('GreenTan') + if len(sys.argv) == 1: rc, fname = sg.GetFileBox('PDF Browser', 'PDF file to open', file_types=(("PDF Files", "*.pdf"),)) if rc is False: @@ -126,7 +128,7 @@ def get_page(pno, zoom=0): if button is None: continue - if button in ("Escape:27"): # this spares me a 'Quit' button! + if button in ("Escape:27",): # this spares me a 'Quit' button! break # print("hex(button)", hexlify(button.encode())) if button[0] == chr(13): # surprise: this is 'Enter'! diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ffdec2b7c..8cbed783d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -867,10 +867,6 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' -<<<<<<< HEAD -======= - ->>>>>>> 531b32ab66746c9f4b6acd2ea8b6d113cb235827 def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS @@ -1038,10 +1034,6 @@ def ReadNonBlocking(self, Message=''): return BuildResults(self, False, self) def KeyboardCallback(self, event ): -<<<<<<< HEAD -======= - ->>>>>>> 531b32ab66746c9f4b6acd2ea8b6d113cb235827 self.LastButtonClicked = None self.FormRemainedOpen = True if event.char != '': @@ -1060,10 +1052,6 @@ def MouseWheelCallback(self, event ): BuildResults(self, False, self) self.TKroot.quit() -<<<<<<< HEAD -======= - ->>>>>>> 531b32ab66746c9f4b6acd2ea8b6d113cb235827 def _Close(self): try: @@ -1826,10 +1814,6 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) -<<<<<<< HEAD -======= - ->>>>>>> 531b32ab66746c9f4b6acd2ea8b6d113cb235827 if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: root.bind("", my_flex_form.KeyboardCallback) root.bind("", my_flex_form.MouseWheelCallback) From 1889a706f864f99a588a54b56aeda53d0bdf5d81 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 20:21:03 -0400 Subject: [PATCH 176/521] Fix mouse up bug --- PySimpleGUI.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4dae3cb99..5b8202ac5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -867,7 +867,6 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS @@ -1035,7 +1034,6 @@ def ReadNonBlocking(self, Message=''): return BuildResults(self, False, self) def KeyboardCallback(self, event ): - self.LastButtonClicked = None self.FormRemainedOpen = True if event.char != '': @@ -1049,13 +1047,12 @@ def KeyboardCallback(self, event ): def MouseWheelCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True - self.LastKeyboardEvent = 'MouseWheel:' + 'Down' if event.delta < 0 else 'Up' + self.LastKeyboardEvent = 'MouseWheel:Down' if event.delta < 0 else 'MouseWheel:Up' if not self.NonBlocking: BuildResults(self, False, self) self.TKroot.quit() - def _Close(self): try: self.TKroot.update() @@ -1817,7 +1814,6 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) - if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: root.bind("", my_flex_form.KeyboardCallback) root.bind("", my_flex_form.MouseWheelCallback) From 1b0f7488d0bec9561cdb6609496fdace793ca393 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 21 Aug 2018 20:21:27 -0400 Subject: [PATCH 177/521] Fix mousewheel up bug --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 8cbed783d..5b8202ac5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1047,7 +1047,7 @@ def KeyboardCallback(self, event ): def MouseWheelCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True - self.LastKeyboardEvent = 'MouseWheel:' + 'Down' if event.delta < 0 else 'Up' + self.LastKeyboardEvent = 'MouseWheel:Down' if event.delta < 0 else 'MouseWheel:Up' if not self.NonBlocking: BuildResults(self, False, self) self.TKroot.quit() From 150779ba1c745f84106799e922367691d75dd1c2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 11:37:51 -0400 Subject: [PATCH 178/521] New "get" methods. Get+Update for Checkboxes, Get for TextInput, Get for Multiline, New shortcut funcs --- PySimpleGUI.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 5b8202ac5..ef4e8e779 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -239,6 +239,9 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto def Update(self, new_value): self.TKStringVar.set(new_value) + def Get(self): + return self.TKStringVar.get() + def __del__(self): super().__del__() @@ -359,15 +362,22 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.Text = text self.InitialState = default self.Value = None - self.TKCheckbox = None + self.TKCheckbutton = None super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key) + def Get(self): + return self.TKIntVar.get() + + def Update(self, value): + if value is None: + self.TKCheckbutton.configure(state='disabled') + else: + self.TKCheckbutton.configure(state='normal') + self.TKIntVar.set(value) + + def __del__(self): - try: - self.TKCheckbox.__del__() - except: - pass super().__del__() # ---------------------------------------------------------------------- # @@ -431,6 +441,10 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s def Update(self, NewValue): self.TKText.insert(1.0, NewValue) + def Get(self): + return self.TKText.get(1.0, tk.END) + + def __del__(self): super().__del__() @@ -521,7 +535,7 @@ def __del__(self): # TKOutput # # New Type of TK Widget that's a Text Widget in disguise # # Note that it's inherited from the TKFrame class so that the # -# Scroll bar will span the length of the frame +# Scroll bar will span the length of the frame # # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): def __init__(self, parent, width, height, bd, background_color=None, text_color=None): @@ -1134,6 +1148,11 @@ def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=N def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) +# ------------------------- CHECKBOX Element lazy functions ------------------------- # +CB = Checkbox +CBox = Checkbox +Check = Checkbox + # ------------------------- INPUT COMBO Element lazy functions ------------------------- # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text, background_color=background_color) From b975c4f18872712481d7efc88ac2a64d3c0ec496 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 13:58:04 -0400 Subject: [PATCH 179/521] Image.Update now resizes TK Label that contains it, removed wraplen setting in text label configure Having trouble with text wrapping. Ended up removing the wraplen from call to tktext_label.configure. --- PySimpleGUI.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ef4e8e779..f2d112ffa 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -788,7 +788,8 @@ def Update(self, filename=None, data=None): else: image = data else: return - self.tktext_label.configure(image=image) + width, height = image.width(), image.height() + self.tktext_label.configure(image=image, width=width, height=height) self.tktext_label.image = image def __del__(self): @@ -1454,7 +1455,7 @@ def CharWidthInPixels(): # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen*2 ) # set wrap to width of widget + tktext_label.configure(anchor=anchor, font=font) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: From 945625b388a0226e9c5f475c55ff82a4afd7560e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 14:35:33 -0400 Subject: [PATCH 180/521] More Wraplength changes for Text Elements Struggling to get wrapping to work --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index f2d112ffa..c3fb2e940 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1455,7 +1455,7 @@ def CharWidthInPixels(): # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font) # set wrap to width of widget + tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen+10) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: From 3f64564ad212e9408516b4f8b03c9e1db671b362 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 15:48:28 -0400 Subject: [PATCH 181/521] Fix for column crash due to keyboard feature, struggling with message box sizes and wrapping --- PySimpleGUI.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c3fb2e940..b9c9b24a7 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1351,9 +1351,12 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) - if form.ReturnKeyboardEvents and form.LastKeyboardEvent is not None: - button_pressed_text = form.LastKeyboardEvent - form.LastKeyboardEvent = None + # if this is a column, then will fail so need to wrap with tr + try: + if form.ReturnKeyboardEvents and form.LastKeyboardEvent is not None: + button_pressed_text = form.LastKeyboardEvent + form.LastKeyboardEvent = None + except: pass try: form.ReturnValuesDictionary.pop(None, None) # clean up dictionary include None was included @@ -1455,12 +1458,13 @@ def CharWidthInPixels(): # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen+10) # set wrap to width of widget + tktext_label.configure(anchor=anchor, font=font, wraplen=0) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) tktext_label.pack(side=tk.LEFT) + # print(f'Text element placed w = {width}, h = {height}, wrap = {wraplen}') # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: element.Location = (row_num, col_num) @@ -1921,7 +1925,7 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a max_line_total = max(max_line_total, width_used) # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines - form.AddRow(Text(message_wrapped, auto_size_text=True)) + form.AddRow(Text(message_wrapped, auto_size_text=True, size=(width_used, height))) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 @@ -2665,7 +2669,7 @@ def ObjToString(obj, extra=' '): def main(): with FlexForm('Demo form..') as form: form_rows = [[Text('You are running the PySimpleGUI.py file itself')], - [Text('You should be importing it rather than running it\n')], + [Text('You should be importing it rather than running it', size=(50,2))], [Text('Here is your sample input form....')], [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], From 6547a1b689ab2534ef0cc1ef1fe19101c5b3a9ed Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 17:01:30 -0400 Subject: [PATCH 182/521] Demo of PNG file viewer --- Demo_PNG_Viewer.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Demo_PNG_Viewer.py diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py new file mode 100644 index 000000000..463f3a8c9 --- /dev/null +++ b/Demo_PNG_Viewer.py @@ -0,0 +1,56 @@ +import PySimpleGUI as sg +import os + +# Simple Image Browser based on PySimpleGUI + +# sg.ChangeLookAndFeel('GreenTan') + +# Get the folder containing the images from the user +rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='A:/TEMP/PDFs') +if rc is False or folder is '': + sg.MsgBoxCancel('Cancelling') + exit(0) + +# get list of PNG files in folder +png_files = [folder + '\\' + f for f in os.listdir(folder) if '.png' in f] + +if len(png_files) == 0: + sg.MsgBox('No PNG images in folder') + exit(0) + +# create the form +form = sg.FlexForm('Image Browser', return_keyboard_events=True) + +# make these 2 elements outside the layout because want to "update" them later +image_elem = sg.Image(filename=png_files[0]) +text_elem = sg.Text(png_files[0], size=(80,3)) + +# define layout, show and read the form +layout = [[text_elem], + [image_elem], + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2))]] + +form.LayoutAndRead(layout) + +# loop reading the user input and display each image and the filename +i=0 +while True: + f = png_files[i] + # update window with new image + image_elem.Update(filename=f) + # update window with filename + text_elem.Update(f) + # read the form + button, values = form.Read() + + # perform button operations + if button is None: + break + elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34') and i < len(png_files): + i += 1 + elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33') and i > 0: + i -= 1 + # else: + # print(button) + + From b1829438a952e72f641e6e36f82eed0e1ebb5c83 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 17:14:58 -0400 Subject: [PATCH 183/521] Adjusted wraplength, Updated demo program that displays PNG files --- Demo_PNG_Viewer.py | 25 +++++++++++++------------ PySimpleGUI.py | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py index 463f3a8c9..4729d9c3c 100644 --- a/Demo_PNG_Viewer.py +++ b/Demo_PNG_Viewer.py @@ -3,8 +3,6 @@ # Simple Image Browser based on PySimpleGUI -# sg.ChangeLookAndFeel('GreenTan') - # Get the folder containing the images from the user rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='A:/TEMP/PDFs') if rc is False or folder is '': @@ -18,39 +16,42 @@ sg.MsgBox('No PNG images in folder') exit(0) -# create the form +# create the form that also returns keyboard events form = sg.FlexForm('Image Browser', return_keyboard_events=True) # make these 2 elements outside the layout because want to "update" them later +# initialize to the first PNG file in the list image_elem = sg.Image(filename=png_files[0]) -text_elem = sg.Text(png_files[0], size=(80,3)) +filename_display_elem = sg.Text(png_files[0], size=(80, 3)) +file_num_display_elem = sg.Text('File 1 of {}'.format(len(png_files)), size=(10,1)) # define layout, show and read the form -layout = [[text_elem], +layout = [[filename_display_elem], [image_elem], - [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2))]] + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2)), file_num_display_elem]] -form.LayoutAndRead(layout) +form.LayoutAndRead(layout) # Shows form on screen -# loop reading the user input and display each image and the filename +# loop reading the user input and displaying image, filename i=0 while True: f = png_files[i] # update window with new image image_elem.Update(filename=f) # update window with filename - text_elem.Update(f) + filename_display_elem.Update(f) + # update page display + file_num_display_elem.Update('File {} of {}'.format(i+1, len(png_files))) # read the form button, values = form.Read() - # perform button operations + # perform button and keyboard operations if button is None: break elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34') and i < len(png_files): i += 1 elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33') and i > 0: i -= 1 - # else: - # print(button) + diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b9c9b24a7..0233c23df 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1458,7 +1458,7 @@ def CharWidthInPixels(): # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font, wraplen=0) # set wrap to width of widget + tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen+40) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: From 8f4e0e182a7e70bc6fac42edceaa105b38c7a8be Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 22 Aug 2018 17:47:32 -0400 Subject: [PATCH 184/521] New GetScreenDimension method for FlexForms --- PySimpleGUI.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0233c23df..9fa1ca910 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1048,6 +1048,14 @@ def ReadNonBlocking(self, Message=''): _my_windows.Decrement() return BuildResults(self, False, self) + def GetScreenDimensions(self): + if self.TKrootDestroyed: + return None, None + screen_width = self.TKroot.winfo_screenwidth() # get window info to move to middle of screen + screen_height = self.TKroot.winfo_screenheight() + return screen_width, screen_height + + def KeyboardCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True From 9a8ece087e7761880a314c489e6d710a4b8b73d8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 23 Aug 2018 12:30:35 -0400 Subject: [PATCH 185/521] Support for Listbox.Update --- PySimpleGUI.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 9fa1ca910..51ac0bfc5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -290,7 +290,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex ''' self.Values = values - self.TKListBox = None + self.TKListbox = None if select_mode == LISTBOX_SELECT_MODE_BROWSE: self.SelectMode = SELECT_MODE_BROWSE elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: @@ -305,6 +305,12 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key) + def Update(self, values): + self.TKListbox.delete(0, 'end') + for item in values: + self.TKListbox.insert(tk.END, item) + self.TKListbox.selection_set(0, 0) + def __del__(self): try: self.TKListBox.__del__() From dcbbf319ebddd24e6bfd77b66b08697abb85467a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 23 Aug 2018 12:45:51 -0400 Subject: [PATCH 186/521] Update method for Text Element now includes colors --- PySimpleGUI.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 51ac0bfc5..78430d43c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -482,10 +482,15 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor) return - def Update(self, NewValue): - self.DisplayText=NewValue - stringvar = self.TKStringVar - stringvar.set(NewValue) + def Update(self, new_value = None, background_color=None, text_color=None): + if new_value is not None: + self.DisplayText=new_value + stringvar = self.TKStringVar + stringvar.set(new_value) + if background_color is not None: + self.TKText.configure(background=background_color) + if text_color is not None: + self.TKText.configure(fg=text_color) def __del__(self): super().__del__() @@ -1478,6 +1483,7 @@ def CharWidthInPixels(): if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) tktext_label.pack(side=tk.LEFT) + element.TKText = tktext_label # print(f'Text element placed w = {width}, h = {height}, wrap = {wraplen}') # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: From dad31df5479bace26a9e7198946f4eb52c0663d2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 23 Aug 2018 13:17:58 -0400 Subject: [PATCH 187/521] New simple persistent form. --- docs/cookbook.md | 53 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 61e581c04..256b2cbfc 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -57,7 +57,7 @@ Browse for a filename that is populated into the input field. import PySimpleGUI as sg - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + with sg.FlexForm('SHA-1 & 256 Hash') as form: form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] @@ -101,7 +101,7 @@ Example of nearly all of the widgets in a single form. Uses a customized color progress_meter_border_depth=0, scrollbar_color='#F7F3EC') - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: + with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], @@ -141,7 +141,7 @@ Example of nearly all of the widgets in a single form. Uses a customized color progress_meter_border_depth=0, scrollbar_color='#F7F3EC') - form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], @@ -175,7 +175,7 @@ An async form that has a button read loop. A Text Element is updated periodical import PySimpleGUI as sg import time - form = sg.FlexForm('Running Timer', auto_size_text=True) + form = sg.FlexForm('Running Timer') # create a text element that will be updated periodically text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') @@ -210,7 +210,7 @@ Like the previous recipe, this form is an async form. The difference is that th import PySimpleGUI as sg import time - with sg.FlexForm('Running Timer', auto_size_text=True) as form: + with sg.FlexForm('Running Timer') as form: text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') layout = [[sg.Text('Non blocking GUI with updates', justification='center')], [text_element], @@ -249,7 +249,7 @@ The architecture of some programs works better with button callbacks instead of # Create a standard form form = sg.FlexForm('Button callback example') # Layout the design of the GUI - layout = [[sg.Text('Please click a button', auto_size_text=True)], + layout = [[sg.Text('Please click a button')], [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] # Show the form to the user form.Layout(layout) @@ -593,3 +593,44 @@ To make it easier to see the Column in the window, the Column background has bee button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) sg.MsgBox(button, values, line_width=200) + + +## Persistent Form With Text Element Updates + +This simple program keep a form open, taking input values until the user terminates the program using the "X" button. + +![math game](https://user-images.githubusercontent.com/13696193/44537842-c9444080-a6cd-11e8-94bc-6cdf1b765dd8.jpg) + + + + import PySimpleGUI as sg + + form = sg.FlexForm('Math') + + output = sg.Txt('', size=(8,1)) + + layout = [ [sg.Txt('Enter values to calculate')], + [sg.In(size=(8,1), key='numerator')], + [sg.Txt('_' * 10)], + [sg.In(size=(8,1), key='denominator')], + [output], + [sg.ReadFormButton('Calculate', bind_return_key=True)]] + + form.Layout(layout) + + while True: + button, values = form.Read() + + if button is not None: + try: + numerator = float(values['numerator']) + denominator = float(values['denominator']) + calc = numerator / denominator + except: + calc = 'Invalid' + + output.Update(calc) + else: + break + + From a57fc797063b74327b34d3656da017150db451c4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 23 Aug 2018 13:50:20 -0400 Subject: [PATCH 188/521] Update method for Buttons --- PySimpleGUI.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 78430d43c..1b34a341d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -715,6 +715,9 @@ def ButtonCallBack(self): self.ParentForm.TKroot.quit() # kick the users out of the mainloop return + def Update(self, new_text): + self.TKButton.configure(text=new_text) + def __del__(self): try: self.TKButton.__del__() From fcdd58ae8366b5626f09db568350ca79613d113f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 23 Aug 2018 14:10:58 -0400 Subject: [PATCH 189/521] Protection around update in case form was manually closed --- PySimpleGUI.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1b34a341d..0813e8cec 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -716,7 +716,10 @@ def ButtonCallBack(self): return def Update(self, new_text): - self.TKButton.configure(text=new_text) + try: + self.TKButton.configure(text=new_text) + except: + return def __del__(self): try: @@ -1060,6 +1063,7 @@ def ReadNonBlocking(self, Message=''): except: self.TKrootDestroyed = True _my_windows.Decrement() + # return None, None return BuildResults(self, False, self) def GetScreenDimensions(self): From cc96d52ae4d364df9749843f791a00e32fe337dc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 23 Aug 2018 14:17:46 -0400 Subject: [PATCH 190/521] Added ability to change button colors using Update method --- PySimpleGUI.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0813e8cec..0df8a727c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -715,9 +715,11 @@ def ButtonCallBack(self): self.ParentForm.TKroot.quit() # kick the users out of the mainloop return - def Update(self, new_text): + def Update(self, new_text, button_color=(None, None)): try: self.TKButton.configure(text=new_text) + if button_color != (None, None): + self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: return @@ -1043,8 +1045,6 @@ def Read(self): if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.Decrement() - # if self.ReturnValues[0] is not None: # keyboard events build their own return values - # return self.ReturnValues if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: return BuildResults(self, False, self) else: From a2e8b0fad3ec42af7452ad4b770027ed71508460 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 07:45:31 -0400 Subject: [PATCH 191/521] Added Slider Update method, reworking of how Text Elements wrap (risky change), rework how MsgBox wraps Some risky changes to how text wraps, but hopefully these will fix problems of forms being way too wide. Also added Update to Slider Element. This allows it to be used for things like tracking progress in a song being played. --- PySimpleGUI.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0df8a727c..985bf2441 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -840,6 +840,9 @@ def __init__(self, range=(None,None), default_value=None, orientation=None, bord super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key) return + def Update(self, value): + self.TKIntVar.set(value) + def __del__(self): super().__del__() @@ -1481,17 +1484,18 @@ def CharWidthInPixels(): justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) - # tktext_label = tk.Label(tk_row_frame,anchor=tk.NW, text=display_text, width=width, height=height, justify=tk.LEFT, bd=border_depth) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS - wraplen = tktext_label.winfo_reqwidth() # width of widget in Pixels - tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen+40) # set wrap to width of widget + wraplen = tktext_label.winfo_reqwidth()+40 # width of widget in Pixels + if not auto_size_text: + wraplen = 0 + # print("wraplen, width, height", wraplen, width, height) + tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) tktext_label.pack(side=tk.LEFT) element.TKText = tktext_label - # print(f'Text element placed w = {width}, h = {height}, wrap = {wraplen}') # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: element.Location = (row_num, col_num) @@ -1952,7 +1956,8 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a max_line_total = max(max_line_total, width_used) # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines - form.AddRow(Text(message_wrapped, auto_size_text=True, size=(width_used, height))) + # print('Msgbox width, height', width_used, height) + form.AddRow(Text(message_wrapped, auto_size_text=True)) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 From 53e0c25a0227c7e4a5ffdb99ab1a89e5b404b0bb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 07:57:22 -0400 Subject: [PATCH 192/521] Chaned how wrapping in Text Elements work, changed MsgBox to use new wrapping More risky Text Element changes --- PySimpleGUI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 985bf2441..0fc5f76a4 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1473,7 +1473,7 @@ def CharWidthInPixels(): stringvar = tk.StringVar() element.TKStringVar = stringvar stringvar.set(display_text) - if auto_size_text: + if element.AutoSizeText: width = 0 if element.Justification is not None: justification = element.Justification @@ -1957,7 +1957,7 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines # print('Msgbox width, height', width_used, height) - form.AddRow(Text(message_wrapped, auto_size_text=True)) + form.AddRow(Text(message_wrapped, auto_size_text=True, size=(width_used, height))) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 From 2e3c401e872576a40bf1edc8fa31b5af0ea87482 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 08:03:56 -0400 Subject: [PATCH 193/521] NEW Demo - MIDI player using Mido --- Demo_MIDI_Player.py | 228 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 Demo_MIDI_Player.py diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py new file mode 100644 index 000000000..3da9b17df --- /dev/null +++ b/Demo_MIDI_Player.py @@ -0,0 +1,228 @@ +import os +import PySimpleGUI as g +import mido +import time + +PLAYER_COMMAND_NONE = 0 +PLAYER_COMMAND_EXIT = 1 +PLAYER_COMMAND_PAUSE = 2 +PLAYER_COMMAND_NEXT = 3 +PLAYER_COMMAND_RESTART_SONG = 4 + +# ---------------------------------------------------------------------- # +# PlayerGUI CLASS # +# ---------------------------------------------------------------------- # +class PlayerGUI(): + ''' + Class implementing GUI for both initial screen but the player itself + ''' + + def __init__(self): + self.Form = None + self.TextElem = None + self.PortList = mido.get_output_names() # use to get the list of midi ports + self.PortList = self.PortList[::-1] # reverse the list so the last one is first + + # ---------------------------------------------------------------------- # + # PlayerChooseSongGUI # + # Show a GUI get to the file to playback # + # ---------------------------------------------------------------------- # + def PlayerChooseSongGUI(self): + + # ---------------------- DEFINION OF CHOOSE WHAT TO PLAY GUI ---------------------------- + with g.FlexForm('MIDI File Player', auto_size_text=False, + default_element_size=(30, 1), + font=("Helvetica", 12)) as form: + layout = [[g.Text('MIDI File Player', font=("Helvetica", 15), size=(20, 1), text_color='green')], + [g.Text('File Selection', font=("Helvetica", 15), size=(20, 1))], + [g.Text('Single File Playback', justification='right'), g.InputText(size=(65, 1), key='midifile'), g.FileBrowse(size=(10, 1), file_types=(("MIDI files", "*.mid"),))], + [g.Text('Or Batch Play From This Folder', auto_size_text=False, justification='right'), g.InputText(size=(65, 1), key='folder'), g.FolderBrowse(size=(10, 1))], + [g.Text('_' * 250, auto_size_text=False, size=(100, 1))], + [g.Text('Choose MIDI Output Device', size=(22, 1)), + g.Listbox(values=self.PortList, size=(30, len(self.PortList) + 1), key='device')], + [g.Text('_' * 250, auto_size_text=False, size=(100, 1))], + [g.SimpleButton('PLAY!', size=(10, 2), button_color=('red', 'white'), font=("Helvetica", 15), bind_return_key=True), g.Text(' ' * 2, size=(4, 1)), g.Cancel(size=(8, 2), font=("Helvetica", 15))]] + + + self.Form = form + return form.LayoutAndRead(layout) + + + def PlayerPlaybackGUIStart(self, NumFiles=1): + # ------- Make a new FlexForm ------- # + + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + self.TextElem = g.T('Song loading....', size=(85, 5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) + form = g.FlexForm('MIDI File Player', default_element_size=(30, 1),font=("Helvetica", 25)) + layout = [ + [g.T('MIDI File Player', size=(30, 1), font=("Helvetica", 25))], + [self.TextElem], + [g.ReadFormButton('PAUSE', button_color=g.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0, + font=("Helvetica", 15), size=(10, 2)), g.T(' ' * 3), + g.ReadFormButton('NEXT', button_color=g.TRANSPARENT_BUTTON, + image_filename=image_next, image_size=(50,50),image_subsample=2, border_width=0, + size=(10, 2), font=("Helvetica", 15)), g.T(' ' * 3), + g.ReadFormButton('Restart Song', button_color=g.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50,50), image_subsample=2,border_width=0, + size=(10, 2), font=("Helvetica", 15)), g.T(' ' * 3), + g.T(' '*2), g.SimpleButton('EXIT', button_color=g.TRANSPARENT_BUTTON, + image_filename=image_exit, image_size=(50,50), image_subsample=2,border_width=0, + size=(10, 2), font=("Helvetica", 15))] + ] + + form.LayoutAndRead(layout, non_blocking=True) + self.Form = form + + + + # ------------------------------------------------------------------------- # + # PlayerPlaybackGUIUpdate # + # Refresh the GUI for the main playback interface (must call periodically # + # ------------------------------------------------------------------------- # + def PlayerPlaybackGUIUpdate(self, DisplayString): + form = self.Form + if 'form' not in locals() or form is None: # if the form has been destoyed don't mess with it + return PLAYER_COMMAND_EXIT + self.TextElem.Update(DisplayString) + button, (values) = form.ReadNonBlocking() + if values is None: + return PLAYER_COMMAND_EXIT + if button == 'PAUSE': + return PLAYER_COMMAND_PAUSE + elif button == 'EXIT': + return PLAYER_COMMAND_EXIT + elif button == 'NEXT': + return PLAYER_COMMAND_NEXT + elif button == 'Restart Song': + return PLAYER_COMMAND_RESTART_SONG + return PLAYER_COMMAND_NONE + + +# ---------------------------------------------------------------------- # +# MAIN - our main program... this is it # +# Runs the GUI to get the file / path to play # +# Decodes the MIDI-Video into a MID file # +# Plays the decoded MIDI file # +# ---------------------------------------------------------------------- # +def main(): + def GetCurrentTime(): + ''' + Get the current system time in milliseconds + :return: milliseconds + ''' + return int(round(time.time() * 1000)) + + g.SetOptions(border_width=1, element_padding=(4, 6), font=("Helvetica", 10), button_color=('white', g.BLUES[0]), + progress_meter_border_depth=1, slider_border_width=1) + pback = PlayerGUI() + + button, values = pback.PlayerChooseSongGUI() + if button != 'PLAY!': + g.MsgBoxCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) + exit(69) + if values['device'] is not None: + midi_port = values['device'][0] + else: + g.MsgBoxCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) + + batch_folder = values['folder'] + midi_filename = values['midifile'] + # ------ Build list of files to play --------------------------------------------------------- # + if batch_folder: + filelist = os.listdir(batch_folder) + filelist = [batch_folder+'/'+f for f in filelist if f.endswith(('.mid', '.MID'))] + filetitles = [os.path.basename(f) for f in filelist] + elif midi_filename: # an individual filename + filelist = [midi_filename,] + filetitles = [os.path.basename(midi_filename),] + else: + g.MsgBoxError('*** Error - No MIDI files specified ***') + exit(666) + + # ------ LOOP THROUGH MULTIPLE FILES --------------------------------------------------------- # + pback.PlayerPlaybackGUIStart(NumFiles=len(filelist) if len(filelist) <=10 else 10) + port = None + # Loop through the files in the filelist + for now_playing_number, current_midi_filename in enumerate(filelist): + display_string = 'Playing Local File...\n{} of {}\n{}'.format(now_playing_number+1, len(filelist), current_midi_filename) + midi_title = filetitles[now_playing_number] + # --------------------------------- REFRESH THE GUI ----------------------------------------- # + pback.PlayerPlaybackGUIUpdate(display_string) + + # ---===--- Output Filename is .MID --- # + midi_filename = current_midi_filename + + # --------------------------------- MIDI - STARTS HERE ----------------------------------------- # + if not port: # if the midi output port not opened yet, then open it + port = mido.open_output(midi_port if midi_port else None) + + try: + mid = mido.MidiFile(filename=midi_filename) + except: + print('****** Exception trying to play MidiFile filename = {}***************'.format(midi_filename)) + g.MsgBoxError('Exception trying to play MIDI file:', midi_filename, 'Skipping file') + continue + + # Build list of data contained in MIDI File using only track 0 + midi_length_in_seconds = mid.length + display_file_list = '>> ' + '\n'.join([f for i, f in enumerate(filelist[now_playing_number:]) if i < 10]) + paused = cancelled = next_file = False + ######################### Loop through MIDI Messages ########################### + while(True): + start_playback_time = GetCurrentTime() + port.reset() + + for midi_msg_number, msg in enumerate(mid.play()): + #################### GUI - read values ################## + if not midi_msg_number % 4: # update the GUI every 4 MIDI messages + t = (GetCurrentTime() - start_playback_time)//1000 + display_midi_len = '{:02d}:{:02d}'.format(*divmod(int(midi_length_in_seconds),60)) + display_string = 'Now Playing {} of {}\n{}\n {:02d}:{:02d} of {}\nPlaylist:'.\ + format(now_playing_number+1, len(filelist), midi_title, *divmod(t, 60), display_midi_len) + # display list of next 10 files to be played. + rc = pback.PlayerPlaybackGUIUpdate(display_string + '\n' + display_file_list) + else: # fake rest of code as if GUI did nothing + rc = PLAYER_COMMAND_NONE + if paused: + rc = PLAYER_COMMAND_NONE + while rc == PLAYER_COMMAND_NONE: # TIGHT-ASS loop waiting on a GUI command + rc = pback.PlayerPlaybackGUIUpdate(display_string) + time.sleep(.25) + + ####################################### MIDI send data ################################## + port.send(msg) + + # ------- Execute GUI Commands after sending MIDI data ------- # + if rc == PLAYER_COMMAND_EXIT: + cancelled = True + break + elif rc == PLAYER_COMMAND_PAUSE: + paused = not paused + port.reset() + elif rc == PLAYER_COMMAND_NEXT: + next_file = True + break + elif rc == PLAYER_COMMAND_RESTART_SONG: + break + + if cancelled or next_file: + break + #------- DONE playing the song ------- # + port.reset() # reset the midi port when done with the song + + if cancelled: + break + exit(69) + +# ---------------------------------------------------------------------- # +# LAUNCH POINT -- program starts and ends here # +# ---------------------------------------------------------------------- # +if __name__ == '__main__': + main() + + exit(69) From 60a6c07b7aac5bca9932a3b8f2d31cfe019987c0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 08:36:45 -0400 Subject: [PATCH 194/521] Cleanup code --- Demo_MIDI_Player.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py index 3da9b17df..3e0e81b5b 100644 --- a/Demo_MIDI_Player.py +++ b/Demo_MIDI_Player.py @@ -56,23 +56,19 @@ def PlayerPlaybackGUIStart(self, NumFiles=1): image_next = './ButtonGraphics/Next.png' image_exit = './ButtonGraphics/Exit.png' - self.TextElem = g.T('Song loading....', size=(85, 5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) - form = g.FlexForm('MIDI File Player', default_element_size=(30, 1),font=("Helvetica", 25)) + self.TextElem = g.T('Song loading....', size=(85,5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) + form = g.FlexForm('MIDI File Player', default_element_size=(30,1),font=("Helvetica", 25)) layout = [ - [g.T('MIDI File Player', size=(30, 1), font=("Helvetica", 25))], + [g.T('MIDI File Player', size=(30,1), font=("Helvetica", 25))], [self.TextElem], [g.ReadFormButton('PAUSE', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0, - font=("Helvetica", 15), size=(10, 2)), g.T(' ' * 3), + image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '), g.ReadFormButton('NEXT', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_next, image_size=(50,50),image_subsample=2, border_width=0, - size=(10, 2), font=("Helvetica", 15)), g.T(' ' * 3), + image_filename=image_next, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '), g.ReadFormButton('Restart Song', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50,50), image_subsample=2,border_width=0, - size=(10, 2), font=("Helvetica", 15)), g.T(' ' * 3), - g.T(' '*2), g.SimpleButton('EXIT', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_exit, image_size=(50,50), image_subsample=2,border_width=0, - size=(10, 2), font=("Helvetica", 15))] + image_filename=image_restart, image_size=(50,50), image_subsample=2, border_width=0), g.T(' '), + g.SimpleButton('EXIT', button_color=g.TRANSPARENT_BUTTON, + image_filename=image_exit, image_size=(50,50), image_subsample=2, border_width=0,)] ] form.LayoutAndRead(layout, non_blocking=True) @@ -117,15 +113,13 @@ def GetCurrentTime(): ''' return int(round(time.time() * 1000)) - g.SetOptions(border_width=1, element_padding=(4, 6), font=("Helvetica", 10), button_color=('white', g.BLUES[0]), - progress_meter_border_depth=1, slider_border_width=1) pback = PlayerGUI() button, values = pback.PlayerChooseSongGUI() if button != 'PLAY!': g.MsgBoxCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) exit(69) - if values['device'] is not None: + if values['device']: midi_port = values['device'][0] else: g.MsgBoxCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) From 21dc55d1d79ec711f369b63526e59c3b7f39c340 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 12:19:05 -0400 Subject: [PATCH 195/521] Chatterbot GUI Front End - Machine Learning Initial checkin of a GUI front-end to the Chatterbot Machine Learning software package. Uses graphical progress meters to show training progress Provides a "chat-window" style interface for conversing --- Demo_Chatterbot.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Demo_Chatterbot.py diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py new file mode 100644 index 000000000..a0e69844f --- /dev/null +++ b/Demo_Chatterbot.py @@ -0,0 +1,38 @@ +import PySimpleGUI as gui +from chatterbot import ChatBot +import chatterbot.utils + +''' +Demo_Chatterbot.py +A GUI wrapped arouind the Chatterbot package. +The GUI is used to show progress bars during the training process and +to collect user input that is sent to the chatbot. The reply is displayed in the GUI window +''' + +# redefine the chatbot text based progress bar with a graphical one +def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20): + gui.EasyProgressMeter(description, iteration_counter, total_items) + +chatterbot.utils.print_progress_bar = print_progress_bar + +chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTrainer') + +# Train based on the english corpus +chatbot.train("chatterbot.corpus.english") + +################# GUI ################# +with gui.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [ [gui.Output(size=(80, 20))], + [gui.Multiline(size=(70, 5), enter_submits=True), + gui.ReadFormButton('SEND', bind_return_key=True), gui.SimpleButton('EXIT')]] + + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, (value,) = form.Read() + if button != 'SEND': + break + print(value.rstrip()) + # send the user input to chatbot to get a response + response = chatbot.get_response(value.rstrip()) + print(response) \ No newline at end of file From 595b3c09938752d82c97e64abdba47dc419315cd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 12:20:01 -0400 Subject: [PATCH 196/521] Chatterbot front-end. Machine Learning --- Demo_Chatterbot.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Demo_Chatterbot.py diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py new file mode 100644 index 000000000..a0e69844f --- /dev/null +++ b/Demo_Chatterbot.py @@ -0,0 +1,38 @@ +import PySimpleGUI as gui +from chatterbot import ChatBot +import chatterbot.utils + +''' +Demo_Chatterbot.py +A GUI wrapped arouind the Chatterbot package. +The GUI is used to show progress bars during the training process and +to collect user input that is sent to the chatbot. The reply is displayed in the GUI window +''' + +# redefine the chatbot text based progress bar with a graphical one +def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20): + gui.EasyProgressMeter(description, iteration_counter, total_items) + +chatterbot.utils.print_progress_bar = print_progress_bar + +chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTrainer') + +# Train based on the english corpus +chatbot.train("chatterbot.corpus.english") + +################# GUI ################# +with gui.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [ [gui.Output(size=(80, 20))], + [gui.Multiline(size=(70, 5), enter_submits=True), + gui.ReadFormButton('SEND', bind_return_key=True), gui.SimpleButton('EXIT')]] + + form.Layout(layout) + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, (value,) = form.Read() + if button != 'SEND': + break + print(value.rstrip()) + # send the user input to chatbot to get a response + response = chatbot.get_response(value.rstrip()) + print(response) \ No newline at end of file From 17d87870e7960d02f3c845125cf9b286d5da2101 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 21:23:57 -0400 Subject: [PATCH 197/521] "Dashboard" design for progress meters. Dashboard type of design that includes 20 Progress Meters. Able to see the progess meters after they have competed. --- Demo_Chatterbot.py | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index a0e69844f..15cfa808d 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -1,4 +1,4 @@ -import PySimpleGUI as gui +import PySimpleGUI as g from chatterbot import ChatBot import chatterbot.utils @@ -9,10 +9,34 @@ to collect user input that is sent to the chatbot. The reply is displayed in the GUI window ''' -# redefine the chatbot text based progress bar with a graphical one +# Create the 'Trainer GUI' +MAX_PROG_BARS = 20 +bars = [] +texts = [] +training_layout = [[g.T('TRAINING PROGRESS', size=(20,1), font=('Helvetica', 17))]] +for i in range(MAX_PROG_BARS): + bars.append(g.ProgressBar(100, size=(30, 5))) + texts.append(g.T(' '*20)) + training_layout += [[texts[i], bars[i]]] + +training_form = g.FlexForm('Training') +training_form.Layout(training_layout) +current_bar = 0 + +# callback function for training runs def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20): - gui.EasyProgressMeter(description, iteration_counter, total_items) + global current_bar + global bars + global texts + global training_form + # update the form and the bars + training_form.ReadNonBlocking() + bars[current_bar].UpdateBar(iteration_counter, max=total_items) + texts[current_bar].Update(description) + if iteration_counter == total_items: + current_bar += 1 +# redefine the chatbot text based progress bar with a graphical one chatterbot.utils.print_progress_bar = print_progress_bar chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTrainer') @@ -21,10 +45,10 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar chatbot.train("chatterbot.corpus.english") ################# GUI ################# -with gui.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [ [gui.Output(size=(80, 20))], - [gui.Multiline(size=(70, 5), enter_submits=True), - gui.ReadFormButton('SEND', bind_return_key=True), gui.SimpleButton('EXIT')]] +with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[g.Output(size=(80, 20))], + [g.Multiline(size=(70, 5), enter_submits=True), + g.ReadFormButton('SEND', bind_return_key=True), g.SimpleButton('EXIT')]] form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # From 4a0d7b815ddb82c8de78258f0d54b7326b765229 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 22:44:52 -0400 Subject: [PATCH 198/521] Correct exiting from application is user closes windows --- Demo_Chatterbot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index 15cfa808d..6697335ba 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -30,8 +30,11 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar global texts global training_form # update the form and the bars - training_form.ReadNonBlocking() - bars[current_bar].UpdateBar(iteration_counter, max=total_items) + button, values = training_form.ReadNonBlocking() + if button is None and values is None: + exit(69) + if bars[current_bar].UpdateBar(iteration_counter, max=total_items) is False: + exit(69) texts[current_bar].Update(description) if iteration_counter == total_items: current_bar += 1 From 4119ea8b5cfb2a077681b0998b8242fef7a5a0d8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 22:47:21 -0400 Subject: [PATCH 199/521] Slider - range can be changed using Update, Progress Bars - Max value c an be changed on the fly when calling UpdateBar. Fixed bug when multiple bars on one form --- PySimpleGUI.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0fc5f76a4..0bc75dc52 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -512,24 +512,21 @@ def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], st if orientation[0].lower() == 'h': s = ttk.Style() s.theme_use(style) - s.configure("my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) - self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style='my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate') - # self.TKCanvas = tk.Canvas(root, width=length, height=width, highlightt=highlightt, relief=relief, borderwidth=border_width) - # self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(length * 1.5), width * 1.5, fill=BarColor[0], tags='bar') - # self.canvas.pack(padx='10') + s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate') else: - # s = ttk.Style() - # s.theme_use('clam') - # s.configure('Vertical.mycolor.progbar', forground=BarColor[0], background=BarColor[1]) s = ttk.Style() s.theme_use(style) - s.configure("my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) - self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style='my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate') - # self.TKCanvas = tk.Canvas(root, width=width, height=length, highlightt=highlightt, relief=relief, borderwidth=border_width) - # self.TKRect = self.TKCanvas.create_rectangle(width * 1.5, 2 * length + 40, 0, length * .5, fill=BarColor[0], tags='bar') - # self.canvas.pack() + s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate') - def Update(self, count): + def Update(self, count, max=None): + if max is not None: + self.Max = max + try: + self.TKProgressBarForReal.config(maximum=max) + except: + return False if count > self.Max: return False try: self.TKProgressBarForReal['value'] = count @@ -757,13 +754,13 @@ def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False - super().__init__(ELEM_TYPE_PROGRESS_BAR, scale, size, auto_size_text) + super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text) return - def UpdateBar(self, current_count): + def UpdateBar(self, current_count, max=None): if self.ParentForm.TKrootDestroyed: return False - self.TKProgressBar.Update(current_count) + self.TKProgressBar.Update(current_count, max=max) try: self.ParentForm.TKroot.update() except: @@ -840,8 +837,11 @@ def __init__(self, range=(None,None), default_value=None, orientation=None, bord super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key) return - def Update(self, value): + def Update(self, value, range=(None, None)): self.TKIntVar.set(value) + if range != (None, None): + self.TKScale.config(from_ = range[0], to_ = range[1]) + def __del__(self): super().__del__() @@ -1749,6 +1749,7 @@ def CharWidthInPixels(): if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: tkscale.configure(fg=text_color) tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + element.TKScale = tkscale #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) From 60034cd168c575ddb1fcf779e38c269ce14b085c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 23:32:12 -0400 Subject: [PATCH 200/521] Progress bar - decrement num windows if update fails (RISKY CHANGE) More battling over the number of open windows. Hopefully won't cause lots of problems! --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0bc75dc52..ba25b2714 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -764,7 +764,7 @@ def UpdateBar(self, current_count, max=None): try: self.ParentForm.TKroot.update() except: - # _my_windows.Decrement() + _my_windows.Decrement() return False return True From 8bf744689faf877f0170e4b6901d84b4d592914b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 24 Aug 2018 23:40:14 -0400 Subject: [PATCH 201/521] Replace MAster with Dev version.... multiple progress bars --- Demo_Chatterbot.py | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index a0e69844f..6697335ba 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -1,4 +1,4 @@ -import PySimpleGUI as gui +import PySimpleGUI as g from chatterbot import ChatBot import chatterbot.utils @@ -9,10 +9,37 @@ to collect user input that is sent to the chatbot. The reply is displayed in the GUI window ''' -# redefine the chatbot text based progress bar with a graphical one +# Create the 'Trainer GUI' +MAX_PROG_BARS = 20 +bars = [] +texts = [] +training_layout = [[g.T('TRAINING PROGRESS', size=(20,1), font=('Helvetica', 17))]] +for i in range(MAX_PROG_BARS): + bars.append(g.ProgressBar(100, size=(30, 5))) + texts.append(g.T(' '*20)) + training_layout += [[texts[i], bars[i]]] + +training_form = g.FlexForm('Training') +training_form.Layout(training_layout) +current_bar = 0 + +# callback function for training runs def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20): - gui.EasyProgressMeter(description, iteration_counter, total_items) + global current_bar + global bars + global texts + global training_form + # update the form and the bars + button, values = training_form.ReadNonBlocking() + if button is None and values is None: + exit(69) + if bars[current_bar].UpdateBar(iteration_counter, max=total_items) is False: + exit(69) + texts[current_bar].Update(description) + if iteration_counter == total_items: + current_bar += 1 +# redefine the chatbot text based progress bar with a graphical one chatterbot.utils.print_progress_bar = print_progress_bar chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTrainer') @@ -21,10 +48,10 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar chatbot.train("chatterbot.corpus.english") ################# GUI ################# -with gui.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [ [gui.Output(size=(80, 20))], - [gui.Multiline(size=(70, 5), enter_submits=True), - gui.ReadFormButton('SEND', bind_return_key=True), gui.SimpleButton('EXIT')]] +with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[g.Output(size=(80, 20))], + [g.Multiline(size=(70, 5), enter_submits=True), + g.ReadFormButton('SEND', bind_return_key=True), g.SimpleButton('EXIT')]] form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # From d4f09d367d7867605cc3a070215df2aa20d6bb40 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 25 Aug 2018 20:48:06 -0400 Subject: [PATCH 202/521] Release 2.10 --- docs/index.md | 127 +++++++++++++++++++++++++++++++++++++++++--------- readme.md | 127 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 212 insertions(+), 42 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2efe1958f..5745ef057 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,7 +10,8 @@ # PySimpleGUI - (Ver 2.9) + (Ver 2.10) + ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) Lots of documentation available in addition to this Readme File. [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) @@ -114,6 +115,9 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Set focus Bind return key to buttons Group widgets into a column and place into form anywhere + Keyboard low-level key capture + Mouse scroll-wheel support + Update elements in a visible form An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -824,7 +828,7 @@ A summary of the variables that can be changed when a FlexForm is created ## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. +"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. Text Single Line Input @@ -890,16 +894,19 @@ The default font setting is ("Helvetica", 10) -**Color** in PySimpleGUI are always in this format: +**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. (foreground, background) -The values foreground and background can be the color names or the hex value formatted as a string: + Individual colors are specified using either the color names as defined in tkinter or an RGB string of this format: "#RRGGBB" **auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. +A `True` value for `auto_size_text`, when placed on Text Elements, indicates that the width of the Element should be shrunk do the width of the text. The default setting is True. + + - [ ] List item + **Shorthand functions** The shorthand functions for `Text` are `Txt` and `T` @@ -950,7 +957,13 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. scale=(None, None), size=(None, None), auto_size_text=None, - password_char='') + password_char='', + background_color=None, + text_color=None, + do_not_clear=False, + key=None, + focus=False + ) . default_text - Text initially shown in the input box @@ -958,6 +971,17 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. size - (width, height) of element in characters auto_size_text- Bool. True is element should be sized to fit text password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + background_color - color to use for the input field background + text_color - color to use for the typed text + do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. + key = Dictionary key to use for return values + focus = Bool. True if this field should capture the focus (moves cursor to this field) + + There are two methods that can be called: + + InputText.Update(new_Value) - sets the input value + Input.Text(Get() - returns the current value of the field. + Shorthand functions that are equivalent to `InputText` are `Input` and `In` @@ -972,13 +996,20 @@ Also known as a drop-down list. Only required parameter is the list of choices. InputCombo(values, scale=(None, None), size=(None, None), - auto_size_text=None) + auto_size_text=None, + background_color = None, + text_color = None, + key = None) . values - Choices to be displayed. List of strings scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length + background_color - color to use for the input field background + text_color - color to use for the typed text + key = Dictionary key to use for return values + #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). @@ -993,7 +1024,10 @@ The standard listbox like you'll find in most GUIs. Note that the return values scale=(None, None), size=(None, None), auto_size_text=None, - font=None) + font=None, + background_color = None, + text_color = None, + key = None) . values - Choices to be displayed. List of strings @@ -1012,6 +1046,9 @@ The standard listbox like you'll find in most GUIs. Note that the return values scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length + background_color - color to use for the input field background + text_color - color to use for the typed text + key = Dictionary key to use for return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. @@ -1029,7 +1066,10 @@ Sliders have a couple of slider-specific settings as well as appearance settings relief=None, scale=(None, None), size=(None, None), - font=None): + font=None, + background_color = None, + text_color = None, + key = None) ): . range - (min, max) slider's range @@ -1046,6 +1086,9 @@ Sliders have a couple of slider-specific settings as well as appearance settings scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text + background_color - color to use for the input field background + text_color - color to use for the typed text + key = Dictionary key to use for return values #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. @@ -1060,7 +1103,10 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o scale=(None, None), size=(None, None), auto_size_text=None, - font=None) + font=None, + background_color = None, + text_color = None, + key = None) . @@ -1071,6 +1117,9 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o size- (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display + background_color - color to use for the background + text_color - color to use for the text + key = Dictionary key to use for return values #### Checkbox Element @@ -1086,7 +1135,10 @@ Checkbox elements are like Radio Button elements. They return a bool indicating scale=(None, None), size=(None, None), auto_size_text=None, - font=None): + font=None, + background_color = None, + text_color = None, + key = None): . text - Text to display next to checkbox @@ -1095,6 +1147,9 @@ Checkbox elements are like Radio Button elements. They return a bool indicating size - (width, height) size of element in characters auto_size_text- Bool. True if should size width to fit text font- Font type and size for text display + background_color - color to use for the background + text_color - color to use for the typed text + key = Dictionary key to use for return values #### Spin Element @@ -1109,7 +1164,10 @@ An up/down spinner control. The valid values are passed in as a list. scale=(None, None), size=(None, None), auto_size_text=None, - font=None) + font=None, + background_color = None, + text_color = None, + key = None): . values - List of valid values @@ -1118,6 +1176,9 @@ An up/down spinner control. The valid values are passed in as a list. size - (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display + background_color - color to use for the background + text_color - color to use for the typed text + key = Dictionary key to use for return values #### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. @@ -1143,11 +1204,17 @@ Realtime - This is another async form button. Normal button clicks occur after While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` SimpleButton(text, + image_filename=None, + image_size=(None, None), + image_subsample=None, + border_width=None, + bind_return_key=False, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, - font=None) + font=None, + focus=False) These Pre-made buttons are some of the most important elements of all because they are used so much. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. (hmmm Save already comes to mind). They include: @@ -1157,14 +1224,19 @@ These Pre-made buttons are some of the most important elements of all because th Cancel Yes No + Exit + Quit + Save + SaveAs FileBrowse + FileSaveAs FolderBrowse . layout = [[sg.OK(), sg.Cancel()]] ![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The FileBrowse, FolderBrowse, FileSaveAs buttons all fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. @@ -1189,7 +1261,7 @@ layout = [[sg.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -1255,7 +1327,7 @@ Somewhere later in your code will be your main event loop. This is where you do This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is +The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) @@ -1264,7 +1336,10 @@ This code produces a form where the Browse button only shows files of type .TXT layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. + +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. --- #### ProgressBar @@ -1507,6 +1582,14 @@ These settings apply to all forms `SetOptions`. The Row options and Element opt Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). +## Persistent Forms (Window stays open after button click) + +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The SimpleButton Element also closes the form. + +The `ReadFormButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. + + + ## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. @@ -1530,9 +1613,11 @@ The basic flow and functions you will be calling are: Setup - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + Periodic refresh @@ -1700,7 +1785,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults - +| 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) diff --git a/readme.md b/readme.md index 2efe1958f..5745ef057 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,8 @@ # PySimpleGUI - (Ver 2.9) + (Ver 2.10) + ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) Lots of documentation available in addition to this Readme File. [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) @@ -114,6 +115,9 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Set focus Bind return key to buttons Group widgets into a column and place into form anywhere + Keyboard low-level key capture + Mouse scroll-wheel support + Update elements in a visible form An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -824,7 +828,7 @@ A summary of the variables that can be changed when a FlexForm is created ## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term Widget to describe these graphic elements. +"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. Text Single Line Input @@ -890,16 +894,19 @@ The default font setting is ("Helvetica", 10) -**Color** in PySimpleGUI are always in this format: +**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. (foreground, background) -The values foreground and background can be the color names or the hex value formatted as a string: + Individual colors are specified using either the color names as defined in tkinter or an RGB string of this format: "#RRGGBB" **auto_size_text** -A `True` value for `auto_size_text`, when placed on any Element, indicates that the width of the Element should be shrunk do the width of the text. This is particularly useful with `Buttons` as fixed-width buttons are somewhat crude looking. The default value is `False`. You will often see this setting on FlexForm definitions. +A `True` value for `auto_size_text`, when placed on Text Elements, indicates that the width of the Element should be shrunk do the width of the text. The default setting is True. + + - [ ] List item + **Shorthand functions** The shorthand functions for `Text` are `Txt` and `T` @@ -950,7 +957,13 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. scale=(None, None), size=(None, None), auto_size_text=None, - password_char='') + password_char='', + background_color=None, + text_color=None, + do_not_clear=False, + key=None, + focus=False + ) . default_text - Text initially shown in the input box @@ -958,6 +971,17 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. size - (width, height) of element in characters auto_size_text- Bool. True is element should be sized to fit text password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + background_color - color to use for the input field background + text_color - color to use for the typed text + do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. + key = Dictionary key to use for return values + focus = Bool. True if this field should capture the focus (moves cursor to this field) + + There are two methods that can be called: + + InputText.Update(new_Value) - sets the input value + Input.Text(Get() - returns the current value of the field. + Shorthand functions that are equivalent to `InputText` are `Input` and `In` @@ -972,13 +996,20 @@ Also known as a drop-down list. Only required parameter is the list of choices. InputCombo(values, scale=(None, None), size=(None, None), - auto_size_text=None) + auto_size_text=None, + background_color = None, + text_color = None, + key = None) . values - Choices to be displayed. List of strings scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length + background_color - color to use for the input field background + text_color - color to use for the typed text + key = Dictionary key to use for return values + #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). @@ -993,7 +1024,10 @@ The standard listbox like you'll find in most GUIs. Note that the return values scale=(None, None), size=(None, None), auto_size_text=None, - font=None) + font=None, + background_color = None, + text_color = None, + key = None) . values - Choices to be displayed. List of strings @@ -1012,6 +1046,9 @@ The standard listbox like you'll find in most GUIs. Note that the return values scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length + background_color - color to use for the input field background + text_color - color to use for the typed text + key = Dictionary key to use for return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. @@ -1029,7 +1066,10 @@ Sliders have a couple of slider-specific settings as well as appearance settings relief=None, scale=(None, None), size=(None, None), - font=None): + font=None, + background_color = None, + text_color = None, + key = None) ): . range - (min, max) slider's range @@ -1046,6 +1086,9 @@ Sliders have a couple of slider-specific settings as well as appearance settings scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text + background_color - color to use for the input field background + text_color - color to use for the typed text + key = Dictionary key to use for return values #### Radio Button Element Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. @@ -1060,7 +1103,10 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o scale=(None, None), size=(None, None), auto_size_text=None, - font=None) + font=None, + background_color = None, + text_color = None, + key = None) . @@ -1071,6 +1117,9 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o size- (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display + background_color - color to use for the background + text_color - color to use for the text + key = Dictionary key to use for return values #### Checkbox Element @@ -1086,7 +1135,10 @@ Checkbox elements are like Radio Button elements. They return a bool indicating scale=(None, None), size=(None, None), auto_size_text=None, - font=None): + font=None, + background_color = None, + text_color = None, + key = None): . text - Text to display next to checkbox @@ -1095,6 +1147,9 @@ Checkbox elements are like Radio Button elements. They return a bool indicating size - (width, height) size of element in characters auto_size_text- Bool. True if should size width to fit text font- Font type and size for text display + background_color - color to use for the background + text_color - color to use for the typed text + key = Dictionary key to use for return values #### Spin Element @@ -1109,7 +1164,10 @@ An up/down spinner control. The valid values are passed in as a list. scale=(None, None), size=(None, None), auto_size_text=None, - font=None) + font=None, + background_color = None, + text_color = None, + key = None): . values - List of valid values @@ -1118,6 +1176,9 @@ An up/down spinner control. The valid values are passed in as a list. size - (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display + background_color - color to use for the background + text_color - color to use for the typed text + key = Dictionary key to use for return values #### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. @@ -1143,11 +1204,17 @@ Realtime - This is another async form button. Normal button clicks occur after While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` SimpleButton(text, + image_filename=None, + image_size=(None, None), + image_subsample=None, + border_width=None, + bind_return_key=False, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, - font=None) + font=None, + focus=False) These Pre-made buttons are some of the most important elements of all because they are used so much. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. (hmmm Save already comes to mind). They include: @@ -1157,14 +1224,19 @@ These Pre-made buttons are some of the most important elements of all because th Cancel Yes No + Exit + Quit + Save + SaveAs FileBrowse + FileSaveAs FolderBrowse . layout = [[sg.OK(), sg.Cancel()]] ![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) -The FileBrowse and FolderBrowse buttons both fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The FileBrowse, FolderBrowse, FileSaveAs buttons all fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. @@ -1189,7 +1261,7 @@ layout = [[sg.SimpleButton('My Button')]] ![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. The two that are not are `FileBrowse` and `FolderBrowse`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -1255,7 +1327,7 @@ Somewhere later in your code will be your main event loop. This is where you do This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** -The `FileBrowse` button has an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is +The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) @@ -1264,7 +1336,10 @@ This code produces a form where the Browse button only shows files of type .TXT layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. + +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. --- #### ProgressBar @@ -1507,6 +1582,14 @@ These settings apply to all forms `SetOptions`. The Row options and Element opt Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). +## Persistent Forms (Window stays open after button click) + +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The SimpleButton Element also closes the form. + +The `ReadFormButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. + + + ## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. @@ -1530,9 +1613,11 @@ The basic flow and functions you will be calling are: Setup - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) + + form = FlexForm() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + Periodic refresh @@ -1700,7 +1785,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults - +| 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) From 07772cb2e7ce8ec092a00b8f5d2c4d4f7c907ef3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 25 Aug 2018 22:57:15 -0400 Subject: [PATCH 203/521] Exposed 'pad' for ALL ELEMENTS. Touched every Element. Changed how shortcut funcations are made. New demo program Keypad. --- Demo_Keypad.py | 36 ++++++++++++++ PySimpleGUI.py | 128 ++++++++++++++++++++++++------------------------- 2 files changed, 98 insertions(+), 66 deletions(-) create mode 100644 Demo_Keypad.py diff --git a/Demo_Keypad.py b/Demo_Keypad.py new file mode 100644 index 000000000..3ca2afb42 --- /dev/null +++ b/Demo_Keypad.py @@ -0,0 +1,36 @@ +import PySimpleGUI as g + +# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons + +# 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('Choose Test'), g.DropDown(values=['Input', 'Output', 'Some option']), g.ReadFormButton('Input Option', size=(10,1))], + [in_elem], + [g.ReadFormButton('1', size=(5,2)), g.ReadFormButton('2', size=(5,2)), g.ReadFormButton('3', size=(5,2))], + [g.ReadFormButton('4', size=(5,2)), g.ReadFormButton('5', size=(5,2)), g.ReadFormButton('6', size=(5,2))], + [g.ReadFormButton('7', size=(5,2)), g.ReadFormButton('8', size=(5,2)), g.ReadFormButton('9', size=(5,2))], + [g.ReadFormButton('Submit', size=(5,2)),g.ReadFormButton('0', size=(5,2)), g.ReadFormButton('Clear', size=(5,2))], + [out_elem], + ] + +form = g.FlexForm('Keypad', auto_size_buttons=False) +form.Layout(layout) + +keys_entered = '' +while True: + button, values = form.Read() # read the form + if button is None: # if the X button clicked, just exit + break + if button == 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button == 'Submit': + keys_entered = in_elem.Get() + out_elem.Update(keys_entered) # output the final string + + in_elem.Update(keys_entered) # change the form to reflect current key string + diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ba25b2714..49ed1e5bc 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,4 +1,3 @@ - #!/usr/bin/env Python3 import tkinter as tk from tkinter import filedialog @@ -165,12 +164,12 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # Element CLASS # # ------------------------------------------------------------------------- # class Element(): - def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): + def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): self.Size = size self.Type = type self.AutoSizeText = auto_size_text self.Scale = scale - self.Pad = DEFAULT_ELEMENT_PADDING + self.Pad = DEFAULT_ELEMENT_PADDING if pad is None else pad self.Font = font self.TKStringVar = None @@ -217,7 +216,7 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): ''' Input a line of text Element :param default_text: Default value to display @@ -233,7 +232,7 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR self.Focus = focus self.do_not_clear = do_not_clear - super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) + super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) def Update(self, new_value): @@ -250,7 +249,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None): + def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -264,7 +263,7 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) + super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) def __del__(self): try: @@ -278,8 +277,7 @@ def __del__(self): # Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): - - def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): + def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Listbox Element :param values: @@ -303,7 +301,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key) + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad) def Update(self, values): self.TKListbox.delete(0, 'end') @@ -324,7 +322,7 @@ def __del__(self): # Radio # # ---------------------------------------------------------------------- # class Radio(Element): - def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None, key=None): + def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None, key=None, pad=None): ''' Radio Button Element :param text: @@ -341,7 +339,7 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None self.TKRadio = None self.GroupID = group_id self.Value = None - super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key) + super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) def __del__(self): try: @@ -354,7 +352,7 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): + def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Check Box Element :param text: @@ -370,7 +368,7 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.Value = None self.TKCheckbutton = None - super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key) + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) def Get(self): return self.TKIntVar.get() @@ -393,7 +391,7 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None): + def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Spin Box Element :param values: @@ -410,7 +408,7 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key) + super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) return def __del__(self): @@ -424,7 +422,7 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): + def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): ''' Input Multi-line Element :param default_text: @@ -441,7 +439,7 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s self.do_not_clear = do_not_clear fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key) + super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) return def Update(self, NewValue): @@ -458,7 +456,7 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None): + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None, pad=None): ''' Text Element - Displays text in your form. Can be updated in non-blocking forms :param text: The text to display @@ -477,9 +475,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: bg = background_color - # self.Font = Font if Font else DEFAULT_FONT - # i=1/0 - super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor) + super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad) return def Update(self, new_value = None, background_color=None, text_color=None): @@ -590,7 +586,7 @@ def __del__(self): # Routes stdout, stderr to a scrolled window # # ---------------------------------------------------------------------- # class Output(Element): - def __init__(self, scale=(None, None), size=(None, None), background_color=None, text_color=None): + def __init__(self, scale=(None, None), size=(None, None), background_color=None, text_color=None, pad=None): ''' Output Element - reroutes stdout, stderr to this window :param scale: Adds multiplier to size (w,h) @@ -601,7 +597,7 @@ def __init__(self, scale=(None, None), size=(None, None), background_color=None, bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=fg) + super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=fg, pad=pad) def __del__(self): try: @@ -614,7 +610,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -645,7 +641,7 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH self.BindReturnKey = bind_return_key self.Focus = focus - super().__init__(ELEM_TYPE_BUTTON, scale, size, font=font) + super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad) return def ButtonReleaseCallBack(self, parm): @@ -731,7 +727,7 @@ def __del__(self): # ProgreessBar # # ---------------------------------------------------------------------- # class ProgressBar(Element): - def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None): + def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None, pad=None): ''' Progress Bar Element :param max_value: @@ -754,7 +750,7 @@ def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False - super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text) + super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text, pad=pad) return def UpdateBar(self, current_count, max=None): @@ -779,7 +775,7 @@ def __del__(self): # Image # # ---------------------------------------------------------------------- # class Image(Element): - def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None)): + def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None), pad=None): ''' Image Element :param filename: @@ -792,7 +788,7 @@ def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None if data is None and filename is None: print('* Warning... no image specified in Image Element! *') - super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size) + super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad) return def Update(self, filename=None, data=None): @@ -815,7 +811,7 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None): + def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None): ''' Slider Element :param range: @@ -834,7 +830,7 @@ def __init__(self, range=(None,None), default_value=None, orientation=None, bord self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF - super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key) + super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) return def Update(self, value, range=(None, None)): @@ -851,7 +847,7 @@ def __del__(self): # Column # # ---------------------------------------------------------------------- # class Column(Element): - def __init__(self, layout, background_color = None): + def __init__(self, layout, background_color = None, pad=None): self.UseDictionary = False self.ReturnValues = None self.ReturnValuesList = [] @@ -865,7 +861,7 @@ def __init__(self, layout, background_color = None): self.Layout(layout) - super().__init__(ELEM_TYPE_COLUMN, background_color=background_color) + super().__init__(ELEM_TYPE_COLUMN, background_color=background_color, pad=pad) return def AddRow(self, *args): @@ -1200,68 +1196,68 @@ def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color) +def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): + return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): + return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) # ------------------------- SAVE AS Element lazy function ------------------------- # -def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font) +def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # -def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus) +def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus) +def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus) +def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # -def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # -def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- Exit BUTTON Element lazy function ------------------------- # -def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) -def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False): - return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus) +def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) ##################################### ----- RESULTS ------ ################################################## From ddaf87914dec3b28898eca7534cee3c0ce5db1a3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 10:45:52 -0400 Subject: [PATCH 204/521] Cleanup keypad demo --- Demo_Keypad.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Demo_Keypad.py b/Demo_Keypad.py index 3ca2afb42..124f34d08 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -2,22 +2,32 @@ # g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons +# Demonstrates a number of PySimpleGUI features including: +# Default element size +# auto_size_buttons +# ReadFormButton +# Dictionary return values +# Update of elements in form (Text, Input) +# do_not_clear of Input elements + + # 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('Choose Test'), g.DropDown(values=['Input', 'Output', 'Some option']), g.ReadFormButton('Input Option', size=(10,1))], +layout = [[g.Text('Choose Test'), g.DropDown(values=['Input', 'Output', 'Some option']), g.ReadFormButton('Input Option', auto_size_button=True)], [in_elem], - [g.ReadFormButton('1', size=(5,2)), g.ReadFormButton('2', size=(5,2)), g.ReadFormButton('3', size=(5,2))], - [g.ReadFormButton('4', size=(5,2)), g.ReadFormButton('5', size=(5,2)), g.ReadFormButton('6', size=(5,2))], - [g.ReadFormButton('7', size=(5,2)), g.ReadFormButton('8', size=(5,2)), g.ReadFormButton('9', size=(5,2))], - [g.ReadFormButton('Submit', size=(5,2)),g.ReadFormButton('0', size=(5,2)), g.ReadFormButton('Clear', size=(5,2))], + [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], + [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], + [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], + [g.ReadFormButton('Submit'),g.ReadFormButton('0'), g.ReadFormButton('Clear')], [out_elem], ] -form = g.FlexForm('Keypad', auto_size_buttons=False) +form = g.FlexForm('Keypad', default_element_size=(5,2), auto_size_buttons=False) form.Layout(layout) +# Loop forever reading the form's values, updating the Input field keys_entered = '' while True: button, values = form.Read() # read the form @@ -26,10 +36,10 @@ if button == 'Clear': # clear keys if clear button keys_entered = '' elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far + keys_entered = values['input'] # get what's been entered so far keys_entered += button # add the new digit elif button == 'Submit': - keys_entered = in_elem.Get() + keys_entered = values['input'] out_elem.Update(keys_entered) # output the final string in_elem.Update(keys_entered) # change the form to reflect current key string From e7c216dfe11bd5a942a0151f48b9b832d8bc2c7a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 15:20:54 -0400 Subject: [PATCH 205/521] CANVAS Element! Fixes for autosizing, scroll-bar artifacts on Output, fonts for Output, all shortcut functions using new method --- PySimpleGUI.py | 93 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 25 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 49ed1e5bc..f7103fd7d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -139,6 +139,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_INPUT_SPIN = 9 ELEM_TYPE_BUTTON = 3 ELEM_TYPE_IMAGE = 30 +ELEM_TYPE_CANVAS = 40 ELEM_TYPE_INPUT_SLIDER = 10 ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 @@ -542,12 +543,13 @@ def __del__(self): # Scroll bar will span the length of the frame # # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): - def __init__(self, parent, width, height, bd, background_color=None, text_color=None): - frame = tk.Frame(parent, width=width, height=height) + def __init__(self, parent, width, height, bd, background_color=None, text_color=None, font=None): + frame = tk.Frame(parent) tk.Frame.__init__(self, frame) - self.output = tk.Text(frame, width=width, height=height, bd=bd) + self.output = tk.Text(frame, width=width, height=height, bd=bd, font=font) if background_color and background_color != COLOR_SYSTEM_DEFAULT: self.output.configure(background=background_color) + frame.configure(background=background_color) if text_color and text_color != COLOR_SYSTEM_DEFAULT: self.output.configure(fg=text_color) self.vsb = tk.Scrollbar(frame, orient="vertical", command=self.output.yview) @@ -586,7 +588,7 @@ def __del__(self): # Routes stdout, stderr to a scrolled window # # ---------------------------------------------------------------------- # class Output(Element): - def __init__(self, scale=(None, None), size=(None, None), background_color=None, text_color=None, pad=None): + def __init__(self, scale=(None, None), size=(None, None), background_color=None, text_color=None, pad=None, font=None): ''' Output Element - reroutes stdout, stderr to this window :param scale: Adds multiplier to size (w,h) @@ -597,7 +599,7 @@ def __init__(self, scale=(None, None), size=(None, None), background_color=None, bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=fg, pad=pad) + super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=fg, pad=pad, font=font) def __del__(self): try: @@ -807,6 +809,28 @@ def Update(self, filename=None, data=None): def __del__(self): super().__del__() + +# ---------------------------------------------------------------------- # +# Canvas # +# ---------------------------------------------------------------------- # +class Canvas(Element): + def __init__(self, background_color=None, scale=(None, None), size=(None, None), pad=None): + ''' + Image Element + :param filename: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + ''' + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.TKCanvas = None + + super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, scale=scale, size=size, pad=pad) + return + + def __del__(self): + super().__del__() + + # ---------------------------------------------------------------------- # # Slider # # ---------------------------------------------------------------------- # @@ -1168,11 +1192,14 @@ def __del__(self): # ====================================================================== # # ------------------------- INPUT TEXT Element lazy functions ------------------------- # -def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) +In = InputText +Input = InputText +#### TODO REMOVE THESE COMMENTS - was the old way, but want to keep around for a bit just in case +# def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): +# return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) -def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): - return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) +# def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): +# return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) # ------------------------- CHECKBOX Element lazy functions ------------------------- # CB = Checkbox @@ -1180,20 +1207,29 @@ def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_tex Check = Checkbox # ------------------------- INPUT COMBO Element lazy functions ------------------------- # -def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): - return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text, background_color=background_color) - -def DropDown(values, scale=(None, None), size=(None, None), auto_size_text=None): - return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) -def Drop(values, scale=(None, None), size=(None, None), auto_size_text=None): - return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) +Combo = InputCombo +DropDown = InputCombo +Drop = InputCombo + +# def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): +# return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text, background_color=background_color) +# +# def DropDown(values, scale=(None, None), size=(None, None), auto_size_text=None): +# return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) +# +# def Drop(values, scale=(None, None), size=(None, None), auto_size_text=None): +# return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) # ------------------------- TEXT Element lazy functions ------------------------- # -def Txt(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): - return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) -def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): - return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) +Txt = Text +T = Text + +# def Txt(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): +# return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) +# +# def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): +# return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): @@ -1469,7 +1505,7 @@ def CharWidthInPixels(): stringvar = tk.StringVar() element.TKStringVar = stringvar stringvar.set(display_text) - if element.AutoSizeText: + if auto_size_text: width = 0 if element.Justification is not None: justification = element.Justification @@ -1500,7 +1536,7 @@ def CharWidthInPixels(): if element.AutoSizeButton is not None: auto_size = element.AutoSizeButton else: auto_size = toplevel_form.AutoSizeButtons - if auto_size is False: width=element_size[0] + if auto_size is False or element.Size[0] is not None: width=element_size[0] else: width = 0 height=element_size[1] lines = btext.split('\n') @@ -1702,8 +1738,8 @@ def CharWidthInPixels(): # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color) - element.TKOut.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font) + element.TKOut.pack(side=tk.LEFT) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: if element.Filename is not None: @@ -1723,6 +1759,13 @@ def CharWidthInPixels(): element.tktext_label.image = photo # tktext_label.configure(anchor=tk.NW, image=photo) element.tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + # ------------------------- Canvas element ------------------------- # + elif element_type == ELEM_TYPE_CANVAS: + width, height = element_size + element.TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKCanvas.configure(background=element.BackgroundColor) + element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() @@ -1954,7 +1997,7 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines # print('Msgbox width, height', width_used, height) - form.AddRow(Text(message_wrapped, auto_size_text=True, size=(width_used, height))) + form.AddRow(Text(message_wrapped, auto_size_text=True)) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 From ceafe787b25bcf1a77cbb136bc9cb09a5379329c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 15:29:12 -0400 Subject: [PATCH 206/521] New CANVAS Demo, updated PNG Viewer Demo --- Demo_Canvas.py | 22 ++++++++++++++++++++++ Demo_PNG_Viewer.py | 38 +++++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 Demo_Canvas.py diff --git a/Demo_Canvas.py b/Demo_Canvas.py new file mode 100644 index 000000000..35eec4942 --- /dev/null +++ b/Demo_Canvas.py @@ -0,0 +1,22 @@ +import PySimpleGUI as gui + +canvas = gui.Canvas(size=(100,100), background_color='red') + +layout = [ + [canvas], + [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] + ] + +form = gui.FlexForm('Canvas test') +form.Layout(layout) +form.ReadNonBlocking() + +cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) + +while True: + button, values = form.Read() + if button is None: break + if button is 'Blue': + canvas.TKCanvas.itemconfig(cir, fill = "Blue") + elif button is 'Red': + canvas.TKCanvas.itemconfig(cir, fill = "Red") diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py index 4729d9c3c..7d6bcd7d4 100644 --- a/Demo_PNG_Viewer.py +++ b/Demo_PNG_Viewer.py @@ -4,54 +4,62 @@ # Simple Image Browser based on PySimpleGUI # Get the folder containing the images from the user -rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='A:/TEMP/PDFs') +rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') if rc is False or folder is '': sg.MsgBoxCancel('Cancelling') exit(0) # get list of PNG files in folder png_files = [folder + '\\' + f for f in os.listdir(folder) if '.png' in f] +filenames_only = [f for f in os.listdir(folder) if '.png' in f] if len(png_files) == 0: sg.MsgBox('No PNG images in folder') exit(0) # create the form that also returns keyboard events -form = sg.FlexForm('Image Browser', return_keyboard_events=True) +form = sg.FlexForm('Image Browser', return_keyboard_events=True, location=(0,0), use_default_focus=False ) # make these 2 elements outside the layout because want to "update" them later # initialize to the first PNG file in the list image_elem = sg.Image(filename=png_files[0]) filename_display_elem = sg.Text(png_files[0], size=(80, 3)) -file_num_display_elem = sg.Text('File 1 of {}'.format(len(png_files)), size=(10,1)) +file_num_display_elem = sg.Text('File 1 of {}'.format(len(png_files)), size=(15,1)) # define layout, show and read the form -layout = [[filename_display_elem], +col = [[filename_display_elem], [image_elem], [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2)), file_num_display_elem]] -form.LayoutAndRead(layout) # Shows form on screen +col_files = [[sg.Listbox(values=filenames_only, size=(60,30), key='listbox')], + [sg.ReadFormButton('Read')]] +layout = [[sg.Column(col_files), sg.Column(col)]] +button, values = form.LayoutAndRead(layout) # Shows form on screen # loop reading the user input and displaying image, filename i=0 while True: - f = png_files[i] - # update window with new image - image_elem.Update(filename=f) - # update window with filename - filename_display_elem.Update(f) - # update page display - file_num_display_elem.Update('File {} of {}'.format(i+1, len(png_files))) - # read the form - button, values = form.Read() # perform button and keyboard operations if button is None: break - elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34') and i < len(png_files): + elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34') and i < len(png_files)-1: i += 1 elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33') and i > 0: i -= 1 + if button == 'Read': + filename = folder + '\\' + values['listbox'][0] + # print(filename) + else: + filename = png_files[i] + # update window with new image + image_elem.Update(filename=filename) + # update window with filename + filename_display_elem.Update(filename) + # update page display + file_num_display_elem.Update('File {} of {}'.format(i+1, len(png_files))) + # read the form + button, values = form.Read() From 4062b2b41cc003b34aaccbad2129d2f476baac41 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 16:10:39 -0400 Subject: [PATCH 207/521] Canvas Recipe, Update Input Element Recipe --- docs/cookbook.md | 100 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/docs/cookbook.md b/docs/cookbook.md index 256b2cbfc..4180f7745 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -634,3 +634,103 @@ This simple program keep a form open, taking input values until the user termina break + +## tkinter Canvas Widget + +The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: + + can = sg.Canvas(size=(100,100)) + tkcanvas = can.TKCanvas + tkcanvas.create_oval(50, 50, 100, 100) + + +![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) + + + + + import PySimpleGUI as gui + + canvas = gui.Canvas(size=(100,100), background_color='red') + + layout = [ + [canvas], + [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] + ] + + form = gui.FlexForm('Canvas test') + form.Layout(layout) + form.ReadNonBlocking() + + cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) + + while True: + button, values = form.Read() + if button is None: + break + if button is 'Blue': + canvas.TKCanvas.itemconfig(cir, fill = "Blue") + elif button is 'Red': + canvas.TKCanvas.itemconfig(cir, fill = "Red") + + +## Input Element Update + +This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. +There are a number of features used in this Recipe including: +* Default Element Size +* auto_size_buttons +* ReadFormButton +* Dictionary Return values +* Update of Elements in form (Input, Text) +* do_not_clear of Input Elements + +. + + + + import PySimpleGUI as g + + # g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons + + # Demonstrates a number of PySimpleGUI features including: + # Default element size + # auto_size_buttons + # ReadFormButton + # Dictionary return values + # Update of elements in form (Text, Input) + # do_not_clear of Input elements + + + # 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')], + [in_elem], + [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], + [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], + [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], + [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], + [out_elem], + ] + + form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) + form.Layout(layout) + + # Loop forever reading the form's values, updating the Input field + keys_entered = '' + while True: + button, values = form.Read() # read the form + if button is None: # if the X button clicked, just exit + break + if button is 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button is 'Submit': + keys_entered = values['input'] + out_elem.Update(keys_entered) # output the final string + + in_elem.Update(keys_entered) # change the form to reflect current key string From fad8378cb0997dbd7b3c13188079f7a5069f12ef Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 19:58:57 -0400 Subject: [PATCH 208/521] Delete SimScript_.py --- SimScript_.py | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 SimScript_.py diff --git a/SimScript_.py b/SimScript_.py deleted file mode 100644 index 2185935b3..000000000 --- a/SimScript_.py +++ /dev/null @@ -1,4 +0,0 @@ -import time - -for i in range(100): - print(i,'', end='') From 0def4bf436c30ede458b3c612f6118101c621762 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 22:16:54 -0400 Subject: [PATCH 209/521] Demo Matplotlib, Canvas Element changes, new Frame Element, added pad to Text, Slider Plus a few other tweaks & bug fixes --- Demo_Matplotlib.py | 73 +++++++++++++++++++++++++++++++++++++++++ Demo_Script_Launcher.py | 2 +- PySimpleGUI.py | 57 +++++++++++++++++++++----------- SimScript_.py | 4 --- 4 files changed, 111 insertions(+), 25 deletions(-) create mode 100644 Demo_Matplotlib.py delete mode 100644 SimScript_.py diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py new file mode 100644 index 000000000..ea6affc3e --- /dev/null +++ b/Demo_Matplotlib.py @@ -0,0 +1,73 @@ +import PySimpleGUI as g +import matplotlib +matplotlib.use('TkAgg') +from numpy import arange, sin, pi +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg +from matplotlib.figure import Figure +import matplotlib.backends.tkagg as tkagg +import sys +import tkinter as Tk + +""" +Demonstrates one way of embedding Matplotlib figures into a PySimpleGUI window. + +Basic steps are: + * Create a Canvas Element + * Layout form + * Display form (NON BLOCKING) + * Draw plots onto convas + * Display form (BLOCKING) +""" + + +def draw_figure(canvas, figure, loc=(0, 0)): + """ Draw a matplotlib figure onto a Tk canvas + + loc: location of top-left corner of figure on canvas in pixels. + + Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py + """ + figure_canvas_agg = FigureCanvasAgg(figure) + figure_canvas_agg.draw() + figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + # Position: convert from top-left anchor to center anchor + canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo) + + # Unfortunately, there's no accessor for the pointer to the native renderer + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + + # Return a handle which contains a reference to the photo object + # which must be kept live or else the picture disappears + return photo + +f = Figure(figsize=(5, 4), dpi=100) +a = f.add_subplot(111) +t = arange(0.0, 3.0, 0.01) +s = sin(2*pi*t) + +a.plot(t, s) +a.set_title('Tk embedding') +a.set_xlabel('X axis label') +a.set_ylabel('Y label') + +# -------------------------------- GUI Starts Here -------------------------------- +canvas_elem = g.Canvas(size=(500, 400)) # get the canvas we'll be drawing on +# define the form layout +layout = [[g.Text('Plot test')], + [canvas_elem], + [g.OK(pad=((250,0), 3))]] + +# create the form and show it without the plot +form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') +form.Layout(layout) +form.ReadNonBlocking() + +# add the plot to the window +fig_photo = draw_figure(canvas_elem.TKCanvas, f) + +# show it all again and get buttons +button, values = form.Read() + diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 50370a42e..3361023d7 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -7,7 +7,7 @@ def Launcher(): layout = [ [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20))], + [sg.Output(size=(88, 20), font='Courier 10')], [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] ] diff --git a/PySimpleGUI.py b/PySimpleGUI.py index f7103fd7d..c26fb7499 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -140,6 +140,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_BUTTON = 3 ELEM_TYPE_IMAGE = 30 ELEM_TYPE_CANVAS = 40 +ELEM_TYPE_FRAME = 41 ELEM_TYPE_INPUT_SLIDER = 10 ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 @@ -506,6 +507,7 @@ def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], st self.Orientation = orientation self.Count = None self.PriorCount = 0 + if orientation[0].lower() == 'h': s = ttk.Style() s.theme_use(style) @@ -814,15 +816,9 @@ def __del__(self): # Canvas # # ---------------------------------------------------------------------- # class Canvas(Element): - def __init__(self, background_color=None, scale=(None, None), size=(None, None), pad=None): - ''' - Image Element - :param filename: - :param scale: Adds multiplier to size (w,h) - :param size: Size of field in characters - ''' + def __init__(self, canvas=None, background_color=None, scale=(None, None), size=(None, None), pad=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR - self.TKCanvas = None + self.TKCanvas = canvas super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, scale=scale, size=size, pad=pad) return @@ -831,6 +827,20 @@ def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# Frame # +# ---------------------------------------------------------------------- # +class Frame(Element): + def __init__(self, frame=None, background_color=None, scale=(None, None), size=(None, None), pad=None): + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.TKFrame = frame + + super().__init__(ELEM_TYPE_FRAME, background_color=background_color, scale=scale, size=size, pad=pad) + return + + def __del__(self): + super().__del__() + # ---------------------------------------------------------------------- # # Slider # # ---------------------------------------------------------------------- # @@ -1058,6 +1068,7 @@ def _AutoCloseAlarmCallback(self): pass def Read(self): + self.NonBlocking = False if self.TKrootDestroyed: return None, None if not self.Shown: @@ -1484,7 +1495,7 @@ def CharWidthInPixels(): if element_type == ELEM_TYPE_COLUMN: col_frame = tk.Frame(tk_row_frame) PackFormIntoFrame(element, col_frame, toplevel_form) - col_frame.pack(side=tk.LEFT) + col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # @@ -1515,18 +1526,18 @@ def CharWidthInPixels(): justification = DEFAULT_TEXT_JUSTIFICATION justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE - tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth) + tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth, font=font) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth()+40 # width of widget in Pixels if not auto_size_text: wraplen = 0 # print("wraplen, width, height", wraplen, width, height) - tktext_label.configure(anchor=anchor, font=font, wraplen=wraplen) # set wrap to width of widget + tktext_label.configure(anchor=anchor, wraplen=wraplen) # set wrap to width of widget if element.BackgroundColor is not None: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) - tktext_label.pack(side=tk.LEFT) + tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) element.TKText = tktext_label # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: @@ -1550,9 +1561,9 @@ def CharWidthInPixels(): bc = DEFAULT_BUTTON_COLOR border_depth = element.BorderWidth if btype != BUTTON_TYPE_REALTIME: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth) + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth, font=font) else: - tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth) + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth, font=font) tkbutton.bind('', element.ButtonReleaseCallBack) tkbutton.bind('', element.ButtonPressCallBack) if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: @@ -1571,9 +1582,7 @@ def CharWidthInPixels(): tkbutton.config(image=photo, width=width, height=height) tkbutton.image = photo if width != 0: - tkbutton.configure(wraplength=wraplen+10, font=font) # set wrap to width of widget - else: - tkbutton.configure(font=font) # only set the font, not wraplength + tkbutton.configure(wraplength=wraplen+10) # set wrap to width of widget tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): focus_set = True @@ -1698,7 +1707,6 @@ def CharWidthInPixels(): else: bar_color = DEFAULT_PROGRESS_BAR_COLOR element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief, style=element.BarStyle ) - # element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief) element.TKProgressBar.TKProgressBarForReal.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- INPUT RADIO BUTTON element ------------------------- # elif element_type == ELEM_TYPE_INPUT_RADIO: @@ -1762,10 +1770,19 @@ def CharWidthInPixels(): # ------------------------- Canvas element ------------------------- # elif element_type == ELEM_TYPE_CANVAS: width, height = element_size - element.TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + if element.TKCanvas is None: + element.TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKCanvas.configure(background=element.BackgroundColor) element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- Frame element ------------------------- # + elif element_type == ELEM_TYPE_FRAME: + width, height = element_size + if element.TKFrame is None: + element.TKFrame = tk.Frame(tk_row_frame, width=width, height=height, bd=border_depth) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKFrame.configure(background=element.BackgroundColor) + element.TKFrame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() @@ -2659,7 +2676,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( ############################################################## def ChangeLookAndFeel(index): # look and feel table - look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS':('#9FB8AD','#F7F3EC' )}, 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, diff --git a/SimScript_.py b/SimScript_.py deleted file mode 100644 index 2185935b3..000000000 --- a/SimScript_.py +++ /dev/null @@ -1,4 +0,0 @@ -import time - -for i in range(100): - print(i,'', end='') From 2c6164567fc21013bf34ec0f68009822c9767034 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 26 Aug 2018 23:23:21 -0400 Subject: [PATCH 210/521] Animated Matplotlib demo! --- Demo_Matplotlib.py | 2 -- Demo_Matplotlib_Animated.py | 60 +++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 Demo_Matplotlib_Animated.py diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index ea6affc3e..36cee6793 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -5,7 +5,6 @@ from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg from matplotlib.figure import Figure import matplotlib.backends.tkagg as tkagg -import sys import tkinter as Tk """ @@ -70,4 +69,3 @@ def draw_figure(canvas, figure, loc=(0, 0)): # show it all again and get buttons button, values = form.Read() - diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py new file mode 100644 index 000000000..7616a6ec7 --- /dev/null +++ b/Demo_Matplotlib_Animated.py @@ -0,0 +1,60 @@ +from tkinter import * +from random import randint +import PySimpleGUI as g +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg +from matplotlib.figure import Figure +import matplotlib.backends.tkagg as tkagg +import tkinter as Tk + + +def main(): + fig = Figure() + + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() + + canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + # define the form layout + layout = [[g.Text('Animated Matplotlib', size=(40,1), justification='center', font='Helvetica 20')], + [canvas_elem], + [g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas + + dpts = [randint(0, 10) for x in range(10000)] + for i in range(len(dpts)): + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + exit(69) + + ax.cla() + ax.grid() + + ax.plot(range(20), dpts[i:i+20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640/2, 480/2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + # Unfortunately, there's no accessor for the pointer to the native renderer + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + + # time.sleep(.1) + + +if __name__ == '__main__': + main() + \ No newline at end of file From de4dd992c30ae4c2ad7ecaf00c72cd0f42c97913 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 00:31:36 -0400 Subject: [PATCH 211/521] Updated animated demo --- Demo_Matplotlib_Animated.py | 3 ++- __pycache__/PySimpleGUI.cpython-36.pyc | Bin 0 -> 72905 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 __pycache__/PySimpleGUI.cpython-36.pyc diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index 7616a6ec7..37212b45a 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -6,6 +6,7 @@ import matplotlib.backends.tkagg as tkagg import tkinter as Tk +VIEW_SIZE = 50 # number of data points visible on 1 screen def main(): fig = Figure() @@ -38,7 +39,7 @@ def main(): ax.cla() ax.grid() - ax.plot(range(20), dpts[i:i+20], color='purple') + ax.plot(range(VIEW_SIZE), dpts[i:i+VIEW_SIZE], color='purple') graph.draw() figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds figure_w, figure_h = int(figure_w), int(figure_h) diff --git a/__pycache__/PySimpleGUI.cpython-36.pyc b/__pycache__/PySimpleGUI.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d418c670c9bd0b1110d7aea55dfb10162a5d6ba1 GIT binary patch literal 72905 zcmeFa34B~veJ?({W=5mYVp*1#I1|TlEXOg9vpFUNYqb^2lChLH8Inv!IwO0=(u{oO z%C^**usA?iOu|mvw51eMLTTDk3N27tD5Z3JrF;LkrG=KqYbd3Zwv?Ag>HB_v=iWPu zBs+xVQ~s|b-E+@5_w38>{Lb(9JHK;dTU&hH?1dM9epA5rcfPvcm9QVgQ@*9e=TkoA zpYx^tcn9Wu^MQ20Pro4S!E{jU{<%;goQ_Dymb8fxO-IEYOUL9LPsdd#-Kzd0n^51% zwyFQjCRIG!j;G@>q@C?liENjOWY?)!wi`bF?0T4iY>#SBZ-6bB?u8jjZ-g06Z-N;~ zZ-&{D-jds-VjF$AEy}miHyeOo6i+O-neN<16``-=l8~OOS8e0B*+}{db#;2H+Meq* zX=JZN3h{IbrML>uw%pe2)p&2m`x-nu@LUV`PK0Vr_o-{syVTC~b*eADTkT3;udYk) zQM=R6L%C1_b^UB0yB8r7*&9&5eYri^8{uk8-=v-|Nxu@$t8#}iqLQ-#wS;#&o(_c>#J}07T2?>wus{8Xgz1#|u};Eq zmaX@~#neOUB?$Lw3D+axdeuu2hBIzcUAUL2mm}P3B-~~RcZG!8if~ufg}b00M!46) zcbj^ZdIjvSgZ&!yYV`>07h&J2UaMXM`|Dx9PF+;5gZ)w1_ozqJ>tTNk_8Zh2)MK!} z0rs2Jo75X&e>>gVu&hkB*eooiJ;|9DXSf_neMf%H$RUsNB!mv^dPQXjW2B@$3yBP>Z9;`cP_=Sj^D4UkHPN=xN3gCrhXlMKi%N> zarFuKy{EzNH`FKL_hf_LZ>mqh@4f1`)TdFhpHY6a$RXvoZovC6LjLyS5%oLjcM;}& z>i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mFElk|=bfUvDk= zFP5zSyBJ%%^MBk37FYS}SeH(#(@0cYY?TKfz4%9YnZXBuq4+i2(eaWB@WzjF03)Ei zJX+&HLhao$!9y9#ogSc!<4-dg>$?oy-ooVeKdQ20i zlu#KZr{m&Kq$-=1F^Oc!WSd3WB$6c&IZ>!2GA5&Kd=wAbH8=_%EX7wQdGE=>%J+>8=5$IqvU2+awO!TfC`sUAZ%Cw$fJk?~=mP<@zp z9cNrHJ_-yb)x(T=NOFNaPNoxZ#PT7=eURW$f=3AY`6!X%ZR4eg0XfO5ZA`d?;9Ufl z5>VQq-L3xf;M+VbZs_Qsf-a~LbL55(8;CFeq=&J5x=mCN!37#SNJi!YDpCI@K!D)gw322n1 zmJwV@@NR8>8vxFuXN`=86gT`s&;b|$@pz6u9#mn36KZxY0WK6P zIYNeS{9xYkjB730t1Rhz1g{au6fP6BOvf_m%G4?os7#Y()#=Z8$LjELvS-ep5PXO0|f6QxSQY} zf)5bT7D-Gs)I$tCOz;4~ae@a49wng8PEoBSnh`~%f{4(BX)}WJVpk(Pg%GJiW2iVf z$nj?nf;JBJ#U4Bxexi=b% zu8nSvu8W=*Jtul@bW`)@w$0HM(S>LiVp^ij(T&mW=G)+VJ%)1ibMzA;yx!=)K)w-w z%{PE+UnCF?g@gF=zbSlu__n&+>TU^dY}*#z6kfI}-rm|Cm2Yc%OL)ne3&ZQ1H?6re z+!&6+wfNe0AKaSz+Uwgx;reA4!WOMH5)HS2x2^g{ZmSE0xBGqJV5A}3NF~z$0#M}} ADgXcg literal 0 HcmV?d00001 From adc887a9f6100d5d48fb70da2bfc9dacbed7b525 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 00:53:00 -0400 Subject: [PATCH 212/521] Added animated Matplotlib --- docs/cookbook.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 4180f7745..871ca1978 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -685,7 +685,8 @@ There are a number of features used in this Recipe including: * Update of Elements in form (Input, Text) * do_not_clear of Input Elements -. + +![keypad 2](https://user-images.githubusercontent.com/13696193/44640891-57504d80-a992-11e8-93f4-4e97e586505e.jpg) @@ -701,7 +702,6 @@ There are a number of features used in this Recipe including: # Update of elements in form (Text, Input) # do_not_clear of Input elements - # 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') @@ -734,3 +734,67 @@ There are a number of features used in this Recipe including: out_elem.Update(keys_entered) # output the final string in_elem.Update(keys_entered) # change the form to reflect current key string + +## Animated Matplotlib Graph + +Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. + +![animated matplotlib](https://user-images.githubusercontent.com/13696193/44640937-91b9ea80-a992-11e8-9c1c-85ae74013679.jpg) + + + from tkinter import * + from random import randint + import PySimpleGUI as g + from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg + from matplotlib.figure import Figure + import matplotlib.backends.tkagg as tkagg + import tkinter as Tk + + + def main(): + fig = Figure() + + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() + + canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + + layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + [canvas_elem], + [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas + + dpts = [randint(0, 10) for x in range(10000)] + for i in range(len(dpts)): + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + exit(69) + + ax.cla() + ax.grid() + + ax.plot(range(20), dpts[i:i + 20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640 / 2, 480 / 2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + # time.sleep(.1) + + if __name__ == '__main__': + main() From 1505b56601bdcc575640cf0c690b12db84e2286b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 09:56:35 -0400 Subject: [PATCH 213/521] New button - FilesBrowse - Select MULTIPLE files --- PySimpleGUI.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c26fb7499..7de09ce20 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -123,6 +123,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # class ButtonType(Enum): BUTTON_TYPE_BROWSE_FOLDER = 1 BUTTON_TYPE_BROWSE_FILE = 2 +BUTTON_TYPE_BROWSE_FILES = 21 BUTTON_TYPE_SAVEAS_FILE = 3 BUTTON_TYPE_CLOSES_WIN = 5 BUTTON_TYPE_READ_FORM = 7 @@ -685,6 +686,10 @@ def ButtonCallBack(self): elif self.BType == BUTTON_TYPE_BROWSE_FILE: file_name = tk.filedialog.askopenfilename(filetypes=filetypes) # show the 'get file' dialog box strvar.set(file_name) + elif self.BType == BUTTON_TYPE_BROWSE_FILES: + file_name = tk.filedialog.askopenfilenames(filetypes=filetypes) + file_name = ';'.join(file_name) + strvar.set(file_name) elif self.BType == BUTTON_TYPE_SAVEAS_FILE: file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes) # show the 'get file' dialog box strvar.set(file_name) @@ -1250,6 +1255,10 @@ def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) +# ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- # +def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): + return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) + # ------------------------- FILE BROWSE Element lazy function ------------------------- # def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) From 8759046bcf921c45d112cc9cf35522ffa155849d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 10:55:53 -0400 Subject: [PATCH 214/521] Bug fix - need to decrement number of open windows after ReadFormButton clicked --- PySimpleGUI.py | 3 +++ __pycache__/PySimpleGUI.cpython-36.pyc | Bin 72905 -> 0 bytes 2 files changed, 3 insertions(+) delete mode 100644 __pycache__/PySimpleGUI.cpython-36.pyc diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7de09ce20..a51df3b52 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1084,6 +1084,9 @@ def Read(self): if self.RootNeedsDestroying: self.TKroot.destroy() _my_windows.Decrement() + # if form was closed with X + if self.LastButtonClicked is None and self.LastKeyboardEvent is None and self.ReturnValues[0] is None: + _my_windows.Decrement() if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: return BuildResults(self, False, self) else: diff --git a/__pycache__/PySimpleGUI.cpython-36.pyc b/__pycache__/PySimpleGUI.cpython-36.pyc deleted file mode 100644 index d418c670c9bd0b1110d7aea55dfb10162a5d6ba1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72905 zcmeFa34B~veJ?({W=5mYVp*1#I1|TlEXOg9vpFUNYqb^2lChLH8Inv!IwO0=(u{oO z%C^**usA?iOu|mvw51eMLTTDk3N27tD5Z3JrF;LkrG=KqYbd3Zwv?Ag>HB_v=iWPu zBs+xVQ~s|b-E+@5_w38>{Lb(9JHK;dTU&hH?1dM9epA5rcfPvcm9QVgQ@*9e=TkoA zpYx^tcn9Wu^MQ20Pro4S!E{jU{<%;goQ_Dymb8fxO-IEYOUL9LPsdd#-Kzd0n^51% zwyFQjCRIG!j;G@>q@C?liENjOWY?)!wi`bF?0T4iY>#SBZ-6bB?u8jjZ-g06Z-N;~ zZ-&{D-jds-VjF$AEy}miHyeOo6i+O-neN<16``-=l8~OOS8e0B*+}{db#;2H+Meq* zX=JZN3h{IbrML>uw%pe2)p&2m`x-nu@LUV`PK0Vr_o-{syVTC~b*eADTkT3;udYk) zQM=R6L%C1_b^UB0yB8r7*&9&5eYri^8{uk8-=v-|Nxu@$t8#}iqLQ-#wS;#&o(_c>#J}07T2?>wus{8Xgz1#|u};Eq zmaX@~#neOUB?$Lw3D+axdeuu2hBIzcUAUL2mm}P3B-~~RcZG!8if~ufg}b00M!46) zcbj^ZdIjvSgZ&!yYV`>07h&J2UaMXM`|Dx9PF+;5gZ)w1_ozqJ>tTNk_8Zh2)MK!} z0rs2Jo75X&e>>gVu&hkB*eooiJ;|9DXSf_neMf%H$RUsNB!mv^dPQXjW2B@$3yBP>Z9;`cP_=Sj^D4UkHPN=xN3gCrhXlMKi%N> zarFuKy{EzNH`FKL_hf_LZ>mqh@4f1`)T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jnd=ui*MBnCFH5;P789OS#7Rwju3M8+xUF(fJmFElk|=bfUvDk= zFP5zSyBJ%%^MBk37FYS}SeH(#(@0cYY?TKfz4%9YnZXBuq4+i2(eaWB@WzjF03)Ei zJX+&HLhao$!9y9#ogSc!<4-dg>$?oy-ooVeKdQ20i zlu#KZr{m&Kq$-=1F^Oc!WSd3WB$6c&IZ>!2GA5&Kd=wAbH8=_%EX7wQdGE=>%J+>8=5$IqvU2+awO!TfC`sUAZ%Cw$fJk?~=mP<@zp z9cNrHJ_-yb)x(T=NOFNaPNoxZ#PT7=eURW$f=3AY`6!X%ZR4eg0XfO5ZA`d?;9Ufl z5>VQq-L3xf;M+VbZs_Qsf-a~LbL55(8;CFeq=&J5x=mCN!37#SNJi!YDpCI@K!D)gw322n1 zmJwV@@NR8>8vxFuXN`=86gT`s&;b|$@pz6u9#mn36KZxY0WK6P zIYNeS{9xYkjB730t1Rhz1g{au6fP6BOvf_m%G4?os7#Y()#=Z8$LjELvS-ep5PXO0|f6QxSQY} zf)5bT7D-Gs)I$tCOz;4~ae@a49wng8PEoBSnh`~%f{4(BX)}WJVpk(Pg%GJiW2iVf z$nj?nf;JBJ#U4Bxexi=b% zu8nSvu8W=*Jtul@bW`)@w$0HM(S>LiVp^ij(T&mW=G)+VJ%)1ibMzA;yx!=)K)w-w z%{PE+UnCF?g@gF=zbSlu__n&+>TU^dY}*#z6kfI}-rm|Cm2Yc%OL)ne3&ZQ1H?6re z+!&6+wfNe0AKaSz+Uwgx;reA4!WOMH5)HS2x2^g{ZmSE0xBGqJV5A}3NF~z$0#M}} ADgXcg From 5243798a732abefe2197675fa2baf72d16086966 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 11:20:01 -0400 Subject: [PATCH 215/521] Resolution for Sliders --- PySimpleGUI.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index a51df3b52..e371e23e7 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -850,7 +850,7 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, range=(None,None), default_value=None, resolution=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None): ''' Slider Element :param range: @@ -869,6 +869,8 @@ def __init__(self, range=(None,None), default_value=None, orientation=None, bord self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF + self.Resolution = 1 if resolution is None else resolution + super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) return @@ -1808,7 +1810,7 @@ def CharWidthInPixels(): else: range_from = element.Range[0] range_to = element.Range[1] - tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) # tktext_label.configure(anchor=tk.NW, image=photo) tkscale.config(highlightthickness=0) if element.BackgroundColor is not None: From 82e326a6c13d72f476cd6d315f062efe2eea55c1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 12:10:20 -0400 Subject: [PATCH 216/521] "template" version of Matplotlib Demo Able to re-create all of the "API demos" from this page: https://matplotlib.org/gallery/index.html --- Demo_Matplotlib.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 36cee6793..93f98a8fb 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -1,9 +1,7 @@ import PySimpleGUI as g import matplotlib matplotlib.use('TkAgg') -from numpy import arange, sin, pi -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg -from matplotlib.figure import Figure +from matplotlib.backends.backend_tkagg import FigureCanvasAgg import matplotlib.backends.tkagg as tkagg import tkinter as Tk @@ -42,22 +40,30 @@ def draw_figure(canvas, figure, loc=(0, 0)): # which must be kept live or else the picture disappears return photo -f = Figure(figsize=(5, 4), dpi=100) -a = f.add_subplot(111) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) +#------------------------------- PASTE YOUR MATPLOTLIB CODE HERE ------------------------------- +import numpy as np +import matplotlib +import matplotlib.pyplot as plt + +# Fixing random state for reproducibility +np.random.seed(19680801) + -a.plot(t, s) -a.set_title('Tk embedding') -a.set_xlabel('X axis label') -a.set_ylabel('Y label') +matplotlib.rcParams['axes.unicode_minus'] = False +fig, ax = plt.subplots() +ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o') +ax.set_title('Using hyphen instead of Unicode minus') -# -------------------------------- GUI Starts Here -------------------------------- -canvas_elem = g.Canvas(size=(500, 400)) # get the canvas we'll be drawing on +# -------------------------------- GUI Starts Here -------------------------------# +# fig = your figure you want to display. Assumption is that 'fig' holds the # +# information to display. # +# --------------------------------------------------------------------------------# +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 # define the form layout layout = [[g.Text('Plot test')], [canvas_elem], - [g.OK(pad=((250,0), 3))]] + [g.OK(pad=((figure_w/2,0), 3), size=(4,2))]] # create the form and show it without the plot form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') @@ -65,7 +71,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): form.ReadNonBlocking() # add the plot to the window -fig_photo = draw_figure(canvas_elem.TKCanvas, f) +fig_photo = draw_figure(canvas_elem.TKCanvas, fig) # show it all again and get buttons button, values = form.Read() From e1637fe8c811cddf319a23c8f29af1f625f4b404 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 16:10:32 -0400 Subject: [PATCH 217/521] Matplotlib demos! Single, animated, multiple --- Demo_Matplotlib.py | 60 +++++++- Demo_Matplotlib_Animated.py | 14 +- Demo_Matplotlib_Multiple.py | 266 ++++++++++++++++++++++++++++++++++++ 3 files changed, 327 insertions(+), 13 deletions(-) create mode 100644 Demo_Matplotlib_Multiple.py diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 93f98a8fb..9dc26dad3 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -41,18 +41,66 @@ def draw_figure(canvas, figure, loc=(0, 0)): return photo #------------------------------- PASTE YOUR MATPLOTLIB CODE HERE ------------------------------- + import numpy as np -import matplotlib import matplotlib.pyplot as plt +from matplotlib.ticker import NullFormatter # useful for `logit` scale + # Fixing random state for reproducibility np.random.seed(19680801) - -matplotlib.rcParams['axes.unicode_minus'] = False -fig, ax = plt.subplots() -ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o') -ax.set_title('Using hyphen instead of Unicode minus') +# make up some data in the interval ]0, 1[ +y = np.random.normal(loc=0.5, scale=0.4, size=1000) +y = y[(y > 0) & (y < 1)] +y.sort() +x = np.arange(len(y)) + +# plot with various axes scales +plt.figure(1) + +# linear +plt.subplot(221) +plt.plot(x, y) +plt.yscale('linear') +plt.title('linear') +plt.grid(True) + + +# log +plt.subplot(222) +plt.plot(x, y) +plt.yscale('log') +plt.title('log') +plt.grid(True) + + +# symmetric log +plt.subplot(223) +plt.plot(x, y - y.mean()) +plt.yscale('symlog', linthreshy=0.01) +plt.title('symlog') +plt.grid(True) + +# logit +plt.subplot(224) +plt.plot(x, y) +plt.yscale('logit') +plt.title('logit') +plt.grid(True) +# Format the minor tick labels of the y-axis into empty strings with +# `NullFormatter`, to avoid cumbering the axis with too many labels. +plt.gca().yaxis.set_minor_formatter(NullFormatter()) +# Adjust the subplot layout, because the logit one may take more space +# than usual, due to y-tick labels like "1 - 10^{-3}" +plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, + wspace=0.35) + + +#------------------------------- END OF YOUR MATPLOTLIB CODE ------------------------------- + +# ****** Comment out this line if not using Pyplot ****** +fig = plt.gcf() # if using Pyplot then get the figure from the plot # -------------------------------- GUI Starts Here -------------------------------# # fig = your figure you want to display. Assumption is that 'fig' holds the # diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index 37212b45a..5f640fea4 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -1,12 +1,10 @@ -from tkinter import * from random import randint import PySimpleGUI as g from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg from matplotlib.figure import Figure import matplotlib.backends.tkagg as tkagg -import tkinter as Tk +import tkinter as tk -VIEW_SIZE = 50 # number of data points visible on 1 screen def main(): fig = Figure() @@ -17,9 +15,11 @@ def main(): ax.grid() canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + slider_elem = g.Slider(range=(0,10000), size=(60,10), orientation='h') # define the form layout layout = [[g.Text('Animated Matplotlib', size=(40,1), justification='center', font='Helvetica 20')], [canvas_elem], + [slider_elem], [g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot @@ -36,14 +36,15 @@ def main(): if button is 'Exit' or values is None: exit(69) + slider_elem.Update(i) ax.cla() ax.grid() - - ax.plot(range(VIEW_SIZE), dpts[i:i+VIEW_SIZE], color='purple') + DATA_POINTS_PER_SCREEN = 40 + ax.plot(range(DATA_POINTS_PER_SCREEN), dpts[i:i+DATA_POINTS_PER_SCREEN], color='purple') graph.draw() figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds figure_w, figure_h = int(figure_w), int(figure_h) - photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) canvas.create_image(640/2, 480/2, image=photo) @@ -58,4 +59,3 @@ def main(): if __name__ == '__main__': main() - \ No newline at end of file diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py new file mode 100644 index 000000000..d56d46d92 --- /dev/null +++ b/Demo_Matplotlib_Multiple.py @@ -0,0 +1,266 @@ +import PySimpleGUI as g +import matplotlib +matplotlib.use('TkAgg') +from matplotlib.backends.backend_tkagg import FigureCanvasAgg +import matplotlib.backends.tkagg as tkagg +import tkinter as Tk + +""" +Demonstrates one way of embedding Matplotlib figures into a PySimpleGUI window. + +Basic steps are: + * Create a Canvas Element + * Layout form + * Display form (NON BLOCKING) + * Draw plots onto convas + * Display form (BLOCKING) +""" + + + +import numpy as np +import matplotlib.pyplot as plt + + +def PyplotSimple(): + import numpy as np + import matplotlib.pyplot as plt + + # evenly sampled time at 200ms intervals + t = np.arange(0., 5., 0.2) + + # red dashes, blue squares and green triangles + plt.plot(t, t, 'r--', t, t ** 2, 'bs', t, t ** 3, 'g^') + + fig = plt.gcf() # get the figure to show + return fig + +def PyplotFormatstr(): + + def f(t): + return np.exp(-t) * np.cos(2*np.pi*t) + + t1 = np.arange(0.0, 5.0, 0.1) + t2 = np.arange(0.0, 5.0, 0.02) + + plt.figure(1) + plt.subplot(211) + plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k') + + plt.subplot(212) + plt.plot(t2, np.cos(2*np.pi*t2), 'r--') + fig = plt.gcf() # get the figure to show + return fig + +def UnicodeMinus(): + import numpy as np + import matplotlib + import matplotlib.pyplot as plt + + # Fixing random state for reproducibility + np.random.seed(19680801) + + matplotlib.rcParams['axes.unicode_minus'] = False + fig, ax = plt.subplots() + ax.plot(10 * np.random.randn(100), 10 * np.random.randn(100), 'o') + ax.set_title('Using hyphen instead of Unicode minus') + return fig + +def Subplot3d(): + from mpl_toolkits.mplot3d.axes3d import Axes3D + from matplotlib import cm + # from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter + import matplotlib.pyplot as plt + import numpy as np + + fig = plt.figure() + + ax = fig.add_subplot(1, 2, 1, projection='3d') + X = np.arange(-5, 5, 0.25) + Y = np.arange(-5, 5, 0.25) + X, Y = np.meshgrid(X, Y) + R = np.sqrt(X ** 2 + Y ** 2) + Z = np.sin(R) + surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, + linewidth=0, antialiased=False) + ax.set_zlim3d(-1.01, 1.01) + + # ax.w_zaxis.set_major_locator(LinearLocator(10)) + # ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f')) + + fig.colorbar(surf, shrink=0.5, aspect=5) + + from mpl_toolkits.mplot3d.axes3d import get_test_data + ax = fig.add_subplot(1, 2, 2, projection='3d') + X, Y, Z = get_test_data(0.05) + ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) + return fig + +def PyplotScales(): + import numpy as np + import matplotlib.pyplot as plt + + from matplotlib.ticker import NullFormatter # useful for `logit` scale + + # Fixing random state for reproducibility + np.random.seed(19680801) + + # make up some data in the interval ]0, 1[ + y = np.random.normal(loc=0.5, scale=0.4, size=1000) + y = y[(y > 0) & (y < 1)] + y.sort() + x = np.arange(len(y)) + + # plot with various axes scales + plt.figure(1) + + # linear + plt.subplot(221) + plt.plot(x, y) + plt.yscale('linear') + plt.title('linear') + plt.grid(True) + + # log + plt.subplot(222) + plt.plot(x, y) + plt.yscale('log') + plt.title('log') + plt.grid(True) + + # symmetric log + plt.subplot(223) + plt.plot(x, y - y.mean()) + plt.yscale('symlog', linthreshy=0.01) + plt.title('symlog') + plt.grid(True) + + # logit + plt.subplot(224) + plt.plot(x, y) + plt.yscale('logit') + plt.title('logit') + plt.grid(True) + # Format the minor tick labels of the y-axis into empty strings with + # `NullFormatter`, to avoid cumbering the axis with too many labels. + plt.gca().yaxis.set_minor_formatter(NullFormatter()) + # Adjust the subplot layout, because the logit one may take more space + # than usual, due to y-tick labels like "1 - 10^{-3}" + plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, + wspace=0.35) + return plt.gcf() + + +def AxesGrid(): + import numpy as np + import matplotlib.pyplot as plt + from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes + + def get_demo_image(): + # prepare image + delta = 0.5 + + extent = (-3, 4, -4, 3) + x = np.arange(-3.0, 4.001, delta) + y = np.arange(-4.0, 3.001, delta) + X, Y = np.meshgrid(x, y) + Z1 = np.exp(-X ** 2 - Y ** 2) + Z2 = np.exp(-(X - 1) ** 2 - (Y - 1) ** 2) + Z = (Z1 - Z2) * 2 + + return Z, extent + + def get_rgb(): + Z, extent = get_demo_image() + + Z[Z < 0] = 0. + Z = Z / Z.max() + + R = Z[:13, :13] + G = Z[2:, 2:] + B = Z[:13, 2:] + + return R, G, B + + fig = plt.figure(1) + ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) + + r, g, b = get_rgb() + kwargs = dict(origin="lower", interpolation="nearest") + ax.imshow_rgb(r, g, b, **kwargs) + + ax.RGB.set_xlim(0., 9.5) + ax.RGB.set_ylim(0.9, 10.6) + + plt.draw() + return plt.gcf() + +def draw_figure(canvas, figure, loc=(0, 0)): + """ Draw a matplotlib figure onto a Tk canvas + + loc: location of top-left corner of figure on canvas in pixels. + + Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py + """ + figure_canvas_agg = FigureCanvasAgg(figure) + figure_canvas_agg.draw() + figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + # Position: convert from top-left anchor to center anchor + canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo) + + # Unfortunately, there's no accessor for the pointer to the native renderer + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + + # Return a handle which contains a reference to the photo object + # which must be kept live or else the picture disappears + return photo + +#------------------------------- PASTE YOUR MATPLOTLIB CODE HERE ------------------------------- + + +# -------------------------------- GUI Starts Here -------------------------------# +# fig = your figure you want to display. Assumption is that 'fig' holds the # +# information to display. # +# --------------------------------------------------------------------------------# + +fig_dict = {'Pyplot Simple':PyplotSimple, 'Pyplot Formatstr':PyplotFormatstr,'PyPlot Three':Subplot3d, + 'Unicode Minus': UnicodeMinus, 'Pyplot Scales' : PyplotScales, 'Axes Grid' : AxesGrid} + +figure_w, figure_h = 640,480 +canvas_elem = g.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on +# define the form layout +listbox_values = [key for key in fig_dict.keys()] +col_listbox = [[g.Listbox(values=listbox_values,size=(20,8), key='func')], + [g.ReadFormButton('Plot', pad=((50,0), 3))]] + +layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], + [g.Column(col_listbox), canvas_elem], + [g.Exit(pad=((50,0), 3), size=(4,2))]] + +# create the form and show it without the plot +form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') +form.Layout(layout) +form.Show(non_blocking=True) +form.NonBlocking = False + +# add the plot to the window +func = fig_dict['Pyplot Simple'] +while True: + fig = func() + fig_photo = draw_figure(canvas_elem.TKCanvas, fig) + + # show it all again and get buttons + button, values = form.Read() + if button is None or button is 'Exit': + break + + choice = values['func'][0] + + try: + func = fig_dict[choice] + except: + func = fig_dict['Pyplot Simple'] + From 28a38dcf869173bf9ac1183d20c55d68518654dc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 16:23:56 -0400 Subject: [PATCH 218/521] Made so that initially no graph is shown --- Demo_Matplotlib_Multiple.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index d56d46d92..a3d933f54 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -247,20 +247,15 @@ def draw_figure(canvas, figure, loc=(0, 0)): form.NonBlocking = False # add the plot to the window -func = fig_dict['Pyplot Simple'] while True: - fig = func() - fig_photo = draw_figure(canvas_elem.TKCanvas, fig) - - # show it all again and get buttons button, values = form.Read() + # show it all again and get buttons if button is None or button is 'Exit': break - choice = values['func'][0] - try: func = fig_dict[choice] except: func = fig_dict['Pyplot Simple'] - + fig = func() + fig_photo = draw_figure(canvas_elem.TKCanvas, fig) From 23bdd2664c19ace67f1bef84d092cc5ecf2c33dd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 20:41:34 -0400 Subject: [PATCH 219/521] Fixed clearing of background, many more plots --- Demo_Matplotlib_Multiple.py | 326 ++++++++++++++++++++++++++++++++++-- 1 file changed, 316 insertions(+), 10 deletions(-) diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index a3d933f54..59e84f80c 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -35,6 +35,307 @@ def PyplotSimple(): fig = plt.gcf() # get the figure to show return fig +def PyplotGGPlotSytleSheet(): + import numpy as np + import matplotlib.pyplot as plt + + plt.style.use('ggplot') + + # Fixing random state for reproducibility + np.random.seed(19680801) + + fig, axes = plt.subplots(ncols=2, nrows=2) + ax1, ax2, ax3, ax4 = axes.ravel() + + # scatter plot (Note: `plt.scatter` doesn't use default colors) + x, y = np.random.normal(size=(2, 200)) + ax1.plot(x, y, 'o') + + # sinusoidal lines with colors from default color cycle + L = 2 * np.pi + x = np.linspace(0, L) + ncolors = len(plt.rcParams['axes.prop_cycle']) + shift = np.linspace(0, L, ncolors, endpoint=False) + for s in shift: + ax2.plot(x, np.sin(x + s), '-') + ax2.margins(0) + + # bar graphs + x = np.arange(5) + y1, y2 = np.random.randint(1, 25, size=(2, 5)) + width = 0.25 + ax3.bar(x, y1, width) + ax3.bar(x + width, y2, width, + color=list(plt.rcParams['axes.prop_cycle'])[2]['color']) + ax3.set_xticks(x + width) + ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e']) + + # circles with colors from default color cycle + for i, color in enumerate(plt.rcParams['axes.prop_cycle']): + xy = np.random.normal(size=2) + ax4.add_patch(plt.Circle(xy, radius=0.3, color=color['color'])) + ax4.axis('equal') + ax4.margins(0) + fig = plt.gcf() # get the figure to show + return fig + +def PyplotBoxPlot(): + import numpy as np + import matplotlib.pyplot as plt + + # Fixing random state for reproducibility + np.random.seed(19680801) + + # fake up some data + spread = np.random.rand(50) * 100 + center = np.ones(25) * 50 + flier_high = np.random.rand(10) * 100 + 100 + flier_low = np.random.rand(10) * -100 + data = np.concatenate((spread, center, flier_high, flier_low), 0) + fig1, ax1 = plt.subplots() + ax1.set_title('Basic Plot') + ax1.boxplot(data) + return fig1 + +def PyplotRadarChart(): + import numpy as np + + import matplotlib.pyplot as plt + from matplotlib.path import Path + from matplotlib.spines import Spine + from matplotlib.projections.polar import PolarAxes + from matplotlib.projections import register_projection + + def radar_factory(num_vars, frame='circle'): + """Create a radar chart with `num_vars` axes. + + This function creates a RadarAxes projection and registers it. + + Parameters + ---------- + num_vars : int + Number of variables for radar chart. + frame : {'circle' | 'polygon'} + Shape of frame surrounding axes. + + """ + # calculate evenly-spaced axis angles + theta = np.linspace(0, 2 * np.pi, num_vars, endpoint=False) + + def draw_poly_patch(self): + # rotate theta such that the first axis is at the top + verts = unit_poly_verts(theta + np.pi / 2) + return plt.Polygon(verts, closed=True, edgecolor='k') + + def draw_circle_patch(self): + # unit circle centered on (0.5, 0.5) + return plt.Circle((0.5, 0.5), 0.5) + + patch_dict = {'polygon': draw_poly_patch, 'circle': draw_circle_patch} + if frame not in patch_dict: + raise ValueError('unknown value for `frame`: %s' % frame) + + class RadarAxes(PolarAxes): + + name = 'radar' + # use 1 line segment to connect specified points + RESOLUTION = 1 + # define draw_frame method + draw_patch = patch_dict[frame] + + def __init__(self, *args, **kwargs): + super(RadarAxes, self).__init__(*args, **kwargs) + # rotate plot such that the first axis is at the top + self.set_theta_zero_location('N') + + def fill(self, *args, **kwargs): + """Override fill so that line is closed by default""" + closed = kwargs.pop('closed', True) + return super(RadarAxes, self).fill(closed=closed, *args, **kwargs) + + def plot(self, *args, **kwargs): + """Override plot so that line is closed by default""" + lines = super(RadarAxes, self).plot(*args, **kwargs) + for line in lines: + self._close_line(line) + + def _close_line(self, line): + x, y = line.get_data() + # FIXME: markers at x[0], y[0] get doubled-up + if x[0] != x[-1]: + x = np.concatenate((x, [x[0]])) + y = np.concatenate((y, [y[0]])) + line.set_data(x, y) + + def set_varlabels(self, labels): + self.set_thetagrids(np.degrees(theta), labels) + + def _gen_axes_patch(self): + return self.draw_patch() + + def _gen_axes_spines(self): + if frame == 'circle': + return PolarAxes._gen_axes_spines(self) + # The following is a hack to get the spines (i.e. the axes frame) + # to draw correctly for a polygon frame. + + # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`. + spine_type = 'circle' + verts = unit_poly_verts(theta + np.pi / 2) + # close off polygon by repeating first vertex + verts.append(verts[0]) + path = Path(verts) + + spine = Spine(self, spine_type, path) + spine.set_transform(self.transAxes) + return {'polar': spine} + + register_projection(RadarAxes) + return theta + + def unit_poly_verts(theta): + """Return vertices of polygon for subplot axes. + + This polygon is circumscribed by a unit circle centered at (0.5, 0.5) + """ + x0, y0, r = [0.5] * 3 + verts = [(r * np.cos(t) + x0, r * np.sin(t) + y0) for t in theta] + return verts + + def example_data(): + # The following data is from the Denver Aerosol Sources and Health study. + # See doi:10.1016/j.atmosenv.2008.12.017 + # + # The data are pollution source profile estimates for five modeled + # pollution sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical + # species. The radar charts are experimented with here to see if we can + # nicely visualize how the modeled source profiles change across four + # scenarios: + # 1) No gas-phase species present, just seven particulate counts on + # Sulfate + # Nitrate + # Elemental Carbon (EC) + # Organic Carbon fraction 1 (OC) + # Organic Carbon fraction 2 (OC2) + # Organic Carbon fraction 3 (OC3) + # Pyrolized Organic Carbon (OP) + # 2)Inclusion of gas-phase specie carbon monoxide (CO) + # 3)Inclusion of gas-phase specie ozone (O3). + # 4)Inclusion of both gas-phase species is present... + data = [ + ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', 'O3'], + ('Basecase', [ + [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00], + [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00], + [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00], + [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00], + [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]]), + ('With CO', [ + [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00], + [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00], + [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00], + [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00], + [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]]), + ('With O3', [ + [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03], + [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00], + [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00], + [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95], + [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]]), + ('CO & O3', [ + [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01], + [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00], + [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00], + [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88], + [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]]) + ] + return data + + N = 9 + theta = radar_factory(N, frame='polygon') + + data = example_data() + spoke_labels = data.pop(0) + + fig, axes = plt.subplots(figsize=(9, 9), nrows=2, ncols=2, + subplot_kw=dict(projection='radar')) + fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05) + + colors = ['b', 'r', 'g', 'm', 'y'] + # Plot the four cases from the example data on separate axes + for ax, (title, case_data) in zip(axes.flatten(), data): + ax.set_rgrids([0.2, 0.4, 0.6, 0.8]) + ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1), + horizontalalignment='center', verticalalignment='center') + for d, color in zip(case_data, colors): + ax.plot(theta, d, color=color) + ax.fill(theta, d, facecolor=color, alpha=0.25) + ax.set_varlabels(spoke_labels) + + # add legend relative to top-left plot + ax = axes[0, 0] + labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5') + legend = ax.legend(labels, loc=(0.9, .95), + labelspacing=0.1, fontsize='small') + + fig.text(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios', + horizontalalignment='center', color='black', weight='bold', + size='large') + return fig + +def DifferentScales(): + import numpy as np + import matplotlib.pyplot as plt + + # Create some mock data + t = np.arange(0.01, 10.0, 0.01) + data1 = np.exp(t) + data2 = np.sin(2 * np.pi * t) + + fig, ax1 = plt.subplots() + + color = 'tab:red' + ax1.set_xlabel('time (s)') + ax1.set_ylabel('exp', color=color) + ax1.plot(t, data1, color=color) + ax1.tick_params(axis='y', labelcolor=color) + + ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis + + color = 'tab:blue' + ax2.set_ylabel('sin', color=color) # we already handled the x-label with ax1 + ax2.plot(t, data2, color=color) + ax2.tick_params(axis='y', labelcolor=color) + + fig.tight_layout() # otherwise the right y-label is slightly clipped + return fig + +def ExploringNormalizations(): + import matplotlib.pyplot as plt + import matplotlib.colors as mcolors + import numpy as np + from numpy.random import multivariate_normal + + data = np.vstack([ + multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000), + multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000) + ]) + + gammas = [0.8, 0.5, 0.3] + + fig, axes = plt.subplots(nrows=2, ncols=2) + + axes[0, 0].set_title('Linear normalization') + axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100) + + for ax, gamma in zip(axes.flat[1:], gammas): + ax.set_title(r'Power law $(\gamma=%1.1f)$' % gamma) + ax.hist2d(data[:, 0], data[:, 1], + bins=100, norm=mcolors.PowerNorm(gamma)) + + fig.tight_layout() + return fig + def PyplotFormatstr(): def f(t): @@ -195,6 +496,7 @@ def get_rgb(): plt.draw() return plt.gcf() +# The magic function that makes it possible.... glues together tkinter and pyplot using Canvas Widget def draw_figure(canvas, figure, loc=(0, 0)): """ Draw a matplotlib figure onto a Tk canvas @@ -218,8 +520,6 @@ def draw_figure(canvas, figure, loc=(0, 0)): # which must be kept live or else the picture disappears return photo -#------------------------------- PASTE YOUR MATPLOTLIB CODE HERE ------------------------------- - # -------------------------------- GUI Starts Here -------------------------------# # fig = your figure you want to display. Assumption is that 'fig' holds the # @@ -227,35 +527,41 @@ def draw_figure(canvas, figure, loc=(0, 0)): # --------------------------------------------------------------------------------# fig_dict = {'Pyplot Simple':PyplotSimple, 'Pyplot Formatstr':PyplotFormatstr,'PyPlot Three':Subplot3d, - 'Unicode Minus': UnicodeMinus, 'Pyplot Scales' : PyplotScales, 'Axes Grid' : AxesGrid} + 'Unicode Minus': UnicodeMinus, 'Pyplot Scales' : PyplotScales, 'Axes Grid' : AxesGrid, + 'Exploring Normalizations' : ExploringNormalizations, 'Different Scales' : DifferentScales, + 'Pyplot Box Plot' : PyplotBoxPlot, 'Pyplot ggplot Style Sheet' : PyplotGGPlotSytleSheet} figure_w, figure_h = 640,480 canvas_elem = g.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on # define the form layout listbox_values = [key for key in fig_dict.keys()] -col_listbox = [[g.Listbox(values=listbox_values,size=(20,8), key='func')], - [g.ReadFormButton('Plot', pad=((50,0), 3))]] +col_listbox = [[g.Listbox(values=listbox_values,size=(25,len(listbox_values)), key='func')], + [g.T(' '), g.ReadFormButton('Plot', size=(5,2)), g.Exit(size=(5,2))]] layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], - [g.Column(col_listbox), canvas_elem], - [g.Exit(pad=((50,0), 3), size=(4,2))]] + [g.Column(col_listbox), canvas_elem]] # create the form and show it without the plot form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) -form.Show(non_blocking=True) -form.NonBlocking = False -# add the plot to the window while True: button, values = form.Read() # show it all again and get buttons if button is None or button is 'Exit': break + if button is 'Clear': + canvas_elem.TKCanvas.delete(Tk.ALL) + continue + choice = values['func'][0] try: func = fig_dict[choice] except: func = fig_dict['Pyplot Simple'] + + plt.clf() fig = func() fig_photo = draw_figure(canvas_elem.TKCanvas, fig) + + From 1554679c20604ded41e7565b3e777f2dd6d4433c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 21:55:27 -0400 Subject: [PATCH 220/521] Added more plots --- Demo_Matplotlib_Multiple.py | 332 +++++++++++++++++++++++++++++++++++- 1 file changed, 329 insertions(+), 3 deletions(-) diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index 59e84f80c..fd4ae0eaa 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -35,6 +35,329 @@ def PyplotSimple(): fig = plt.gcf() # get the figure to show return fig +def PyplotHistogram(): + """ + ============================================================= + Demo of the histogram (hist) function with multiple data sets + ============================================================= + + Plot histogram with multiple sample sets and demonstrate: + + * Use of legend with multiple sample sets + * Stacked bars + * Step curve with no fill + * Data sets of different sample sizes + + Selecting different bin counts and sizes can significantly affect the + shape of a histogram. The Astropy docs have a great section on how to + select these parameters: + http://docs.astropy.org/en/stable/visualization/histogram.html + """ + + import numpy as np + import matplotlib.pyplot as plt + + np.random.seed(0) + + n_bins = 10 + x = np.random.randn(1000, 3) + + fig, axes = plt.subplots(nrows=2, ncols=2) + ax0, ax1, ax2, ax3 = axes.flatten() + + colors = ['red', 'tan', 'lime'] + ax0.hist(x, n_bins, normed=1, histtype='bar', color=colors, label=colors) + ax0.legend(prop={'size': 10}) + ax0.set_title('bars with legend') + + ax1.hist(x, n_bins, normed=1, histtype='bar', stacked=True) + ax1.set_title('stacked bar') + + ax2.hist(x, n_bins, histtype='step', stacked=True, fill=False) + ax2.set_title('stack step (unfilled)') + + # Make a multiple-histogram of data-sets with different length. + x_multi = [np.random.randn(n) for n in [10000, 5000, 2000]] + ax3.hist(x_multi, n_bins, histtype='bar') + ax3.set_title('different sample sizes') + + fig.tight_layout() + return fig + +def PyplotArtistBoxPlots(): + """ + ========================================= + Demo of artist customization in box plots + ========================================= + + This example demonstrates how to use the various kwargs + to fully customize box plots. The first figure demonstrates + how to remove and add individual components (note that the + mean is the only value not shown by default). The second + figure demonstrates how the styles of the artists can + be customized. It also demonstrates how to set the limit + of the whiskers to specific percentiles (lower right axes) + + A good general reference on boxplots and their history can be found + here: http://vita.had.co.nz/papers/boxplots.pdf + + """ + + import numpy as np + import matplotlib.pyplot as plt + + # fake data + np.random.seed(937) + data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) + labels = list('ABCD') + fs = 10 # fontsize + + # demonstrate how to toggle the display of different elements: + fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) + axes[0, 0].boxplot(data, labels=labels) + axes[0, 0].set_title('Default', fontsize=fs) + + axes[0, 1].boxplot(data, labels=labels, showmeans=True) + axes[0, 1].set_title('showmeans=True', fontsize=fs) + + axes[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True) + axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) + + axes[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False) + tufte_title = 'Tufte Style \n(showbox=False,\nshowcaps=False)' + axes[1, 0].set_title(tufte_title, fontsize=fs) + + axes[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000) + axes[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs) + + axes[1, 2].boxplot(data, labels=labels, showfliers=False) + axes[1, 2].set_title('showfliers=False', fontsize=fs) + + for ax in axes.flatten(): + ax.set_yscale('log') + ax.set_yticklabels([]) + + fig.subplots_adjust(hspace=0.4) + return fig + +def ArtistBoxplot2(): + + # fake data + np.random.seed(937) + data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) + labels = list('ABCD') + fs = 10 # fontsize + + # demonstrate how to customize the display different elements: + boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') + flierprops = dict(marker='o', markerfacecolor='green', markersize=12, + linestyle='none') + medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') + meanpointprops = dict(marker='D', markeredgecolor='black', + markerfacecolor='firebrick') + meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') + + fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) + axes[0, 0].boxplot(data, boxprops=boxprops) + axes[0, 0].set_title('Custom boxprops', fontsize=fs) + + axes[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops) + axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) + + axes[0, 2].boxplot(data, whis='range') + axes[0, 2].set_title('whis="range"', fontsize=fs) + + axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False, + showmeans=True) + axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) + + axes[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True, + showmeans=True) + axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) + + axes[1, 2].boxplot(data, whis=[15, 85]) + axes[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs) + + for ax in axes.flatten(): + ax.set_yscale('log') + ax.set_yticklabels([]) + + fig.suptitle("I never said they'd be pretty") + fig.subplots_adjust(hspace=0.4) + return fig + +def PyplotScatterWithLegend(): + import matplotlib.pyplot as plt + from numpy.random import rand + + fig, ax = plt.subplots() + for color in ['red', 'green', 'blue']: + n = 750 + x, y = rand(2, n) + scale = 200.0 * rand(n) + ax.scatter(x, y, c=color, s=scale, label=color, + alpha=0.3, edgecolors='none') + + ax.legend() + ax.grid(True) + return fig + +def PyplotLineStyles(): + """ + ========== + Linestyles + ========== + + This examples showcases different linestyles copying those of Tikz/PGF. + """ + import numpy as np + import matplotlib.pyplot as plt + from collections import OrderedDict + from matplotlib.transforms import blended_transform_factory + + linestyles = OrderedDict( + [('solid', (0, ())), + ('loosely dotted', (0, (1, 10))), + ('dotted', (0, (1, 5))), + ('densely dotted', (0, (1, 1))), + + ('loosely dashed', (0, (5, 10))), + ('dashed', (0, (5, 5))), + ('densely dashed', (0, (5, 1))), + + ('loosely dashdotted', (0, (3, 10, 1, 10))), + ('dashdotted', (0, (3, 5, 1, 5))), + ('densely dashdotted', (0, (3, 1, 1, 1))), + + ('loosely dashdotdotted', (0, (3, 10, 1, 10, 1, 10))), + ('dashdotdotted', (0, (3, 5, 1, 5, 1, 5))), + ('densely dashdotdotted', (0, (3, 1, 1, 1, 1, 1)))]) + + plt.figure(figsize=(10, 6)) + ax = plt.subplot(1, 1, 1) + + X, Y = np.linspace(0, 100, 10), np.zeros(10) + for i, (name, linestyle) in enumerate(linestyles.items()): + ax.plot(X, Y + i, linestyle=linestyle, linewidth=1.5, color='black') + + ax.set_ylim(-0.5, len(linestyles) - 0.5) + plt.yticks(np.arange(len(linestyles)), linestyles.keys()) + plt.xticks([]) + + # For each line style, add a text annotation with a small offset from + # the reference point (0 in Axes coords, y tick value in Data coords). + reference_transform = blended_transform_factory(ax.transAxes, ax.transData) + for i, (name, linestyle) in enumerate(linestyles.items()): + ax.annotate(str(linestyle), xy=(0.0, i), xycoords=reference_transform, + xytext=(-6, -12), textcoords='offset points', color="blue", + fontsize=8, ha="right", family="monospace") + + plt.tight_layout() + return plt.gcf() + +def PyplotLinePolyCollection(): + import matplotlib.pyplot as plt + from matplotlib import collections, colors, transforms + import numpy as np + + nverts = 50 + npts = 100 + + # Make some spirals + r = np.arange(nverts) + theta = np.linspace(0, 2 * np.pi, nverts) + xx = r * np.sin(theta) + yy = r * np.cos(theta) + spiral = np.column_stack([xx, yy]) + + # Fixing random state for reproducibility + rs = np.random.RandomState(19680801) + + # Make some offsets + xyo = rs.randn(npts, 2) + + # Make a list of colors cycling through the default series. + colors = [colors.to_rgba(c) + for c in plt.rcParams['axes.prop_cycle'].by_key()['color']] + + fig, axes = plt.subplots(2, 2) + fig.subplots_adjust(top=0.92, left=0.07, right=0.97, + hspace=0.3, wspace=0.3) + ((ax1, ax2), (ax3, ax4)) = axes # unpack the axes + + col = collections.LineCollection([spiral], offsets=xyo, + transOffset=ax1.transData) + trans = fig.dpi_scale_trans + transforms.Affine2D().scale(1.0 / 72.0) + col.set_transform(trans) # the points to pixels transform + # Note: the first argument to the collection initializer + # must be a list of sequences of x,y tuples; we have only + # one sequence, but we still have to put it in a list. + ax1.add_collection(col, autolim=True) + # autolim=True enables autoscaling. For collections with + # offsets like this, it is neither efficient nor accurate, + # but it is good enough to generate a plot that you can use + # as a starting point. If you know beforehand the range of + # x and y that you want to show, it is better to set them + # explicitly, leave out the autolim kwarg (or set it to False), + # and omit the 'ax1.autoscale_view()' call below. + + # Make a transform for the line segments such that their size is + # given in points: + col.set_color(colors) + + ax1.autoscale_view() # See comment above, after ax1.add_collection. + ax1.set_title('LineCollection using offsets') + + # The same data as above, but fill the curves. + col = collections.PolyCollection([spiral], offsets=xyo, + transOffset=ax2.transData) + trans = transforms.Affine2D().scale(fig.dpi / 72.0) + col.set_transform(trans) # the points to pixels transform + ax2.add_collection(col, autolim=True) + col.set_color(colors) + + ax2.autoscale_view() + ax2.set_title('PolyCollection using offsets') + + # 7-sided regular polygons + + col = collections.RegularPolyCollection( + 7, sizes=np.abs(xx) * 10.0, offsets=xyo, transOffset=ax3.transData) + trans = transforms.Affine2D().scale(fig.dpi / 72.0) + col.set_transform(trans) # the points to pixels transform + ax3.add_collection(col, autolim=True) + col.set_color(colors) + ax3.autoscale_view() + ax3.set_title('RegularPolyCollection using offsets') + + # Simulate a series of ocean current profiles, successively + # offset by 0.1 m/s so that they form what is sometimes called + # a "waterfall" plot or a "stagger" plot. + + nverts = 60 + ncurves = 20 + offs = (0.1, 0.0) + + yy = np.linspace(0, 2 * np.pi, nverts) + ym = np.max(yy) + xx = (0.2 + (ym - yy) / ym) ** 2 * np.cos(yy - 0.4) * 0.5 + segs = [] + for i in range(ncurves): + xxx = xx + 0.02 * rs.randn(nverts) + curve = np.column_stack([xxx, yy * 100]) + segs.append(curve) + + col = collections.LineCollection(segs, offsets=offs) + ax4.add_collection(col, autolim=True) + col.set_color(colors) + ax4.autoscale_view() + ax4.set_title('Successive data offsets') + ax4.set_xlabel('Zonal velocity component (m/s)') + ax4.set_ylabel('Depth (m)') + # Reverse the y-axis so depth increases downward + ax4.set_ylim(ax4.get_ylim()[::-1]) + return fig + def PyplotGGPlotSytleSheet(): import numpy as np import matplotlib.pyplot as plt @@ -529,13 +852,16 @@ def draw_figure(canvas, figure, loc=(0, 0)): fig_dict = {'Pyplot Simple':PyplotSimple, 'Pyplot Formatstr':PyplotFormatstr,'PyPlot Three':Subplot3d, 'Unicode Minus': UnicodeMinus, 'Pyplot Scales' : PyplotScales, 'Axes Grid' : AxesGrid, 'Exploring Normalizations' : ExploringNormalizations, 'Different Scales' : DifferentScales, - 'Pyplot Box Plot' : PyplotBoxPlot, 'Pyplot ggplot Style Sheet' : PyplotGGPlotSytleSheet} + 'Pyplot Box Plot' : PyplotBoxPlot, 'Pyplot ggplot Style Sheet' : PyplotGGPlotSytleSheet, + 'Pyplot Line Poly Collection' : PyplotLinePolyCollection, 'Pyplot Line Styles' : PyplotLineStyles, + 'Pyplot Scatter With Legend' :PyplotScatterWithLegend, 'Artist Customized Box Plots' : PyplotArtistBoxPlots, + 'Artist Customized Box Plots 2' : ArtistBoxplot2, 'Pyplot Histogram' : PyplotHistogram} -figure_w, figure_h = 640,480 +figure_w, figure_h = 650, 650 canvas_elem = g.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on # define the form layout listbox_values = [key for key in fig_dict.keys()] -col_listbox = [[g.Listbox(values=listbox_values,size=(25,len(listbox_values)), key='func')], +col_listbox = [[g.Listbox(values=listbox_values,size=(28,len(listbox_values)), key='func')], [g.T(' '), g.ReadFormButton('Plot', size=(5,2)), g.Exit(size=(5,2))]] layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], From f659d5b4191c42015aaf6d7312b83bde6f238d5b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 22:45:09 -0400 Subject: [PATCH 221/521] New layout shows SOURCE CODE in addition to plot --- Demo_Matplotlib_Multiple.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index fd4ae0eaa..2bf96ba18 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -4,6 +4,7 @@ from matplotlib.backends.backend_tkagg import FigureCanvasAgg import matplotlib.backends.tkagg as tkagg import tkinter as Tk +import inspect """ Demonstrates one way of embedding Matplotlib figures into a PySimpleGUI window. @@ -849,6 +850,9 @@ def draw_figure(canvas, figure, loc=(0, 0)): # information to display. # # --------------------------------------------------------------------------------# +print(inspect.getsource(PyplotSimple)) + + fig_dict = {'Pyplot Simple':PyplotSimple, 'Pyplot Formatstr':PyplotFormatstr,'PyPlot Three':Subplot3d, 'Unicode Minus': UnicodeMinus, 'Pyplot Scales' : PyplotScales, 'Axes Grid' : AxesGrid, 'Exploring Normalizations' : ExploringNormalizations, 'Different Scales' : DifferentScales, @@ -857,15 +861,18 @@ def draw_figure(canvas, figure, loc=(0, 0)): 'Pyplot Scatter With Legend' :PyplotScatterWithLegend, 'Artist Customized Box Plots' : PyplotArtistBoxPlots, 'Artist Customized Box Plots 2' : ArtistBoxplot2, 'Pyplot Histogram' : PyplotHistogram} + figure_w, figure_h = 650, 650 canvas_elem = g.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))) # define the form layout listbox_values = [key for key in fig_dict.keys()] col_listbox = [[g.Listbox(values=listbox_values,size=(28,len(listbox_values)), key='func')], [g.T(' '), g.ReadFormButton('Plot', size=(5,2)), g.Exit(size=(5,2))]] layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], - [g.Column(col_listbox), canvas_elem]] + [g.Column(col_listbox, pad=(5,(3,330))), canvas_elem, multiline_elem], + ] # create the form and show it without the plot form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') @@ -876,16 +883,14 @@ def draw_figure(canvas, figure, loc=(0, 0)): # show it all again and get buttons if button is None or button is 'Exit': break - if button is 'Clear': - canvas_elem.TKCanvas.delete(Tk.ALL) - continue - choice = values['func'][0] try: + choice = values['func'][0] func = fig_dict[choice] except: func = fig_dict['Pyplot Simple'] + multiline_elem.Update(inspect.getsource(func)) plt.clf() fig = func() fig_photo = draw_figure(canvas_elem.TKCanvas, fig) From bdf9f67be1658636ed7ca8fade118ffb5be28a4f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 27 Aug 2018 23:57:52 -0400 Subject: [PATCH 222/521] New feature - Listbox bind to button. Indicates that as soon as a selection is made, a button click is simulated. --- Demo_Matplotlib_Multiple.py | 4 +-- PySimpleGUI.py | 54 ++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index 2bf96ba18..518c3c3c0 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -867,8 +867,8 @@ def draw_figure(canvas, figure, loc=(0, 0)): multiline_elem = g.Multiline(size=(70,35),pad=(5,(3,90))) # define the form layout listbox_values = [key for key in fig_dict.keys()] -col_listbox = [[g.Listbox(values=listbox_values,size=(28,len(listbox_values)), key='func')], - [g.T(' '), g.ReadFormButton('Plot', size=(5,2)), g.Exit(size=(5,2))]] +col_listbox = [[g.Listbox(values=listbox_values, select_submits=True, size=(28,len(listbox_values)), key='func')], + [g.T(' '), g.ReadFormButton('Plot', bind_listbox_select=True, size=(5,2)), g.Exit(size=(5,2))]] layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], [g.Column(col_listbox, pad=(5,(3,330))), canvas_elem, multiline_elem], diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e371e23e7..7b9fe5049 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -188,14 +188,41 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.TextColor = text_color if text_color is not None else DEFAULT_ELEMENT_TEXT_COLOR self.Key = key # dictionary key for return values + def FindReturnKeyBoundButton(self, form): + for row in form.Rows: + for element in row: + if element.Type == ELEM_TYPE_BUTTON: + if element.BindReturnKey: + return element + if element.Type == ELEM_TYPE_COLUMN: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + return None + def ReturnKeyHandler(self, event): MyForm = self.ParentForm - # search through this form and find the first button that will exit the form - for row in MyForm.Rows: + button_element = self.FindReturnKeyBoundButton(MyForm) + if button_element is not None: + button_element.ButtonCallBack() + + def FindListboxBoundButton(self, form): + for row in form.Rows: for element in row: if element.Type == ELEM_TYPE_BUTTON: - if element.BindReturnKey: - element.ButtonCallBack() + if element.BindListboxSelect: + return element + if element.Type == ELEM_TYPE_COLUMN: + rc = self.FindListboxBoundButton(element) + if rc is not None: + return rc + return None + + def ListboxSelectHandler(self, event): + MyForm = self.ParentForm + button_element = self.FindListboxBoundButton(MyForm) + if button_element is not None: + button_element.ButtonCallBack() def __del__(self): try: @@ -280,7 +307,7 @@ def __del__(self): # Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, select_mode=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, select_mode=None, select_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Listbox Element :param values: @@ -292,6 +319,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non :param background_color: Color for Element. Text or RGB Hex ''' self.Values = values self.TKListbox = None + self.SelectSubmits = select_submits if select_mode == LISTBOX_SELECT_MODE_BROWSE: self.SelectMode = SELECT_MODE_BROWSE elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: @@ -304,6 +332,7 @@ def __init__(self, values, select_mode=None, scale=(None, None), size=(None, Non self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad) def Update(self, values): @@ -615,7 +644,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, bind_listbox_select=False, focus=False, pad=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -645,6 +674,7 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.UserData = None self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH self.BindReturnKey = bind_return_key + self.BindListboxSelect = bind_listbox_select self.Focus = focus super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad) return @@ -1314,8 +1344,8 @@ def SimpleButton(button_text, image_filename=None, image_size=(None, None), imag return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, bind_listbox_select=False, focus=False, pad=None): + return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, bind_listbox_select=bind_listbox_select, focus=focus, pad=pad) def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) @@ -1671,6 +1701,8 @@ def CharWidthInPixels(): element.TKListbox.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKListbox.configure(fg=text_color) + if element.SelectSubmits: + element.TKListbox.bind('<>', element.ListboxSelectHandler) vsb = tk.Scrollbar(listbox_frame, orient="vertical", command=element.TKListbox.yview) element.TKListbox.configure(yscrollcommand=vsb.set) element.TKListbox.pack(side=tk.LEFT) @@ -1786,6 +1818,8 @@ def CharWidthInPixels(): width, height = element_size if element.TKCanvas is None: element.TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + else: + element.TKCanvas.master = tk_row_frame if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKCanvas.configure(background=element.BackgroundColor) element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) @@ -2690,9 +2724,9 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( ############################################################## def ChangeLookAndFeel(index): # look and feel table - look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS':('#9FB8AD','#F7F3EC' )}, + look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, - 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')}, + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, From d4ee06353e94cf2b1fcda1ca2a7d9d4852243346 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 12:25:15 -0400 Subject: [PATCH 223/521] Big changes - Default button color now system default!! New default button size setting. Added padding to Output Element These are sizeable look and feel changes. All of the buttons will become a flat gray that matches the background. --- PySimpleGUI.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7b9fe5049..530a2a016 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -11,6 +11,7 @@ # ----====----====----==== Constants the user CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = '' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS +DEFAULT_BUTTON_ELEMENT_SIZE = (10,1) # In CHARACTERS DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels DEFAULT_AUTOSIZE_TEXT = True @@ -32,8 +33,8 @@ (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long -DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default -# DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default +DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_BACKGROUND_COLOR = None DEFAULT_ELEMENT_BACKGROUND_COLOR = None @@ -575,7 +576,7 @@ def __del__(self): # Scroll bar will span the length of the frame # # ---------------------------------------------------------------------- # class TKOutput(tk.Frame): - def __init__(self, parent, width, height, bd, background_color=None, text_color=None, font=None): + def __init__(self, parent, width, height, bd, background_color=None, text_color=None, font=None, pad=None): frame = tk.Frame(parent) tk.Frame.__init__(self, frame) self.output = tk.Text(frame, width=width, height=height, bd=bd, font=font) @@ -588,7 +589,7 @@ def __init__(self, parent, width, height, bd, background_color=None, text_color= self.output.configure(yscrollcommand=self.vsb.set) self.output.pack(side="left", fill="both") self.vsb.pack(side="left", fill="y") - frame.pack(side="left") + frame.pack(side="left", padx=pad[0], pady=pad[1]) self.previous_stdout = sys.stdout self.previous_stderr = sys.stderr @@ -971,12 +972,13 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title self.Rows = [] # a list of ELEMENTS for this row self.DefaultElementSize = default_element_size + self.DefaultButtonElementSize = default_button_element_size if default_button_element_size != (None, None) else DEFAULT_BUTTON_ELEMENT_SIZE self.Scale = scale self.Location = location self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR @@ -1522,19 +1524,21 @@ def CharWidthInPixels(): auto_size_text = toplevel_form.AutoSizeText else: auto_size_text = DEFAULT_AUTOSIZE_TEXT + element_type = element.Type + # Set foreground color + text_color = element.TextColor # Determine Element size element_size = element.Size - if (element_size == (None, None)): # user did not specify a size + if (element_size == (None, None) and element_type != ELEM_TYPE_BUTTON): # user did not specify a size element_size = toplevel_form.DefaultElementSize + elif (element_size == (None, None) and element_type == ELEM_TYPE_BUTTON): + element_size = toplevel_form.DefaultButtonElementSize else: auto_size_text = False # if user has specified a size then it shouldn't autosize # Apply scaling... Element scaling is higher priority than form level if element.Scale != (None, None): element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) elif toplevel_form.Scale != (None, None): element_size = (int(element_size[0] * toplevel_form.Scale[0]), int(element_size[1] * toplevel_form.Scale[1])) - # Set foreground color - text_color = element.TextColor - element_type = element.Type # ------------------------- COLUMN element ------------------------- # if element_type == ELEM_TYPE_COLUMN: col_frame = tk.Frame(tk_row_frame) @@ -1591,9 +1595,11 @@ def CharWidthInPixels(): if element.AutoSizeButton is not None: auto_size = element.AutoSizeButton else: auto_size = toplevel_form.AutoSizeButtons - if auto_size is False or element.Size[0] is not None: width=element_size[0] - else: width = 0 - height=element_size[1] + if auto_size is False or element.Size[0] is not None: + width, height = element_size + else: + width = 0 + height= toplevel_form.DefaultButtonElementSize[1] lines = btext.split('\n') max_line_len = max([len(l) for l in lines]) num_lines = len(lines) @@ -1792,7 +1798,7 @@ def CharWidthInPixels(): # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font) + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font, pad=element.Pad) element.TKOut.pack(side=tk.LEFT) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: @@ -2580,7 +2586,7 @@ def SetGlobalIcon(icon): # ============================== SetOptions =========# # Sets the icon to be used by default # # ===================================================# -def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=(None,None), +def SetOptions(icon=None, button_color=None, element_size=(None,None), button_element_size=(None, None), margins=(None,None), element_padding=(None,None),auto_size_text=None, auto_size_buttons=None, font=None, border_width=None, slider_border_width=None, slider_relief=None, slider_orientation=None, autoclose_time=None, message_box_line_width=None, @@ -2591,6 +2597,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( scrollbar_color=None, text_color=None, element_text_color = None, debug_win_size=(None,None), window_location=(None,None)): global DEFAULT_ELEMENT_SIZE + global DEFAULT_BUTTON_ELEMENT_SIZE global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels global DEFAULT_AUTOSIZE_TEXT @@ -2635,6 +2642,9 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=( if element_size != (None,None): DEFAULT_ELEMENT_SIZE = element_size + if button_element_size != (None,None): + DEFAULT_BUTTON_ELEMENT_SIZE = button_element_size + if margins != (None,None): DEFAULT_MARGINS = margins From 0aaa2fa0df3132f1c5c545af04e72e81a5a3e365 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 16:03:15 -0400 Subject: [PATCH 224/521] Rewrote parts of tutorial --- docs/tutorial.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index ab1e798b7..72e6f3be0 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,14 +1,19 @@ # Add GUIs to your programs and scripts easily with PySimpleGUI ## Introduction -Python has dropped the GUI ball. While the rest of the world has been enjoying the use of a mouse, most Python programs continue to be accessed via the command line. Why is this, does anybody care, and what can be done about it? +Few people run Python programs by double clicking the .py file as if it were a .exe file. When a typical user (non-programmer types) double clicks an exe file, they expect it to pop open with a window they can interact with. While GUIs, using tkinter, are possible using standard Python installations, it's unlikely many programs do this. + +What if it were easy so to open a Python program into a GUI that completely beginners could do it? Would anyone care? Would anyone use it? It's difficult to answer because to date it's not been "easy" to build a custom GUI. + +There seems to be a gap in the ability to add a GUI onto a Python program/script. Complete beginners are left using only the command line and many advanced programmers don't want to take the time required to code up a tkinter GUI. + ## GUI Frameworks There is no shortage of GUI frameworks for Python. tkinter, WxPython, Qt, Kivy are a few of the major packages. In addition, there are a good number of dumbed down GUI packages that wrap one of the major packages. These include EasyGUI, PyGUI, Pyforms, ... -The problem is that beginners (those with experience of less than 6 weeks) are not capable of learning even the simplest of the major packages. That leaves the wrapper-packages. Users will quickly find it difficult or impossible to build a custom GUI layout. Or, if it's possible, pages of code are still required. +The problem is that beginners (those with experience of less than 6 weeks) are not capable of learning even the simplest of the major packages. That leaves the wrapper-packages. Users will likely find it difficult or impossible to build a custom GUI layout. Or, if it's possible, pages of code are required. -PySimpleGUI attempts to address these GUI challenges by providing a super-simple, easy to understand interface to GUIs that can be customized easily. Even the most complex of GUIs are often less than 20 lines of code when PySimpleGUI is used. +PySimpleGUI attempts to address these GUI challenges by providing a super-simple, easy to understand interface to GUIs that can be easily customized. Even the most complex of GUIs are often less than 20 lines of code when PySimpleGUI is used. ## The Secret @@ -16,7 +21,7 @@ What makes PySimpleGUI superior for newcomers is that the package contains the m With most GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. -Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a form layout, it is configured in-place, not several lines of code away. +Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a form layout, it is configured in-place, not several lines of code away. Results are returned as a simple list or a dictionary. ## What is a GUI? @@ -254,6 +259,20 @@ Each parameter to the message box call is displayed on a new line. There are ac Take a moment and pair up the results values with the GUI to get an understanding of how results are created and returned. +## Adding a GUI to Your Program or Script +If you have a script that uses the command line, you don't have to abandon it in order to add a GUI. An easy solution is that if there are zero parameters given on the command line, then the GUI is run. Otherwise, execute the command line as you do today. + +This kind of logic is all that's needed: + + if len(sys.argv) == 1: + # collect arguments from GUI + else: + # collect arguements from sys.argv + +The easiest way to get a GUI up and running quickly is to copy and modify one of the Recipes from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) + +Have some fun! Spice up the scripts you're tired of running by hand. Spend 5 or 10 minutes playing with the demo scripts. You may find one already exists that does exactly what you need. If not, you will find it's 'simple' to create your own. If you really get lost, you've only invested 10 minutes. + ## Resources ### Installation @@ -270,4 +289,4 @@ Works on all systems that run tkinter, including the Raspberry Pi ### Home Page -www.PySimpleGUI.com +[www.PySimpleGUI.com](www.PySimpleGUI.com) \ No newline at end of file From 9eaf7f99e6e881af64226f8105f76e214eeb51d3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 16:06:17 -0400 Subject: [PATCH 225/521] Typo --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 72e6f3be0..6f790fa0c 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -3,7 +3,7 @@ ## Introduction Few people run Python programs by double clicking the .py file as if it were a .exe file. When a typical user (non-programmer types) double clicks an exe file, they expect it to pop open with a window they can interact with. While GUIs, using tkinter, are possible using standard Python installations, it's unlikely many programs do this. -What if it were easy so to open a Python program into a GUI that completely beginners could do it? Would anyone care? Would anyone use it? It's difficult to answer because to date it's not been "easy" to build a custom GUI. +What if it were easy so to open a Python program into a GUI that complete beginners could do it? Would anyone care? Would anyone use it? It's difficult to answer because to date it's not been "easy" to build a custom GUI. There seems to be a gap in the ability to add a GUI onto a Python program/script. Complete beginners are left using only the command line and many advanced programmers don't want to take the time required to code up a tkinter GUI. From fee2bd64325981c625b2f51e2bb2f4281627039e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 16:42:51 -0400 Subject: [PATCH 226/521] Listbox select return option - removed the bind_listbox_select option from Buttons. No longer signaling that way. --- Demo_Matplotlib_Multiple.py | 5 +++-- PySimpleGUI.py | 28 +++++++++------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index 518c3c3c0..07f2a1635 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -850,7 +850,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): # information to display. # # --------------------------------------------------------------------------------# -print(inspect.getsource(PyplotSimple)) +# print(inspect.getsource(PyplotSimple)) fig_dict = {'Pyplot Simple':PyplotSimple, 'Pyplot Formatstr':PyplotFormatstr,'PyPlot Three':Subplot3d, @@ -868,7 +868,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): # define the form layout listbox_values = [key for key in fig_dict.keys()] col_listbox = [[g.Listbox(values=listbox_values, select_submits=True, size=(28,len(listbox_values)), key='func')], - [g.T(' '), g.ReadFormButton('Plot', bind_listbox_select=True, size=(5,2)), g.Exit(size=(5,2))]] + [g.T(' '*12), g.Exit(size=(5,2))]] layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], [g.Column(col_listbox, pad=(5,(3,330))), canvas_elem, multiline_elem], @@ -880,6 +880,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): while True: button, values = form.Read() + print(button) # show it all again and get buttons if button is None or button is 'Exit': break diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 530a2a016..851ff2856 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -207,23 +207,15 @@ def ReturnKeyHandler(self, event): if button_element is not None: button_element.ButtonCallBack() - def FindListboxBoundButton(self, form): - for row in form.Rows: - for element in row: - if element.Type == ELEM_TYPE_BUTTON: - if element.BindListboxSelect: - return element - if element.Type == ELEM_TYPE_COLUMN: - rc = self.FindListboxBoundButton(element) - if rc is not None: - return rc - return None def ListboxSelectHandler(self, event): MyForm = self.ParentForm - button_element = self.FindListboxBoundButton(MyForm) - if button_element is not None: - button_element.ButtonCallBack() + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + def __del__(self): try: @@ -645,7 +637,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, bind_listbox_select=False, focus=False, pad=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -675,7 +667,6 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.UserData = None self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH self.BindReturnKey = bind_return_key - self.BindListboxSelect = bind_listbox_select self.Focus = focus super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad) return @@ -742,7 +733,6 @@ def ButtonCallBack(self): elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE # first, get the results table built # modify the Results table in the parent FlexForm object - r,c = self.Position self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop @@ -1347,7 +1337,7 @@ def SimpleButton(button_text, image_filename=None, image_size=(None, None), imag # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, bind_listbox_select=False, focus=False, pad=None): - return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, bind_listbox_select=bind_listbox_select, focus=focus, pad=pad) + return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) @@ -1399,7 +1389,7 @@ def BuildResults(form, initialize_only, top_level_form): return form.ReturnValues def BuildResultsForSubform(form, initialize_only, top_level_form): - button_pressed_text = None + button_pressed_text = top_level_form.LastButtonClicked for row_num,row in enumerate(form.Rows): for col_num, element in enumerate(row): value = None From b11eeae7efa7bf308a076b21ababe0505be5e58b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 19:02:02 -0400 Subject: [PATCH 227/521] FlexForm.Refresh method, Open() - new button shortcut function --- PySimpleGUI.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 851ff2856..4438b7db4 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1116,7 +1116,6 @@ def Read(self): else: return self.ReturnValues - def ReadNonBlocking(self, Message=''): if self.TKrootDestroyed: return None, None @@ -1132,6 +1131,15 @@ def ReadNonBlocking(self, Message=''): # return None, None return BuildResults(self, False, self) + def Refresh(self): + if self.TKrootDestroyed: + return + try: + rc = self.TKroot.update() + except: + pass + + def GetScreenDimensions(self): if self.TKrootDestroyed: return None, None @@ -1302,6 +1310,10 @@ def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_bu def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +# ------------------------- OPEN BUTTON Element lazy function ------------------------- # +def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) + # ------------------------- OK BUTTON Element lazy function ------------------------- # def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None): return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) @@ -1336,7 +1348,7 @@ def SimpleButton(button_text, image_filename=None, image_size=(None, None), imag return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, bind_listbox_select=False, focus=False, pad=None): +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): From 3c5b1d25524f3c0678b06768b6ac58bd2cab09e3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 19:46:27 -0400 Subject: [PATCH 228/521] Quickly add GUI to script Recipe --- Demo_Script_Parameters.py | 25 +++++++++++++++++++++++++ docs/cookbook.md | 22 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Demo_Script_Parameters.py diff --git a/Demo_Script_Parameters.py b/Demo_Script_Parameters.py new file mode 100644 index 000000000..aa16c0658 --- /dev/null +++ b/Demo_Script_Parameters.py @@ -0,0 +1,25 @@ +import PySimpleGUI as sg +import sys + +''' +Quickly add a GUI to your script! + +This simple script shows a 1-line-GUI addition to a typical Python command line script. + +Previously this script accepted 1 parameter on the command line. When executed, that +parameter is read into the variable fname. + +The 1-line-GUI shows a form that allows the user to browse to find the filename. The GUI +stores the result in the variable fname, just like the command line parsing did. +''' + +if len(sys.argv) == 1: + button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) +else: + fname = sys.argv[1] + +if not fname: + sg.MsgBox("Cancel", "No filename supplied") + raise SystemExit("Cancelling: no filename supplied") diff --git a/docs/cookbook.md b/docs/cookbook.md index 871ca1978..976ac6dd3 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -66,6 +66,28 @@ Browse for a filename that is populated into the input field. print(button, source_filename) -------------------------- +## Add GUI to Front-End of Script +Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. + + import PySimpleGUI as sg + import sys + + if len(sys.argv) == 1: + button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) + else: + fname = sys.argv[1] + + if not fname: + sg.MsgBox("Cancel", "No filename supplied") + raise SystemExit("Cancelling: no filename supplied") + + +![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) + +-------------- + ## Compare 2 Files Browse to get 2 file names that can be then compared. Uses a context manager From f5d86d2fa227784b891a47318831a817ceec6a9e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 19:48:16 -0400 Subject: [PATCH 229/521] Formatting --- docs/cookbook.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 976ac6dd3..44453e27b 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -69,6 +69,9 @@ Browse for a filename that is populated into the input field. ## Add GUI to Front-End of Script Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. +![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) + + import PySimpleGUI as sg import sys @@ -84,7 +87,7 @@ Quickly add a GUI allowing the user to browse for a filename if a filename is no raise SystemExit("Cancelling: no filename supplied") -![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) + -------------- From 01e7fd65fa849ab2cde00e618453ce1c991d3d5b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 20:07:17 -0400 Subject: [PATCH 230/521] Button color is system default for Mac platform ONLY, otherwise blue Hated the gray buttons on windows so made the change so only the Mac platform uses the gray buttons --- PySimpleGUI.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4438b7db4..53a91ae48 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -6,6 +6,7 @@ import tkinter.font import datetime import sys +from sys import platform import textwrap # ----====----====----==== Constants the user CAN safely change ====----====----====----# @@ -33,8 +34,10 @@ (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long -# DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default -DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default +if sys.platform is 'darwin': + DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default +else: + DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_BACKGROUND_COLOR = None DEFAULT_ELEMENT_BACKGROUND_COLOR = None @@ -1866,7 +1869,7 @@ def CharWidthInPixels(): # done with row, pack the row of widgets tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) - if form.BackgroundColor is not None: + if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: tk_row_frame.configure(background=form.BackgroundColor) if not toplevel_form.IsTabbedForm: toplevel_form.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) @@ -1973,7 +1976,7 @@ def StartupTK(my_flex_form): ow = _my_windows.NumOpenWindows # print('Starting TK open Windows = {}'.format(ow)) root = tk.Tk() if not ow else tk.Toplevel() - if my_flex_form.BackgroundColor is not None: + if my_flex_form.BackgroundColor is not None and my_flex_form.BackgroundColor != COLOR_SYSTEM_DEFAULT: root.configure(background=my_flex_form.BackgroundColor) _my_windows.Increment() From 9b286bb05094ddc38b53c5f027da7193ab5bc526 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 21:05:11 -0400 Subject: [PATCH 231/521] Delete multiline input when doing an "Update", History added to HowDoI using up/down keys --- Demo_HowDoI.py | 47 +++++++++++++++++++++++++++++++++-------------- PySimpleGUI.py | 2 +- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index 2d260e8b6..a7870dc2a 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,6 +1,6 @@ import PySimpleGUI as sg import subprocess -import howdoi + # Test this command in a dos window if you are having trouble. HOW_DO_I_COMMAND = 'python -m howdoi.howdoi -n 2' @@ -17,27 +17,46 @@ def HowDoI(): :return: never returns ''' # ------- Make a new FlexForm ------- # - # Set system-wide options that will affect all future forms. Give our form a spiffy look and feel - sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white', '#475841')) - form = sg.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) + sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors + + form = sg.FlexForm('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, 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) + layout = [ [sg.Text('Ask and your answer will appear here....', size=(40, 1))], - [sg.Output(size=(88, 20))], - [ sg.Spin(values=(1, 2, 3, 4), initial_value=1, size=(2, 1), key='Num Answers'), sg.T('Num Answers'), sg.Checkbox('Display Full Text', key='full text')], - [sg.Multiline(size=(85, 5), enter_submits=True, key='query'), + [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')], + [multiline_elem, 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]))] ] form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # + command_history = [] + history_offset = 0 while True: (button, value) = form.Read() - - if button == 'SEND': - QueryHowDoI(value['query'], value['Num Answers'], value['full text']) # send string without carriage return on end - else: + if button is 'SEND': + query = value['query'].rstrip() + QueryHowDoI(query, value['Num Answers'], value['full text']) # send the string to HowDoI + command_history.append(query) + history_offset = len(command_history) + multiline_elem.Update('') # manually clear input because keyboard events blocks clear + elif button is None or button is 'EXIT': break # exit button clicked - + elif 'Up' in button: + history_offset -= 1 * (history_offset > 0) # decrement is not zero + command = command_history[history_offset] + multiline_elem.Update(command) + elif 'Down' in button: + history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list + if history_offset >= len(command_history): + history_offset = len(command_history)-1 + command = command_history[history_offset] + multiline_elem.Update(command) + elif 'Escape' in button: + multiline_elem.Update('') # manually clear input because keyboard events blocks clear exit(69) def QueryHowDoI(Query, num_answers, full_text): @@ -51,8 +70,8 @@ def QueryHowDoI(Query, num_answers, full_text): full_text_option = ' -a' if full_text else '' t = subprocess.Popen(howdoi_command + ' '+ Query + ' -n ' + str(num_answers)+full_text_option, stdout=subprocess.PIPE) (output, err) = t.communicate() - print('You asked: '+ Query) - print('_______________________________________') + print('{:^88}'.format(Query.rstrip())) + print('_'*60) print(output.decode("utf-8") ) exit_code = t.wait() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 53a91ae48..3244b1e73 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -6,7 +6,6 @@ import tkinter.font import datetime import sys -from sys import platform import textwrap # ----====----====----==== Constants the user CAN safely change ====----====----====----# @@ -471,6 +470,7 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s return def Update(self, NewValue): + self.TKText.delete('1.0', tk.END) self.TKText.insert(1.0, NewValue) def Get(self): From fe8b9222921598af801a7e33f58a09380dd19342 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 28 Aug 2018 21:08:25 -0400 Subject: [PATCH 232/521] HowDoI tweak --- Demo_HowDoI.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index a7870dc2a..405d27b22 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -3,7 +3,7 @@ # Test this command in a dos window if you are having trouble. -HOW_DO_I_COMMAND = 'python -m howdoi.howdoi -n 2' +HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' # if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' @@ -43,20 +43,21 @@ def HowDoI(): command_history.append(query) history_offset = len(command_history) multiline_elem.Update('') # manually clear input because keyboard events blocks clear - elif button is None or button is 'EXIT': - break # exit button clicked - elif 'Up' in button: + elif button is None or button is 'EXIT': # if exit button or closed using X + break + elif 'Up' in button: # scroll back in history history_offset -= 1 * (history_offset > 0) # decrement is not zero command = command_history[history_offset] multiline_elem.Update(command) - elif 'Down' in button: + elif 'Down' in button: # scroll forward in history history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list if history_offset >= len(command_history): history_offset = len(command_history)-1 command = command_history[history_offset] multiline_elem.Update(command) - elif 'Escape' in button: - multiline_elem.Update('') # manually clear input because keyboard events blocks clear + elif 'Escape' in button: # clear currently line + multiline_elem.Update('') + exit(69) def QueryHowDoI(Query, num_answers, full_text): From bf4b9ffc0c02b45b6659b5170edf3fa1c2613be3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 09:10:19 -0400 Subject: [PATCH 233/521] New Demo program - Chat with scrollable command history --- Demo_Chat.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Demo_Chat.py diff --git a/Demo_Chat.py b/Demo_Chat.py new file mode 100644 index 000000000..99d3df497 --- /dev/null +++ b/Demo_Chat.py @@ -0,0 +1,60 @@ +import PySimpleGUI as sg + +''' +A chatbot with history +Scroll up and down through prior commands using the arrow keys +Special keyboard keys: + Up arrow - scroll up in commands + Down arrow - scroll down in commands + Escape - clear current command + Control C - exit form +''' + +def ChatBotWithHistory(): + # ------- Make a new FlexForm ------- # + sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors + + 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 = [ + [sg.Text('Your output will go here', size=(40, 1))], + [sg.Output(size=(127, 30), font=('Helvetica 10'))], + [sg.T('Command History'), history_elem], + [multiline_elem, + 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]))] + ] + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + command_history = [] + history_offset = 0 + while True: + (button, value) = form.Read() + if button is 'SEND': + query = value['query'].rstrip() + # EXECUTE YOUR COMMAND HERE + print('The command you entered was {}'.format(query)) + command_history.append(query) + history_offset = len(command_history)-1 + multiline_elem.Update('') # manually clear input because keyboard events blocks clear + history_elem.Update('\n'.join(command_history[-3:])) + elif button is None or button is 'EXIT' or 'c:67' in button: # quit if exit button, X, or control C + break + elif 'Up' in button and len(command_history): + command = command_history[history_offset] + history_offset -= 1 * (history_offset > 0) # decrement is not zero + multiline_elem.Update(command) + elif 'Down' in button and len(command_history): + history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list + command = command_history[history_offset] + multiline_elem.Update(command) + elif 'Escape' in button: + multiline_elem.Update('') + + exit(69) + + +ChatBotWithHistory() From 292ba9754e8c76c5b03e6fe2393cff3163c254eb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 10:28:03 -0400 Subject: [PATCH 234/521] Demo updates, readme update --- Demo_Keyboard.py | 4 +- Demo_Matplotlib_Animated_Scatter.py | 62 ++++++++++++++++ Demo_Matplotlib_Multiple.py | 4 +- docs/index.md | 109 ++++++++++++++++++++++++---- readme.md | 109 ++++++++++++++++++++++++---- 5 files changed, 258 insertions(+), 30 deletions(-) create mode 100644 Demo_Matplotlib_Animated_Scatter.py diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index 88c5fc5dc..a2ac060cb 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -12,11 +12,13 @@ form.Layout(layout) # ---===--- Loop taking in user input --- # while True: - button, value = form.ReadNonBlocking() + button, value = form.Read() if button == "OK" or (button is None and value is None): print(button, "exiting") break + if len(button) == 1: + text_elem.Update(new_value='%s - %s'%(button, ord(button))) if button is not None: text_elem.Update(button) diff --git a/Demo_Matplotlib_Animated_Scatter.py b/Demo_Matplotlib_Animated_Scatter.py new file mode 100644 index 000000000..53f0e5802 --- /dev/null +++ b/Demo_Matplotlib_Animated_Scatter.py @@ -0,0 +1,62 @@ +from random import randint +import PySimpleGUI as g +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg +from matplotlib.figure import Figure +import matplotlib.backends.tkagg as tkagg +import tkinter as tk + + +def main(): + canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + # define the form layout + layout = [[g.Text('Animated Matplotlib', size=(40,1), justification='center', font='Helvetica 20')], + [canvas_elem], + [g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + canvas = canvas_elem.TKCanvas + + while True: + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + exit(69) + + def PyplotScatterWithLegend(): + import matplotlib.pyplot as plt + from numpy.random import rand + + fig, ax = plt.subplots() + for color in ['red', 'green', 'blue']: + n = 750 + x, y = rand(2, n) + scale = 200.0 * rand(n) + ax.scatter(x, y, c=color, s=scale, label=color, + alpha=0.3, edgecolors='none') + + ax.legend() + ax.grid(True) + return fig + + fig = PyplotScatterWithLegend() + + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640/2, 480/2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + # Unfortunately, there's no accessor for the pointer to the native renderer + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + + # time.sleep(.1) + + +if __name__ == '__main__': + main() diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Multiple.py index 07f2a1635..2cf3baeeb 100644 --- a/Demo_Matplotlib_Multiple.py +++ b/Demo_Matplotlib_Multiple.py @@ -862,6 +862,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): 'Artist Customized Box Plots 2' : ArtistBoxplot2, 'Pyplot Histogram' : PyplotHistogram} +g.ChangeLookAndFeel('LightGreen') figure_w, figure_h = 650, 650 canvas_elem = g.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))) @@ -889,7 +890,8 @@ def draw_figure(canvas, figure, loc=(0, 0)): choice = values['func'][0] func = fig_dict[choice] except: - func = fig_dict['Pyplot Simple'] + pass + # func = fig_dict['Pyplot Simple'] multiline_elem.Update(inspect.getsource(func)) plt.clf() diff --git a/docs/index.md b/docs/index.md index 5745ef057..886e60b11 100644 --- a/docs/index.md +++ b/docs/index.md @@ -73,15 +73,13 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and `PySimpleGUI` is that in addition to getting the simple Message Boxes you also get the ability to **make your own forms** that are highly customizeable. Don't like the standard Message Box? Then make your own! +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Don't like the standard Message Box? Then replace it with your own GUI! -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. -The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? +The `PySimpleGUI` package is focused on the ***developer***. Create a custom GUI with as little and as simple code as possible. This was the primary mantra used to create PySimpleGUI. "Do it in a Python-like way" was the second desired outcome. ## Features @@ -117,6 +115,7 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Group widgets into a column and place into form anywhere Keyboard low-level key capture Mouse scroll-wheel support + Get Listbox values as they are selected Update elements in a visible form @@ -1675,24 +1674,106 @@ Note the `else` statement on the for loop. This is needed because we're about t That's it... this example follows the async design pattern well. +## Keyboard & Mouse Capture +Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call return_keyboard_events that is set to True in order to get keys returned along with buttons. +Keys and scroll-wheel events are returned in exactly the same way as buttons. -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: +For scroll-wheel events, if the mouse is scrolled up, then the `button` text will be `MouseWheel:Up`. For downward scrolling, the text returned is `MouseWheel:Down` + +Keyboard keys return 2 types of key events. For "normal" keys (a,b,c, etc), a single character is returned that represents that key. Modifier and special keys are returned as a string with 2 parts: + + Key Sym:Key Code -`Demo_Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. Start here! +Key Sym is a string such as 'Control_L'. The Key Code is a numeric representation of that key. The left control key, when pressed will return the value 'Control_L:17' -`Demo_Compare_Files` - Takes 2 filenames as input. Does a byte for byte compare and returns the results. + import PySimpleGUI as sg + + # Recipe for getting keys, one at a time as they are released + # If want to use the space bar, then be sure and disable the "default focus" + + with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], + [text_elem], + [sg.SimpleButton("OK")]] - `Demo_Dictionary` - Simple form demonstrating how return values in dictionary form work. + form.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = form.ReadNonBlocking() - `Demo_DisplayHash1and256` - Presents 3 methods of gathering the same user input using both high-level APIs and lower-level. + if button == "OK" or (button is None and value is None): + print(button, "exiting") + break + if button is not None: + text_elem.Update(button) -Demo_Func_Callback_Simulation - Shows how callback functions can be simulated. This is particularly good for the Raspberry Pi and other embedded type applications. +You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. -`Demo_DuplicateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning +### Realtime Keyboard Capture +Use realtime keyboard capture by calling + + import PySimpleGUI as sg + + with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + layout = [[sg.Text("Hold down a key")], + [sg.SimpleButton("OK")]] + + form.Layout(layout) + + while True: + button, value = form.ReadNonBlocking() + + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + print(button) + elif value is None: + break + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -`Demo_HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program **could forever change how you code**. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up and release as a standalone application, then speak up on the GitHub! + **Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form + **Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form + **Demo_Chat.py** - A chat window with scrollable history + **Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project + **Demo_Color.py** - How to interact with color using RGB hex values and named colors + **Demo_Columns.py** - Using the Column Element to create more complex forms + **Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility + **Demo_Dictionary.py** - Specifying and using return values in dictionary format + **Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility + **Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. + **Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. + **Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors + **Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. + **Demo_Keyboard.py** - Using blocking keyboard events + **Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events + **Demo_Machine_Learning.py** - A sample Machine Learning front end + **Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph + **Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph + **Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph + **Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method + **Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices + **Demo_NonBlocking_Form.py** - a basic async form + **Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate + **Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons + **Demo_PNG_Vierwer.p**y - Uses Image Element to display PNG files + **Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) + **Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts + **Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts + **Demo_Tabbed_Form.py** - Using the Tab feature + + ## Packages Used In Demos + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: + * [Chatterbot](https://github.com/gunthercox/ChatterBot) + * [Mido](https://github.com/olemb/mido) + * [Matplotlib](https://matplotlib.org/) + * [PyMuPDF](https://github.com/rk700/PyMuPDF) ## Fun Stuff Here are some things to try if you're bored or want to further customize diff --git a/readme.md b/readme.md index 5745ef057..886e60b11 100644 --- a/readme.md +++ b/readme.md @@ -73,15 +73,13 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited. The primary difference between these and `PySimpleGUI` is that in addition to getting the simple Message Boxes you also get the ability to **make your own forms** that are highly customizeable. Don't like the standard Message Box? Then make your own! +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Don't like the standard Message Box? Then replace it with your own GUI! -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. - -GUI Packages with more functionality, like QT and WxPython, require configuring and can take a ***week*** to get *reasonably familiar* with the interfaces. Clearly there needs to be a middle ground between forms with 1 or two input fields and a full-blown GUI. You'll be making your own custom forms with PySimpleGUI within minutes, even Async forms. +Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. -The `PySimpleGUI` package is focused on the ***developer***. How can the desired result be achieved in as little and as simple code as possible? This was the mantra used to create PySimpleGUI. How can it be done is a Python-like way? +The `PySimpleGUI` package is focused on the ***developer***. Create a custom GUI with as little and as simple code as possible. This was the primary mantra used to create PySimpleGUI. "Do it in a Python-like way" was the second desired outcome. ## Features @@ -117,6 +115,7 @@ The `PySimpleGUI` package is focused on the ***developer***. How can the desire Group widgets into a column and place into form anywhere Keyboard low-level key capture Mouse scroll-wheel support + Get Listbox values as they are selected Update elements in a visible form @@ -1675,24 +1674,106 @@ Note the `else` statement on the for loop. This is needed because we're about t That's it... this example follows the async design pattern well. +## Keyboard & Mouse Capture +Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call return_keyboard_events that is set to True in order to get keys returned along with buttons. +Keys and scroll-wheel events are returned in exactly the same way as buttons. -## Sample Applications -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: +For scroll-wheel events, if the mouse is scrolled up, then the `button` text will be `MouseWheel:Up`. For downward scrolling, the text returned is `MouseWheel:Down` + +Keyboard keys return 2 types of key events. For "normal" keys (a,b,c, etc), a single character is returned that represents that key. Modifier and special keys are returned as a string with 2 parts: + + Key Sym:Key Code -`Demo_Recipes.py` - Sample forms for all major form types and situations. This is the place to get your code template from. Includes asynchronous forms, etc. Start here! +Key Sym is a string such as 'Control_L'. The Key Code is a numeric representation of that key. The left control key, when pressed will return the value 'Control_L:17' -`Demo_Compare_Files` - Takes 2 filenames as input. Does a byte for byte compare and returns the results. + import PySimpleGUI as sg + + # Recipe for getting keys, one at a time as they are released + # If want to use the space bar, then be sure and disable the "default focus" + + with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], + [text_elem], + [sg.SimpleButton("OK")]] - `Demo_Dictionary` - Simple form demonstrating how return values in dictionary form work. + form.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = form.ReadNonBlocking() - `Demo_DisplayHash1and256` - Presents 3 methods of gathering the same user input using both high-level APIs and lower-level. + if button == "OK" or (button is None and value is None): + print(button, "exiting") + break + if button is not None: + text_elem.Update(button) -Demo_Func_Callback_Simulation - Shows how callback functions can be simulated. This is particularly good for the Raspberry Pi and other embedded type applications. +You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. -`Demo_DuplicateFileFinder.py` - Demonstrates High Level API to get a folder & Easy Progress Meter to show progress of the file scanning +### Realtime Keyboard Capture +Use realtime keyboard capture by calling + + import PySimpleGUI as sg + + with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + layout = [[sg.Text("Hold down a key")], + [sg.SimpleButton("OK")]] + + form.Layout(layout) + + while True: + button, value = form.ReadNonBlocking() + + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + print(button) + elif value is None: + break + + + +## Sample Applications +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -`Demo_HowDoI.py` - An amazing little application. Acts as a front-end to HowDoI. This one program **could forever change how you code**. It does searches on Stack Overflow and returns the CODE found in the best answer for your query. If anyone wants to help me package this application up and release as a standalone application, then speak up on the GitHub! + **Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form + **Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form + **Demo_Chat.py** - A chat window with scrollable history + **Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project + **Demo_Color.py** - How to interact with color using RGB hex values and named colors + **Demo_Columns.py** - Using the Column Element to create more complex forms + **Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility + **Demo_Dictionary.py** - Specifying and using return values in dictionary format + **Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility + **Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. + **Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. + **Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors + **Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. + **Demo_Keyboard.py** - Using blocking keyboard events + **Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events + **Demo_Machine_Learning.py** - A sample Machine Learning front end + **Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph + **Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph + **Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph + **Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method + **Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices + **Demo_NonBlocking_Form.py** - a basic async form + **Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate + **Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons + **Demo_PNG_Vierwer.p**y - Uses Image Element to display PNG files + **Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) + **Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts + **Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts + **Demo_Tabbed_Form.py** - Using the Tab feature + + ## Packages Used In Demos + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: + * [Chatterbot](https://github.com/gunthercox/ChatterBot) + * [Mido](https://github.com/olemb/mido) + * [Matplotlib](https://matplotlib.org/) + * [PyMuPDF](https://github.com/rk700/PyMuPDF) ## Fun Stuff Here are some things to try if you're bored or want to further customize From 8098867836df50ecfe8a5fc4ed5b9c368765530a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 11:04:17 -0400 Subject: [PATCH 235/521] Readme update --- docs/index.md | 66 ++++++++++++++++++++++++++------------------------- readme.md | 66 ++++++++++++++++++++++++++------------------------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/docs/index.md b/docs/index.md index 886e60b11..179e66158 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ - +readme.md ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) @@ -1738,37 +1738,39 @@ Use realtime keyboard capture by calling ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - **Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form - **Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form - **Demo_Chat.py** - A chat window with scrollable history - **Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project - **Demo_Color.py** - How to interact with color using RGB hex values and named colors - **Demo_Columns.py** - Using the Column Element to create more complex forms - **Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility - **Demo_Dictionary.py** - Specifying and using return values in dictionary format - **Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility - **Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. - **Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. - **Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors - **Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. - **Demo_Keyboard.py** - Using blocking keyboard events - **Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events - **Demo_Machine_Learning.py** - A sample Machine Learning front end - **Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph - **Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph - **Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph - **Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method - **Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices - **Demo_NonBlocking_Form.py** - a basic async form - **Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate - **Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons - **Demo_PNG_Vierwer.p**y - Uses Image Element to display PNG files - **Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) - **Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts - **Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts - **Demo_Tabbed_Form.py** - Using the Tab feature - - ## Packages Used In Demos +**Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form +**Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form +**Demo_Chat.py** - A chat window with scrollable history +**Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project +**Demo_Color.py** - How to interact with color using RGB hex values and named colors +**Demo_Columns.py** - Using the Column Element to create more complex forms +**Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility +**Demo_Dictionary.py** - Specifying and using return values in dictionary format +**Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility +**Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. +**Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. +**Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors +**Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. +**Demo_Keyboard.py** - Using blocking keyboard events +**Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events +**Demo_Machine_Learning.py** - A sample Machine Learning front end +**Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph +**Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph +**Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph +**Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method +**Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +**Demo_NonBlocking_Form.py** - a basic async form +**Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +**Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons +**Demo_PNG_Vierwer.py** - Uses Image Element to display PNG files +**Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) +**Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts +**Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts +**Demo_Tabbed_Form.py** - Using the Tab feature + +## Packages Used In Demos + + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: * [Chatterbot](https://github.com/gunthercox/ChatterBot) * [Mido](https://github.com/olemb/mido) diff --git a/readme.md b/readme.md index 886e60b11..179e66158 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ - +readme.md ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) @@ -1738,37 +1738,39 @@ Use realtime keyboard capture by calling ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - **Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form - **Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form - **Demo_Chat.py** - A chat window with scrollable history - **Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project - **Demo_Color.py** - How to interact with color using RGB hex values and named colors - **Demo_Columns.py** - Using the Column Element to create more complex forms - **Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility - **Demo_Dictionary.py** - Specifying and using return values in dictionary format - **Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility - **Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. - **Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. - **Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors - **Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. - **Demo_Keyboard.py** - Using blocking keyboard events - **Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events - **Demo_Machine_Learning.py** - A sample Machine Learning front end - **Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph - **Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph - **Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph - **Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method - **Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices - **Demo_NonBlocking_Form.py** - a basic async form - **Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate - **Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons - **Demo_PNG_Vierwer.p**y - Uses Image Element to display PNG files - **Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) - **Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts - **Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts - **Demo_Tabbed_Form.py** - Using the Tab feature - - ## Packages Used In Demos +**Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form +**Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form +**Demo_Chat.py** - A chat window with scrollable history +**Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project +**Demo_Color.py** - How to interact with color using RGB hex values and named colors +**Demo_Columns.py** - Using the Column Element to create more complex forms +**Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility +**Demo_Dictionary.py** - Specifying and using return values in dictionary format +**Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility +**Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. +**Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. +**Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors +**Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. +**Demo_Keyboard.py** - Using blocking keyboard events +**Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events +**Demo_Machine_Learning.py** - A sample Machine Learning front end +**Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph +**Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph +**Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph +**Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method +**Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +**Demo_NonBlocking_Form.py** - a basic async form +**Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +**Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons +**Demo_PNG_Vierwer.py** - Uses Image Element to display PNG files +**Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) +**Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts +**Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts +**Demo_Tabbed_Form.py** - Using the Tab feature + +## Packages Used In Demos + + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: * [Chatterbot](https://github.com/gunthercox/ChatterBot) * [Mido](https://github.com/olemb/mido) From 1803625ae0412fe5faff4f9d70f3c5b410688e3e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 11:13:39 -0400 Subject: [PATCH 236/521] Readme updates (formatting hell) --- docs/index.md | 63 ++++++++++++++++++++++++++------------------------- readme.md | 63 ++++++++++++++++++++++++++------------------------- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/docs/index.md b/docs/index.md index 179e66158..31719dd99 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -readme.md + ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) @@ -1737,36 +1737,37 @@ Use realtime keyboard capture by calling ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - -**Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form -**Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form -**Demo_Chat.py** - A chat window with scrollable history -**Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project -**Demo_Color.py** - How to interact with color using RGB hex values and named colors -**Demo_Columns.py** - Using the Column Element to create more complex forms -**Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility -**Demo_Dictionary.py** - Specifying and using return values in dictionary format -**Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility -**Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. -**Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. -**Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors -**Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. -**Demo_Keyboard.py** - Using blocking keyboard events -**Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events -**Demo_Machine_Learning.py** - A sample Machine Learning front end -**Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph -**Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph -**Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph -**Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method -**Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -**Demo_NonBlocking_Form.py** - a basic async form -**Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate -**Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons -**Demo_PNG_Vierwer.py** - Uses Image Element to display PNG files -**Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) -**Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts -**Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts -**Demo_Tabbed_Form.py** - Using the Tab feature + |Version | Description | +|--|--| +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form | +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form | +|**Demo_Chat.py** | A chat window with scrollable history | +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project | +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors | +|**Demo_Columns.py** | Using the Column Element to create more complex forms | +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility | +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format | +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility | +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter | +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them | +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors | +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code | +|**Demo_Keyboard.py** | Using blocking keyboard events | +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events | +|**Demo_Machine_Learning.py** | A sample Machine Learning front end | +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph | +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph | +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph | +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method | +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices | +|**Demo_NonBlocking_Form.py** | a basic async form | +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate | +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons | +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) | +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts | +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts | +|**Demo_Tabbed_Form.py** | Using the Tab feature | ## Packages Used In Demos diff --git a/readme.md b/readme.md index 179e66158..31719dd99 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -readme.md + ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) @@ -1737,36 +1737,37 @@ Use realtime keyboard capture by calling ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - -**Demo_All_Widgets.py** - Nearly all of the Elements shown in a single form -**Demo_Canvas.py** - Form with a Canvas Element that is updated outside of the form -**Demo_Chat.py** - A chat window with scrollable history -**Demo_Chatterbot.py** - Front-end to Chatterbot Machine Learning project -**Demo_Color.py** - How to interact with color using RGB hex values and named colors -**Demo_Columns.py** - Using the Column Element to create more complex forms -**Demo_Compare_Files.py** - Using a simple GUI front-end to create a compare 2-files utility -**Demo_Dictionary.py** - Specifying and using return values in dictionary format -**Demo_DisplayHash1and256.py** - Using high level API and custom form to implement a simple display hash code utility -**Demo_DuplicateFileFinder.py** - High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter. -**Demo_Func_Callback_Simulator.py** - For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them. -**Demo_GoodColors.py** - Using some of the pre-defined PySimpleGUI individual colors -**Demo_HowDoI.py** - This is a utility to be experienced! It will change how you code. -**Demo_Keyboard.py** - Using blocking keyboard events -**Demo_Keyboard_Realtime.py** - Using non-blocking / realtime keyboard events -**Demo_Machine_Learning.py** - A sample Machine Learning front end -**Demo_Matplotlib.py** - Integrating with Matplotlib to create a single graph -**Demo_Matplotlib_Animated.py** - Animated Matplotlib line graph -**Demo_Matplotlib_Animated_Scatter.py -** Animated Matplotlib scatter graph -**Demo_Media_Player.py** - Non-blocking form with a media player layout. Demonstrates button graphics, Update method -**Demo_MIDI_Player.py** - GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -**Demo_NonBlocking_Form.py** - a basic async form -**Demo_PDF_Viewer.py** - Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate -**Demo_Pi_Robotics.py** - Simulated robot control using realtime buttons -**Demo_PNG_Vierwer.py** - Uses Image Element to display PNG files -**Demo_Recipes.py** - A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) -**Demo_Script_Launcher.py** - Demonstrates one way of adding a front-end onto several command line scripts -**Demo_Script_Parameters.py** - Add a 1-line GUI to the front of your previously command-line only scripts -**Demo_Tabbed_Form.py** - Using the Tab feature + |Version | Description | +|--|--| +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form | +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form | +|**Demo_Chat.py** | A chat window with scrollable history | +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project | +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors | +|**Demo_Columns.py** | Using the Column Element to create more complex forms | +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility | +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format | +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility | +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter | +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them | +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors | +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code | +|**Demo_Keyboard.py** | Using blocking keyboard events | +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events | +|**Demo_Machine_Learning.py** | A sample Machine Learning front end | +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph | +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph | +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph | +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method | +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices | +|**Demo_NonBlocking_Form.py** | a basic async form | +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate | +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons | +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) | +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts | +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts | +|**Demo_Tabbed_Form.py** | Using the Tab feature | ## Packages Used In Demos From 52eee9c08394eea54b6299d2cedd39f789bf6c0e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 11:22:05 -0400 Subject: [PATCH 237/521] Readme formatting (What the HELL?) --- docs/index.md | 60 +++++++++++++++++++++++++-------------------------- readme.md | 60 +++++++++++++++++++++++++-------------------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/index.md b/docs/index.md index 31719dd99..f5c57ab54 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1737,37 +1737,37 @@ Use realtime keyboard capture by calling ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - |Version | Description | + | Source File| Description | |--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form | -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form | -|**Demo_Chat.py** | A chat window with scrollable history | -|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project | -|**Demo_Color.py** | How to interact with color using RGB hex values and named colors | -|**Demo_Columns.py** | Using the Column Element to create more complex forms | -|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility | -|**Demo_Dictionary.py** | Specifying and using return values in dictionary format | -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility | -|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter | -|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them | -|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors | -|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code | -|**Demo_Keyboard.py** | Using blocking keyboard events | -|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events | -|**Demo_Machine_Learning.py** | A sample Machine Learning front end | -|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph | -|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph | -|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph | -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method | -|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices | -|**Demo_NonBlocking_Form.py** | a basic async form | -|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate | -|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons | -|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) | -|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts | -|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts | -|**Demo_Tabbed_Form.py** | Using the Tab feature | +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form +|**Demo_Chat.py** | A chat window with scrollable history +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors +|**Demo_Columns.py** | Using the Column Element to create more complex forms +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Keyboard.py** | Using blocking keyboard events +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events +|**Demo_Machine_Learning.py** | A sample Machine Learning front end +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts +|**Demo_Tabbed_Form.py** | Using the Tab feature ## Packages Used In Demos diff --git a/readme.md b/readme.md index 31719dd99..f5c57ab54 100644 --- a/readme.md +++ b/readme.md @@ -1737,37 +1737,37 @@ Use realtime keyboard capture by calling ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - |Version | Description | + | Source File| Description | |--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form | -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form | -|**Demo_Chat.py** | A chat window with scrollable history | -|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project | -|**Demo_Color.py** | How to interact with color using RGB hex values and named colors | -|**Demo_Columns.py** | Using the Column Element to create more complex forms | -|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility | -|**Demo_Dictionary.py** | Specifying and using return values in dictionary format | -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility | -|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter | -|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them | -|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors | -|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code | -|**Demo_Keyboard.py** | Using blocking keyboard events | -|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events | -|**Demo_Machine_Learning.py** | A sample Machine Learning front end | -|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph | -|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph | -|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph | -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method | -|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices | -|**Demo_NonBlocking_Form.py** | a basic async form | -|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate | -|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons | -|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) | -|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts | -|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts | -|**Demo_Tabbed_Form.py** | Using the Tab feature | +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form +|**Demo_Chat.py** | A chat window with scrollable history +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors +|**Demo_Columns.py** | Using the Column Element to create more complex forms +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Keyboard.py** | Using blocking keyboard events +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events +|**Demo_Machine_Learning.py** | A sample Machine Learning front end +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts +|**Demo_Tabbed_Form.py** | Using the Tab feature ## Packages Used In Demos From 3eb65e509344312dac184936c09348b6cc799595 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 11:26:28 -0400 Subject: [PATCH 238/521] Readme (markdown whoas -sigh-) --- docs/index.md | 2 ++ readme.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/index.md b/docs/index.md index f5c57ab54..a0dd2d9f5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1736,7 +1736,9 @@ Use realtime keyboard capture by calling ## Sample Applications + Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + | Source File| Description | |--|--| |**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form diff --git a/readme.md b/readme.md index f5c57ab54..a0dd2d9f5 100644 --- a/readme.md +++ b/readme.md @@ -1736,7 +1736,9 @@ Use realtime keyboard capture by calling ## Sample Applications + Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + | Source File| Description | |--|--| |**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form From c1de1938c1a46d9ad19a3b41306c146e55234ea4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 13:36:03 -0400 Subject: [PATCH 239/521] Removed Contrtol C, Updated All Widgets, new Cookbook demo! --- Demo_All_Widgets.py | 98 +++--- Demo_Chat.py | 2 +- Demo_Cookbook.py | 750 ++++++++++++++++++++++++++++++++++++++++++++ Demo_HowDoI.py | 14 +- 4 files changed, 795 insertions(+), 69 deletions(-) create mode 100644 Demo_Cookbook.py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 8dcf08ed8..66f6c5980 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -2,64 +2,40 @@ def Everything(): - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything',size=(35,3)), - sg.Multiline(default_text='A second multi-line',size=(35,3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] ] - - button, values = form.LayoutAndRead(layout) - - sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) - -import PySimpleGUI as sg - -sg.ChangeLookAndFeel('GreenTan') - -form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) - -column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10,1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] -layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#d3dfda')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] - ] - -button, values = form.LayoutAndRead(layout) -sg.MsgBox(button, values) - -# Everything_NoContextManager() \ No newline at end of file + # sg.ChangeLookAndFeel('LightGreen') + # sg.SetOptions(input_elements_background_color=sg.COLOR_SYSTEM_DEFAULT) + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + + column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#d3dfda')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + + # sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + +sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) +Everything() \ No newline at end of file diff --git a/Demo_Chat.py b/Demo_Chat.py index 99d3df497..5e4d793b1 100644 --- a/Demo_Chat.py +++ b/Demo_Chat.py @@ -41,7 +41,7 @@ def ChatBotWithHistory(): history_offset = len(command_history)-1 multiline_elem.Update('') # manually clear input because keyboard events blocks clear history_elem.Update('\n'.join(command_history[-3:])) - elif button is None or button is 'EXIT' or 'c:67' in button: # quit if exit button, X, or control C + elif button is None or button is 'EXIT': # quit if exit button or X break elif 'Up' in button and len(command_history): command = command_history[history_offset] diff --git a/Demo_Cookbook.py b/Demo_Cookbook.py new file mode 100644 index 000000000..2158c4edd --- /dev/null +++ b/Demo_Cookbook.py @@ -0,0 +1,750 @@ + +"""Simple Data Entry - Return Values As List +Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. +""" + + + +import PySimpleGUI as sg + +# Very basic form. Return values as a list +form = sg.FlexForm('Simple data entry form') # begin with a blank form + +layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] + +button, values = form.LayoutAndRead(layout) + +print(button, values[0], values[1], values[2]) + +""" +Simple data entry - Return Values As Dictionary +A simple form with default values. Results returned in a dictionary. Does not use a context manager +""" +import PySimpleGUI as sg + +# Very basic form. Return values as a dictionary +form = sg.FlexForm('Simple data entry form') # begin with a blank form + +layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + +button, values = form.LayoutAndRead(layout) + +print(button, values['name'], values['address'], values['phone']) + + +""" +Simple File Browse +Browse for a filename that is populated into the input field. +""" +import PySimpleGUI as sg + +with sg.FlexForm('SHA-1 & 256 Hash') as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + (button, (source_filename,)) = form.LayoutAndShow(form_rows) + +print(button, source_filename) + + +""" +Add GUI to Front-End of Script +Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. +""" +import PySimpleGUI as sg +import sys + +if len(sys.argv) == 1: + button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) +else: + fname = sys.argv[1] + +if not fname: + sg.MsgBox("Cancel", "No filename supplied") + # raise SystemExit("Cancelling: no filename supplied") + + +""" +Compare 2 Files +Browse to get 2 file names that can be then compared. Uses a context manager +""" +import PySimpleGUI as sg + +with sg.FlexForm('File Compare') as form: + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, values = form.LayoutAndShow(form_rows) + +print(button, values) + +""" +Nearly All Widgets with Green Color Theme with Context Manager +Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method. +""" +# Green & tan color scheme +sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + +with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))]] + + button, values = form.LayoutAndRead(layout) + +""" +All Widgets No Context Manager +""" +import PySimpleGUI as sg + +# Green & tan color scheme +sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + +form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) +layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] + ] + +button, values = form.LayoutAndRead(layout) + + +""" +Non-Blocking Form With Periodic Update +An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. +""" +import PySimpleGUI as sg +import time + +form = sg.FlexForm('Running Timer') +# create a text element that will be updated periodically +text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') + +form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], + [text_element], + [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] + +form.LayoutAndRead(form_rows, non_blocking=True) + +timer_running = True +i = 0 +# loop to process user clicks +while True: + i += 1 * (timer_running is True) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + elif button == 'Start/Stop': + timer_running = not timer_running + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + + time.sleep(.01) + # if the loop finished then need to close the form for the user +form.CloseNonBlockingForm() +del (form) + +""" +Async Form (Non-Blocking) with Context Manager +Like the previous recipe, this form is an async form. The difference is that this form uses a context manager. +""" +import PySimpleGUI as sg +import time + +with sg.FlexForm('Running Timer') as form: + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') + layout = [[sg.Text('Non blocking GUI with updates', justification='center')], + [text_element], + [sg.T(' ' * 15), sg.Quit()]] + form.LayoutAndRead(layout, non_blocking=True) + + for i in range(1, 500): + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + +""" +Callback Function Simulation +The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. +""" +import PySimpleGUI as sg + +# This design pattern simulates button callbacks +# Note that callbacks are NOT a part of the package's interface to the +# caller intentionally. The underlying implementation actually does use +# tkinter callbacks. They are simply hidden from the user. + +# The callback functions +def button1(): + print('Button 1 callback') + +def button2(): + print('Button 2 callback') + +# Create a standard form +form = sg.FlexForm('Button callback example') +# Layout the design of the GUI +layout = [[sg.Text('Please click a button')], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] +# Show the form to the user +form.Layout(layout) + +# Event loop. Read buttons, make callbacks +while True: + # Read the form + button, value = form.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break + +# All done! +sg.MsgBoxOK('Done') + +""" +Realtime Buttons (Good For Raspberry Pi) +This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. +""" +import PySimpleGUI as sg + +# Make a form, but don't use context manager +form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + +form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' ' * 10), sg.RealtimeButton('Forward')], + [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], + [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + +form.LayoutAndRead(form_rows, non_blocking=True) + +# +# Some place later in your code... +# You need to perform a ReadNonBlocking on your form every now and then or +# else it won't refresh. +# +# your program's main loop +while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + print(button) + if button == 'Quit' or values is None: + break + +form.CloseNonBlockingForm() + + +""" +Easy Progress Meter +This recipe shows just how easy it is to add a progress meter to your code. +""" +import PySimpleGUI as sg + +for i in range(1000): + sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) + +""" +Tabbed Form +Tabbed forms are easy to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of LayoutAndRead you call ShowTabbedForm. Results are returned as a list of form results. Each tab acts like a single form. +""" +import PySimpleGUI as sg + +with sg.FlexForm('', auto_size_text=True) as form: + with sg.FlexForm('', auto_size_text=True) as form2: + + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2,'Second Tab')) + +sg.MsgBox(results) + +""" +Button Graphics (Media Player) +Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. +""" +import PySimpleGUI as sg + +background = '#F0F0F0' +# Set the backgrounds the same as the background on the buttons +sg.SetOptions(background_color=background, element_background_color=background) +# Images are located in a subfolder in the Demo Media Player.py folder +image_pause = './ButtonGraphics/Pause.png' +image_restart = './ButtonGraphics/Restart.png' +image_next = './ButtonGraphics/Next.png' +image_exit = './ButtonGraphics/Exit.png' + +# 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 +form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)) +# define layout of the rows +layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=(background, background), + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Pause', button_color=(background, background), + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Next', button_color=(background, background), + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, + border_width=0)], + [sg.Text('_' * 30)], + [sg.Text(' ' * 30)], + [ + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] + + ] + +# Call the same LayoutAndRead but indicate the form is non-blocking +form.LayoutAndRead(layout, non_blocking=True) +# Our event loop +while (True): + # Read the form (this call will not block) + button, values = form.ReadNonBlocking() + if button == 'Exit' or values is None: + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + TextElem.Update(button) + +""" +Script Launcher - Persistent Form +This form doesn't close after button clicks. To achieve this the buttons are specified as sg.ReadFormButton instead of sg.SimpleButton. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. +""" +import PySimpleGUI as sg +import subprocess + +def Launcher(): + + form = sg.FlexForm('Script launcher') + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], + [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] + ] + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip','list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) + + +def ExecuteCommandSubprocess(command, *args): + try: + sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + +Launcher() + +""" +Machine Learning GUI +A standard non-blocking GUI with lots of inputs. +""" +import PySimpleGUI as sg + +# Green & tan color scheme +sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + +sg.SetOptions(text_justification='right') + +form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + +layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + +button, values = form.LayoutAndRead(layout) + +"""" +Custom Progress Meter / Progress Bar +Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. +""" +import PySimpleGUI as sg + +def CustomMeter(): + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + +CustomMeter() + +""" +The One-Line GUI +For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to FlexForm and the call to LayoutAndRead. FlexForm returns a FlexForm object which has the LayoutAndRead method. +""" +import PySimpleGUI as sg + +layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + +button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + +""" +you can write this line of code for the exact same result (OK, two lines with the import): +""" +import PySimpleGUI as sg + +button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + +""" +Multiple Columns +Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + +This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + +To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. +""" +import PySimpleGUI as sg + +# Demo of how columns work +# Form has on row 1 a vertical slider followed by a COLUMN with 7 rows +# Prior to the Column element, this layout was not possible +# Columns layouts look identical to form layouts, they are a list of lists of elements. + +# sg.ChangeLookAndFeel('BlueMono') + +# Column layout +col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + +layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + +# Display the form and get values +# If you're willing to not use the "context manager" design pattern, then it's possible +# to collapse the form display and read down to a single line of code. +button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + +sg.MsgBox(button, values, line_width=200) + +""" +Persistent Form With Text Element Updates +This simple program keep a form open, taking input values until the user terminates the program using the "X" button. +""" +import PySimpleGUI as sg + +form = sg.FlexForm('Math') + +output = sg.Txt('', size=(8,1)) + +layout = [ [sg.Txt('Enter values to calculate')], + [sg.In(size=(8,1), key='numerator')], + [sg.Txt('_' * 10)], + [sg.In(size=(8,1), key='denominator')], + [output], + [sg.ReadFormButton('Calculate', bind_return_key=True)]] + +form.Layout(layout) + +while True: + button, values = form.Read() + + if button is not None: + try: + numerator = float(values['numerator']) + denominator = float(values['denominator']) + calc = numerator / denominator + except: + calc = 'Invalid' + + output.Update(calc) + else: + break + +""" +tkinter Canvas Widget +The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: +""" + +import PySimpleGUI as gui + +canvas = gui.Canvas(size=(100,100), background_color='red') + +layout = [ + [canvas], + [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] + ] + +form = gui.FlexForm('Canvas test') +form.Layout(layout) +form.ReadNonBlocking() + +cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) + +while True: + button, values = form.Read() + if button is None: + break + if button is 'Blue': + canvas.TKCanvas.itemconfig(cir, fill = "Blue") + elif button is 'Red': + canvas.TKCanvas.itemconfig(cir, fill = "Red") + +""" +Input Element Update +This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. There are a number of features used in this Recipe including: Default Element Size auto_size_buttons ReadFormButton Dictionary Return values Update of Elements in form (Input, Text) do_not_clear of Input Elements +""" +import PySimpleGUI as g + +# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons + +# Demonstrates a number of PySimpleGUI features including: +# Default element size +# auto_size_buttons +# ReadFormButton +# Dictionary return values +# Update of elements in form (Text, Input) +# do_not_clear of Input elements + +# 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')], + [in_elem], + [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], + [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], + [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], + [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], + [out_elem], + ] + +form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) +form.Layout(layout) + +# Loop forever reading the form's values, updating the Input field +keys_entered = '' +while True: + button, values = form.Read() # read the form + if button is None: # if the X button clicked, just exit + break + if button is 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button is 'Submit': + keys_entered = values['input'] + out_elem.Update(keys_entered) # output the final string + + in_elem.Update(keys_entered) # change the form to reflect current key string + +""" +Animated Matplotlib Graph +Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. +""" +from tkinter import * +from random import randint +import PySimpleGUI as g +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg +from matplotlib.figure import Figure +import matplotlib.backends.tkagg as tkagg +import tkinter as Tk + + +def main(): + fig = Figure() + + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() + + canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + + layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + [canvas_elem], + [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas + + dpts = [randint(0, 10) for x in range(10000)] + for i in range(len(dpts)): + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + exit(69) + + ax.cla() + ax.grid() + + ax.plot(range(20), dpts[i:i + 20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640 / 2, 480 / 2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + # time.sleep(.1) + + +if __name__ == 'main': + CustomMeter() \ No newline at end of file diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index 405d27b22..f97c6df7f 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -22,11 +22,12 @@ def HowDoI(): form = sg.FlexForm('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, 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=(40,3)) layout = [ [sg.Text('Ask and your answer will appear here....', size=(40, 1))], [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.T('Command History'), history_elem], [multiline_elem, 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]))] @@ -41,18 +42,17 @@ def HowDoI(): query = value['query'].rstrip() QueryHowDoI(query, value['Num Answers'], value['full text']) # send the string to HowDoI command_history.append(query) - history_offset = len(command_history) + history_offset = len(command_history)-1 multiline_elem.Update('') # manually clear input because keyboard events blocks clear + history_elem.Update('\n'.join(command_history[-3:])) elif button is None or button is 'EXIT': # if exit button or closed using X break - elif 'Up' in button: # scroll back in history - history_offset -= 1 * (history_offset > 0) # decrement is not zero + elif 'Up' in button and len(command_history): # scroll back in history command = command_history[history_offset] + history_offset -= 1 * (history_offset > 0) # decrement is not zero multiline_elem.Update(command) - elif 'Down' in button: # 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 - if history_offset >= len(command_history): - history_offset = len(command_history)-1 command = command_history[history_offset] multiline_elem.Update(command) elif 'Escape' in button: # clear currently line From 7b26ccb8090a2e7652315e7e1e40da8429243ec4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 17:43:13 -0400 Subject: [PATCH 240/521] Demo Cookbook both shows the code and executes it! --- Demo_Cookbook.py | 1461 ++++++++++++++++++++++++---------------------- 1 file changed, 766 insertions(+), 695 deletions(-) diff --git a/Demo_Cookbook.py b/Demo_Cookbook.py index 2158c4edd..2d1e69543 100644 --- a/Demo_Cookbook.py +++ b/Demo_Cookbook.py @@ -1,750 +1,821 @@ -"""Simple Data Entry - Return Values As List -Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. -""" +# import PySimpleGUI as sg +import inspect +def SimpleDataEntry(): + """Simple Data Entry - Return Values As List + Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. + """ + import PySimpleGUI as sg + # Very basic form. Return values as a list + form = sg.FlexForm('Simple data entry form') # begin with a blank form + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] -import PySimpleGUI as sg - -# Very basic form. Return values as a list -form = sg.FlexForm('Simple data entry form') # begin with a blank form - -layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], - [sg.Submit(), sg.Cancel()] - ] - -button, values = form.LayoutAndRead(layout) - -print(button, values[0], values[1], values[2]) - -""" -Simple data entry - Return Values As Dictionary -A simple form with default values. Results returned in a dictionary. Does not use a context manager -""" -import PySimpleGUI as sg - -# Very basic form. Return values as a dictionary -form = sg.FlexForm('Simple data entry form') # begin with a blank form - -layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - -button, values = form.LayoutAndRead(layout) - -print(button, values['name'], values['address'], values['phone']) - - -""" -Simple File Browse -Browse for a filename that is populated into the input field. -""" -import PySimpleGUI as sg - -with sg.FlexForm('SHA-1 & 256 Hash') as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - (button, (source_filename,)) = form.LayoutAndShow(form_rows) - -print(button, source_filename) - - -""" -Add GUI to Front-End of Script -Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. -""" -import PySimpleGUI as sg -import sys - -if len(sys.argv) == 1: - button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], - [sg.In(), sg.FileBrowse()], - [sg.Open(), sg.Cancel()]]) -else: - fname = sys.argv[1] + button, values = form.LayoutAndRead(layout) -if not fname: - sg.MsgBox("Cancel", "No filename supplied") - # raise SystemExit("Cancelling: no filename supplied") + print(button, values[0], values[1], values[2]) +def SimpleReturnAsDict(): + """ + Simple data entry - Return Values As Dictionary + A simple form with default values. Results returned in a dictionary. Does not use a context manager + """ + import PySimpleGUI as sg -""" -Compare 2 Files -Browse to get 2 file names that can be then compared. Uses a context manager -""" -import PySimpleGUI as sg + # Very basic form. Return values as a dictionary + form = sg.FlexForm('Simple data entry form') # begin with a blank form -with sg.FlexForm('File Compare') as form: - form_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, values = form.LayoutAndShow(form_rows) - -print(button, values) - -""" -Nearly All Widgets with Green Color Theme with Context Manager -Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method. -""" -# Green & tan color scheme -sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') - -with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))]] + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Submit(), sg.Cancel()] + ] button, values = form.LayoutAndRead(layout) -""" -All Widgets No Context Manager -""" -import PySimpleGUI as sg - -# Green & tan color scheme -sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') - -form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) -layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] - ] - -button, values = form.LayoutAndRead(layout) - - -""" -Non-Blocking Form With Periodic Update -An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. -""" -import PySimpleGUI as sg -import time + print(button, values['name'], values['address'], values['phone']) + +def FileBrowse(): + """ + Simple File Browse + Browse for a filename that is populated into the input field. + """ + import PySimpleGUI as sg + + with sg.FlexForm('SHA-1 & 256 Hash') as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + (button, (source_filename,)) = form.LayoutAndShow(form_rows) + + print(button, source_filename) + +def GUIAddOn(): + """ + Add GUI to Front-End of Script + Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. + """ + import PySimpleGUI as sg + import sys + + if len(sys.argv) == 1: + button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) + else: + fname = sys.argv[1] + + if not fname: + sg.MsgBox("Cancel", "No filename supplied") + # raise SystemExit("Cancelling: no filename supplied") + +def Compare2Files(): + """ + Compare 2 Files + Browse to get 2 file names that can be then compared. Uses a context manager + """ + import PySimpleGUI as sg + + with sg.FlexForm('File Compare') as form: + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, values = form.LayoutAndShow(form_rows) + + print(button, values) + +def AllWidgetsWithContext(): + """ + Nearly All Widgets with Green Color Theme with Context Manager + Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method. + """ + import PySimpleGUI as sg + # Green & tan color scheme + sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + + with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))]] + + button, values = form.LayoutAndRead(layout) + +def AllWidgetsNoContext(): + """ + All Widgets No Context Manager + """ + import PySimpleGUI as sg + + # Green & tan color scheme + sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] + ] -form = sg.FlexForm('Running Timer') -# create a text element that will be updated periodically -text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') + button, values = form.LayoutAndRead(layout) -form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], - [text_element], - [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] +def NonBlockingWithUpdates(): + """ + Non-Blocking Form With Periodic Update + An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. + """ + import PySimpleGUI as sg + import time -form.LayoutAndRead(form_rows, non_blocking=True) + form = sg.FlexForm('Running Timer') + # create a text element that will be updated periodically + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') -timer_running = True -i = 0 -# loop to process user clicks -while True: - i += 1 * (timer_running is True) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - elif button == 'Start/Stop': - timer_running = not timer_running - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - - time.sleep(.01) - # if the loop finished then need to close the form for the user -form.CloseNonBlockingForm() -del (form) - -""" -Async Form (Non-Blocking) with Context Manager -Like the previous recipe, this form is an async form. The difference is that this form uses a context manager. -""" -import PySimpleGUI as sg -import time + form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], + [text_element], + [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] -with sg.FlexForm('Running Timer') as form: - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') - layout = [[sg.Text('Non blocking GUI with updates', justification='center')], - [text_element], - [sg.T(' ' * 15), sg.Quit()]] - form.LayoutAndRead(layout, non_blocking=True) + form.LayoutAndRead(form_rows, non_blocking=True) - for i in range(1, 500): - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + timer_running = True + i = 0 + # loop to process user clicks + while True: + i += 1 * (timer_running is True) button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X - break + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + elif button == 'Start/Stop': + timer_running = not timer_running + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + time.sleep(.01) - else: # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - -""" -Callback Function Simulation -The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. -""" -import PySimpleGUI as sg - -# This design pattern simulates button callbacks -# Note that callbacks are NOT a part of the package's interface to the -# caller intentionally. The underlying implementation actually does use -# tkinter callbacks. They are simply hidden from the user. - -# The callback functions -def button1(): - print('Button 1 callback') - -def button2(): - print('Button 2 callback') + form.CloseNonBlockingForm() + +def NonBlockingWithContext(): + """ + Async Form (Non-Blocking) with Context Manager + Like the previous recipe, this form is an async form. The difference is that this form uses a context manager. + """ + import PySimpleGUI as sg + import time + + with sg.FlexForm('Running Timer') as form: + text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') + layout = [[sg.Text('Non blocking GUI with updates', justification='center')], + [text_element], + [sg.T(' ' * 15), sg.Quit()]] + form.LayoutAndRead(layout, non_blocking=True) + + for i in range(1, 500): + text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + form.CloseNonBlockingForm() + +def CallbackSimulation(): + """ + Callback Function Simulation + The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. + """ + import PySimpleGUI as sg + + # This design pattern simulates button callbacks + # Note that callbacks are NOT a part of the package's interface to the + # caller intentionally. The underlying implementation actually does use + # tkinter callbacks. They are simply hidden from the user. + + # The callback functions + def button1(): + print('Button 1 callback') + + def button2(): + print('Button 2 callback') + + # Create a standard form + form = sg.FlexForm('Button callback example') + # Layout the design of the GUI + layout = [[sg.Text('Please click a button')], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] + # Show the form to the user + form.Layout(layout) -# Create a standard form -form = sg.FlexForm('Button callback example') -# Layout the design of the GUI -layout = [[sg.Text('Please click a button')], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] -# Show the form to the user -form.Layout(layout) + # Event loop. Read buttons, make callbacks + while True: + # Read the form + button, value = form.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break -# Event loop. Read buttons, make callbacks -while True: - # Read the form - button, value = form.Read() - # Take appropriate action based on button - if button == '1': - button1() - elif button == '2': - button2() - elif button =='Quit' or button is None: + # All done! + sg.MsgBoxOK('Done') + +def RealtimeButtons(): + """ + Realtime Buttons (Good For Raspberry Pi) + This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. + """ + import PySimpleGUI as sg + + # Make a form, but don't use context manager + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' ' * 10), sg.RealtimeButton('Forward')], + [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], + [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh. + # + # your program's main loop + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + print(button) + if button == 'Quit' or values is None: break -# All done! -sg.MsgBoxOK('Done') - -""" -Realtime Buttons (Good For Raspberry Pi) -This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. -""" -import PySimpleGUI as sg - -# Make a form, but don't use context manager -form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + form.CloseNonBlockingForm() + +def EasyProgressMeter(): + """ + Easy Progress Meter + This recipe shows just how easy it is to add a progress meter to your code. + """ + import PySimpleGUI as sg + + for i in range(1000): + sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) + +def TabbedForm(): + """ + Tabbed Form + Tabbed forms are easy to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of LayoutAndRead you call ShowTabbedForm. Results are returned as a list of form results. Each tab acts like a single form. + """ + import PySimpleGUI as sg + + with sg.FlexForm('', auto_size_text=True) as form: + with sg.FlexForm('', auto_size_text=True) as form2: + + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2,'Second Tab')) + + sg.MsgBox(results) + +def MediaPlayer(): + """ + Button Graphics (Media Player) + Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. + """ + import PySimpleGUI as sg + + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # 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 + form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)) + # define layout of the rows + layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=(background, background), + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Pause', button_color=(background, background), + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadFormButton('Next', button_color=(background, background), + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, + border_width=0)], + [sg.Text('_' * 30)], + [sg.Text(' ' * 30)], + [ + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] -form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' ' * 10), sg.RealtimeButton('Forward')], - [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], - [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - -form.LayoutAndRead(form_rows, non_blocking=True) - -# -# Some place later in your code... -# You need to perform a ReadNonBlocking on your form every now and then or -# else it won't refresh. -# -# your program's main loop -while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - print(button) - if button == 'Quit' or values is None: - break - -form.CloseNonBlockingForm() - - -""" -Easy Progress Meter -This recipe shows just how easy it is to add a progress meter to your code. -""" -import PySimpleGUI as sg + ] -for i in range(1000): - sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) + # Call the same LayoutAndRead but indicate the form is non-blocking + form.LayoutAndRead(layout, non_blocking=True) + # Our event loop + while (True): + # Read the form (this call will not block) + button, values = form.ReadNonBlocking() + if button == 'Exit' or values is None: + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + TextElem.Update(button) + +def ScriptLauncher(): + """ + Script Launcher - Persistent Form + This form doesn't close after button clicks. To achieve this the buttons are specified as sg.ReadFormButton instead of sg.SimpleButton. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. + """ + import PySimpleGUI as sg + import subprocess + + def Launcher(): + + form = sg.FlexForm('Script launcher') + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], + [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] + ] + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip','list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) + + + def ExecuteCommandSubprocess(command, *args): + try: + sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + Launcher() + +def MachineLearning(): + """ + Machine Learning GUI + A standard non-blocking GUI with lots of inputs. + """ + import PySimpleGUI as sg + + # Green & tan color scheme + sg.SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + input_elements_background_color='#F7F3EC', + button_color=('white', '#475841'), + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color='#F7F3EC') + + sg.SetOptions(text_justification='right') + + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] -""" -Tabbed Form -Tabbed forms are easy to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of LayoutAndRead you call ShowTabbedForm. Results are returned as a list of form results. Each tab acts like a single form. -""" -import PySimpleGUI as sg + button, values = form.LayoutAndRead(layout) -with sg.FlexForm('', auto_size_text=True) as form: - with sg.FlexForm('', auto_size_text=True) as form2: +def CustromProgressMeter(): + """" + Custom Progress Meter / Progress Bar + Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. + """ + import PySimpleGUI as sg + + def CustomMeter(): + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + + CustomMeter() + +def OneLineGUI(): + """ + The One-Line GUI + For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to FlexForm and the call to LayoutAndRead. FlexForm returns a FlexForm object which has the LayoutAndRead method. + """ + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + + """ + you can write this line of code for the exact same result (OK, two lines with the import): + """ + # import PySimpleGUI as sg + + button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + +def MultipleColumns(): + """ + Multiple Columns + Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + + This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + + To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. + """ + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + # sg.ChangeLookAndFeel('BlueMono') + + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + + sg.MsgBox(button, values, line_width=200) + +def PersistentForm(): + """ + Persistent Form With Text Element Updates + This simple program keep a form open, taking input values until the user terminates the program using the "X" button. + """ + import PySimpleGUI as sg + + form = sg.FlexForm('Math') + + output = sg.Txt('', size=(8,1)) + + layout = [ [sg.Txt('Enter values to calculate')], + [sg.In(size=(8,1), key='numerator')], + [sg.Txt('_' * 10)], + [sg.In(size=(8,1), key='denominator')], + [output], + [sg.ReadFormButton('Calculate', bind_return_key=True)]] - layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + form.Layout(layout) - layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + while True: + button, values = form.Read() + + if button is not None: + try: + numerator = float(values['numerator']) + denominator = float(values['denominator']) + calc = numerator / denominator + except: + calc = 'Invalid' + + output.Update(calc) + else: + break - results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), - (form2, layout_tab_2,'Second Tab')) +def CanvasWidget(): + """ + tkinter Canvas Widget + The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: + """ -sg.MsgBox(results) + import PySimpleGUI as gui -""" -Button Graphics (Media Player) -Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. -""" -import PySimpleGUI as sg + canvas = gui.Canvas(size=(100,100), background_color='red') -background = '#F0F0F0' -# Set the backgrounds the same as the background on the buttons -sg.SetOptions(background_color=background, element_background_color=background) -# Images are located in a subfolder in the Demo Media Player.py folder -image_pause = './ButtonGraphics/Pause.png' -image_restart = './ButtonGraphics/Restart.png' -image_next = './ButtonGraphics/Next.png' -image_exit = './ButtonGraphics/Exit.png' - -# 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 -form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), - font=("Helvetica", 25)) -# define layout of the rows -layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], - [TextElem], - [sg.ReadFormButton('Restart Song', button_color=(background, background), - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=(background, background), - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=(background, background), - image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), - image_filename=image_exit, image_size=(50, 50), image_subsample=2, - border_width=0)], - [sg.Text('_' * 30)], - [sg.Text(' ' * 30)], - [ - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 2), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 8), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15))], - [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), - sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), - sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] - - ] - -# Call the same LayoutAndRead but indicate the form is non-blocking -form.LayoutAndRead(layout, non_blocking=True) -# Our event loop -while (True): - # Read the form (this call will not block) - button, values = form.ReadNonBlocking() - if button == 'Exit' or values is None: - break - # If a button was pressed, display it on the GUI by updating the text element - if button: - TextElem.Update(button) - -""" -Script Launcher - Persistent Form -This form doesn't close after button clicks. To achieve this the buttons are specified as sg.ReadFormButton instead of sg.SimpleButton. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. -""" -import PySimpleGUI as sg -import subprocess + layout = [ + [canvas], + [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] + ] -def Launcher(): + form = gui.FlexForm('Canvas test') + form.Layout(layout) + form.ReadNonBlocking() - form = sg.FlexForm('Script launcher') + cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) - layout = [ - [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20))], - [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], - [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] + while True: + button, values = form.Read() + if button is None: + break + if button is 'Blue': + canvas.TKCanvas.itemconfig(cir, fill = "Blue") + elif button is 'Red': + canvas.TKCanvas.itemconfig(cir, fill = "Red") + +def InputElementUpdate(): + """ + Input Element Update + This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. There are a number of features used in this Recipe including: Default Element Size auto_size_buttons ReadFormButton Dictionary Return values Update of Elements in form (Input, Text) do_not_clear of Input Elements + """ + import PySimpleGUI as g + + # g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons + + # Demonstrates a number of PySimpleGUI features including: + # Default element size + # auto_size_buttons + # ReadFormButton + # Dictionary return values + # Update of elements in form (Text, Input) + # do_not_clear of Input elements + + # 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')], + [in_elem], + [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], + [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], + [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], + [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], + [out_elem], ] + form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI --- # + # Loop forever reading the form's values, updating the Input field + keys_entered = '' while True: - (button, value) = form.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': - ExecuteCommandSubprocess('pip','list') - elif button == 'script2': - ExecuteCommandSubprocess('python', '--version') - elif button == 'Run': - ExecuteCommandSubprocess(value[0]) - - -def ExecuteCommandSubprocess(command, *args): - try: - sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = sp.communicate() - if out: - print(out.decode("utf-8")) - if err: - print(err.decode("utf-8")) - except: pass - -Launcher() - -""" -Machine Learning GUI -A standard non-blocking GUI with lots of inputs. -""" -import PySimpleGUI as sg - -# Green & tan color scheme -sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') - -sg.SetOptions(text_justification='right') - -form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form - -layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), - sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 15), justification='left')], - [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], - [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], - [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], - [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], - [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], - [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], - [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], - [sg.Submit(), sg.Cancel()]] - -button, values = form.LayoutAndRead(layout) - -"""" -Custom Progress Meter / Progress Bar -Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. -""" -import PySimpleGUI as sg - -def CustomMeter(): - # create the progress bar element - progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) - # layout the form - layout = [[sg.Text('A custom progress meter')], - [progress_bar], - [sg.Cancel()]] - - # create the form - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: + button, values = form.Read() # read the form + if button is None: # if the X button clicked, just exit break - # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i+1) - # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() - -CustomMeter() + if button is 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button is 'Submit': + keys_entered = values['input'] + out_elem.Update(keys_entered) # output the final string + + in_elem.Update(keys_entered) # change the form to reflect current key string + +# def EverythingInOne(): + # """ + # Animated Matplotlib Graph + # Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. + # """ + # from tkinter import * + # from random import randint + # import PySimpleGUI as g + # from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg + # from matplotlib.figure import Figure + # import matplotlib.backends.tkagg as tkagg + # import tkinter as Tk + # + # + # def main(): + # fig = Figure() + # + # ax = fig.add_subplot(111) + # ax.set_xlabel("X axis") + # ax.set_ylabel("Y axis") + # ax.grid() + # + # canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + # + # layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + # [canvas_elem], + # [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + # + # # create the form and show it without the plot + # form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + # form.Layout(layout) + # form.ReadNonBlocking() + # + # graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + # canvas = canvas_elem.TKCanvas + # + # dpts = [randint(0, 10) for x in range(10000)] + # for i in range(len(dpts)): + # button, values = form.ReadNonBlocking() + # if button is 'Exit' or values is None: + # exit(69) + # + # ax.cla() + # ax.grid() + # + # ax.plot(range(20), dpts[i:i + 20], color='purple') + # graph.draw() + # figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # figure_w, figure_h = int(figure_w), int(figure_h) + # photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + # + # canvas.create_image(640 / 2, 480 / 2, image=photo) + # + # figure_canvas_agg = FigureCanvasAgg(fig) + # figure_canvas_agg.draw() + # + # tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + # # time.sleep(.1) + + +# -------------------------------- GUI Starts Here -------------------------------# +# fig = your figure you want to display. Assumption is that 'fig' holds the # +# information to display. # +# --------------------------------------------------------------------------------# + +# print(inspect.getsource(PyplotSimple)) -""" -The One-Line GUI -For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to FlexForm and the call to LayoutAndRead. FlexForm returns a FlexForm object which has the LayoutAndRead method. -""" import PySimpleGUI as sg -layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] - -button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) - -""" -you can write this line of code for the exact same result (OK, two lines with the import): -""" -import PySimpleGUI as sg - -button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) - -""" -Multiple Columns -Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. - -This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. - -To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. -""" -import PySimpleGUI as sg - -# Demo of how columns work -# Form has on row 1 a vertical slider followed by a COLUMN with 7 rows -# Prior to the Column element, this layout was not possible -# Columns layouts look identical to form layouts, they are a list of lists of elements. - -# sg.ChangeLookAndFeel('BlueMono') - -# Column layout -col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], - [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], - [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] - -layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], - [sg.Input('Last input')], - [sg.OK()]] - -# Display the form and get values -# If you're willing to not use the "context manager" design pattern, then it's possible -# to collapse the form display and read down to a single line of code. -button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - -sg.MsgBox(button, values, line_width=200) - -""" -Persistent Form With Text Element Updates -This simple program keep a form open, taking input values until the user terminates the program using the "X" button. -""" -import PySimpleGUI as sg - -form = sg.FlexForm('Math') - -output = sg.Txt('', size=(8,1)) +fig_dict = {'Simple Data Entry':SimpleDataEntry, 'Simple Entry Return Data as Dict':SimpleReturnAsDict, 'File Browse' : FileBrowse, + 'GUI Add On':GUIAddOn, 'Compare 2 Files':Compare2Files, 'All Widgets With Context Manager':AllWidgetsWithContext, 'All Widgets No Context Manager':AllWidgetsNoContext, + 'Non-Blocking With Updates':NonBlockingWithUpdates, 'Non-Bocking With Context Manager':NonBlockingWithContext, 'Callback Simulation':CallbackSimulation, + 'Realtime Buttons':RealtimeButtons, 'Easy Progress Meter':EasyProgressMeter, 'Tabbed Form':TabbedForm, 'Media Player':MediaPlayer, 'Script Launcher':ScriptLauncher, + 'Machine Learning':MachineLearning, 'Custom Progress Meter':CustromProgressMeter, 'One Line GUI':OneLineGUI, 'Multiple Columns':MultipleColumns, + 'Persistent Form':PersistentForm, 'Canvas Widget':CanvasWidget, 'Input Element Update':InputElementUpdate} -layout = [ [sg.Txt('Enter values to calculate')], - [sg.In(size=(8,1), key='numerator')], - [sg.Txt('_' * 10)], - [sg.In(size=(8,1), key='denominator')], - [output], - [sg.ReadFormButton('Calculate', bind_return_key=True)]] -form.Layout(layout) +# multiline_elem = sg.Multiline(size=(70,35),pad=(5,(3,90))) +# define the form layout +listbox_values = [key for key in fig_dict.keys()] +multiline_elem = sg.Multiline(size=(70,35), do_not_clear=True) while True: - button, values = form.Read() + sg.ChangeLookAndFeel('LightGreen') + col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), key='func')], + [sg.SimpleButton('Run'), sg.ReadFormButton('Show Code'), sg.Exit()]] - if button is not None: - try: - numerator = float(values['numerator']) - denominator = float(values['denominator']) - calc = numerator / denominator - except: - calc = 'Invalid' - - output.Update(calc) - else: - break - -""" -tkinter Canvas Widget -The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: -""" - -import PySimpleGUI as gui - -canvas = gui.Canvas(size=(100,100), background_color='red') - -layout = [ - [canvas], - [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] - ] - -form = gui.FlexForm('Canvas test') -form.Layout(layout) -form.ReadNonBlocking() - -cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) - -while True: - button, values = form.Read() - if button is None: - break - if button is 'Blue': - canvas.TKCanvas.itemconfig(cir, fill = "Blue") - elif button is 'Red': - canvas.TKCanvas.itemconfig(cir, fill = "Red") - -""" -Input Element Update -This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. There are a number of features used in this Recipe including: Default Element Size auto_size_buttons ReadFormButton Dictionary Return values Update of Elements in form (Input, Text) do_not_clear of Input Elements -""" -import PySimpleGUI as g - -# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons - -# Demonstrates a number of PySimpleGUI features including: -# Default element size -# auto_size_buttons -# ReadFormButton -# Dictionary return values -# Update of elements in form (Text, Input) -# do_not_clear of Input elements - -# 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')], - [in_elem], - [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], - [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], - [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], - [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], - [out_elem], - ] - -form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) -form.Layout(layout) - -# Loop forever reading the form's values, updating the Input field -keys_entered = '' -while True: - button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit - break - if button is 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button is 'Submit': - keys_entered = values['input'] - out_elem.Update(keys_entered) # output the final string - - in_elem.Update(keys_entered) # change the form to reflect current key string - -""" -Animated Matplotlib Graph -Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. -""" -from tkinter import * -from random import randint -import PySimpleGUI as g -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg -from matplotlib.figure import Figure -import matplotlib.backends.tkagg as tkagg -import tkinter as Tk - - -def main(): - fig = Figure() - - ax = fig.add_subplot(111) - ax.set_xlabel("X axis") - ax.set_ylabel("Y axis") - ax.grid() - - canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on - - layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [canvas_elem], - [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - - # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.ReadNonBlocking() + layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], + [sg.Column(col_listbox, pad=(5,(3,2))), multiline_elem], + ] - graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) - canvas = canvas_elem.TKCanvas +# create the form and show it without the plot +# form.Layout(layout) - dpts = [randint(0, 10) for x in range(10000)] - for i in range(len(dpts)): - button, values = form.ReadNonBlocking() - if button is 'Exit' or values is None: + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(8,2),auto_size_buttons=False) + button, values = form.LayoutAndRead(layout) + print(button, values) + # show it all again and get buttons + while True: + if button is None or button is 'Exit': exit(69) - - ax.cla() - ax.grid() - - ax.plot(range(20), dpts[i:i + 20], color='purple') - graph.draw() - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - canvas.create_image(640 / 2, 480 / 2, image=photo) - - figure_canvas_agg = FigureCanvasAgg(fig) - figure_canvas_agg.draw() - - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - # time.sleep(.1) - - -if __name__ == 'main': - CustomMeter() \ No newline at end of file + try: + choice = values['func'][0] + func = fig_dict[choice] + except: + continue + + if button is 'Show Code': + multiline_elem.Update(inspect.getsource(func)) + button, values = form.Read() + elif button is 'Run': + sg.ChangeLookAndFeel('SystemDefault') + func() + break + else: + button, values = form.Read() From 3e8c59d7ddf23ab8ec644c7dd1c5d6528c91892f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 17:59:06 -0400 Subject: [PATCH 241/521] New SystemDefaul look and feel setting --- PySimpleGUI.py | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3244b1e73..e3931bdb1 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -35,8 +35,11 @@ COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long if sys.platform is 'darwin': DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default + OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Colors should never be this long else: DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default + OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = ('white', BLUES[0]) # Colors should never be this long + DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") DEFAULT_BACKGROUND_COLOR = None DEFAULT_ELEMENT_BACKGROUND_COLOR = None @@ -1586,7 +1589,7 @@ def CharWidthInPixels(): wraplen = 0 # print("wraplen, width, height", wraplen, width, height) tktext_label.configure(anchor=anchor, wraplen=wraplen) # set wrap to width of widget - if element.BackgroundColor is not None: + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) @@ -1666,7 +1669,7 @@ def CharWidthInPixels(): if auto_size_text is False: width=element_size[0] else: width = max_line_len element.TKStringVar = tk.StringVar() - if element.BackgroundColor and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: combostyle = ttk.Style() try: combostyle.theme_create('combostyle', @@ -1858,7 +1861,7 @@ def CharWidthInPixels(): tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) # tktext_label.configure(anchor=tk.NW, image=photo) tkscale.config(highlightthickness=0) - if element.BackgroundColor is not None: + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: tkscale.configure(background=element.BackgroundColor) tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: @@ -2739,38 +2742,39 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el ############################################################## def ChangeLookAndFeel(index): # look and feel table - look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + look_and_feel = {'SystemDefault': {'BACKGROUND' : COLOR_SYSTEM_DEFAULT, 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT': COLOR_SYSTEM_DEFAULT,'TEXT_INPUT' : COLOR_SYSTEM_DEFAULT, 'SCROLL': COLOR_SYSTEM_DEFAULT, 'BUTTON': OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, 'PROGRESS': COLOR_SYSTEM_DEFAULT, 'BORDER': 1,'SLIDER_DEPTH':1, 'PROGRESS_DEPTH':1}, + 'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, - 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER':1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, - 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}, + 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'Purple': {'BACKGROUND': '#B0AAC2', 'TEXT': 'black', 'INPUT': '#F2EFE8','SCROLL': '#F2EFE8','TEXT_INPUT' : 'black', - 'BUTTON': ('black', '#C2D4D8'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BUTTON': ('black', '#C2D4D8'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'BlueMono': {'BACKGROUND': '#AAB6D3', 'TEXT': 'black', 'INPUT': '#F1F4FC','SCROLL': '#F1F4FC','TEXT_INPUT' : 'black', - 'BUTTON': ('white', '#7186C7'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BUTTON': ('white', '#7186C7'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'GreenMono': {'BACKGROUND': '#A8C1B4', 'TEXT': 'black', 'INPUT': '#DDE0DE', 'SCROLL': '#E3E3E3','TEXT_INPUT' : 'black', - 'BUTTON': ('white', '#6D9F85'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BUTTON': ('white', '#6D9F85'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, - 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, - 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'NeutralBlue': {'BACKGROUND': '#92aa9d', 'TEXT': 'black', 'INPUT': '#fcfff6', 'SCROLL': '#fcfff6', 'TEXT_INPUT': 'black', 'BUTTON': ('black', '#d0dbbd'), - 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'Kayak': {'BACKGROUND': '#a7ad7f', 'TEXT': 'black', 'INPUT': '#e6d3a8', 'SCROLL': '#e6d3a8', 'TEXT_INPUT': 'black', 'BUTTON': ('white', '#5d907d'), - 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'SandyBeach': {'BACKGROUND': '#efeccb', 'TEXT': '#012f2f', 'INPUT': '#e6d3a8', 'SCROLL': '#e6d3a8', 'TEXT_INPUT': '#012f2f', 'BUTTON': ('white', '#046380'), - 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR}, + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, - 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#183440'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR} + 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#183440'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0} } try: colors = look_and_feel[index] @@ -2782,9 +2786,9 @@ def ChangeLookAndFeel(index): input_elements_background_color=colors['INPUT'], button_color=colors['BUTTON'], progress_meter_color=colors['PROGRESS'], - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, + border_width=colors['BORDER'], + slider_border_width=colors['SLIDER_DEPTH'], + progress_meter_border_depth=colors['PROGRESS_DEPTH'], scrollbar_color=(colors['SCROLL']), element_text_color=colors['TEXT'], input_text_color=colors['TEXT_INPUT']) From 159d98a2dcd8e643c264dd398fff9e095a6e2910 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 18:15:59 -0400 Subject: [PATCH 242/521] 2.11 Docs --- Demo_Cookbook.py | 1 - docs/index.md | 3 ++- readme.md | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Demo_Cookbook.py b/Demo_Cookbook.py index 2d1e69543..38caa5d48 100644 --- a/Demo_Cookbook.py +++ b/Demo_Cookbook.py @@ -799,7 +799,6 @@ def InputElementUpdate(): form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(8,2),auto_size_buttons=False) button, values = form.LayoutAndRead(layout) - print(button, values) # show it all again and get buttons while True: if button is None or button is 'Exit': diff --git a/docs/index.md b/docs/index.md index a0dd2d9f5..5a32a4df7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,7 +10,7 @@ # PySimpleGUI - (Ver 2.10) + (Ver 2.11) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) Lots of documentation available in addition to this Readme File. @@ -1872,6 +1872,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others +| 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel setting, ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) diff --git a/readme.md b/readme.md index a0dd2d9f5..5a32a4df7 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ # PySimpleGUI - (Ver 2.10) + (Ver 2.11) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) Lots of documentation available in addition to this Readme File. @@ -1872,6 +1872,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others +| 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel setting, ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) From a27240f14631f6fa3780674b4a298d0e43c9941e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 19:42:00 -0400 Subject: [PATCH 243/521] Cookbook updated --- docs/cookbook.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/cookbook.md b/docs/cookbook.md index 44453e27b..a67843fc9 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1,6 +1,10 @@ # The PySimpleGUI Cookbook +You will find all of these Recipes in a single Python file ([Demo_Cookbook.py](https://github.com/MikeTheWatchGuy/PySimpleGUI/blob/master/Demo_Cookbook.py)) located on the project's GitHub page. This program will allow you to view the source code and the window that it produces. + +You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. + ## Simple Data Entry - Return Values As List Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. From 2afef635f281a45e2bbe981082cdad386135aae9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 20:50:10 -0400 Subject: [PATCH 244/521] Imrpoved spiffy launcher!! --- Demo_Script_Launcher.py | 55 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 3361023d7..bb88b3433 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -1,7 +1,11 @@ import PySimpleGUI as sg +import glob +import ntpath import subprocess -def Launcher(): +LOCATION_OF_YOUR_SCRIPTS = 'C:/Python/PycharmProjects/GooeyGUI/' + +def Launcher1(): form = sg.FlexForm('Script launcher') @@ -20,14 +24,15 @@ def Launcher(): if button == 'EXIT' or button is None: break # exit button clicked if button == 'script1': - ExecuteCommandSubprocess('pip','list') + execute_command_blocking('pip', 'list') elif button == 'script2': - ExecuteCommandSubprocess('python', '--version') + execute_command_blocking('python', '--version') elif button == 'Run': - ExecuteCommandSubprocess(value[0]) # send string without carriage return on end + execute_command_blocking(value[0]) # send string without carriage return on end -def ExecuteCommandSubprocess(command, *args): +# Execute the command. Will not see the output from the command until it completes. +def execute_command_blocking(command, *args): try: sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() @@ -37,7 +42,45 @@ def ExecuteCommandSubprocess(command, *args): print(err.decode("utf-8")) except: pass +# Executes command and immediately returns. Will not see anything the script outputs +def execute_command_nonblocking(command, *args): + try: + sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except: pass + +def Launcher2(): + sg.ChangeLookAndFeel('GreenTan') + form = sg.FlexForm('Script launcher') + + filelist = glob.glob(LOCATION_OF_YOUR_SCRIPTS+'*.py') + namesonly = [] + for file in filelist: + namesonly.append(ntpath.basename(file)) + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Listbox(values=namesonly, size=(30, 19), select_mode=sg.SELECT_MODE_EXTENDED, key='demolist'), sg.Output(size=(88, 20), font='Courier 10')], + [sg.ReadFormButton('Run'), sg.ReadFormButton('Shortcut 1'), sg.ReadFormButton('Fav Program'), sg.SimpleButton('EXIT')], + ] + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button in ('EXIT', None): + break # exit button clicked + if button in ('Shortcut 1', 'Fav Program'): + print('Quickly launch your favorite programs using these shortcuts') + print('Or copy files to your github folder. Or anything else you type on the command line') + # copyfile(source, dest) + elif button is 'Run': + for index, file in enumerate(value['demolist']): + print('Launching %s'%file) + form.Refresh() # make the print appear immediately + execute_command_nonblocking(LOCATION_OF_YOUR_SCRIPTS + file) + if __name__ == '__main__': - Launcher() + Launcher2() From fda9298a001fd978a64cc9440d773a8105414f7e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 21:00:08 -0400 Subject: [PATCH 245/521] Blocking / Non-Blocking option --- Demo_Script_Launcher.py | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index bb88b3433..807ee013c 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -5,32 +5,6 @@ LOCATION_OF_YOUR_SCRIPTS = 'C:/Python/PycharmProjects/GooeyGUI/' -def Launcher1(): - - form = sg.FlexForm('Script launcher') - - layout = [ - [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20), font='Courier 10')], - [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], - [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] - ] - - form.Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI --- # - while True: - (button, value) = form.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': - execute_command_blocking('pip', 'list') - elif button == 'script2': - execute_command_blocking('python', '--version') - elif button == 'Run': - execute_command_blocking(value[0]) # send string without carriage return on end - - # Execute the command. Will not see the output from the command until it completes. def execute_command_blocking(command, *args): try: @@ -60,6 +34,7 @@ def Launcher2(): layout = [ [sg.Text('Script output....', size=(40, 1))], [sg.Listbox(values=namesonly, size=(30, 19), select_mode=sg.SELECT_MODE_EXTENDED, key='demolist'), sg.Output(size=(88, 20), font='Courier 10')], + [sg.Checkbox('Wait for program to complete', default=False, key='wait')], [sg.ReadFormButton('Run'), sg.ReadFormButton('Shortcut 1'), sg.ReadFormButton('Fav Program'), sg.SimpleButton('EXIT')], ] @@ -78,7 +53,10 @@ def Launcher2(): for index, file in enumerate(value['demolist']): print('Launching %s'%file) form.Refresh() # make the print appear immediately - execute_command_nonblocking(LOCATION_OF_YOUR_SCRIPTS + file) + if value['wait']: + execute_command_blocking(LOCATION_OF_YOUR_SCRIPTS + file) + else: + execute_command_nonblocking(LOCATION_OF_YOUR_SCRIPTS + file) if __name__ == '__main__': From 102322822b71f8a954f42eea1248ca1c784e16f6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 29 Aug 2018 21:50:47 -0400 Subject: [PATCH 246/521] New Animated Ping Graph! --- Demo_Matplotlib_Ping_Graph.py | 738 ++++++++++++++++++++++++++++++++++ 1 file changed, 738 insertions(+) create mode 100644 Demo_Matplotlib_Ping_Graph.py diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py new file mode 100644 index 000000000..307bf95c8 --- /dev/null +++ b/Demo_Matplotlib_Ping_Graph.py @@ -0,0 +1,738 @@ +import PySimpleGUI as g +import matplotlib.pyplot as plt +from matplotlib.backends.backend_tkagg import FigureCanvasAgg +import matplotlib.backends.tkagg as tkagg +import tkinter as tk + + +""" +A graph of time to ping Google.com +Demonstrates Matploylib used in an animated way. + +Note this file contains a copy of ping.py. Here is some information about it. +If you scroll past the PySimpleGUI code, you will find 100% of the original file +has been copied to this file. + + A pure python ping implementation using raw sockets. + + (This is Python 3 port of https://github.com/jedie/python-ping) + (Tested and working with python 2.7, should work with 2.6+) + + Note that ICMP messages can only be sent from processes running as root + (in Windows, you must run this script as 'Administrator'). + + Derived from ping.c distributed in Linux's netkit. That code is + copyright (c) 1989 by The Regents of the University of California. + That code is in turn derived from code written by Mike Muuss of the + US Army Ballistic Research Laboratory in December, 1983 and + placed in the public domain. They have my thanks. + + Bugs are naturally mine. I'd be glad to hear about them. There are + certainly word - size dependencies here. + + Copyright (c) Matthew Dixon Cowles, . + Distributable under the terms of the GNU General Public License + version 2. Provided with no warranties of any sort. + + Original Version from Matthew Dixon Cowles: + -> ftp://ftp.visi.com/users/mdc/ping.py + + Rewrite by Jens Diemer: + -> http://www.python-forum.de/post-69122.html#69122 + + Rewrite by George Notaras: + -> http://www.g-loaded.eu/2009/10/30/python-ping/ + + Enhancements by Martin Falatic: + -> http://www.falatic.com/index.php/39/pinging-with-python + + Enhancements and fixes by Georgi Kolev: + -> http://github.com/jedie/python-ping/ + + Bug fix by Andrejs Rozitis: + -> http://github.com/rozitis/python-ping/ + +""" + + +#================================================================================ +# Globals +# These are needed because callback functions are used. +# Need to retain state across calls +#================================================================================ +class MyGlobals: + axis_pings = None + ping_x_array = [] + ping_y_array = [] + +g_my_globals = MyGlobals() + +#================================================================================ +# Performs *** PING! *** +#================================================================================ +def run_a_ping_and_graph(): + global g_my_globals # graphs are global so that can be retained across multiple calls to this callback + + #===================== Do the ping =====================# + response = quiet_ping('google.com',timeout=1000) + if response[0] == 0: + ping_time = 1000 + else: + ping_time = response[0] + #===================== Store current ping in historical array =====================# + g_my_globals.ping_x_array.append(len(g_my_globals.ping_x_array)) + g_my_globals.ping_y_array.append(ping_time) + # ===================== Only graph last 100 items =====================# + if len(g_my_globals.ping_x_array) > 100: + x_array = g_my_globals.ping_x_array[-100:] + y_array = g_my_globals.ping_y_array[-100:] + else: + x_array = g_my_globals.ping_x_array + y_array = g_my_globals.ping_y_array + + # ===================== Call graphinc functions =====================# + g_my_globals.axis_ping.clear() # clear before graphing + g_my_globals.axis_ping.plot(x_array,y_array) # graph the ping values + +#================================================================================ +# Function: Set graph titles and Axis labels +# Sets the text for the subplots +# Have to do this in 2 places... initially when creating and when updating +# So, putting into a function so don't have to duplicate code +#================================================================================ +def set_chart_labels(): + global g_my_globals + + g_my_globals.axis_ping.set_xlabel('Time') + g_my_globals.axis_ping.set_ylabel('Ping (ms)') + g_my_globals.axis_ping.set_title('Current Ping Duration', fontsize = 12) + +def draw(fig, canvas): + # Magic code that draws the figure onto the Canvas Element's canvas + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + canvas.create_image(640 / 2, 480 / 2, image=photo) + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + return photo + +#================================================================================ +# Function: MAIN +#================================================================================ +def main(): + global g_my_globals + + canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + # define the form layout + layout = [[g.Text('Animated Ping', size=(40,1), justification='center', font='Helvetica 20')], + [canvas_elem], + [g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + canvas = canvas_elem.TKCanvas + + fig = plt.figure() + g_my_globals.axis_ping = fig.add_subplot(1,1,1) + set_chart_labels() + plt.tight_layout() + + while True: + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + break + + run_a_ping_and_graph() + photo = draw(fig, canvas) + + +if __name__ == '__main__': + main() + +# !/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" + A pure python ping implementation using raw sockets. + + (This is Python 3 port of https://github.com/jedie/python-ping) + (Tested and working with python 2.7, should work with 2.6+) + + Note that ICMP messages can only be sent from processes running as root + (in Windows, you must run this script as 'Administrator'). + + Derived from ping.c distributed in Linux's netkit. That code is + copyright (c) 1989 by The Regents of the University of California. + That code is in turn derived from code written by Mike Muuss of the + US Army Ballistic Research Laboratory in December, 1983 and + placed in the public domain. They have my thanks. + + Bugs are naturally mine. I'd be glad to hear about them. There are + certainly word - size dependencies here. + + Copyright (c) Matthew Dixon Cowles, . + Distributable under the terms of the GNU General Public License + version 2. Provided with no warranties of any sort. + + Original Version from Matthew Dixon Cowles: + -> ftp://ftp.visi.com/users/mdc/ping.py + + Rewrite by Jens Diemer: + -> http://www.python-forum.de/post-69122.html#69122 + + Rewrite by George Notaras: + -> http://www.g-loaded.eu/2009/10/30/python-ping/ + + Enhancements by Martin Falatic: + -> http://www.falatic.com/index.php/39/pinging-with-python + + Enhancements and fixes by Georgi Kolev: + -> http://github.com/jedie/python-ping/ + + Bug fix by Andrejs Rozitis: + -> http://github.com/rozitis/python-ping/ + + Revision history + ~~~~~~~~~~~~~~~~ + May 1, 2014 + ----------- + Little modifications by Mohammad Emami + - Added Python 3 support. For now this project will just support + python 3.x + - Tested with python 3.3 + - version was upped to 0.6 + + March 19, 2013 + -------------- + * Fixing bug to prevent divide by 0 during run-time. + + January 26, 2012 + ---------------- + * Fixing BUG #4 - competability with python 2.x [tested with 2.7] + - Packet data building is different for 2.x and 3.x. + 'cose of the string/bytes difference. + * Fixing BUG #10 - the multiple resolv issue. + - When pinging domain names insted of hosts (for exmaple google.com) + you can get different IP every time you try to resolv it, we should + resolv the host only once and stick to that IP. + * Fixing BUGs #3 #10 - Doing hostname resolv only once. + * Fixing BUG #14 - Removing all 'global' stuff. + - You should not use globul! Its bad for you...and its not thread safe! + * Fix - forcing the use of different times on linux/windows for + more accurate mesurments. (time.time - linux/ time.clock - windows) + * Adding quiet_ping function - This way we'll be able to use this script + as external lib. + * Changing default timeout to 3s. (1second is not enought) + * Switching data syze to packet size. It's easyer for the user to ignore the + fact that the packet headr is 8b and the datasize 64 will make packet with + size 72. + + October 12, 2011 + -------------- + Merged updates from the main project + -> https://github.com/jedie/python-ping + + September 12, 2011 + -------------- + Bugfixes + cleanup by Jens Diemer + Tested with Ubuntu + Windows 7 + + September 6, 2011 + -------------- + Cleanup by Martin Falatic. Restored lost comments and docs. Improved + functionality: constant time between pings, internal times consistently + use milliseconds. Clarified annotations (e.g., in the checksum routine). + Using unsigned data in IP & ICMP header pack/unpack unless otherwise + necessary. Signal handling. Ping-style output formatting and stats. + + August 3, 2011 + -------------- + Ported to py3k by Zach Ware. Mostly done by 2to3; also minor changes to + deal with bytes vs. string changes (no more ord() in checksum() because + >source_string< is actually bytes, added .encode() to data in + send_one_ping()). That's about it. + + March 11, 2010 + -------------- + changes by Samuel Stauffer: + - replaced time.clock with default_timer which is set to + time.clock on windows and time.time on other systems. + + November 8, 2009 + ---------------- + Improved compatibility with GNU/Linux systems. + + Fixes by: + * George Notaras -- http://www.g-loaded.eu + Reported by: + * Chris Hallman -- http://cdhallman.blogspot.com + + Changes in this release: + - Re-use time.time() instead of time.clock(). The 2007 implementation + worked only under Microsoft Windows. Failed on GNU/Linux. + time.clock() behaves differently under the two OSes[1]. + + [1] http://docs.python.org/library/time.html#time.clock + + May 30, 2007 + ------------ + little rewrite by Jens Diemer: + - change socket asterisk import to a normal import + - replace time.time() with time.clock() + - delete "return None" (or change to "return" only) + - in checksum() rename "str" to "source_string" + + December 4, 2000 + ---------------- + Changed the struct.pack() calls to pack the checksum and ID as + unsigned. My thanks to Jerome Poincheval for the fix. + + November 22, 1997 + ----------------- + Initial hack. Doesn't do much, but rather than try to guess + what features I (or others) will want in the future, I've only + put in what I need now. + + December 16, 1997 + ----------------- + For some reason, the checksum bytes are in the wrong order when + this is run under Solaris 2.X for SPARC but it works right under + Linux x86. Since I don't know just what's wrong, I'll swap the + bytes always and then do an htons(). + + =========================================================================== + IP header info from RFC791 + -> http://tools.ietf.org/html/rfc791) + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |Version| IHL |Type of Service| Total Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Identification |Flags| Fragment Offset | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time to Live | Protocol | Header Checksum | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Options | Padding | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + =========================================================================== + ICMP Echo / Echo Reply Message header info from RFC792 + -> http://tools.ietf.org/html/rfc792 + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type | Code | Checksum | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Identifier | Sequence Number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Data ... + +-+-+-+-+- + + =========================================================================== + ICMP parameter info: + -> http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml + + =========================================================================== + An example of ping's typical output: + + PING heise.de (193.99.144.80): 56 data bytes + 64 bytes from 193.99.144.80: icmp_seq=0 ttl=240 time=127 ms + 64 bytes from 193.99.144.80: icmp_seq=1 ttl=240 time=127 ms + 64 bytes from 193.99.144.80: icmp_seq=2 ttl=240 time=126 ms + 64 bytes from 193.99.144.80: icmp_seq=3 ttl=240 time=126 ms + 64 bytes from 193.99.144.80: icmp_seq=4 ttl=240 time=127 ms + + ----heise.de PING Statistics---- + 5 packets transmitted, 5 packets received, 0.0% packet loss + round-trip (ms) min/avg/max/med = 126/127/127/127 + + =========================================================================== +""" + +# =============================================================================# +import argparse +import os, sys, socket, struct, select, time, signal + +__description__ = 'A pure python ICMP ping implementation using raw sockets.' + +if sys.platform == "win32": + # On Windows, the best timer is time.clock() + default_timer = time.clock +else: + # On most other platforms the best timer is time.time() + default_timer = time.time + +NUM_PACKETS = 3 +PACKET_SIZE = 64 +WAIT_TIMEOUT = 3.0 + +# =============================================================================# +# ICMP parameters + +ICMP_ECHOREPLY = 0 # Echo reply (per RFC792) +ICMP_ECHO = 8 # Echo request (per RFC792) +ICMP_MAX_RECV = 2048 # Max size of incoming buffer + +MAX_SLEEP = 1000 + + +class MyStats: + thisIP = "0.0.0.0" + pktsSent = 0 + pktsRcvd = 0 + minTime = 999999999 + maxTime = 0 + totTime = 0 + avrgTime = 0 + fracLoss = 1.0 + + +myStats = MyStats # NOT Used globally anymore. + + +# =============================================================================# +def checksum(source_string): + """ + A port of the functionality of in_cksum() from ping.c + Ideally this would act on the string as a series of 16-bit ints (host + packed), but this works. + Network data is big-endian, hosts are typically little-endian + """ + countTo = (int(len(source_string) / 2)) * 2 + sum = 0 + count = 0 + + # Handle bytes in pairs (decoding as short ints) + loByte = 0 + hiByte = 0 + while count < countTo: + if (sys.byteorder == "little"): + loByte = source_string[count] + hiByte = source_string[count + 1] + else: + loByte = source_string[count + 1] + hiByte = source_string[count] + try: # For Python3 + sum = sum + (hiByte * 256 + loByte) + except: # For Python2 + sum = sum + (ord(hiByte) * 256 + ord(loByte)) + count += 2 + + # Handle last byte if applicable (odd-number of bytes) + # Endianness should be irrelevant in this case + if countTo < len(source_string): # Check for odd length + loByte = source_string[len(source_string) - 1] + try: # For Python3 + sum += loByte + except: # For Python2 + sum += ord(loByte) + + sum &= 0xffffffff # Truncate sum to 32 bits (a variance from ping.c, which + # uses signed ints, but overflow is unlikely in ping) + + sum = (sum >> 16) + (sum & 0xffff) # Add high 16 bits to low 16 bits + sum += (sum >> 16) # Add carry from above (if any) + answer = ~sum & 0xffff # Invert and truncate to 16 bits + answer = socket.htons(answer) + + return answer + + +# =============================================================================# +def do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size, quiet=False): + """ + Returns either the delay (in ms) or None on timeout. + """ + delay = None + + try: # One could use UDP here, but it's obscure + mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname("icmp")) + except socket.error as e: + print("failed. (socket error: '%s')" % e.args[1]) + raise # raise the original error + + my_ID = os.getpid() & 0xFFFF + + sentTime = send_one_ping(mySocket, destIP, my_ID, mySeqNumber, packet_size) + if sentTime == None: + mySocket.close() + return delay + + myStats.pktsSent += 1 + + recvTime, dataSize, iphSrcIP, icmpSeqNumber, iphTTL = receive_one_ping(mySocket, my_ID, timeout) + + mySocket.close() + + if recvTime: + delay = (recvTime - sentTime) * 1000 + if not quiet: + print("%d bytes from %s: icmp_seq=%d ttl=%d time=%d ms" % ( + dataSize, socket.inet_ntoa(struct.pack("!I", iphSrcIP)), icmpSeqNumber, iphTTL, delay) + ) + myStats.pktsRcvd += 1 + myStats.totTime += delay + if myStats.minTime > delay: + myStats.minTime = delay + if myStats.maxTime < delay: + myStats.maxTime = delay + else: + delay = None + print("Request timed out.") + + return delay + + +# =============================================================================# +def send_one_ping(mySocket, destIP, myID, mySeqNumber, packet_size): + """ + Send one ping to the given >destIP<. + """ + # destIP = socket.gethostbyname(destIP) + + # Header is type (8), code (8), checksum (16), id (16), sequence (16) + # (packet_size - 8) - Remove header size from packet size + myChecksum = 0 + + # Make a dummy heder with a 0 checksum. + header = struct.pack( + "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber + ) + + padBytes = [] + startVal = 0x42 + # 'cose of the string/byte changes in python 2/3 we have + # to build the data differnely for different version + # or it will make packets with unexpected size. + if sys.version[:1] == '2': + bytes = struct.calcsize("d") + data = ((packet_size - 8) - bytes) * "Q" + data = struct.pack("d", default_timer()) + data + else: + for i in range(startVal, startVal + (packet_size - 8)): + padBytes += [(i & 0xff)] # Keep chars in the 0-255 range + # data = bytes(padBytes) + data = bytearray(padBytes) + + # Calculate the checksum on the data and the dummy header. + myChecksum = checksum(header + data) # Checksum is in network order + + # Now that we have the right checksum, we put that in. It's just easier + # to make up a new header than to stuff it into the dummy. + header = struct.pack( + "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber + ) + + packet = header + data + + sendTime = default_timer() + + try: + mySocket.sendto(packet, (destIP, 1)) # Port number is irrelevant for ICMP + except socket.error as e: + print("General failure (%s)" % (e.args[1])) + return + + return sendTime + + +# =============================================================================# +def receive_one_ping(mySocket, myID, timeout): + """ + Receive the ping from the socket. Timeout = in ms + """ + timeLeft = timeout / 1000 + + while True: # Loop while waiting for packet or timeout + startedSelect = default_timer() + whatReady = select.select([mySocket], [], [], timeLeft) + howLongInSelect = (default_timer() - startedSelect) + if whatReady[0] == []: # Timeout + return None, 0, 0, 0, 0 + + timeReceived = default_timer() + + recPacket, addr = mySocket.recvfrom(ICMP_MAX_RECV) + + ipHeader = recPacket[:20] + iphVersion, iphTypeOfSvc, iphLength, \ + iphID, iphFlags, iphTTL, iphProtocol, \ + iphChecksum, iphSrcIP, iphDestIP = struct.unpack( + "!BBHHHBBHII", ipHeader + ) + + icmpHeader = recPacket[20:28] + icmpType, icmpCode, icmpChecksum, \ + icmpPacketID, icmpSeqNumber = struct.unpack( + "!BBHHH", icmpHeader + ) + + if icmpPacketID == myID: # Our packet + dataSize = len(recPacket) - 28 + # print (len(recPacket.encode())) + return timeReceived, (dataSize + 8), iphSrcIP, icmpSeqNumber, iphTTL + + timeLeft = timeLeft - howLongInSelect + if timeLeft <= 0: + return None, 0, 0, 0, 0 + + +# =============================================================================# +def dump_stats(myStats): + """ + Show stats when pings are done + """ + print("\n----%s PYTHON PING Statistics----" % (myStats.thisIP)) + + if myStats.pktsSent > 0: + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd) / myStats.pktsSent + + print("%d packets transmitted, %d packets received, %0.1f%% packet loss" % ( + myStats.pktsSent, myStats.pktsRcvd, 100.0 * myStats.fracLoss + )) + + if myStats.pktsRcvd > 0: + print("round-trip (ms) min/avg/max = %d/%0.1f/%d" % ( + myStats.minTime, myStats.totTime / myStats.pktsRcvd, myStats.maxTime + )) + + print("") + return + + +# =============================================================================# +def signal_handler(signum, frame): + """ + Handle exit via signals + """ + dump_stats() + print("\n(Terminated with signal %d)\n" % (signum)) + sys.exit(0) + + +# =============================================================================# +def verbose_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, + packet_size=PACKET_SIZE, path_finder=False): + """ + Send >count< ping to >destIP< with the given >timeout< and display + the result. + """ + signal.signal(signal.SIGINT, signal_handler) # Handle Ctrl-C + if hasattr(signal, "SIGBREAK"): + # Handle Ctrl-Break e.g. under Windows + signal.signal(signal.SIGBREAK, signal_handler) + + myStats = MyStats() # Reset the stats + + mySeqNumber = 0 # Starting value + + try: + destIP = socket.gethostbyname(hostname) + print("\nPYTHON PING %s (%s): %d data bytes" % (hostname, destIP, packet_size)) + except socket.gaierror as e: + print("\nPYTHON PING: Unknown host: %s (%s)" % (hostname, e.args[1])) + print() + return + + myStats.thisIP = destIP + + for i in range(count): + delay = do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size) + + if delay == None: + delay = 0 + + mySeqNumber += 1 + + # Pause for the remainder of the MAX_SLEEP period (if applicable) + if (MAX_SLEEP > delay): + time.sleep((MAX_SLEEP - delay) / 1000) + + dump_stats(myStats) + + +# =============================================================================# +def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, + packet_size=PACKET_SIZE, path_finder=False): + """ + Same as verbose_ping, but the results are returned as tuple + """ + myStats = MyStats() # Reset the stats + mySeqNumber = 0 # Starting value + + try: + destIP = socket.gethostbyname(hostname) + except socket.gaierror as e: + return False + + myStats.thisIP = destIP + + # This will send packet that we dont care about 0.5 seconds before it starts + # acrutally pinging. This is needed in big MAN/LAN networks where you sometimes + # loose the first packet. (while the switches find the way... :/ ) + if path_finder: + fakeStats = MyStats() + do_one(fakeStats, destIP, hostname, timeout, + mySeqNumber, packet_size, quiet=True) + time.sleep(0.5) + + for i in range(count): + delay = do_one(myStats, destIP, hostname, timeout, + mySeqNumber, packet_size, quiet=True) + + if delay == None: + delay = 0 + + mySeqNumber += 1 + + # Pause for the remainder of the MAX_SLEEP period (if applicable) + if (MAX_SLEEP > delay): + time.sleep((MAX_SLEEP - delay) / 1000) + + if myStats.pktsSent > 0: + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd) / myStats.pktsSent + if myStats.pktsRcvd > 0: + myStats.avrgTime = myStats.totTime / myStats.pktsRcvd + + # return tuple(max_rtt, min_rtt, avrg_rtt, percent_lost) + return myStats.maxTime, myStats.minTime, myStats.avrgTime, myStats.fracLoss + + +# =============================================================================# +def main(): + parser = argparse.ArgumentParser(description=__description__) + parser.add_argument('-q', '--quiet', action='store_true', + help='quiet output') + parser.add_argument('-c', '--count', type=int, default=NUM_PACKETS, + help=('number of packets to be sent ' + '(default: %(default)s)')) + parser.add_argument('-W', '--timeout', type=float, default=WAIT_TIMEOUT, + help=('time to wait for a response in seoncds ' + '(default: %(default)s)')) + parser.add_argument('-s', '--packet-size', type=int, default=PACKET_SIZE, + help=('number of data bytes to be sent ' + '(default: %(default)s)')) + parser.add_argument('destination') + # args = parser.parse_args() + + ping = verbose_ping + # if args.quiet: + # ping = quiet_ping + ping('Google.com', timeout=1000) + # ping(args.destination, timeout=args.timeout*1000, count=args.count, + # packet_size=args.packet_size) + + +if __name__ == '__main__': + main() From b0c6ff3076e68acc34243639d4bb5ca17a0eb221 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 30 Aug 2018 09:05:59 -0400 Subject: [PATCH 247/521] Display a periodically updated graphical ping time --- Demo_Matplotlib_Ping_Graph.py | 290 ++++++++++++++-------------------- 1 file changed, 115 insertions(+), 175 deletions(-) diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index 307bf95c8..b0083fb78 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -9,154 +9,11 @@ A graph of time to ping Google.com Demonstrates Matploylib used in an animated way. -Note this file contains a copy of ping.py. Here is some information about it. -If you scroll past the PySimpleGUI code, you will find 100% of the original file -has been copied to this file. - - A pure python ping implementation using raw sockets. - - (This is Python 3 port of https://github.com/jedie/python-ping) - (Tested and working with python 2.7, should work with 2.6+) - - Note that ICMP messages can only be sent from processes running as root - (in Windows, you must run this script as 'Administrator'). - - Derived from ping.c distributed in Linux's netkit. That code is - copyright (c) 1989 by The Regents of the University of California. - That code is in turn derived from code written by Mike Muuss of the - US Army Ballistic Research Laboratory in December, 1983 and - placed in the public domain. They have my thanks. - - Bugs are naturally mine. I'd be glad to hear about them. There are - certainly word - size dependencies here. - - Copyright (c) Matthew Dixon Cowles, . - Distributable under the terms of the GNU General Public License - version 2. Provided with no warranties of any sort. - - Original Version from Matthew Dixon Cowles: - -> ftp://ftp.visi.com/users/mdc/ping.py - - Rewrite by Jens Diemer: - -> http://www.python-forum.de/post-69122.html#69122 - - Rewrite by George Notaras: - -> http://www.g-loaded.eu/2009/10/30/python-ping/ - - Enhancements by Martin Falatic: - -> http://www.falatic.com/index.php/39/pinging-with-python - - Enhancements and fixes by Georgi Kolev: - -> http://github.com/jedie/python-ping/ - - Bug fix by Andrejs Rozitis: - -> http://github.com/rozitis/python-ping/ +Note this file contains a copy of ping.py. It is contained in the first part of this file """ -#================================================================================ -# Globals -# These are needed because callback functions are used. -# Need to retain state across calls -#================================================================================ -class MyGlobals: - axis_pings = None - ping_x_array = [] - ping_y_array = [] - -g_my_globals = MyGlobals() - -#================================================================================ -# Performs *** PING! *** -#================================================================================ -def run_a_ping_and_graph(): - global g_my_globals # graphs are global so that can be retained across multiple calls to this callback - - #===================== Do the ping =====================# - response = quiet_ping('google.com',timeout=1000) - if response[0] == 0: - ping_time = 1000 - else: - ping_time = response[0] - #===================== Store current ping in historical array =====================# - g_my_globals.ping_x_array.append(len(g_my_globals.ping_x_array)) - g_my_globals.ping_y_array.append(ping_time) - # ===================== Only graph last 100 items =====================# - if len(g_my_globals.ping_x_array) > 100: - x_array = g_my_globals.ping_x_array[-100:] - y_array = g_my_globals.ping_y_array[-100:] - else: - x_array = g_my_globals.ping_x_array - y_array = g_my_globals.ping_y_array - - # ===================== Call graphinc functions =====================# - g_my_globals.axis_ping.clear() # clear before graphing - g_my_globals.axis_ping.plot(x_array,y_array) # graph the ping values - -#================================================================================ -# Function: Set graph titles and Axis labels -# Sets the text for the subplots -# Have to do this in 2 places... initially when creating and when updating -# So, putting into a function so don't have to duplicate code -#================================================================================ -def set_chart_labels(): - global g_my_globals - - g_my_globals.axis_ping.set_xlabel('Time') - g_my_globals.axis_ping.set_ylabel('Ping (ms)') - g_my_globals.axis_ping.set_title('Current Ping Duration', fontsize = 12) - -def draw(fig, canvas): - # Magic code that draws the figure onto the Canvas Element's canvas - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - canvas.create_image(640 / 2, 480 / 2, image=photo) - figure_canvas_agg = FigureCanvasAgg(fig) - figure_canvas_agg.draw() - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - return photo - -#================================================================================ -# Function: MAIN -#================================================================================ -def main(): - global g_my_globals - - canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on - # define the form layout - layout = [[g.Text('Animated Ping', size=(40,1), justification='center', font='Helvetica 20')], - [canvas_elem], - [g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]] - - # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.ReadNonBlocking() - - canvas = canvas_elem.TKCanvas - - fig = plt.figure() - g_my_globals.axis_ping = fig.add_subplot(1,1,1) - set_chart_labels() - plt.tight_layout() - - while True: - button, values = form.ReadNonBlocking() - if button is 'Exit' or values is None: - break - - run_a_ping_and_graph() - photo = draw(fig, canvas) - - -if __name__ == '__main__': - main() - -# !/usr/bin/env python3 -# -*- coding: utf-8 -*- - """ A pure python ping implementation using raw sockets. @@ -661,20 +518,19 @@ def verbose_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, dump_stats(myStats) - -# =============================================================================# +#=============================================================================# def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, packet_size=PACKET_SIZE, path_finder=False): """ Same as verbose_ping, but the results are returned as tuple """ - myStats = MyStats() # Reset the stats - mySeqNumber = 0 # Starting value + myStats = MyStats() # Reset the stats + mySeqNumber = 0 # Starting value try: destIP = socket.gethostbyname(hostname) except socket.gaierror as e: - return False + return 0,0,0,0 myStats.thisIP = destIP @@ -684,12 +540,12 @@ def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, if path_finder: fakeStats = MyStats() do_one(fakeStats, destIP, hostname, timeout, - mySeqNumber, packet_size, quiet=True) + mySeqNumber, packet_size, quiet=True) time.sleep(0.5) for i in range(count): delay = do_one(myStats, destIP, hostname, timeout, - mySeqNumber, packet_size, quiet=True) + mySeqNumber, packet_size, quiet=True) if delay == None: delay = 0 @@ -698,41 +554,125 @@ def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, # Pause for the remainder of the MAX_SLEEP period (if applicable) if (MAX_SLEEP > delay): - time.sleep((MAX_SLEEP - delay) / 1000) + time.sleep((MAX_SLEEP - delay)/1000) if myStats.pktsSent > 0: - myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd) / myStats.pktsSent + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd)/myStats.pktsSent if myStats.pktsRcvd > 0: myStats.avrgTime = myStats.totTime / myStats.pktsRcvd # return tuple(max_rtt, min_rtt, avrg_rtt, percent_lost) return myStats.maxTime, myStats.minTime, myStats.avrgTime, myStats.fracLoss - # =============================================================================# + + + +#================================================================================ +# Globals +# These are needed because callback functions are used. +# Need to retain state across calls +#================================================================================ +SIZE=(320,240) + +class MyGlobals: + axis_pings = None + ping_x_array = [] + ping_y_array = [] + +g_my_globals = MyGlobals() + +#================================================================================ +# Performs *** PING! *** +#================================================================================ +def run_a_ping_and_graph(): + global g_my_globals # graphs are global so that can be retained across multiple calls to this callback + + #===================== Do the ping =====================# + response = quiet_ping('google.com',timeout=1000) + if response[0] == 0: + ping_time = 1000 + else: + ping_time = response[0] + #===================== Store current ping in historical array =====================# + g_my_globals.ping_x_array.append(len(g_my_globals.ping_x_array)) + g_my_globals.ping_y_array.append(ping_time) + # ===================== Only graph last 100 items =====================# + if len(g_my_globals.ping_x_array) > 100: + x_array = g_my_globals.ping_x_array[-100:] + y_array = g_my_globals.ping_y_array[-100:] + else: + x_array = g_my_globals.ping_x_array + y_array = g_my_globals.ping_y_array + + # ===================== Call graphinc functions =====================# + g_my_globals.axis_ping.clear() # clear before graphing + set_chart_labels() + g_my_globals.axis_ping.plot(x_array,y_array) # graph the ping values + +#================================================================================ +# Function: Set graph titles and Axis labels +# Sets the text for the subplots +# Have to do this in 2 places... initially when creating and when updating +# So, putting into a function so don't have to duplicate code +#================================================================================ +def set_chart_labels(): + global g_my_globals + + g_my_globals.axis_ping.set_xlabel('Time', fontsize=8) + g_my_globals.axis_ping.set_ylabel('Ping (ms)', fontsize=8) + g_my_globals.axis_ping.set_title('Current Ping Duration', fontsize = 8) + +def draw(fig, canvas): + # Magic code that draws the figure onto the Canvas Element's canvas + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + canvas.create_image(SIZE[0] / 2, SIZE[1] / 2, image=photo) + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + return photo + +#================================================================================ +# Function: MAIN +#================================================================================ def main(): - parser = argparse.ArgumentParser(description=__description__) - parser.add_argument('-q', '--quiet', action='store_true', - help='quiet output') - parser.add_argument('-c', '--count', type=int, default=NUM_PACKETS, - help=('number of packets to be sent ' - '(default: %(default)s)')) - parser.add_argument('-W', '--timeout', type=float, default=WAIT_TIMEOUT, - help=('time to wait for a response in seoncds ' - '(default: %(default)s)')) - parser.add_argument('-s', '--packet-size', type=int, default=PACKET_SIZE, - help=('number of data bytes to be sent ' - '(default: %(default)s)')) - parser.add_argument('destination') - # args = parser.parse_args() - - ping = verbose_ping - # if args.quiet: - # ping = quiet_ping - ping('Google.com', timeout=1000) - # ping(args.destination, timeout=args.timeout*1000, count=args.count, - # packet_size=args.packet_size) + global g_my_globals + + canvas_elem = g.Canvas(size=SIZE, background_color='white') # get the canvas we'll be drawing on + # define the form layout + layout = [[canvas_elem], + [g.ReadFormButton('Exit', size=(4,1), pad=((130, 0), 3))]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', background_color='white') + form.Layout(layout) + form.ReadNonBlocking() + + canvas = canvas_elem.TKCanvas + + fig = plt.figure(figsize=(3.1, 2.25), tight_layout={'pad':0}) + g_my_globals.axis_ping = fig.add_subplot(1,1,1) + plt.rcParams['xtick.labelsize'] = 8 + plt.rcParams['ytick.labelsize'] = 8 + set_chart_labels() + plt.tight_layout() + + while True: + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + exit(0) + + run_a_ping_and_graph() + photo = draw(fig, canvas) + +if __name__ == '__main__': + main() + +# !/usr/bin/env python3 +# -*- coding: utf-8 -*- if __name__ == '__main__': main() From b7a818ac7219e18a5f7079924cfd3c52b16917c1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 30 Aug 2018 09:58:54 -0400 Subject: [PATCH 248/521] Cookook browser, Matplotlib browser, Ping graph layout --- Demo_Cookbook.py => Demo_Cookbook_Browser.py | 0 ...tplotlib_Multiple.py => Demo_Matplotlib_Browser.py | 0 Demo_Matplotlib_Ping_Graph.py | 11 ++--------- 3 files changed, 2 insertions(+), 9 deletions(-) rename Demo_Cookbook.py => Demo_Cookbook_Browser.py (100%) rename Demo_Matplotlib_Multiple.py => Demo_Matplotlib_Browser.py (100%) diff --git a/Demo_Cookbook.py b/Demo_Cookbook_Browser.py similarity index 100% rename from Demo_Cookbook.py rename to Demo_Cookbook_Browser.py diff --git a/Demo_Matplotlib_Multiple.py b/Demo_Matplotlib_Browser.py similarity index 100% rename from Demo_Matplotlib_Multiple.py rename to Demo_Matplotlib_Browser.py diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index b0083fb78..d20755a8d 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -642,11 +642,10 @@ def main(): canvas_elem = g.Canvas(size=SIZE, background_color='white') # get the canvas we'll be drawing on # define the form layout - layout = [[canvas_elem], - [g.ReadFormButton('Exit', size=(4,1), pad=((130, 0), 3))]] + layout = [[ canvas_elem, g.ReadFormButton('Exit', pad=(0,(210,0)))] ] # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', background_color='white') + form = g.FlexForm('Ping Graph', background_color='white') form.Layout(layout) form.ReadNonBlocking() @@ -668,11 +667,5 @@ def main(): photo = draw(fig, canvas) -if __name__ == '__main__': - main() - -# !/usr/bin/env python3 -# -*- coding: utf-8 -*- - if __name__ == '__main__': main() From 870c3026f58801d489e7a52be8d2ce450ecd7349 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 30 Aug 2018 10:55:49 -0400 Subject: [PATCH 249/521] Automatically show code when item selected This is such a cool feature. --- Demo_Cookbook_Browser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 38caa5d48..468e6b34e 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -787,8 +787,8 @@ def InputElementUpdate(): while True: sg.ChangeLookAndFeel('LightGreen') - col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), key='func')], - [sg.SimpleButton('Run'), sg.ReadFormButton('Show Code'), sg.Exit()]] + col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), select_submits=True, key='func')], + [sg.SimpleButton('Run'), sg.Exit()]] layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], [sg.Column(col_listbox, pad=(5,(3,2))), multiline_elem], @@ -809,7 +809,7 @@ def InputElementUpdate(): except: continue - if button is 'Show Code': + if button is '': multiline_elem.Update(inspect.getsource(func)) button, values = form.Read() elif button is 'Run': From f574f333181482043cb09eeb9883f50623cd6522 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 30 Aug 2018 22:02:29 -0400 Subject: [PATCH 250/521] Slider addition --- Demo_MIDI_Player.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py index 3e0e81b5b..dbaabc0c1 100644 --- a/Demo_MIDI_Player.py +++ b/Demo_MIDI_Player.py @@ -41,7 +41,7 @@ def PlayerChooseSongGUI(self): [g.Text('Choose MIDI Output Device', size=(22, 1)), g.Listbox(values=self.PortList, size=(30, len(self.PortList) + 1), key='device')], [g.Text('_' * 250, auto_size_text=False, size=(100, 1))], - [g.SimpleButton('PLAY!', size=(10, 2), button_color=('red', 'white'), font=("Helvetica", 15), bind_return_key=True), g.Text(' ' * 2, size=(4, 1)), g.Cancel(size=(8, 2), font=("Helvetica", 15))]] + [g.SimpleButton('PLAY', size=(12, 2), button_color=('red', 'white'), font=("Helvetica", 15), bind_return_key=True), g.Text(' ' * 2, size=(4, 1)), g.Cancel(size=(8, 2), font=("Helvetica", 15))]] self.Form = form @@ -56,11 +56,13 @@ def PlayerPlaybackGUIStart(self, NumFiles=1): image_next = './ButtonGraphics/Next.png' image_exit = './ButtonGraphics/Exit.png' - self.TextElem = g.T('Song loading....', size=(85,5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) + self.TextElem = g.T('Song loading....', size=(70,5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) + self.SliderElem = g.Slider(range=(1,100), size=(50, 8), orientation='h', text_color='#f0f0f0') form = g.FlexForm('MIDI File Player', default_element_size=(30,1),font=("Helvetica", 25)) layout = [ [g.T('MIDI File Player', size=(30,1), font=("Helvetica", 25))], [self.TextElem], + [self.SliderElem], [g.ReadFormButton('PAUSE', button_color=g.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '), g.ReadFormButton('NEXT', button_color=g.TRANSPARENT_BUTTON, @@ -113,10 +115,11 @@ def GetCurrentTime(): ''' return int(round(time.time() * 1000)) + pback = PlayerGUI() button, values = pback.PlayerChooseSongGUI() - if button != 'PLAY!': + if button != 'PLAY': g.MsgBoxCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) exit(69) if values['device']: @@ -164,7 +167,7 @@ def GetCurrentTime(): # Build list of data contained in MIDI File using only track 0 midi_length_in_seconds = mid.length - display_file_list = '>> ' + '\n'.join([f for i, f in enumerate(filelist[now_playing_number:]) if i < 10]) + display_file_list = '>> ' + '\n'.join([f for i, f in enumerate(filetitles[now_playing_number:]) if i < 10]) paused = cancelled = next_file = False ######################### Loop through MIDI Messages ########################### while(True): @@ -179,6 +182,7 @@ def GetCurrentTime(): display_string = 'Now Playing {} of {}\n{}\n {:02d}:{:02d} of {}\nPlaylist:'.\ format(now_playing_number+1, len(filelist), midi_title, *divmod(t, 60), display_midi_len) # display list of next 10 files to be played. + pback.SliderElem.Update(t, range=(1,midi_length_in_seconds)) rc = pback.PlayerPlaybackGUIUpdate(display_string + '\n' + display_file_list) else: # fake rest of code as if GUI did nothing rc = PLAYER_COMMAND_NONE From 310fe845e4fcf16d27b7a23fa81af2a601fe7cb0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 31 Aug 2018 09:07:37 -0400 Subject: [PATCH 251/521] Spin Element change_submits feature, can change font when updating Text Element, CHANGE TO PACKED ROWS Important change to how "rows" are placed into form. Switched from Grid to packed. SHOULD be ok, but it's a big change. --- PySimpleGUI.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e3931bdb1..c3c67a850 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -421,7 +421,7 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, values, initial_value=None, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, initial_value=None, change_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Spin Box Element :param values: @@ -434,6 +434,7 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N ''' self.Values = values self.DefaultValue = initial_value + self.ChangeSubmits = change_submits self.TKSpinBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR @@ -441,6 +442,13 @@ def __init__(self, values, initial_value=None, scale=(None, None), size=(None, N super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) return + def SpinChangedHandler(self, event): + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + def __del__(self): try: self.TKSpinBox.__del__() @@ -509,7 +517,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad) return - def Update(self, new_value = None, background_color=None, text_color=None): + def Update(self, new_value = None, background_color=None, text_color=None, font=None): if new_value is not None: self.DisplayText=new_value stringvar = self.TKStringVar @@ -518,6 +526,9 @@ def Update(self, new_value = None, background_color=None, text_color=None): self.TKText.configure(background=background_color) if text_color is not None: self.TKText.configure(fg=text_color) + if font is not None: + self.TKText.configure(font=font) + def __del__(self): super().__del__() @@ -1803,6 +1814,8 @@ def CharWidthInPixels(): element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKSpinBox.configure(fg=text_color) + if element.ChangeSubmits: + element.TKSpinBox.bind('', element.SpinChangedHandler) # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size @@ -1870,7 +1883,8 @@ def CharWidthInPixels(): element.TKScale = tkscale #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets - tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) + # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) + tk_row_frame.pack(side=tk.TOP, anchor='sw', padx=DEFAULT_MARGINS[0]) if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: tk_row_frame.configure(background=form.BackgroundColor) From b7c095d9c01a758945b4d0bb14a50c77d08b9969 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 31 Aug 2018 09:10:15 -0400 Subject: [PATCH 252/521] New demo that shows how to use new spinner change submits capability --- Demo_Font_Sizer.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Demo_Font_Sizer.py diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py new file mode 100644 index 000000000..452e22b5b --- /dev/null +++ b/Demo_Font_Sizer.py @@ -0,0 +1,28 @@ + +# Testing async form, see if can have a spinner +# that adjusts the size of text displayed + +import PySimpleGUI as sg + +form = sg.FlexForm("Font size selector") + +fontSize = 12 +sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize)) +layout = [ + [sampleText, sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin')], + [sg.OK(), sg.Cancel()] + ] + +sz = fontSize +form.Layout(layout) +while True: + button, values= form.Read() + if button is None: + break + sz = int(values['spin']) + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + sampleText.Update(font=font) + +print("Done.") From 3793ff81c222dbf39fcf9a7213e875171562d7ee Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 31 Aug 2018 09:29:00 -0400 Subject: [PATCH 253/521] Slider change_submits feature. Update method for Slider, updated Font Sizer demo --- Demo_Font_Sizer.py | 13 ++++++++++--- PySimpleGUI.py | 29 +++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 452e22b5b..7a5e0b8f0 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -1,5 +1,5 @@ -# Testing async form, see if can have a spinner +# Testing async form, see if can have a slider # that adjusts the size of text displayed import PySimpleGUI as sg @@ -8,8 +8,10 @@ fontSize = 12 sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize)) +slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider') +spin = sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin') layout = [ - [sampleText, sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin')], + [sampleText, spin, slider], [sg.OK(), sg.Cancel()] ] @@ -19,10 +21,15 @@ button, values= form.Read() if button is None: break - sz = int(values['spin']) + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider if sz != fontSize: + print(sampleText.Font, sampleText.Size) fontSize = sz font = "Helvetica " + str(fontSize) sampleText.Update(font=font) + slider.Update(sz) + spin.Update(sz) print("Done.") diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c3c67a850..ecac9639d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -442,6 +442,9 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) return + def Update(self, new_value): + self.TKStringVar.set(new_value) + def SpinChangedHandler(self, event): # first, get the results table built # modify the Results table in the parent FlexForm object @@ -888,18 +891,23 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, resolution=None, orientation=None, border_width=None, relief=None, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, range=(None,None), default_value=None, resolution=None, orientation=None, border_width=None, relief=None, change_submits=False, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None): ''' - Slider Element + Slider :param range: :param default_value: + :param resolution: :param orientation: :param border_width: :param relief: - :param scale: Adds multiplier to size (w,h) - :param size: Size of field in characters - :param background_color: Color for Element. Text or RGB Hex + :param change_submits: + :param scale: + :param size: :param font: + :param background_color: + :param text_color: + :param key: + :param pad: ''' self.TKScale = None self.Range = (1,10) if range == (None, None) else range @@ -908,6 +916,7 @@ def __init__(self, range=(None,None), default_value=None, resolution=None, orien self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF self.Resolution = 1 if resolution is None else resolution + self.ChangeSubmits = change_submits super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) return @@ -917,6 +926,12 @@ def Update(self, value, range=(None, None)): if range != (None, None): self.TKScale.config(from_ = range[0], to_ = range[1]) + def SliderChangedHandler(self, event): + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop def __del__(self): super().__del__() @@ -1871,7 +1886,9 @@ def CharWidthInPixels(): else: range_from = element.Range[0] range_to = element.Range[1] - tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font, command=element.SliderChangedHandler) + # if element.ChangeSubmits: + # element.tkscale.bind('', element.SliderChangedHandler) # tktext_label.configure(anchor=tk.NW, image=photo) tkscale.config(highlightthickness=0) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: From c4364a210968b984481b916dfc9cbb943a262add Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 31 Aug 2018 19:03:19 -0400 Subject: [PATCH 254/521] New Pop series of functions Popup, PopupGetFile, PopupGetFolder, PopupGetText, --- PySimpleGUI.py | 80 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ecac9639d..02260b3ad 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -911,7 +911,7 @@ def __init__(self, range=(None,None), default_value=None, resolution=None, orien ''' self.TKScale = None self.Range = (1,10) if range == (None, None) else range - self.DefaultValue = 5 if default_value is None else default_value + self.DefaultValue = self.Range[0] if default_value is None else default_value self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF @@ -2131,6 +2131,11 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a button, values = form.Show() return button +# ============================== PopUp ============# +# Lazy function. Same as calling MsgBox with parms # +# ===================================================# +Popup = MsgBox + # ============================== MsgBoxAutoClose====# # Lazy function. Same as calling MsgBox with parms # # ===================================================# @@ -2147,6 +2152,8 @@ def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_durati MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return +PopupTimed = MsgBoxAutoClose + # ============================== MsgBoxError =====# # Like MsgBox but presents RED BUTTONS # @@ -2164,6 +2171,9 @@ def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return +PopupError = MsgBoxError + + # ============================== MsgBoxCancel =====# # # # ===================================================# @@ -2180,6 +2190,9 @@ def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return +PopupCancel =MsgBoxCancel + + # ============================== MsgBoxOK =====# # Like MsgBox but only 1 button # # ===================================================# @@ -2196,6 +2209,10 @@ def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=Non MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return +PopupOk = MsgBoxOK +PopupOK = MsgBoxOK + + # ============================== MsgBoxOKCancel ====# # Like MsgBox but presents OK and Cancel buttons # # ===================================================# @@ -2212,6 +2229,10 @@ def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_durati result = MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return result +PopupOKCancel = MsgBoxOKCancel +PopupOkCancel = MsgBoxOKCancel + + # ==================================== YesNoBox=====# # Like MsgBox but presents Yes and No buttons # # Returns True if Yes was pressed else False # @@ -2229,6 +2250,9 @@ def MsgBoxYesNo(*args, button_color=None, auto_close=False, auto_close_duration= result = MsgBox(*args, button_type=MSG_BOX_YES_NO, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return result + +PopupYesNo = MsgBoxYesNo + # ============================== PROGRESS METER ========================================== # def ConvertArgsToSingleString(*args): @@ -2574,6 +2598,24 @@ def GetPathBox(title, message, default_path='', button_color=None, size=(None, N path = input_values[0] return True, path + +GetFolder = GetPathBox +AskForFolder = GetPathBox + + +def PopupGetFolder(message, default_path='', button_color=None, size=(None, None)): + with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: + layout = [[Text(message, auto_size_text=True)], + [InputText(default_text=default_path, size=size), FolderBrowse()], + [Ok(), Cancel()]] + + (button, input_values) = form.LayoutAndShow(layout) + if button != 'Ok': + return None + else: + path = input_values[0] + return path + # ============================== GetFileBox =========# # Like the Get folder box but for files # # ===================================================# @@ -2590,6 +2632,22 @@ def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*") path = input_values[0] return True, path +GetFile = GetFileBox +AskForFile = GetFileBox + + +def PopupGetFile(message, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)): + with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: + layout = [[Text(message, auto_size_text=True)], + [InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)], + [Ok(), Cancel()]] + + (button, input_values) = form.LayoutAndShow(layout) + if button != 'Ok': + return None + else: + path = input_values[0] + return path # ============================== GetTextBox =========# # Get a single line of text # @@ -2606,6 +2664,24 @@ def GetTextBox(title, message, Default='', button_color=None, size=(None, None)) else: return True, input_values[0] +GetText = GetTextBox +GetString = GetTextBox +AskForText = GetTextBox +AskForString = GetTextBox + + +def PopupGetText(message, Default='', button_color=None, size=(None, None)): + with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: + layout = [[Text(message, auto_size_text=True)], + [InputText(default_text=Default, size=size)], + [Ok(), Cancel()]] + + (button, input_values) = form.LayoutAndShow(layout) + if button != 'Ok': + return None + else: + return input_values[0] + # ============================== SetGlobalIcon ======# # Sets the icon to be used by default # @@ -2860,7 +2936,7 @@ def main(): [Text('Here is your sample input form....')], [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], - [Submit(bind_return_key=True), Cancel()]] + [Ok(bind_return_key=True), Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) From 421e96e800bfd68756ab8fb8eac2c2a3825ddf27 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 1 Sep 2018 10:51:19 -0400 Subject: [PATCH 255/521] Font sizer - fixed exit detection. Change Submits for Slider - don't setup unless change_submits flag is set --- Demo_Font_Sizer.py | 4 ++-- PySimpleGUI.py | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 7a5e0b8f0..4874437c5 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -8,7 +8,7 @@ fontSize = 12 sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize)) -slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider') +slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=False, key='slider') spin = sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin') layout = [ [sampleText, spin, slider], @@ -19,7 +19,7 @@ form.Layout(layout) while True: button, values= form.Read() - if button is None: + if button in (None, 'OK', 'Cancel'): break sz_spin = int(values['spin']) sz_slider = int(values['slider']) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 02260b3ad..419213c35 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -937,6 +937,37 @@ def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# TkScrollableFrame (Used by Column (SOON) # +# ---------------------------------------------------------------------- # +# TODO NOT YET WORKING! DO NOT USE. Will be used to make scrollable columns +class TkScrollableFrame(tk.Frame): + def __init__(self, master, **kwargs): + tk.Frame.__init__(self, master, **kwargs) + + # create a canvas object and a vertical scrollbar for scrolling it + self.vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) + self.vscrollbar.pack(side='right', fill="y", expand="false") + self.canvas = tk.Canvas(self, yscrollcommand=self.vscrollbar.set) + self.canvas.pack(side="left") + self.vscrollbar.config(command=self.canvas.yview) + + # reset the view + self.canvas.xview_moveto(0) + self.canvas.yview_moveto(0) + + # create a frame inside the canvas which will be scrolled with it + # self.interior = tk.Frame(self.canvas, **kwargs) + # self.canvas.create_window(0, 0, window=self.interior, anchor="nw") + + # self.bind('', self.set_scrollregion) + + + def set_scrollregion(self, event=None): + """ Set the scroll region on the canvas""" + self.canvas.configure(scrollregion=self.canvas.bbox('all')) + + # ---------------------------------------------------------------------- # # Column # # ---------------------------------------------------------------------- # @@ -1576,6 +1607,7 @@ def CharWidthInPixels(): # ------------------------- COLUMN element ------------------------- # if element_type == ELEM_TYPE_COLUMN: col_frame = tk.Frame(tk_row_frame) + # col_frame = TkScrollableFrame(tk_row_frame) # do not use yet! not working PackFormIntoFrame(element, col_frame, toplevel_form) col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: @@ -1886,10 +1918,10 @@ def CharWidthInPixels(): else: range_from = element.Range[0] range_to = element.Range[1] - tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font, command=element.SliderChangedHandler) - # if element.ChangeSubmits: - # element.tkscale.bind('', element.SliderChangedHandler) - # tktext_label.configure(anchor=tk.NW, image=photo) + if element.ChangeSubmits: + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font, command=element.SliderChangedHandler) + else: + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) tkscale.config(highlightthickness=0) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: tkscale.configure(background=element.BackgroundColor) From a19fb528d4a4a1f2cd01ede489f190345d8f1337 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 1 Sep 2018 11:28:44 -0400 Subject: [PATCH 256/521] NEW ELEMENT - InputOptionMenu / OptionMenu. Acts like a ComboBox but looks better Never heard of this widget before, but after seeing it, had to add it to the list of Element choices! --- PySimpleGUI.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 419213c35..be3511825 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -140,6 +140,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_TEXT = 1 ELEM_TYPE_INPUT_TEXT = 20 ELEM_TYPE_INPUT_COMBO = 21 +ELEM_TYPE_INPUT_OPTION_MENU = 22 ELEM_TYPE_INPUT_RADIO = 5 ELEM_TYPE_INPUT_MULTILINE = 7 ELEM_TYPE_INPUT_CHECKBOX = 8 @@ -301,6 +302,34 @@ def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# Option Menu # +# ---------------------------------------------------------------------- # +class InputOptionMenu(Element): + + def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): + ''' + Input Combo Box Element (also called Dropdown box) + :param values: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + ''' + self.Values = values + self.TKOptionMenu = None + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + + def __del__(self): + try: + self.TKOptionMenu.__del__() + except: + pass + super().__del__() + # ---------------------------------------------------------------------- # # Listbox # # ---------------------------------------------------------------------- # @@ -1326,6 +1355,13 @@ def __del__(self): DropDown = InputCombo Drop = InputCombo + +# ------------------------- OPTION MENU Element lazy functions ------------------------- # + +OptionMenu = InputOptionMenu + + + # def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): # return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text, background_color=background_color) # @@ -1502,6 +1538,8 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): top_level_form.LastButtonClicked = None elif element.Type == ELEM_TYPE_INPUT_COMBO: value=element.TKStringVar.get() + elif element.Type == ELEM_TYPE_INPUT_OPTION_MENU: + value=element.TKStringVar.get() elif element.Type == ELEM_TYPE_INPUT_LISTBOX: try: items=element.TKListbox.curselection() @@ -1758,6 +1796,19 @@ def CharWidthInPixels(): # element.TKCombo.configure(background=element.BackgroundColor) element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) element.TKCombo.current(0) + # ------------------------- OPTION MENU (Like ComboBox but different) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_OPTION_MENU: + max_line_len = max([len(str(l)) for l in element.Values]) + element.TKStringVar = tk.StringVar() + element.TKStringVar.set(element.Values[0]) + element.TKOptionMenu = tk.OptionMenu(tk_row_frame, element.TKStringVar ,*element.Values ) + element.TKOptionMenu.config(highlightthickness=0) + element.TKOptionMenu.config(borderwidth=border_depth) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKOptionMenu.configure(background=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + element.TKOptionMenu.configure(fg=element.TextColor) + element.TKOptionMenu.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- LISTBOX element ------------------------- # elif element_type == ELEM_TYPE_INPUT_LISTBOX: max_line_len = max([len(str(l)) for l in element.Values]) From 209e5ebf25de5deff6811f92b5e33e3dc167ae03 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 1 Sep 2018 11:37:36 -0400 Subject: [PATCH 257/521] bug fix --- Demo_Font_Sizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 4874437c5..9107ffef7 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -8,7 +8,7 @@ fontSize = 12 sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize)) -slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=False, key='slider') +slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider') spin = sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin') layout = [ [sampleText, spin, slider], From aeaf04ed73ec00d8b92d64063fa25f928125f3ab Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 1 Sep 2018 17:46:35 -0400 Subject: [PATCH 258/521] NEW Dark look and feel setting. Fixed problem with incorrect checkbox colors --- PySimpleGUI.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index be3511825..f66cf6dc1 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -398,7 +398,9 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None self.TKRadio = None self.GroupID = group_id self.Value = None - super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) + self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR + + super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) def __del__(self): try: @@ -426,8 +428,9 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.InitialState = default self.Value = None self.TKCheckbutton = None + self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) def Get(self): return self.TKIntVar.get() @@ -583,12 +586,19 @@ def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], st if orientation[0].lower() == 'h': s = ttk.Style() s.theme_use(style) - s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + if BarColor != COLOR_SYSTEM_DEFAULT: + s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + else: + s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", troughrelief=relief, borderwidth=border_width, thickness=width) + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate') else: s = ttk.Style() s.theme_use(style) - s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + if BarColor != COLOR_SYSTEM_DEFAULT: + s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + else: + s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", troughrelief=relief, borderwidth=border_width, thickness=width) self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate') def Update(self, count, max=None): @@ -1802,7 +1812,7 @@ def CharWidthInPixels(): element.TKStringVar = tk.StringVar() element.TKStringVar.set(element.Values[0]) element.TKOptionMenu = tk.OptionMenu(tk_row_frame, element.TKStringVar ,*element.Values ) - element.TKOptionMenu.config(highlightthickness=0) + element.TKOptionMenu.config(highlightthickness=0, font=font) element.TKOptionMenu.config(borderwidth=border_depth) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKOptionMenu.configure(background=element.BackgroundColor) @@ -1859,6 +1869,7 @@ def CharWidthInPixels(): element.TKCheckbutton.configure(state='disable') if element.BackgroundColor is not None: element.TKCheckbutton.configure(background=element.BackgroundColor) + element.TKCheckbutton.configure(selectcolor=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKCheckbutton.configure(fg=text_color) element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) @@ -1894,7 +1905,7 @@ def CharWidthInPixels(): element.TKIntVar.set(value) element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, value=value, bd=border_depth, font=font) - if element.BackgroundColor is not None: + if not element.BackgroundColor in (None, COLOR_SYSTEM_DEFAULT): element.TKRadio.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKRadio.configure(fg=text_color) @@ -2932,9 +2943,15 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el ############################################################## def ChangeLookAndFeel(index): # look and feel table - look_and_feel = {'SystemDefault': {'BACKGROUND' : COLOR_SYSTEM_DEFAULT, 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT': COLOR_SYSTEM_DEFAULT,'TEXT_INPUT' : COLOR_SYSTEM_DEFAULT, 'SCROLL': COLOR_SYSTEM_DEFAULT, 'BUTTON': OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, 'PROGRESS': COLOR_SYSTEM_DEFAULT, 'BORDER': 1,'SLIDER_DEPTH':1, 'PROGRESS_DEPTH':1}, + look_and_feel = {'SystemDefault': {'BACKGROUND' : COLOR_SYSTEM_DEFAULT, 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT': COLOR_SYSTEM_DEFAULT,'TEXT_INPUT' : COLOR_SYSTEM_DEFAULT, 'SCROLL': COLOR_SYSTEM_DEFAULT, 'BUTTON': OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, 'PROGRESS': COLOR_SYSTEM_DEFAULT, 'BORDER': 1,'SLIDER_DEPTH':1, 'PROGRESS_DEPTH':0}, + 'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + 'Dark': {'BACKGROUND': 'gray25', 'TEXT': 'white', 'INPUT': 'gray40', + 'TEXT_INPUT': 'white', 'SCROLL': 'gray44', 'BUTTON': ('white', '#004F00'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER':1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, From 4c8722765a1dc0518a06e45d47020bdaa34a2aa0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 1 Sep 2018 19:04:19 -0400 Subject: [PATCH 259/521] Fix for radio button disappearing Used same logar --- PySimpleGUI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index f66cf6dc1..69656f0fa 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1907,6 +1907,7 @@ def CharWidthInPixels(): variable=element.TKIntVar, value=value, bd=border_depth, font=font) if not element.BackgroundColor in (None, COLOR_SYSTEM_DEFAULT): element.TKRadio.configure(background=element.BackgroundColor) + element.TKRadio.configure(selectcolor=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKRadio.configure(fg=text_color) element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) From f8aff92c98080959e870dcb55ec0baba716cc604 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 2 Sep 2018 01:01:37 -0400 Subject: [PATCH 260/521] Default icon, function hiding, experimental dummy button, MsgBox renaming to Popup, Non-blocking Pop-up, removed legacy LayoutAndShow --- PySimpleGUI.py | 116 ++++++++++++++++++++++++++++++----------------- default_icon.ico | Bin 0 -> 18850 bytes 2 files changed, 75 insertions(+), 41 deletions(-) create mode 100644 default_icon.ico diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 69656f0fa..3af229309 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -6,10 +6,17 @@ import tkinter.font import datetime import sys +import os +import base64 +import tempfile import textwrap +# TODO - Sept 1 2018 - HIGHLY EXPERIMENTAL.... start TK right away with a hidden window +# dummyroot = tk.Tk() +# dummyroot.attributes('-alpha', 0) # hide window while getting info and moving + # ----====----====----==== Constants the user CAN safely change ====----====----====----# -DEFAULT_WINDOW_ICON = '' +DEFAULT_WINDOW_ICON = 'default_icon.ico' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS DEFAULT_BUTTON_ELEMENT_SIZE = (10,1) # In CHARACTERS DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term @@ -132,6 +139,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) BUTTON_TYPE_BROWSE_FILES = 21 BUTTON_TYPE_SAVEAS_FILE = 3 BUTTON_TYPE_CLOSES_WIN = 5 +BUTTON_TYPE_CLOSES_WIN_ONLY = 6 BUTTON_TYPE_READ_FORM = 7 BUTTON_TYPE_REALTIME = 9 @@ -752,7 +760,7 @@ def ButtonCallBack(self): if target[0] != None: if target[0] < 0: target = [self.Position[0] + target[0], target[1]] - target_element = self.ParentForm.GetElementAtLocation(target) + target_element = self.ParentForm._GetElementAtLocation(target) try: strvar = target_element.TKStringVar except: pass @@ -795,6 +803,15 @@ def ButtonCallBack(self): self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop + elif self.BType == BUTTON_TYPE_CLOSES_WIN_ONLY: # this is a return type button so GET RESULTS and destroy window + # if the form is tabbed, must collect all form's results and destroy all forms + if self.ParentForm.IsTabbedForm: + self.ParentForm.UberParent._Close() + else: + self.ParentForm._Close() + if self.ParentForm.NonBlocking: + self.ParentForm.TKroot.destroy() + _my_windows.Decrement() return def Update(self, new_text, button_color=(None, None)): @@ -1080,7 +1097,9 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.Font = font if font else DEFAULT_FONT self.RadioDict = {} self.BorderDepth = border_depth - self.WindowIcon = icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon + # self.WindowIcon = icon + # self.WindowIcon = icon if icon else icon_tempfile + self.WindowIcon = icon if not None else _my_windows.user_defined_icon self.AutoClose = auto_close self.NonBlocking = False self.TKroot = None @@ -1124,11 +1143,6 @@ def AddRows(self,rows): def Layout(self,rows): self.AddRows(rows) - def LayoutAndShow(self,rows, non_blocking=False): - self.AddRows(rows) - self.Show(non_blocking=non_blocking) - return self.ReturnValues - def LayoutAndRead(self,rows, non_blocking=False): self.AddRows(rows) self.Show(non_blocking=non_blocking) @@ -1176,7 +1190,7 @@ def SetIcon(self, icon): self.TKroot.iconbitmap(icon) except: pass - def GetElementAtLocation(self, location): + def _GetElementAtLocation(self, location): (row_num,col_num) = location row = self.Rows[row_num] element = row[col_num] @@ -1250,7 +1264,7 @@ def GetScreenDimensions(self): return screen_width, screen_height - def KeyboardCallback(self, event ): + def _KeyboardCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True if event.char != '': @@ -1261,7 +1275,7 @@ def KeyboardCallback(self, event ): BuildResults(self, False, self) self.TKroot.quit() - def MouseWheelCallback(self, event ): + def _MouseWheelCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True self.LastKeyboardEvent = 'MouseWheel:Down' if event.delta < 0 else 'MouseWheel:Up' @@ -1463,6 +1477,11 @@ def ReadFormButton(button_text, image_filename=None, image_size=(None, None),ima def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +# this is the only button that REQUIRES button text field +def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) + ##################################### ----- RESULTS ------ ################################################## def AddToReturnDictionary(form, element, value): @@ -2105,6 +2124,7 @@ def StartupTK(my_flex_form): ow = _my_windows.NumOpenWindows # print('Starting TK open Windows = {}'.format(ow)) root = tk.Tk() if not ow else tk.Toplevel() + # root = tk.Toplevel() if my_flex_form.BackgroundColor is not None and my_flex_form.BackgroundColor != COLOR_SYSTEM_DEFAULT: root.configure(background=my_flex_form.BackgroundColor) _my_windows.Increment() @@ -2115,11 +2135,11 @@ def StartupTK(my_flex_form): ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: - root.bind("", my_flex_form.KeyboardCallback) - root.bind("", my_flex_form.MouseWheelCallback) + root.bind("", my_flex_form._KeyboardCallback) + root.bind("", my_flex_form._MouseWheelCallback) elif my_flex_form.ReturnKeyboardEvents: - root.bind("", my_flex_form.KeyboardCallback) - root.bind("", my_flex_form.MouseWheelCallback) + root.bind("", my_flex_form._KeyboardCallback) + root.bind("", my_flex_form._MouseWheelCallback) if my_flex_form.AutoClose: duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration @@ -2135,7 +2155,6 @@ def StartupTK(my_flex_form): if my_flex_form.RootNeedsDestroying: my_flex_form.TKroot.destroy() my_flex_form.RootNeedsDestroying = False - return # ==============================_GetNumLinesNeeded ==# @@ -2163,7 +2182,7 @@ def _GetNumLinesNeeded(text, max_line_width): # Exits via an OK button2 press # # Returns nothing # # ===================================================# -def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None): +def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None): ''' Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: @@ -2207,29 +2226,45 @@ def MsgBox(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, a pad = max_line_total-15 if max_line_total > 15 else 1 pad =1 + if non_blocking: + PopupButton = DummyButton + else: + PopupButton = SimpleButton # show either an OK or Yes/No depending on paramater if button_type is MSG_BOX_YES_NO: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(button_color=button_color, focus=True, bind_return_key=True), No( - button_color=button_color)) - (button_text, values) = form.Show() - return button_text == 'Yes' + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) elif button_type is MSG_BOX_CANCELLED: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) elif button_type is MSG_BOX_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) elif button_type is MSG_BOX_OK_CANCEL: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), - SimpleButton('Cancel', size=(5, 1), button_color=button_color)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), + PopupButton('Cancel', size=(5, 1), button_color=button_color)) else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + + if non_blocking: + button, values = form.ReadNonBlocking() + else: + button, values = form.Show() - button, values = form.Show() return button -# ============================== PopUp ============# -# Lazy function. Same as calling MsgBox with parms # -# ===================================================# -Popup = MsgBox + + +# ============================== MsgBox============# +# Lazy function. Same as calling Popup with parms # +# ==================================================# +# MsgBox is the legacy call and show not be used any longer +MsgBox = Popup + +# --------------------------- PopupNonBlocking --------------------------- +def PopupoNonBlocking(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + Popup(*args, non_blocking=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + return + +PopupNoWait = PopupoNonBlocking + # ============================== MsgBoxAutoClose====# # Lazy function. Same as calling MsgBox with parms # @@ -2248,7 +2283,7 @@ def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_durati return PopupTimed = MsgBoxAutoClose - +PopupAutoClose = MsgBoxAutoClose # ============================== MsgBoxError =====# # Like MsgBox but presents RED BUTTONS # @@ -2285,7 +2320,7 @@ def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return -PopupCancel =MsgBoxCancel +PopupCancel = MsgBoxCancel # ============================== MsgBoxOK =====# @@ -2305,7 +2340,6 @@ def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=Non return PopupOk = MsgBoxOK -PopupOK = MsgBoxOK # ============================== MsgBoxOKCancel ====# @@ -2324,7 +2358,6 @@ def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_durati result = MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return result -PopupOKCancel = MsgBoxOKCancel PopupOkCancel = MsgBoxOKCancel @@ -2686,7 +2719,7 @@ def GetPathBox(title, message, default_path='', button_color=None, size=(None, N [InputText(default_text=default_path, size=size), FolderBrowse()], [Submit(), Cancel()]] - (button, input_values) = form.LayoutAndShow(layout) + (button, input_values) = form.LayoutAndRead(layout) if button != 'Submit': return False,None else: @@ -2704,7 +2737,7 @@ def PopupGetFolder(message, default_path='', button_color=None, size=(None, None [InputText(default_text=default_path, size=size), FolderBrowse()], [Ok(), Cancel()]] - (button, input_values) = form.LayoutAndShow(layout) + (button, input_values) = form.LayoutAndRead(layout) if button != 'Ok': return None else: @@ -2720,7 +2753,7 @@ def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*") [InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)], [Submit(), Cancel()]] - (button, input_values) = form.LayoutAndShow(layout) + (button, input_values) = form.LayoutAndRead(layout) if button != 'Submit': return False,None else: @@ -2737,7 +2770,7 @@ def PopupGetFile(message, default_path='', file_types=(("ALL Files", "*.*"),), b [InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)], [Ok(), Cancel()]] - (button, input_values) = form.LayoutAndShow(layout) + (button, input_values) = form.LayoutAndRead(layout) if button != 'Ok': return None else: @@ -2753,7 +2786,7 @@ def GetTextBox(title, message, Default='', button_color=None, size=(None, None)) [InputText(default_text=Default, size=size)], [Submit(), Cancel()]] - (button, input_values) = form.LayoutAndShow(layout) + (button, input_values) = form.LayoutAndRead(layout) if button != 'Submit': return False,None else: @@ -2771,7 +2804,7 @@ def PopupGetText(message, Default='', button_color=None, size=(None, None)): [InputText(default_text=Default, size=size)], [Ok(), Cancel()]] - (button, input_values) = form.LayoutAndShow(layout) + (button, input_values) = form.LayoutAndRead(layout) if button != 'Ok': return None else: @@ -3041,6 +3074,7 @@ def main(): button, (source, dest) = form.LayoutAndRead(form_rows) + if __name__ == '__main__': main() exit(69) \ No newline at end of file diff --git a/default_icon.ico b/default_icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..e5d1c2241275e84a0414f611dcb56568de7f2551 GIT binary patch literal 18850 zcmeI4`CC*+*2kHDVxIR;cz>KMCMF^xh!OXR8e?>vL`_CT7EwTCaRm$rZi5TTzRC`w zs36cNDuPQ4$kuEP4K%xeAc&kfb*uaK?Yc|f#?14~Gh_L+bEa{XhQ2BD)y;OUg;wh1b{w{~O8fe*+Ufa{hM(`eQt8jOXmk zR8L)LZ(WIv?_;ZX%|OKj+!}+spogC?QvYk+`$h#P^n4`ZGu=k%MA&g!hn3!BTM)|Q=KU3PjE ztH{-w^Bc952`XvRMhT&}j1KgHp8?JcLc?2??XlJ7!}+?W;YpHv`I&WQwuqHwQo`6a zm0n`+Dat2~C_(b@N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7>cI`L>6{B?u`d6@aRxSp&xJ6mm7awKm$ zA5Pj3?yh%Y4&v^Lv5ocmI>vng1`rL*rU$RBOb?a3pF$x%N%#T3U%{td4Mb}iVPg~g zT?+=dZ@Pcw)i&cOByF3YY Date: Sun, 2 Sep 2018 13:38:59 -0400 Subject: [PATCH 261/521] NEW Fill Form feature! More Popup functions, Update methods added for all elements that did not have previously --- Demo_Fill_Form.py | 52 +++++++++++++++++++ PySimpleGUI.py | 124 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 149 insertions(+), 27 deletions(-) create mode 100644 Demo_Fill_Form.py diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py new file mode 100644 index 000000000..c38cb2009 --- /dev/null +++ b/Demo_Fill_Form.py @@ -0,0 +1,52 @@ +import PySimpleGUI as sg + +""" +Show a complex form, save the initial values +When the "Fill" button is clicked, the form will reset to the initial values +""" + +def Everything(): + sg.ChangeLookAndFeel('Green') + + + column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10, key='slider'), + sg.Column(column1, background_color='#d3dfda')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.ReadFormButton('Fill'), sg.Cancel()] + ] + + form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1)) + form.Layout(layout) + button, initial_values = form.ReadNonBlocking() + + while True: + button, values = form.Read() + if button in (None, 'Cancel'): + break + form.Fill(initial_values) # fill form with whatever initial values were + + sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + +Everything() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3af229309..de4807555 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -302,6 +302,13 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + def Update(self, value): + for index, v in enumerate(self.Values): + if v == value: + self.TKCombo.current(index) + break + + def __del__(self): try: self.TKComboBox.__del__() @@ -331,6 +338,13 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + def Update(self, value): + for index, v in enumerate(self.Values): + if v == value: + self.TKStringVar.set(value) + break + + def __del__(self): try: self.TKOptionMenu.__del__() @@ -376,6 +390,13 @@ def Update(self, values): self.TKListbox.insert(tk.END, item) self.TKListbox.selection_set(0, 0) + def SetValue(self, value): + for index, item in enumerate(self.Values): + if item in value: + self.TKListbox.selection_set(index) + else: + self.TKListbox.selection_clear(index) + def __del__(self): try: self.TKListBox.__del__() @@ -410,6 +431,12 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) + def Update(self, value): + if not value: + return + location = EncodeRadioRowCol(self.Position[0], self.Position[1]) + self.TKIntVar.set(location) + def __del__(self): try: self.TKRadio.__del__() @@ -1256,6 +1283,9 @@ def Refresh(self): pass + def Fill(self, values_dict): + FillFormWithValues(self, values_dict) + def GetScreenDimensions(self): if self.TKrootDestroyed: return None, None @@ -1487,6 +1517,7 @@ def DummyButton(button_text, image_filename=None, image_size=(None, None),image_ def AddToReturnDictionary(form, element, value): if element.Key is None: form.ReturnValuesDictionary[form.DictionaryKeyCounter] = value + element.Key = form.DictionaryKeyCounter form.DictionaryKeyCounter += 1 else: form.ReturnValuesDictionary[element.Key] = value @@ -1619,6 +1650,38 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): return form.ReturnValues +def FillFormWithValues(form, values_dict): + FillSubformWithValues(form, values_dict) + +def FillSubformWithValues(form, values_dict): + for row_num,row in enumerate(form.Rows): + for col_num, element in enumerate(row): + value = None + if element.Type == ELEM_TYPE_COLUMN: + FillSubformWithValues(element, values_dict) + try: + value = values_dict[element.Key] + except: + continue + + if element.Type == ELEM_TYPE_INPUT_TEXT: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_RADIO: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_COMBO: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_OPTION_MENU: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_LISTBOX: + element.SetValue(value) + elif element.Type == ELEM_TYPE_INPUT_SLIDER: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_MULTILINE: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_SPIN: + element.Update(value) # ------------------------------------------------------------------------------------------------------------------ # # ===================================== TK CODE STARTS HERE ====================================================== # @@ -2279,8 +2342,7 @@ def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_durati :param font: :return: ''' - MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return + return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) PopupTimed = MsgBoxAutoClose PopupAutoClose = MsgBoxAutoClose @@ -2298,8 +2360,8 @@ def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False :param font: :return: ''' - MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return + return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + PopupError = MsgBoxError @@ -2317,8 +2379,7 @@ def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration :param font: :return: ''' - MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return + return MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) PopupCancel = MsgBoxCancel @@ -2336,8 +2397,7 @@ def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=Non :param font: :return: ''' - MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return + return MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) PopupOk = MsgBoxOK @@ -2355,8 +2415,7 @@ def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_durati :param font: :return: ''' - result = MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return result + return MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) PopupOkCancel = MsgBoxOKCancel @@ -2670,8 +2729,10 @@ def EasyPrintClose(): # ======================== Scrolled Text Box =====# # ===================================================# -def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, auto_close_duration=None, height=None): +def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, auto_close_duration=None, size=(None, None)): if not args: return + width, height = size + width = width if width else MESSAGE_BOX_LINE_WIDTH with FlexForm(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 complete_output = '' @@ -2680,9 +2741,9 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au # if not isinstance(message, str): message = str(message) message = str(message) longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, MESSAGE_BOX_LINE_WIDTH) + width_used = min(longest_line_len, width) max_line_total = max(max_line_total, width_used) - max_line_width = MESSAGE_BOX_LINE_WIDTH + max_line_width = width lines_needed = _GetNumLinesNeeded(message, width_used) height_computed += lines_needed complete_output += message + '\n' @@ -2695,12 +2756,15 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au # show either an OK or Yes/No depending on paramater if yes_no: form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(), No()) - (button_text, values) = form.Show() - return button_text == 'Yes' + button, values = form.Read() + return button else: form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color)) - form.Show() + button, values = form.Read() + return button + +PopupScrolled = ScrolledTextBox # ---------------------------------------------------------------------- # # GetPathBox # @@ -2727,10 +2791,6 @@ def GetPathBox(title, message, default_path='', button_color=None, size=(None, N return True, path -GetFolder = GetPathBox -AskForFolder = GetPathBox - - def PopupGetFolder(message, default_path='', button_color=None, size=(None, None)): with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: layout = [[Text(message, auto_size_text=True)], @@ -2792,11 +2852,6 @@ def GetTextBox(title, message, Default='', button_color=None, size=(None, None)) else: return True, input_values[0] -GetText = GetTextBox -GetString = GetTextBox -AskForText = GetTextBox -AskForString = GetTextBox - def PopupGetText(message, Default='', button_color=None, size=(None, None)): with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: @@ -2981,11 +3036,26 @@ def ChangeLookAndFeel(index): 'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, - 'Dark': {'BACKGROUND': 'gray25', 'TEXT': 'white', 'INPUT': 'gray40', + 'Dark': {'BACKGROUND': 'gray25', 'TEXT': 'white', 'INPUT': 'gray30', 'TEXT_INPUT': 'white', 'SCROLL': 'gray44', 'BUTTON': ('white', '#004F00'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0}, + 'Black': {'BACKGROUND': 'black', 'TEXT': 'white', 'INPUT': 'gray30', + 'TEXT_INPUT': 'white', 'SCROLL': 'gray44', 'BUTTON': ('black', 'white'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Reds': {'BACKGROUND': '#280001', 'TEXT': 'white', 'INPUT': '#d8d584', + 'TEXT_INPUT': 'black', 'SCROLL': '#763e00', 'BUTTON': ('black', '#daad28'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Green': {'BACKGROUND': '#82a459', 'TEXT': 'black', 'INPUT': '#d8d584', + 'TEXT_INPUT': 'black', 'SCROLL': '#e3ecf3', 'BUTTON': ('white', '#517239'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER':1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, @@ -3070,7 +3140,7 @@ def main(): [Text('Here is your sample input form....')], [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], - [Ok(bind_return_key=True), Cancel()]] + [Ok(), Cancel()]] button, (source, dest) = form.LayoutAndRead(form_rows) From 9c6b21526527fc41e2a29261cda231f271da0fbf Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 2 Sep 2018 13:41:03 -0400 Subject: [PATCH 262/521] Dark color them for Demo Fill program --- Demo_Fill_Form.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index c38cb2009..1b8e24e63 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -6,10 +6,10 @@ """ def Everything(): - sg.ChangeLookAndFeel('Green') + sg.ChangeLookAndFeel('Dark') - column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10, 1))], + column1 = [[sg.Text('Column 1', background_color='black', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] @@ -29,7 +29,7 @@ def Everything(): sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10, key='slider'), - sg.Column(column1, background_color='#d3dfda')], + sg.Column(column1, background_color='black')], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), From 4e518e966767f34d5ac2ce4341722efcaa642c79 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 2 Sep 2018 16:31:18 -0400 Subject: [PATCH 263/521] Change from MsgBox to Popup. New screen shots --- docs/cookbook.md | 8 +- docs/index.md | 241 +++++++++++++++++++++++++++-------------------- readme.md | 241 +++++++++++++++++++++++++++-------------------- 3 files changed, 286 insertions(+), 204 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index a67843fc9..71d608590 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -87,7 +87,7 @@ Quickly add a GUI allowing the user to browse for a filename if a filename is no fname = sys.argv[1] if not fname: - sg.MsgBox("Cancel", "No filename supplied") + sg.Popup("Cancel", "No filename supplied") raise SystemExit("Cancelling: no filename supplied") @@ -296,7 +296,7 @@ The architecture of some programs works better with button callbacks instead of break # All done! - sg.MsgBoxOK('Done') + sg.PopupOk('Done') ----- ## Realtime Buttons (Good For Raspberry Pi) @@ -371,7 +371,7 @@ Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your l results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), (form2, layout_tab_2,'Second Tab')) - sg.MsgBox(results) + sg.Popup(results) ----- ## Button Graphics (Media Player) Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. @@ -621,7 +621,7 @@ To make it easier to see the Column in the window, the Column background has bee # to collapse the form display and read down to a single line of code. button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - sg.MsgBox(button, values, line_width=200) + sg.Popup(button, values, line_width=200) ## Persistent Form With Text Element Updates diff --git a/docs/index.md b/docs/index.md index 5a32a4df7..8078be65f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,18 +10,19 @@ # PySimpleGUI + (Ver 2.11) - ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) -Lots of documentation available in addition to this Readme File. -[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) +[Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -[COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) -[Brief Tutorial on PySimpleGUI](https://pysimplegui.readthedocs.io/en/latest/tutorial/) +Lots of documentation available in addition to this Readme File. +[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) -[See Wiki for latest news about development branch + new features](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) +[COOKBOOK!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) Super-simple GUI to grasp... Powerfully customizable. @@ -35,10 +36,11 @@ Looking to take your Python code from the world of command lines and into the co import PySimpleGUI as sg - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + +![hello world](https://user-images.githubusercontent.com/13696193/44960047-1f7f6380-aec6-11e8-9d5e-12ef935bcade.jpg) -![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) Or how about a ***custom GUI*** in 1 line of code? @@ -46,15 +48,16 @@ Or how about a ***custom GUI*** in 1 line of code? button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) -![simple](https://user-images.githubusercontent.com/13696193/44279378-2f891900-a21f-11e8-89d1-52d935a4f5f5.jpg) +![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) +![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) -Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. +Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The same for shown as on Pi (roughly the same) ![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) @@ -64,16 +67,17 @@ In addition to a primary GUI, you can add a Progress Meter to your code with ONE EasyProgressMeter('My meter title', current_value, max value) - ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) You can build an async media player GUI with custom buttons in 30 lines of code. -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) +![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Don't like the standard Message Box? Then replace it with your own GUI! +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. @@ -108,6 +112,7 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) Single-Line-Of-Code Proress Bar & Debug Print Complete control of colors, look and feel + Selection of pre-defined palettes Button images Return values as dictionary Set focus @@ -116,7 +121,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected - Update elements in a visible form + Update elements in a live form + Bulk form-fill operation An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -198,9 +204,9 @@ To use in your code, simply import.... Then use either "high level" API calls or build your own forms. - sg.MsgBox('This is my first message box') + sg.Popup('This is my first Popup') -![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) +![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. @@ -209,13 +215,13 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi ## APIs PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions + * High Level single call functions (The `Popup` calls) * Custom form functions ### Python Language Features - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... * Variable number of arguments to a function call * Optional parameters to a function call @@ -223,9 +229,9 @@ PySimpleGUI can be broken down into 2 types of API's: The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + sg.Popup('Variable number of parameters example', var1, var2, "etc") -Each new item begins on a new line in the Message Box +Each new item begins on a new line in the Popup ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) @@ -235,9 +241,9 @@ Each new item begins on a new line in the Message Box This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. +Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - def MsgBox(*args, + def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, @@ -248,7 +254,7 @@ Here is the function definition for the MsgBox function. The details aren't impo If the caller wanted to change the button color to be black on yellow, the call would look something like this: - sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) ![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) @@ -256,89 +262,109 @@ If the caller wanted to change the button color to be black on yellow, the call --- -### High Level API Calls +### High Level API Calls - Popup's -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: +"High level calls" are those that start with "Popup". They are the most basic form of communications with the user. They are named after the type of window they create, a pop-up window. These windows are meant to be short lived while, either delivering information or collecting it, and then quickly disappearing. +### Popup Output - import PySimpleGUI as sg +Think of the `Popup` call as the GUI equivelent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. - rc = sg.GetTextBox('Title', 'Please input something') - sg.MsgBox('Results', 'The value returned from GetTextBox', rc) +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. +Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. - ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) +There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). -![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) +The list of Popup output functions are + Popup,PopupOk + PopupYesNo + PopupCancel + PopupOkCancel + PopupError + PopupTimed, PopupAutoClose -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. +The trailing portion of the function name after Popup indicates what buttons are shown. `PopupYesNo` shows a pair of button with Yes and No on them. `PopupCancel` has a Cancel button, etc. -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. +While these are "output" windows, they do collect input in the form of buttons. The Popup functions return the button that was clicked. If the Ok button was clicked, then Popup returns the string 'Ok'. If the user clicked the X button to close the window, then the button value returned is `None`. - import PySimpleGUI as sg +The function `PopupTimed` or `PopupAutoClose` are popup windows that will automatically close after come period of time. - `sg.MsgBoxOK('This is an OK MsgBox')` +Here is a quick-reference showing how the Popup calls look. - ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + print(sg.Popup('Popup')) + print(sg.PopupOk('PopupOk')) + print(sg.PopupYesNo('PopupYesNo')) + print(sg.PopupCancel('PopupCancel')) + print(sg.PopupOkCancel('PopupOkCancel')) + print(sg.PopupError('PopupError')) + print(sg.PopupTimed('PopupTimed')) + print(sg.PopupAutoClose('PopupAutoClose')) - sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') +![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) -![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) +![snap0257](https://user-images.githubusercontent.com/13696193/44957400-167b9b80-aea0-11e8-9d42-2314f24e62de.jpg) - sg.MsgBoxCancel('This is a Cancel MsgBox') +![snap0258](https://user-images.githubusercontent.com/13696193/44957399-154a6e80-aea0-11e8-9580-e716f839d400.jpg) -![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) +![snap0259](https://user-images.githubusercontent.com/13696193/44957398-14b1d800-aea0-11e8-9e88-c2b36a248447.jpg) - sg.MsgBoxYesNo('This is a Yes No MsgBox') +![snap0260](https://user-images.githubusercontent.com/13696193/44957397-14b1d800-aea0-11e8-950b-6d0b4f33841a.jpg) -![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) +![snap0261](https://user-images.githubusercontent.com/13696193/44957396-14194180-aea0-11e8-8eef-bb2e1193ecfa.jpg) +![snap0264](https://user-images.githubusercontent.com/13696193/44957595-9e15da00-aea1-11e8-8909-6b6121b74509.jpg) - sg.MsgBoxError('This is an error MsgBox') +#### Scrolled Output +There is a scrolled version of Popups should you have a lot of information to display. -![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + sg.PopupScrolled(my_text) - sg.MsgBoxAutoClose('This is an autoclose MsgBox') +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) -![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) - sg.ScrolledTextBox(my_text, height=10) +The `PopupScrolled` will auto-fit the window size to the size of the text. Specify `None` in the height field of a `size` parameter to get auto-sized height. -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) +This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. + +sg.PopupScrolled(my_text, size=(80, None)) +Note that the default max number of lines before scrolling happens is set to 50. At 50 lines the scrolling will begin. -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: +### Popup Input - sprint(f'My variables values include x={x}', f'y={y}') +There are Popup calls for single-item inputs. These follow the pattern of `Popup` followed by `Get` and then the type of item to get. -This becomes a debug print of sorts that will route to a scrolled window. + - `PopupGetString` - get a single line of text + - `PopupGetFile` - get a filename + - `PopupGetFolder` - get a folder name -See also the `EasyPrint` and `Print` functions. +Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. + + + import PySimpleGUI as sg -#### High Level User Input + text = sg.PopupGetText('Title', 'Please input something') + sg.Popup('Results', 'The value returned from PopupGetText', text) -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox + ![popupgettext](https://user-images.githubusercontent.com/13696193/44957281-8721b880-ae9e-11e8-98cd-d06369f4187e.jpg) - `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` +![popup gettext response](https://user-images.githubusercontent.com/13696193/44957282-8721b880-ae9e-11e8-84ae-dc8bb30504a0.jpg) -![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + text = sg.PopupGetFile('Please enter a file name') + sg.Popup('Results', 'The value returned from PopupGetFile', text) -![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) +![popupgetfile](https://user-images.githubusercontent.com/13696193/44957857-2fd31680-aea5-11e8-8eb7-f6b91c202cc8.jpg) - submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') +The window created to get a folder name looks the same as the get a file name. The difference is in what the browse button does. `PopupGetFile` shows an Open File dialog box while `PopupGetFolder` shows an Open Folder dialog box. -![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + text = sg.PopupGetFolder('Please enter a folder name') + sg.Popup('Results', 'The value returned from PopupGetFolder', text) +![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) #### Progress Meter! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? @@ -466,7 +492,7 @@ Finally we can put it all together into a program that will display our window. button, (number,) = sg.FlexForm('Enter a number example').LayoutAndRead(layout) - sg.MsgBox(button, number) + sg.Popup(button, number) ### Example 2 - Get a filename Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. @@ -484,7 +510,7 @@ Writing the code for this one is just as straightforward. There is one tricky t button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) - sg.MsgBox(button, number) + sg.Popup(button, number) Read on for detailed instructions on the calls that show the form and return your results. @@ -572,9 +598,6 @@ In the statement that shows and reads the form, the two input fields are directl Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - - ### The Auto-Packer Once you've laid out your elements into, it's the job of the Auto-Packer to place your elements into a window frame. @@ -592,6 +615,7 @@ This is how your GUI is created, one row at a time, with one row stacked on top ### Laying out your form + Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. layout = [ [row 1], @@ -636,7 +660,9 @@ This is the code that **displays** the form, collects the information and return ## Return values As of version 2.8 there are 2 forms of return values, list and dictionary. + ### Return values as a list + By default return values are a list of values, one entry for each input field. Return information from FlexForm, SG's primary form builder interface, is in this format: @@ -686,12 +712,10 @@ This sample program demonstrates these 2 steps as well as how to address the ret button, values = form.LayoutAndRead(layout) - sg.MsgBox(button, values, values[0], values['address'], values['phone']) - + sg.Popup(button, values, values[0], values['address'], values['phone']) --- - ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. @@ -724,16 +748,17 @@ This is a somewhat complex form with quite a bit of custom sizing to make things ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. ![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- # Building Custom Forms + You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition @@ -857,12 +882,12 @@ Building a form is simply making lists of Elements. Each list is a row in the o layout = [ [row 1 element, row 1 element], [row 2 element, row 2 element, row 2 element] ] The code is a crude representation of the GUI, laid out in text. + #### Text Element layout = [[sg.Text('This is what a Text Element looks like')]] - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. @@ -907,14 +932,15 @@ A `True` value for `auto_size_text`, when placed on Text Elements, indicates tha - [ ] List item -**Shorthand functions** +**Shortcut functions** The shorthand functions for `Text` are `Txt` and `T` - #### Multiline Text Element layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) + +![multiline](https://user-images.githubusercontent.com/13696193/44959853-b139a180-aec3-11e8-972f-f52188510c88.jpg) + This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. Multiline(default_text='', @@ -935,7 +961,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. form.AddRow(gg.Output(size=(100,20))) -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) +![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) Output(scale=(None, None), size=(None, None)) @@ -950,7 +976,9 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. #### Text Input Element layout = [[sg.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + +![inputtext 2](https://user-images.githubusercontent.com/13696193/44959861-b5fe5580-aec3-11e8-8040-53ec241b5079.jpg) + def InputText(default_text = '', scale=(None, None), @@ -990,7 +1018,7 @@ Also known as a drop-down list. Only required parameter is the list of choices. layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) +![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) InputCombo(values, scale=(None, None), @@ -1009,13 +1037,12 @@ Also known as a drop-down list. Only required parameter is the list of choices. text_color - color to use for the typed text key = Dictionary key to use for return values - #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] -![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) +![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) Listbox(values, @@ -1052,11 +1079,12 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. #### Slider Element + Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] -![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) +![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) Slider(range=(None,None), default_value=None, @@ -1090,11 +1118,12 @@ Sliders have a couple of slider-specific settings as well as appearance settings key = Dictionary key to use for return values #### Radio Button Element + Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) +![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) Radio(text, group_id, @@ -1126,7 +1155,8 @@ Checkbox elements are like Radio Button elements. They return a bool indicating layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + +![checkbox](https://user-images.githubusercontent.com/13696193/44959906-6f5d2b00-aec4-11e8-9c8a-962c787f0286.jpg) Checkbox(text, @@ -1152,11 +1182,12 @@ Checkbox elements are like Radio Button elements. They return a bool indicating #### Spin Element + An up/down spinner control. The valid values are passed in as a list. layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) +![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) Spin(values, intiial_value=None, @@ -1180,6 +1211,7 @@ An up/down spinner control. The valid values are passed in as a list. key = Dictionary key to use for return values #### Button Element + Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: @@ -1233,7 +1265,8 @@ These Pre-made buttons are some of the most important elements of all because th . layout = [[sg.OK(), sg.Cancel()]] -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) +![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) + The FileBrowse, FolderBrowse, FileSaveAs buttons all fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. @@ -1241,24 +1274,28 @@ The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value Let's examine this form as an example: -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) + The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: Target = (1,0) Target = (-1,0) + The code for the entire form could be: - layout = [[sg.T('Source Folder')], - [sg.In()], - [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] + **Custom Buttons** Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. layout = [[sg.SimpleButton('My Button')]] -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) +![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. @@ -1294,7 +1331,8 @@ This is one you'll have to experiment with at this point. Not up for an exhaust Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: -![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) +![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) + This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". @@ -1416,7 +1454,8 @@ Columns are specified in exactly the same way as a form is, as a list of lists. Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: -![column example](https://user-images.githubusercontent.com/13696193/44215113-b1097a00-a13f-11e8-96d0-f3511036494e.jpg) +![column](https://user-images.githubusercontent.com/13696193/44959988-66b92480-aec5-11e8-9c26-316ed24a68c0.jpg) + This code produced the above window. @@ -1448,7 +1487,7 @@ This code produced the above window. # to collapse the form display and read down to a single line of code. button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - sg.MsgBox(button, values, line_width=200) + sg.Popup(button, values, line_width=200) The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. @@ -1748,6 +1787,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Color.py** | How to interact with color using RGB hex values and named colors |**Demo_Columns.py** | Using the Column Element to create more complex forms |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format |**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter @@ -1760,13 +1800,14 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph |**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph |**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery |**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices |**Demo_NonBlocking_Form.py** | a basic async form |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons |**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook |**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature diff --git a/readme.md b/readme.md index 5a32a4df7..8078be65f 100644 --- a/readme.md +++ b/readme.md @@ -10,18 +10,19 @@ # PySimpleGUI + (Ver 2.11) - ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) -Lots of documentation available in addition to this Readme File. -[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) +[Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -[COOKBOOK documentation now online!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) -[Brief Tutorial on PySimpleGUI](https://pysimplegui.readthedocs.io/en/latest/tutorial/) +Lots of documentation available in addition to this Readme File. +[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) -[See Wiki for latest news about development branch + new features](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) +[COOKBOOK!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) Super-simple GUI to grasp... Powerfully customizable. @@ -35,10 +36,11 @@ Looking to take your Python code from the world of command lines and into the co import PySimpleGUI as sg - sg.MsgBox('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + +![hello world](https://user-images.githubusercontent.com/13696193/44960047-1f7f6380-aec6-11e8-9d5e-12ef935bcade.jpg) -![snap0136](https://user-images.githubusercontent.com/13696193/43162494-33095ece-8f59-11e8-86de-b6d8bcc5a52f.jpg) Or how about a ***custom GUI*** in 1 line of code? @@ -46,15 +48,16 @@ Or how about a ***custom GUI*** in 1 line of code? button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) -![simple](https://user-images.githubusercontent.com/13696193/44279378-2f891900-a21f-11e8-89d1-52d935a4f5f5.jpg) +![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) +![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) -Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The is the same form as above, except shown on a Pi. +Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The same for shown as on Pi (roughly the same) ![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) @@ -64,16 +67,17 @@ In addition to a primary GUI, you can add a Progress Meter to your code with ONE EasyProgressMeter('My meter title', current_value, max value) - ![snap0177](https://user-images.githubusercontent.com/13696193/43658025-947973d2-9725-11e8-902f-e2d5effb6e3e.jpg) + ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) You can build an async media player GUI with custom buttons in 30 lines of code. -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) +![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Don't like the standard Message Box? Then replace it with your own GUI! +There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. @@ -108,6 +112,7 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) Single-Line-Of-Code Proress Bar & Debug Print Complete control of colors, look and feel + Selection of pre-defined palettes Button images Return values as dictionary Set focus @@ -116,7 +121,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected - Update elements in a visible form + Update elements in a live form + Bulk form-fill operation An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -198,9 +204,9 @@ To use in your code, simply import.... Then use either "high level" API calls or build your own forms. - sg.MsgBox('This is my first message box') + sg.Popup('This is my first Popup') -![snap0178](https://user-images.githubusercontent.com/13696193/43658024-945c83f8-9725-11e8-8ddd-0bbe67a9fc5d.jpg) +![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. @@ -209,13 +215,13 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi ## APIs PySimpleGUI can be broken down into 2 types of API's: - * High Level single call functions + * High Level single call functions (The `Popup` calls) * Custom form functions ### Python Language Features - There are a couple of Python language features that PySimpleGUI utilizes heavily that should be understood first... + There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... * Variable number of arguments to a function call * Optional parameters to a function call @@ -223,9 +229,9 @@ PySimpleGUI can be broken down into 2 types of API's: The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - sg.MsgBox('Variable number of parameters example', var1, var2, "etc") + sg.Popup('Variable number of parameters example', var1, var2, "etc") -Each new item begins on a new line in the Message Box +Each new item begins on a new line in the Popup ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) @@ -235,9 +241,9 @@ Each new item begins on a new line in the Message Box This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. -Here is the function definition for the MsgBox function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. +Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - def MsgBox(*args, + def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, @@ -248,7 +254,7 @@ Here is the function definition for the MsgBox function. The details aren't impo If the caller wanted to change the button color to be black on yellow, the call would look something like this: - sg.MsgBox('This box has a custom button color', button_color=('black', 'yellow')) + sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) ![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) @@ -256,89 +262,109 @@ If the caller wanted to change the button color to be black on yellow, the call --- -### High Level API Calls +### High Level API Calls - Popup's -The classic "input a value, print result" example. -Often command line programs simply take some value as input on the command line, do something with it and then display the results. Moving from the command line to a GUI is very simple. -This code prompts user to input a line of text and then displays that text in a messages box: +"High level calls" are those that start with "Popup". They are the most basic form of communications with the user. They are named after the type of window they create, a pop-up window. These windows are meant to be short lived while, either delivering information or collecting it, and then quickly disappearing. +### Popup Output - import PySimpleGUI as sg +Think of the `Popup` call as the GUI equivelent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. - rc = sg.GetTextBox('Title', 'Please input something') - sg.MsgBox('Results', 'The value returned from GetTextBox', rc) +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. +Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. - ![snap0181](https://user-images.githubusercontent.com/13696193/43658233-48cc7794-9726-11e8-8582-8844280c344e.jpg) +There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). -![snap0182](https://user-images.githubusercontent.com/13696193/43658232-48aaad4e-9726-11e8-95f5-aa9b9213bb77.jpg) +The list of Popup output functions are + Popup,PopupOk + PopupYesNo + PopupCancel + PopupOkCancel + PopupError + PopupTimed, PopupAutoClose -#### Message Boxes -In addition to MsgBox, you'll find a several API calls that are shortcuts to common messages boxes. You can achieve similar results by calling MsgBox with the correct parameters. +The trailing portion of the function name after Popup indicates what buttons are shown. `PopupYesNo` shows a pair of button with Yes and No on them. `PopupCancel` has a Cancel button, etc. -The differences tend to be the number and types of buttons. Here are the calls and the windows that are created. +While these are "output" windows, they do collect input in the form of buttons. The Popup functions return the button that was clicked. If the Ok button was clicked, then Popup returns the string 'Ok'. If the user clicked the X button to close the window, then the button value returned is `None`. - import PySimpleGUI as sg +The function `PopupTimed` or `PopupAutoClose` are popup windows that will automatically close after come period of time. - `sg.MsgBoxOK('This is an OK MsgBox')` +Here is a quick-reference showing how the Popup calls look. - ![ok](https://user-images.githubusercontent.com/13696193/43667331-723ac666-9745-11e8-8666-230c35a6afd6.jpg) + print(sg.Popup('Popup')) + print(sg.PopupOk('PopupOk')) + print(sg.PopupYesNo('PopupYesNo')) + print(sg.PopupCancel('PopupCancel')) + print(sg.PopupOkCancel('PopupOkCancel')) + print(sg.PopupError('PopupError')) + print(sg.PopupTimed('PopupTimed')) + print(sg.PopupAutoClose('PopupAutoClose')) - sg.MsgBoxOKCancel('This is an OK Cancel MsgBox') +![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) -![ok cancel 2](https://user-images.githubusercontent.com/13696193/43667330-71d5bea6-9745-11e8-8944-b3900853aa62.jpg) +![snap0257](https://user-images.githubusercontent.com/13696193/44957400-167b9b80-aea0-11e8-9d42-2314f24e62de.jpg) - sg.MsgBoxCancel('This is a Cancel MsgBox') +![snap0258](https://user-images.githubusercontent.com/13696193/44957399-154a6e80-aea0-11e8-9580-e716f839d400.jpg) -![cancel](https://user-images.githubusercontent.com/13696193/43667329-71a007de-9745-11e8-974b-d028f68798e7.jpg) +![snap0259](https://user-images.githubusercontent.com/13696193/44957398-14b1d800-aea0-11e8-9e88-c2b36a248447.jpg) - sg.MsgBoxYesNo('This is a Yes No MsgBox') +![snap0260](https://user-images.githubusercontent.com/13696193/44957397-14b1d800-aea0-11e8-950b-6d0b4f33841a.jpg) -![yesno](https://user-images.githubusercontent.com/13696193/43667327-717ff7dc-9745-11e8-9dce-52c305a85101.jpg) +![snap0261](https://user-images.githubusercontent.com/13696193/44957396-14194180-aea0-11e8-8eef-bb2e1193ecfa.jpg) +![snap0264](https://user-images.githubusercontent.com/13696193/44957595-9e15da00-aea1-11e8-8909-6b6121b74509.jpg) - sg.MsgBoxError('This is an error MsgBox') +#### Scrolled Output +There is a scrolled version of Popups should you have a lot of information to display. -![error msgbox](https://user-images.githubusercontent.com/13696193/43667326-71621712-9745-11e8-87c4-56e2ab500f8e.jpg) + sg.PopupScrolled(my_text) - sg.MsgBoxAutoClose('This is an autoclose MsgBox') +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) -![autoclose](https://user-images.githubusercontent.com/13696193/43667325-714997dc-9745-11e8-836a-7185dc80329f.jpg) - sg.ScrolledTextBox(my_text, height=10) +The `PopupScrolled` will auto-fit the window size to the size of the text. Specify `None` in the height field of a `size` parameter to get auto-sized height. -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) +This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. + +sg.PopupScrolled(my_text, size=(80, None)) +Note that the default max number of lines before scrolling happens is set to 50. At 50 lines the scrolling will begin. -Take a moment to look at that last one. It's such a simple API call and yet the result is awesome. Rather than seeing your printed text scrolling past on your display, you can capture that text and present it in a scrolled interface. It's handy enough of an API call that it can also be called using the name `sprint` which is easier to remember than `ScrollectTextBox`. Your code could contain a line like: +### Popup Input - sprint(f'My variables values include x={x}', f'y={y}') +There are Popup calls for single-item inputs. These follow the pattern of `Popup` followed by `Get` and then the type of item to get. -This becomes a debug print of sorts that will route to a scrolled window. + - `PopupGetString` - get a single line of text + - `PopupGetFile` - get a filename + - `PopupGetFolder` - get a folder name -See also the `EasyPrint` and `Print` functions. +Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. + + + import PySimpleGUI as sg -#### High Level User Input + text = sg.PopupGetText('Title', 'Please input something') + sg.Popup('Results', 'The value returned from PopupGetText', text) -There are 3 very basic user input high-level function calls. It's expected that for most applications, a custom input form will be created. If you need only 1 value, then perhaps one of these high level functions will work. - - GetTextBox - - GetFileBox - - GetFolderBox + ![popupgettext](https://user-images.githubusercontent.com/13696193/44957281-8721b880-ae9e-11e8-98cd-d06369f4187e.jpg) - `submit_clicked, value = sg.GetTextBox('Title', 'Please enter anything')` +![popup gettext response](https://user-images.githubusercontent.com/13696193/44957282-8721b880-ae9e-11e8-84ae-dc8bb30504a0.jpg) -![gettextbox 2](https://user-images.githubusercontent.com/13696193/43667510-355b23a2-9746-11e8-9f1e-91c0dd0f4ed8.jpg) - submit_clicked, value = sg.GetFileBox('Title', 'Choose a file') + text = sg.PopupGetFile('Please enter a file name') + sg.Popup('Results', 'The value returned from PopupGetFile', text) -![getfilebox 2](https://user-images.githubusercontent.com/13696193/43667535-5821fc94-9746-11e8-95c3-82395099e994.jpg) +![popupgetfile](https://user-images.githubusercontent.com/13696193/44957857-2fd31680-aea5-11e8-8eb7-f6b91c202cc8.jpg) - submit_clicked, value = sg.GetPathBox('Title', 'Choose a folder') +The window created to get a folder name looks the same as the get a file name. The difference is in what the browse button does. `PopupGetFile` shows an Open File dialog box while `PopupGetFolder` shows an Open Folder dialog box. -![getpathbox](https://user-images.githubusercontent.com/13696193/43667556-79874c22-9746-11e8-80f2-8262d32802c2.jpg) + text = sg.PopupGetFolder('Please enter a folder name') + sg.Popup('Results', 'The value returned from PopupGetFolder', text) +![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) #### Progress Meter! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? @@ -466,7 +492,7 @@ Finally we can put it all together into a program that will display our window. button, (number,) = sg.FlexForm('Enter a number example').LayoutAndRead(layout) - sg.MsgBox(button, number) + sg.Popup(button, number) ### Example 2 - Get a filename Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. @@ -484,7 +510,7 @@ Writing the code for this one is just as straightforward. There is one tricky t button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) - sg.MsgBox(button, number) + sg.Popup(button, number) Read on for detailed instructions on the calls that show the form and return your results. @@ -572,9 +598,6 @@ In the statement that shows and reads the form, the two input fields are directl Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - - ### The Auto-Packer Once you've laid out your elements into, it's the job of the Auto-Packer to place your elements into a window frame. @@ -592,6 +615,7 @@ This is how your GUI is created, one row at a time, with one row stacked on top ### Laying out your form + Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. layout = [ [row 1], @@ -636,7 +660,9 @@ This is the code that **displays** the form, collects the information and return ## Return values As of version 2.8 there are 2 forms of return values, list and dictionary. + ### Return values as a list + By default return values are a list of values, one entry for each input field. Return information from FlexForm, SG's primary form builder interface, is in this format: @@ -686,12 +712,10 @@ This sample program demonstrates these 2 steps as well as how to address the ret button, values = form.LayoutAndRead(layout) - sg.MsgBox(button, values, values[0], values['address'], values['phone']) - + sg.Popup(button, values, values[0], values['address'], values['phone']) --- - ## All Widgets / Elements This code utilizes as many of the elements in one form as possible. @@ -724,16 +748,17 @@ This is a somewhat complex form with quite a bit of custom sizing to make things ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) -Clicking the Submit button caused the form call to return. The call to MsgBox resulted in this dialog box. +Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. ![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the MsgBox that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- # Building Custom Forms + You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition @@ -857,12 +882,12 @@ Building a form is simply making lists of Elements. Each list is a row in the o layout = [ [row 1 element, row 1 element], [row 2 element, row 2 element, row 2 element] ] The code is a crude representation of the GUI, laid out in text. + #### Text Element layout = [[sg.Text('This is what a Text Element looks like')]] - - ![textelem](https://user-images.githubusercontent.com/13696193/42670173-4c1fcb40-8627-11e8-851a-5a9ee4672320.jpg) + ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. @@ -907,14 +932,15 @@ A `True` value for `auto_size_text`, when placed on Text Elements, indicates tha - [ ] List item -**Shorthand functions** +**Shortcut functions** The shorthand functions for `Text` are `Txt` and `T` - #### Multiline Text Element layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] -![multiline text](https://user-images.githubusercontent.com/13696193/42670464-0824c754-8629-11e8-9741-6ed08f924618.jpg) + +![multiline](https://user-images.githubusercontent.com/13696193/44959853-b139a180-aec3-11e8-972f-f52188510c88.jpg) + This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. Multiline(default_text='', @@ -935,7 +961,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. form.AddRow(gg.Output(size=(100,20))) -![output element](https://user-images.githubusercontent.com/13696193/42704820-5446959c-869f-11e8-849e-047ea280387a.jpg) +![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) Output(scale=(None, None), size=(None, None)) @@ -950,7 +976,9 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. #### Text Input Element layout = [[sg.InputText('Default text')]] -![inputtext](https://user-images.githubusercontent.com/13696193/42693515-610a716c-867d-11e8-9a00-7e7fcf771230.jpg) + +![inputtext 2](https://user-images.githubusercontent.com/13696193/44959861-b5fe5580-aec3-11e8-8040-53ec241b5079.jpg) + def InputText(default_text = '', scale=(None, None), @@ -990,7 +1018,7 @@ Also known as a drop-down list. Only required parameter is the list of choices. layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] -![combo](https://user-images.githubusercontent.com/13696193/42694431-631c4108-8680-11e8-8e99-c1a642734464.jpg) +![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) InputCombo(values, scale=(None, None), @@ -1009,13 +1037,12 @@ Also known as a drop-down list. Only required parameter is the list of choices. text_color - color to use for the typed text key = Dictionary key to use for return values - #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] -![snap0130](https://user-images.githubusercontent.com/13696193/43115859-2fbf0646-8ed3-11e8-9979-bbee8eaebfab.jpg) +![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) Listbox(values, @@ -1052,11 +1079,12 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. #### Slider Element + Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] -![snap0129](https://user-images.githubusercontent.com/13696193/43115741-e1cb52c8-8ed2-11e8-80bb-0e99ae846ec1.jpg) +![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) Slider(range=(None,None), default_value=None, @@ -1090,11 +1118,12 @@ Sliders have a couple of slider-specific settings as well as appearance settings key = Dictionary key to use for return values #### Radio Button Element + Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] -![radio element](https://user-images.githubusercontent.com/13696193/42705705-327b4b6c-86a2-11e8-81a7-740e57646ba8.jpg) +![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) Radio(text, group_id, @@ -1126,7 +1155,8 @@ Checkbox elements are like Radio Button elements. They return a bool indicating layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] -![checkbox element](https://user-images.githubusercontent.com/13696193/42717015-655d73d2-86cc-11e8-9c69-3c810f48e578.jpg) + +![checkbox](https://user-images.githubusercontent.com/13696193/44959906-6f5d2b00-aec4-11e8-9c8a-962c787f0286.jpg) Checkbox(text, @@ -1152,11 +1182,12 @@ Checkbox elements are like Radio Button elements. They return a bool indicating #### Spin Element + An up/down spinner control. The valid values are passed in as a list. layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] -![spin element](https://user-images.githubusercontent.com/13696193/42717231-8ddb51d4-86cd-11e8-827a-75f2237477fa.jpg) +![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) Spin(values, intiial_value=None, @@ -1180,6 +1211,7 @@ An up/down spinner control. The valid values are passed in as a list. key = Dictionary key to use for return values #### Button Element + Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: @@ -1233,7 +1265,8 @@ These Pre-made buttons are some of the most important elements of all because th . layout = [[sg.OK(), sg.Cancel()]] -![ok cancel](https://user-images.githubusercontent.com/13696193/42717733-1803f584-86d1-11e8-9223-36b782971b9f.jpg) +![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) + The FileBrowse, FolderBrowse, FileSaveAs buttons all fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. @@ -1241,24 +1274,28 @@ The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value Let's examine this form as an example: -![button target example](https://user-images.githubusercontent.com/13696193/42718075-b4dcb61e-86d3-11e8-904c-d709dd364108.jpg) + +![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) + The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: Target = (1,0) Target = (-1,0) + The code for the entire form could be: - layout = [[sg.T('Source Folder')], - [sg.In()], - [sg.FolderBrowse(Target=(-1,0)), sg.OK()]] + layout = [[sg.T('Source Folder')], + [sg.In()], + [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] + **Custom Buttons** Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. layout = [[sg.SimpleButton('My Button')]] -![singlebutton](https://user-images.githubusercontent.com/13696193/42718281-9453deca-86d5-11e8-83c7-4b6d33720858.jpg) +![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. @@ -1294,7 +1331,8 @@ This is one you'll have to experiment with at this point. Not up for an exhaust Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: -![snap0135](https://user-images.githubusercontent.com/13696193/43440841-bcf8d184-9466-11e8-9f7b-30a1d5ce32d3.jpg) +![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) + This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". @@ -1416,7 +1454,8 @@ Columns are specified in exactly the same way as a form is, as a list of lists. Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: -![column example](https://user-images.githubusercontent.com/13696193/44215113-b1097a00-a13f-11e8-96d0-f3511036494e.jpg) +![column](https://user-images.githubusercontent.com/13696193/44959988-66b92480-aec5-11e8-9c26-316ed24a68c0.jpg) + This code produced the above window. @@ -1448,7 +1487,7 @@ This code produced the above window. # to collapse the form display and read down to a single line of code. button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - sg.MsgBox(button, values, line_width=200) + sg.Popup(button, values, line_width=200) The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. @@ -1748,6 +1787,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Color.py** | How to interact with color using RGB hex values and named colors |**Demo_Columns.py** | Using the Column Element to create more complex forms |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format |**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter @@ -1760,13 +1800,14 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph |**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph |**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery |**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices |**Demo_NonBlocking_Form.py** | a basic async form |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons |**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook (another script is in the works) +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook |**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature From 38dd2732e49ddd0f14ac3b656f481d60039692b3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 2 Sep 2018 17:16:18 -0400 Subject: [PATCH 264/521] Table display Recipe added to Cookbook --- Demo_Cookbook_Browser.py | 88 +++++++++++----------------------------- docs/cookbook.md | 16 ++++++++ 2 files changed, 39 insertions(+), 65 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 468e6b34e..290fc2ffc 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -1,4 +1,5 @@ + # import PySimpleGUI as sg import inspect @@ -75,7 +76,7 @@ def GUIAddOn(): fname = sys.argv[1] if not fname: - sg.MsgBox("Cancel", "No filename supplied") + sg.Popup("Cancel", "No filename supplied") # raise SystemExit("Cancelling: no filename supplied") def Compare2Files(): @@ -276,7 +277,7 @@ def button2(): break # All done! - sg.MsgBoxOK('Done') + sg.PopupOk('Done') def RealtimeButtons(): """ @@ -309,7 +310,7 @@ def RealtimeButtons(): button, values = form.ReadNonBlocking() if button is not None: print(button) - if button == 'Quit' or values is None: + if button is 'Quit' or values is None: break form.CloseNonBlockingForm() @@ -345,7 +346,7 @@ def TabbedForm(): results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), (form2, layout_tab_2,'Second Tab')) - sg.MsgBox(results) + sg.Popup(results) def MediaPlayer(): """ @@ -586,7 +587,7 @@ def MultipleColumns(): # to collapse the form display and read down to a single line of code. button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - sg.MsgBox(button, values, line_width=200) + sg.Popup(button, values, line_width=200) def PersistentForm(): """ @@ -703,64 +704,21 @@ def InputElementUpdate(): in_elem.Update(keys_entered) # change the form to reflect current key string -# def EverythingInOne(): - # """ - # Animated Matplotlib Graph - # Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. - # """ - # from tkinter import * - # from random import randint - # import PySimpleGUI as g - # from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg - # from matplotlib.figure import Figure - # import matplotlib.backends.tkagg as tkagg - # import tkinter as Tk - # - # - # def main(): - # fig = Figure() - # - # ax = fig.add_subplot(111) - # ax.set_xlabel("X axis") - # ax.set_ylabel("Y axis") - # ax.grid() - # - # canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on - # - # layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - # [canvas_elem], - # [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - # - # # create the form and show it without the plot - # form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - # form.Layout(layout) - # form.ReadNonBlocking() - # - # graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) - # canvas = canvas_elem.TKCanvas - # - # dpts = [randint(0, 10) for x in range(10000)] - # for i in range(len(dpts)): - # button, values = form.ReadNonBlocking() - # if button is 'Exit' or values is None: - # exit(69) - # - # ax.cla() - # ax.grid() - # - # ax.plot(range(20), dpts[i:i + 20], color='purple') - # graph.draw() - # figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # figure_w, figure_h = int(figure_w), int(figure_h) - # photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - # - # canvas.create_image(640 / 2, 480 / 2, image=photo) - # - # figure_canvas_agg = FigureCanvasAgg(fig) - # figure_canvas_agg.draw() - # - # tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - # # time.sleep(.1) + +def TableSimulation(): + """ + Display data in a table format + """ + import PySimpleGUI as sg + + layout = [[sg.T('Table Test')]] + + for i in range(20): + row = [sg.T(f'Row {i} ', size=(10, 1))] + layout.append([sg.T(f'{i}{j}', size=(4, 1), background_color='white', pad=(1, 1)) for j in range(10)]) + + sg.FlexForm('Table').LayoutAndRead(layout) + # -------------------------------- GUI Starts Here -------------------------------# @@ -768,7 +726,6 @@ def InputElementUpdate(): # information to display. # # --------------------------------------------------------------------------------# -# print(inspect.getsource(PyplotSimple)) import PySimpleGUI as sg @@ -777,7 +734,8 @@ def InputElementUpdate(): 'Non-Blocking With Updates':NonBlockingWithUpdates, 'Non-Bocking With Context Manager':NonBlockingWithContext, 'Callback Simulation':CallbackSimulation, 'Realtime Buttons':RealtimeButtons, 'Easy Progress Meter':EasyProgressMeter, 'Tabbed Form':TabbedForm, 'Media Player':MediaPlayer, 'Script Launcher':ScriptLauncher, 'Machine Learning':MachineLearning, 'Custom Progress Meter':CustromProgressMeter, 'One Line GUI':OneLineGUI, 'Multiple Columns':MultipleColumns, - 'Persistent Form':PersistentForm, 'Canvas Widget':CanvasWidget, 'Input Element Update':InputElementUpdate} + 'Persistent Form':PersistentForm, 'Canvas Widget':CanvasWidget, 'Input Element Update':InputElementUpdate, + 'Table Simulation':TableSimulation} # multiline_elem = sg.Multiline(size=(70,35),pad=(5,(3,90))) diff --git a/docs/cookbook.md b/docs/cookbook.md index 71d608590..ad4f453f4 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -827,3 +827,19 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to if __name__ == '__main__': main() + + + +## Tables + +While there is no official support for "Tables" (e.g. there is no Table Element), it is possible to display information in a tabular way. This only works for smaller tables because there is no way to scroll a window or a column element. Until scrollable columns are implemented there is little use in creating a Table Element. + +![simpletable](https://user-images.githubusercontent.com/13696193/44960497-c667fd80-aece-11e8-988c-5fa7dfdb90a6.jpg) + + layout = [[sg.T('Table Test')]] + + for i in range(20): + row = [sg.T(f'Row {i} ', size=(10,1))] + layout.append([sg.T(f'{i}{j}', size=(4,1), background_color='white', pad=(1,1)) for j in range(10)]) + + sg.FlexForm('Table').LayoutAndRead(layout) From 60a93a54ae5039d285d4f54eec087a4d5916ad43 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 2 Sep 2018 22:15:05 -0400 Subject: [PATCH 265/521] Fill form function working! New Look and Feel settings --- PySimpleGUI.py | 118 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 87 insertions(+), 31 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index de4807555..530d8e900 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -273,7 +273,10 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto def Update(self, new_value): - self.TKStringVar.set(new_value) + try: + self.TKStringVar.set(new_value) + except: pass + self.DefaultText = new_value def Get(self): return self.TKStringVar.get() @@ -285,8 +288,7 @@ def __del__(self): # Combo # # ---------------------------------------------------------------------- # class InputCombo(Element): - - def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -296,6 +298,7 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text :param background_color: Color for Element. Text or RGB Hex ''' self.Values = values + self.DefaultValue = default_value self.TKComboBox = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR @@ -305,7 +308,10 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text def Update(self, value): for index, v in enumerate(self.Values): if v == value: - self.TKCombo.current(index) + try: + self.TKCombo.current(index) + except: pass + self.DefaultValue = value break @@ -321,8 +327,7 @@ def __del__(self): # Option Menu # # ---------------------------------------------------------------------- # class InputOptionMenu(Element): - - def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -332,6 +337,7 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text :param background_color: Color for Element. Text or RGB Hex ''' self.Values = values + self.DefaultValue = default_value self.TKOptionMenu = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR @@ -341,7 +347,10 @@ def __init__(self, values, scale=(None, None), size=(None, None), auto_size_text def Update(self, value): for index, v in enumerate(self.Values): if v == value: - self.TKStringVar.set(value) + try: + self.TKStringVar.set(value) + except: pass + self.DefaultValue = value break @@ -356,7 +365,7 @@ def __del__(self): # Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, select_mode=None, select_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_values=None, select_mode=None, select_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Listbox Element :param values: @@ -367,6 +376,7 @@ def __init__(self, values, select_mode=None, select_submits=False, scale=(None, :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex ''' self.Values = values + self.DefaultValues = default_values self.TKListbox = None self.SelectSubmits = select_submits if select_mode == LISTBOX_SELECT_MODE_BROWSE: @@ -390,12 +400,15 @@ def Update(self, values): self.TKListbox.insert(tk.END, item) self.TKListbox.selection_set(0, 0) - def SetValue(self, value): + def SetValue(self, values): for index, item in enumerate(self.Values): - if item in value: - self.TKListbox.selection_set(index) - else: - self.TKListbox.selection_clear(index) + try: + if item in values: + self.TKListbox.selection_set(index) + else: + self.TKListbox.selection_clear(index) + except: pass + self.DefaultValues = values def __del__(self): try: @@ -435,7 +448,10 @@ def Update(self, value): if not value: return location = EncodeRadioRowCol(self.Position[0], self.Position[1]) - self.TKIntVar.set(location) + try: + self.TKIntVar.set(location) + except: pass + self.InitialState = value def __del__(self): try: @@ -471,11 +487,14 @@ def Get(self): return self.TKIntVar.get() def Update(self, value): - if value is None: - self.TKCheckbutton.configure(state='disabled') - else: - self.TKCheckbutton.configure(state='normal') - self.TKIntVar.set(value) + try: + if value is None: + self.TKCheckbutton.configure(state='disabled') + else: + self.TKCheckbutton.configure(state='normal') + self.TKIntVar.set(value) + except: pass + self.InitialState = value def __del__(self): @@ -510,7 +529,10 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None return def Update(self, new_value): - self.TKStringVar.set(new_value) + try: + self.TKStringVar.set(new_value) + except: pass + self.DefaultValue = new_value def SpinChangedHandler(self, event): # first, get the results table built @@ -550,9 +572,12 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, NewValue): - self.TKText.delete('1.0', tk.END) - self.TKText.insert(1.0, NewValue) + def Update(self, new_value): + try: + self.TKText.delete('1.0', tk.END) + self.TKText.insert(1.0, new_value) + except: pass + self.DefaultText = new_value def Get(self): return self.TKText.get(1.0, tk.END) @@ -1005,9 +1030,12 @@ def __init__(self, range=(None,None), default_value=None, resolution=None, orien return def Update(self, value, range=(None, None)): - self.TKIntVar.set(value) - if range != (None, None): - self.TKScale.config(from_ = range[0], to_ = range[1]) + try: + self.TKIntVar.set(value) + if range != (None, None): + self.TKScale.config(from_ = range[0], to_ = range[1]) + except: pass + self.DefaultValue = value def SliderChangedHandler(self, event): # first, get the results table built @@ -1663,7 +1691,6 @@ def FillSubformWithValues(form, values_dict): value = values_dict[element.Key] except: continue - if element.Type == ELEM_TYPE_INPUT_TEXT: element.Update(value) elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: @@ -1887,12 +1914,19 @@ def CharWidthInPixels(): # if element.BackgroundColor is not None: # element.TKCombo.configure(background=element.BackgroundColor) element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - element.TKCombo.current(0) + if element.DefaultValue: + for i, v in enumerate(element.Values): + if v == element.DefaultValue: + element.TKCombo.current(i) + break + else: + element.TKCombo.current(0) # ------------------------- OPTION MENU (Like ComboBox but different) element ------------------------- # elif element_type == ELEM_TYPE_INPUT_OPTION_MENU: max_line_len = max([len(str(l)) for l in element.Values]) element.TKStringVar = tk.StringVar() - element.TKStringVar.set(element.Values[0]) + default = element.DefaultValue if element.DefaultValue else element.Values[0] + element.TKStringVar.set(default) element.TKOptionMenu = tk.OptionMenu(tk_row_frame, element.TKStringVar ,*element.Values ) element.TKOptionMenu.config(highlightthickness=0, font=font) element.TKOptionMenu.config(borderwidth=border_depth) @@ -1909,9 +1943,11 @@ def CharWidthInPixels(): listbox_frame = tk.Frame(tk_row_frame) element.TKStringVar = tk.StringVar() element.TKListbox= tk.Listbox(listbox_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) - for item in element.Values: + for index, item in enumerate(element.Values): element.TKListbox.insert(tk.END, item) - element.TKListbox.selection_set(0,0) + if element.DefaultValues is not None and item in element.DefaultValues: + element.TKListbox.selection_set(index) + # element.TKListbox.selection_set(0,0) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKListbox.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: @@ -3046,6 +3082,26 @@ def ChangeLookAndFeel(index): 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0}, + 'Tan': {'BACKGROUND': '#fdf6e3', 'TEXT': '#268bd1', 'INPUT': '#eee8d5', + 'TEXT_INPUT': '#6c71c3', 'SCROLL': '#eee8d5', 'BUTTON': ('white', '#063542'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'TanBlue': {'BACKGROUND': '#e5dece', 'TEXT': '#063289', 'INPUT': '#f9f8f4', + 'TEXT_INPUT': '#242834', 'SCROLL': '#eee8d5', 'BUTTON': ('white', '#063289'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'DarkTanBlue': {'BACKGROUND': '#242834', 'TEXT': '#dfe6f8', 'INPUT': '#4f5764', + 'TEXT_INPUT': 'white', 'SCROLL': '#a9afbb', 'BUTTON': ('white', '#063289'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'DarkBlue': {'BACKGROUND': '#1a2835', 'TEXT': '#d1ecff', 'INPUT': '#335267', + 'TEXT_INPUT': '#acc2d0', 'SCROLL': '#1b6497', 'BUTTON': ('black', '#fafaf8'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + 'Reds': {'BACKGROUND': '#280001', 'TEXT': 'white', 'INPUT': '#d8d584', 'TEXT_INPUT': 'black', 'SCROLL': '#763e00', 'BUTTON': ('black', '#daad28'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, From a33b0710849513e8e8105cea54e680d26cfba9a2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 2 Sep 2018 22:25:13 -0400 Subject: [PATCH 266/521] New icon --- default_icon.ico | Bin 18850 -> 23462 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/default_icon.ico b/default_icon.ico index e5d1c2241275e84a0414f611dcb56568de7f2551..1a41525eccc9d2942797a9049eece9aef370b868 100644 GIT binary patch literal 23462 zcmeI3YmgO36~}w)R=Iw#z)$*xs`aBE(bCEa2}_WWgjXS2BpM4%DpHXkkc9xj4P3(# zh=c?p;jxmi5V#T`$ZHqE^MdhFvI1^+B*erE5;Q(n%g27$N_)=Cp1EhvcF*+8oqNfL zUFvL~KHW3j|KFVMnLBq;st*25n4sYIXVjVpl=_rX>a$=FQtQDmjz2fZ{rSItC z>WLvc`RqiEhHb_J69m`(RqN(I*{$_2T3`6zN0%KkI=$wrz+-}wT|L>BirM@KMv~tG z=!?0R;4)ObYuEP22J%@oUZ0Gy%ZJw_(vgG{=Z1M!bqFy7T<_ZFtt-jo_z&;ZuI9=M zbA;|>TpCe2=sIB+<+@*bVk=1IzsEN`KH!$ z4OVMjX`dyIKQ}dzepg=SUuzw}X*O^oGcl8~YBGGaC)rxOa(q*!oDMxTR-<(;zc<7Q z84#nmQu31ZEcx+gmpDHvM@V;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p&xJ6mm7awKm$ zA5Pj3?yh%Y4&v^Lv5ocmI>vng1`rL*rU$RBOb?a3pF$x%N%#T3U%{td4Mb}iVPg~g zT?+=dZ@Pcw)i&cOByF3YY Date: Sun, 2 Sep 2018 22:53:11 -0400 Subject: [PATCH 267/521] Better prog bar layout --- Demo_Chatterbot.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index 6697335ba..25ac0a301 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -10,14 +10,16 @@ ''' # Create the 'Trainer GUI' -MAX_PROG_BARS = 20 +# The Trainer GUI consists of a lot of progress bars stacked on top of each other +g.ChangeLookAndFeel('GreenTan') +MAX_PROG_BARS = 20 # number of training sessions bars = [] texts = [] -training_layout = [[g.T('TRAINING PROGRESS', size=(20,1), font=('Helvetica', 17))]] +training_layout = [[g.T('TRAINING PROGRESS', size=(20,1), font=('Helvetica', 17))],] for i in range(MAX_PROG_BARS): - bars.append(g.ProgressBar(100, size=(30, 5))) - texts.append(g.T(' '*20)) - training_layout += [[texts[i], bars[i]]] + bars.append(g.ProgressBar(100, size=(30, 4))) + texts.append(g.T(' '*20, size=(20,1), justification='right')) + training_layout += [[texts[i], bars[i]],] # add a single row training_form = g.FlexForm('Training') training_form.Layout(training_layout) @@ -31,11 +33,11 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar global training_form # update the form and the bars button, values = training_form.ReadNonBlocking() - if button is None and values is None: + if button is None and values is None: # if user closed the form on us, exit exit(69) if bars[current_bar].UpdateBar(iteration_counter, max=total_items) is False: exit(69) - texts[current_bar].Update(description) + texts[current_bar].Update(description) # show the training dataset name if iteration_counter == total_items: current_bar += 1 @@ -51,15 +53,16 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: layout = [[g.Output(size=(80, 20))], [g.Multiline(size=(70, 5), enter_submits=True), - g.ReadFormButton('SEND', bind_return_key=True), g.SimpleButton('EXIT')]] + g.ReadFormButton('SEND', bind_return_key=True), g.ReadFormButton('EXIT')]] form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: button, (value,) = form.Read() - if button != 'SEND': + if button is not 'SEND': break - print(value.rstrip()) + string = value.rstrip() + print(string.rjust(120)) # send the user input to chatbot to get a response response = chatbot.get_response(value.rstrip()) print(response) \ No newline at end of file From 85dd1893342288b0f813e4b88f66254040048b13 Mon Sep 17 00:00:00 2001 From: "Jorj X. McKie" Date: Mon, 3 Sep 2018 10:05:33 -0400 Subject: [PATCH 268/521] Viewer for arbitrary images --- Demo_Img_Viewer.py | 114 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Demo_Img_Viewer.py diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py new file mode 100644 index 000000000..67da83929 --- /dev/null +++ b/Demo_Img_Viewer.py @@ -0,0 +1,114 @@ +import PySimpleGUI as sg +import os +from PIL import Image, ImageTk +import io +""" +Simple Image Browser based on PySimpleGUI +-------------------------------------------- +There are some improvements compared to the PNG browser of the repository: +1. Paging is cyclic, i.e. automatically wraps around if file index is outside +2. Supports all file types that are valid PIL images +3. Limits the maximum form size to the physical screen +4. When selecting an image from the listbox, subsequent paging uses its index +5. Paging performance improved significantly because of using PIL + +Dependecies +------------ +Python v3 +PIL +""" +# Get the folder containing the images from the user +rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') +if not rc or not folder: + sg.MsgBoxCancel('Cancelling') + raise SystemExit() + +# PIL supported image types +img_types = (".png", ".jpg", "jpeg", ".tiff", ".bmp") + +# get list of files in folder +flist0 = os.listdir(folder) + +# create sub list of image files (no sub folders, no wrong file types) +fnames = [f for f in flist0 if os.path.isfile(os.path.join(folder,f)) and f.lower().endswith(img_types)] + +num_files = len(fnames) # number of iamges found +if num_files == 0: + sg.MsgBox('No files in folder') + raise SystemExit() + +del flist0 # no longer needed + +#------------------------------------------------------------------------------ +# use PIL to read data of one image +#------------------------------------------------------------------------------ +def get_img_data(f, maxsize = (1200, 850), first = False): + """Generate image data using PIL + """ + img = Image.open(f) + img.thumbnail(maxsize) + if first: # tkinter is inactive the first time + bio = io.BytesIO() + img.save(bio, format = "PNG") + del img + return bio.getvalue() + return ImageTk.PhotoImage(img) +#------------------------------------------------------------------------------ + + +# create the form that also returns keyboard events +form = sg.FlexForm('Image Browser', return_keyboard_events=True, + location=(0, 0), use_default_focus=False) + +# make these 2 elements outside the layout as we want to "update" them later +# initialize to the first file in the list +filename = os.path.join(folder, fnames[0]) # name of first file in list +image_elem = sg.Image(data = get_img_data(filename, first = True)) +filename_display_elem = sg.Text(filename, size=(80, 3)) +file_num_display_elem = sg.Text('File 1 of {}'.format(num_files), size=(15,1)) + +# define layout, show and read the form +col = [[filename_display_elem], + [image_elem], + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', + size=(8,2)), file_num_display_elem]] + +col_files = [[sg.Listbox(values = fnames, size=(60,30), key='listbox')], + [sg.ReadFormButton('Read')]] + +layout = [[sg.Column(col_files), sg.Column(col)]] + +button, values = form.LayoutAndRead(layout) # Shows form on screen + +# loop reading the user input and displaying image, filename +i=0 +while True: + + # perform button and keyboard operations + if button is None: + break + elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34'): + i += 1 + if i >= num_files: + i -= num_files + elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33'): + i -= 1 + if i < 0: + i = num_files + i + + if button == 'Read': # something from the listbox + f = values["listbox"][0] # selected filename + filename = os.path.join(folder, f) # read this file + i = fnames.index(f) # update running index + else: + filename = os.path.join(folder, fnames[i]) + + # update window with new image + image_elem.Update(data=get_img_data(filename)) + # update window with filename + filename_display_elem.Update(filename) + # update page display + file_num_display_elem.Update('File {} of {}'.format(i+1, num_files)) + + # read the form + button, values = form.Read() From ccd3e4c7979e6831be25e54174b73af943d584ae Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 10:51:54 -0400 Subject: [PATCH 269/521] Scrollable Columns - NEW Feature! --- Demo_Columns.py | 61 ++++++++++++++++++++++++++++++-------- PySimpleGUI.py | 78 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 114 insertions(+), 25 deletions(-) diff --git a/Demo_Columns.py b/Demo_Columns.py index ededa3f66..2f07b83b7 100644 --- a/Demo_Columns.py +++ b/Demo_Columns.py @@ -7,18 +7,55 @@ # sg.ChangeLookAndFeel('BlueMono') -# Column layout -col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], - [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], - [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] -layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], - [sg.Input('Last input')], - [sg.OK()]] +def ScrollableColumns(): + # sg.ChangeLookAndFeel('Dark') -# Display the form and get values -# If you're willing to not use the "context manager" design pattern, then it's possible -# to collapse the form display and read down to a single line of code. -button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) -sg.MsgBox(button, values, line_width=200) + column1 = [[sg.Text('Column 1', justification='center', size=(20, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1', key='spin1', size=(30,1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3', key='spin3')]] + + + column2 = [[sg.T('Table Test')]] + + for i in range(50): + column2.append([sg.T(f'{i}{j}', size=(4, 1), background_color='gray25', text_color='white', pad=(1, 1)) for j in range(10)]) + + layout = [[sg.Column(column2, scrollable=True, size=(400,300)), sg.Column(column1, scrollable=True, size=(200,150))], + [sg.OK()]] + + form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1)) + b, v = form.LayoutAndRead(layout) + + +def NormalColumns(): + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) + +NormalColumns() +ScrollableColumns() \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 530d8e900..7438608a0 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1059,20 +1059,52 @@ def __init__(self, master, **kwargs): # create a canvas object and a vertical scrollbar for scrolling it self.vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) self.vscrollbar.pack(side='right', fill="y", expand="false") - self.canvas = tk.Canvas(self, yscrollcommand=self.vscrollbar.set) - self.canvas.pack(side="left") + + self.hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL) + self.hscrollbar.pack(side='bottom', fill="x", expand="false") + + self.canvas = tk.Canvas(self, yscrollcommand=self.vscrollbar.set, xscrollcommand=self.hscrollbar.set) + self.canvas.pack(side="left", fill="both", expand=True) + self.vscrollbar.config(command=self.canvas.yview) + self.hscrollbar.config(command=self.canvas.xview) # reset the view self.canvas.xview_moveto(0) self.canvas.yview_moveto(0) # create a frame inside the canvas which will be scrolled with it - # self.interior = tk.Frame(self.canvas, **kwargs) - # self.canvas.create_window(0, 0, window=self.interior, anchor="nw") - - # self.bind('', self.set_scrollregion) - + self.TKFrame = tk.Frame(self.canvas, **kwargs) + self.canvas.create_window(0, 0, window=self.TKFrame, anchor="nw") + self.canvas.config(borderwidth=0, highlightthickness=0) + self.TKFrame.config(borderwidth=0, highlightthickness=0) + self.config(borderwidth=0, highlightthickness=0) + + self.bind('', self.set_scrollregion) + + self.bind_mouse_scroll(self.canvas, self.yscroll) + self.bind_mouse_scroll(self.hscrollbar, self.xscroll) + self.bind_mouse_scroll(self.vscrollbar, self.yscroll) + + + def yscroll(self, event): + if event.num == 5 or event.delta < 0: + self.canvas.yview_scroll(1, "unit") + elif event.num == 4 or event.delta > 0: + self.canvas.yview_scroll(-1, "unit") + + def xscroll(self, event): + if event.num == 5 or event.delta < 0: + self.canvas.xview_scroll(1, "unit") + elif event.num == 4 or event.delta > 0: + self.canvas.xview_scroll(-1, "unit") + + def bind_mouse_scroll(self, parent, mode): + # ~~ Windows only + parent.bind("", mode) + # ~~ Unix only + parent.bind("", mode) + parent.bind("", mode) def set_scrollregion(self, event=None): """ Set the scroll region on the canvas""" @@ -1083,7 +1115,7 @@ def set_scrollregion(self, event=None): # Column # # ---------------------------------------------------------------------- # class Column(Element): - def __init__(self, layout, background_color = None, pad=None): + def __init__(self, layout, background_color = None, size=(None, None), pad=None, scrollable=False): self.UseDictionary = False self.ReturnValues = None self.ReturnValuesList = [] @@ -1093,11 +1125,12 @@ def __init__(self, layout, background_color = None, pad=None): self.Rows = [] self.ParentForm = None self.TKFrame = None + self.Scrollable = scrollable bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.Layout(layout) - super().__init__(ELEM_TYPE_COLUMN, background_color=background_color, pad=pad) + super().__init__(ELEM_TYPE_COLUMN, background_color=background_color, size=size, pad=pad) return def AddRow(self, *args): @@ -1763,9 +1796,23 @@ def CharWidthInPixels(): element_size = (int(element_size[0] * toplevel_form.Scale[0]), int(element_size[1] * toplevel_form.Scale[1])) # ------------------------- COLUMN element ------------------------- # if element_type == ELEM_TYPE_COLUMN: - col_frame = tk.Frame(tk_row_frame) - # col_frame = TkScrollableFrame(tk_row_frame) # do not use yet! not working - PackFormIntoFrame(element, col_frame, toplevel_form) + if element.Scrollable: + col_frame = TkScrollableFrame(tk_row_frame) # do not use yet! not working + PackFormIntoFrame(element, col_frame.TKFrame, toplevel_form) + col_frame.TKFrame.update() + if element.Size == (None, None): + col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth(),height=col_frame.TKFrame.winfo_reqheight()) + else: + col_frame.canvas.config(width=element.Size[0],height=element.Size[1]) + + if not element.BackgroundColor in (None, COLOR_SYSTEM_DEFAULT): + col_frame.canvas.config(background=element.BackgroundColor) + col_frame.TKFrame.config(background=element.BackgroundColor, borderwidth =0, highlightthickness=0) + col_frame.config(background=element.BackgroundColor, borderwidth =0, highlightthickness=0) + else: + col_frame = tk.Frame(tk_row_frame) + PackFormIntoFrame(element, col_frame, toplevel_form) + col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) @@ -3092,11 +3139,16 @@ def ChangeLookAndFeel(index): 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0}, - 'DarkTanBlue': {'BACKGROUND': '#242834', 'TEXT': '#dfe6f8', 'INPUT': '#4f5764', + 'DarkTanBlue': {'BACKGROUND': '#242834', 'TEXT': '#dfe6f8', 'INPUT': '#97755c', 'TEXT_INPUT': 'white', 'SCROLL': '#a9afbb', 'BUTTON': ('white', '#063289'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0}, + 'DarkAmber': {'BACKGROUND': '#2c2825', 'TEXT': '#fdcb52', 'INPUT': '#705e52', + 'TEXT_INPUT': '#fdcb52', 'SCROLL': '#705e52', 'BUTTON': ('black', '#fdcb52'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + 'DarkBlue': {'BACKGROUND': '#1a2835', 'TEXT': '#d1ecff', 'INPUT': '#335267', 'TEXT_INPUT': '#acc2d0', 'SCROLL': '#1b6497', 'BUTTON': ('black', '#fafaf8'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, From 30be0e3276dbec8595e8623f867830af48c9f68e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 13:47:17 -0400 Subject: [PATCH 270/521] Tight layout Recipe --- docs/cookbook.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/docs/cookbook.md b/docs/cookbook.md index ad4f453f4..d623d5e09 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -843,3 +843,66 @@ While there is no official support for "Tables" (e.g. there is no Table Element) layout.append([sg.T(f'{i}{j}', size=(4,1), background_color='white', pad=(1,1)) for j in range(10)]) sg.FlexForm('Table').LayoutAndRead(layout) + +## Tight Layout + +Saw this example layout written in tkinter and liked it so much I duplicated the interface. It's "tight", clean, and has a nice dark look and feel. + +This Recipe also contains code that implements the button interactions so that you'll have a template to build from. + +In other GUI frameworks this program would be most likely "event driven" with callback functions being used to communicate button events. The "event loop" would be handled by the GUI engine. If code already existed that used a call-back mechanism, the loop in the example code below could simply call these callback functions directly based on the button text it receives in the form.Read call. + +![timemanagement](https://user-images.githubusercontent.com/13696193/44996818-0f27c100-af78-11e8-8836-9ef6164efe3b.jpg) + + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0, 0)) + + StartButton = sg.ReadFormButton('Start', button_color=('white', 'black')) + StopButton = sg.ReadFormButton('Stop', button_color=('gray34', 'black')) + ResetButton = sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3')) + SubmitButton = sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4')) + + 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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')], + [StartButton, StopButton, ResetButton, SubmitButton] + ] + + form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, + auto_size_buttons=False, + default_button_element_size=(12, 1)) + form.Layout(layout) + recording = have_data = False + while True: + button, values = form.Read() + if button is None: + exit(69) + if button is 'Start': + StartButton.Update(button_color=('gray34', 'black')) + StopButton.Update(button_color=('white', 'black')) + ResetButton.Update(button_color=('white', 'firebrick3')) + recording = True + elif button is 'Stop' and recording: + StopButton.Update(button_color=('gray34', 'black')) + StartButton.Update(button_color=('white', 'black')) + SubmitButton.Update(button_color=('white', 'springgreen4')) + recording = False + have_data = True + elif button is 'Reset': + StopButton.Update(button_color=('gray34', 'black')) + StartButton.Update(button_color=('white', 'black')) + SubmitButton.Update(button_color=('gray34', 'springgreen4')) + ResetButton.Update(button_color=('gray34', 'firebrick3')) + recording = False + have_data = False + elif button is 'Submit' and have_data: + StopButton.Update(button_color=('gray34', 'black')) + StartButton.Update(button_color=('white', 'black')) + SubmitButton.Update(button_color=('gray34', 'springgreen4')) + ResetButton.Update(button_color=('gray34', 'firebrick3')) + recording = False From c7a695d2a66d29d3ea8899b8df0823aea6fa85a7 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 14:20:22 -0400 Subject: [PATCH 271/521] Changed button update method so can change only color if desired, tweaks to scrollable columns, fixed bug in size of OptionMeny element, initial check-in of image viewer demo by Jorj --- Demo_Img_Viewer.py | 115 +++++++++++++++++++++++++++++++++++++++++++++ PySimpleGUI.py | 14 ++++-- 2 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 Demo_Img_Viewer.py diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py new file mode 100644 index 000000000..f09dc5610 --- /dev/null +++ b/Demo_Img_Viewer.py @@ -0,0 +1,115 @@ +import PySimpleGUI as sg +import os +from PIL import Image, ImageTk +import io +""" +Simple Image Browser based on PySimpleGUI +-------------------------------------------- +There are some improvements compared to the PNG browser of the repository: +1. Paging is cyclic, i.e. automatically wraps around if file index is outside +2. Supports all file types that are valid PIL images +3. Limits the maximum form size to the physical screen +4. When selecting an image from the listbox, subsequent paging uses its index +5. Paging performance improved significantly because of using PIL + +Dependecies +------------ +Python v3 +PIL +""" +# Get the folder containing the images from the user +rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') +if not rc or not folder: + sg.MsgBoxCancel('Cancelling') + raise SystemExit() + +# PIL supported image types +img_types = (".png", ".jpg", "jpeg", ".tiff", ".bmp") + +# get list of files in folder +flist0 = os.listdir(folder) + +# create sub list of image files (no sub folders, no wrong file types) +fnames = [f for f in flist0 if os.path.isfile(os.path.join(folder,f)) and f.lower().endswith(img_types)] + +num_files = len(fnames) # number of iamges found +if num_files == 0: + sg.MsgBox('No files in folder') + raise SystemExit() + +del flist0 # no longer needed + +#------------------------------------------------------------------------------ +# use PIL to read data of one image +#------------------------------------------------------------------------------ +def get_img_data(f, maxsize = (1200, 850), first = False): + """Generate image data using PIL + """ + img = Image.open(f) + img.thumbnail(maxsize) + if first: # tkinter is inactive the first time + bio = io.BytesIO() + img.save(bio, format = "PNG") + del img + return bio.getvalue() + return ImageTk.PhotoImage(img) +#------------------------------------------------------------------------------ + + +# create the form that also returns keyboard events +form = sg.FlexForm('Image Browser', return_keyboard_events=True, + location=(0, 0), use_default_focus=False) + +# make these 2 elements outside the layout as we want to "update" them later +# initialize to the first file in the list +filename = os.path.join(folder, fnames[0]) # name of first file in list +image_elem = sg.Image(data = get_img_data(filename, first = True)) +filename_display_elem = sg.Text(filename, size=(80, 3)) +file_num_display_elem = sg.Text('File 1 of {}'.format(num_files), size=(15,1)) + +# define layout, show and read the form +col = [[filename_display_elem], + [image_elem]] + +col_files = [[sg.Listbox(values = fnames, select_submits=True, size=(60,30), key='listbox')], + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', + size=(8,2)), file_num_display_elem]] + +layout = [[sg.Column(col_files), sg.Column(col)]] + +form.Layout(layout) # Shows form on screen + +# loop reading the user input and displaying image, filename +i=0 +while True: + # read the form + button, values = form.Read() + + # perform button and keyboard operations + if button is None: + break + elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34'): + i += 1 + if i >= num_files: + i -= num_files + filename = os.path.join(folder, fnames[i]) + elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33'): + i -= 1 + if i < 0: + i = num_files + i + filename = os.path.join(folder, fnames[i]) + elif button in ('Read', ''): # something from the listbox + f = values["listbox"][0] # selected filename + filename = os.path.join(folder, f) # read this file + i = fnames.index(f) # update running index + else: + filename = os.path.join(folder, fnames[i]) + + # update window with new image + image_elem.Update(data=get_img_data(filename)) + # update window with filename + filename_display_elem.Update(filename) + # update page display + file_num_display_elem.Update('File {} of {}'.format(i+1, num_files)) + + diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7438608a0..17ce24ea0 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -866,9 +866,10 @@ def ButtonCallBack(self): _my_windows.Decrement() return - def Update(self, new_text, button_color=(None, None)): + def Update(self, new_text=None, button_color=(None, None)): try: - self.TKButton.configure(text=new_text) + if new_text is not None: + self.TKButton.configure(text=new_text) if button_color != (None, None): self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: @@ -1618,6 +1619,7 @@ def BuildResults(form, initialize_only, top_level_form): form.ReturnValuesDictionary = {} form.ReturnValuesList = [] BuildResultsForSubform(form, initialize_only, top_level_form) + top_level_form.LastButtonClicked = None return form.ReturnValues def BuildResultsForSubform(form, initialize_only, top_level_form): @@ -1801,7 +1803,7 @@ def CharWidthInPixels(): PackFormIntoFrame(element, col_frame.TKFrame, toplevel_form) col_frame.TKFrame.update() if element.Size == (None, None): - col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth(),height=col_frame.TKFrame.winfo_reqheight()) + col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth()/2,height=col_frame.TKFrame.winfo_reqheight()/2) else: col_frame.canvas.config(width=element.Size[0],height=element.Size[1]) @@ -1971,11 +1973,13 @@ def CharWidthInPixels(): # ------------------------- OPTION MENU (Like ComboBox but different) element ------------------------- # elif element_type == ELEM_TYPE_INPUT_OPTION_MENU: max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len element.TKStringVar = tk.StringVar() default = element.DefaultValue if element.DefaultValue else element.Values[0] element.TKStringVar.set(default) - element.TKOptionMenu = tk.OptionMenu(tk_row_frame, element.TKStringVar ,*element.Values ) - element.TKOptionMenu.config(highlightthickness=0, font=font) + element.TKOptionMenu = tk.OptionMenu(tk_row_frame, element.TKStringVar ,*element.Values) + element.TKOptionMenu.config(highlightthickness=0, font=font, width=width ) element.TKOptionMenu.config(borderwidth=border_depth) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKOptionMenu.configure(background=element.BackgroundColor) From 29b6e4d202e1fcd34e237ad7463ba413c3f5ea4d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 14:32:58 -0400 Subject: [PATCH 272/521] Resolving different brach --- Demo_Img_Viewer.py | 115 --------------------------------------------- 1 file changed, 115 deletions(-) delete mode 100644 Demo_Img_Viewer.py diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py deleted file mode 100644 index f09dc5610..000000000 --- a/Demo_Img_Viewer.py +++ /dev/null @@ -1,115 +0,0 @@ -import PySimpleGUI as sg -import os -from PIL import Image, ImageTk -import io -""" -Simple Image Browser based on PySimpleGUI --------------------------------------------- -There are some improvements compared to the PNG browser of the repository: -1. Paging is cyclic, i.e. automatically wraps around if file index is outside -2. Supports all file types that are valid PIL images -3. Limits the maximum form size to the physical screen -4. When selecting an image from the listbox, subsequent paging uses its index -5. Paging performance improved significantly because of using PIL - -Dependecies ------------- -Python v3 -PIL -""" -# Get the folder containing the images from the user -rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') -if not rc or not folder: - sg.MsgBoxCancel('Cancelling') - raise SystemExit() - -# PIL supported image types -img_types = (".png", ".jpg", "jpeg", ".tiff", ".bmp") - -# get list of files in folder -flist0 = os.listdir(folder) - -# create sub list of image files (no sub folders, no wrong file types) -fnames = [f for f in flist0 if os.path.isfile(os.path.join(folder,f)) and f.lower().endswith(img_types)] - -num_files = len(fnames) # number of iamges found -if num_files == 0: - sg.MsgBox('No files in folder') - raise SystemExit() - -del flist0 # no longer needed - -#------------------------------------------------------------------------------ -# use PIL to read data of one image -#------------------------------------------------------------------------------ -def get_img_data(f, maxsize = (1200, 850), first = False): - """Generate image data using PIL - """ - img = Image.open(f) - img.thumbnail(maxsize) - if first: # tkinter is inactive the first time - bio = io.BytesIO() - img.save(bio, format = "PNG") - del img - return bio.getvalue() - return ImageTk.PhotoImage(img) -#------------------------------------------------------------------------------ - - -# create the form that also returns keyboard events -form = sg.FlexForm('Image Browser', return_keyboard_events=True, - location=(0, 0), use_default_focus=False) - -# make these 2 elements outside the layout as we want to "update" them later -# initialize to the first file in the list -filename = os.path.join(folder, fnames[0]) # name of first file in list -image_elem = sg.Image(data = get_img_data(filename, first = True)) -filename_display_elem = sg.Text(filename, size=(80, 3)) -file_num_display_elem = sg.Text('File 1 of {}'.format(num_files), size=(15,1)) - -# define layout, show and read the form -col = [[filename_display_elem], - [image_elem]] - -col_files = [[sg.Listbox(values = fnames, select_submits=True, size=(60,30), key='listbox')], - [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', - size=(8,2)), file_num_display_elem]] - -layout = [[sg.Column(col_files), sg.Column(col)]] - -form.Layout(layout) # Shows form on screen - -# loop reading the user input and displaying image, filename -i=0 -while True: - # read the form - button, values = form.Read() - - # perform button and keyboard operations - if button is None: - break - elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34'): - i += 1 - if i >= num_files: - i -= num_files - filename = os.path.join(folder, fnames[i]) - elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33'): - i -= 1 - if i < 0: - i = num_files + i - filename = os.path.join(folder, fnames[i]) - elif button in ('Read', ''): # something from the listbox - f = values["listbox"][0] # selected filename - filename = os.path.join(folder, f) # read this file - i = fnames.index(f) # update running index - else: - filename = os.path.join(folder, fnames[i]) - - # update window with new image - image_elem.Update(data=get_img_data(filename)) - # update window with filename - filename_display_elem.Update(filename) - # update page display - file_num_display_elem.Update('File {} of {}'.format(i+1, num_files)) - - From 5d6ae5dcdce8a9a4e28c8d7f862f99e55527956a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 16:51:25 -0400 Subject: [PATCH 273/521] MsgBox changed to Popup. Removed Read button. Listbox returns when selected --- Demo_Img_Viewer.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py index 67da83929..ffd48d753 100644 --- a/Demo_Img_Viewer.py +++ b/Demo_Img_Viewer.py @@ -20,7 +20,7 @@ # Get the folder containing the images from the user rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') if not rc or not folder: - sg.MsgBoxCancel('Cancelling') + sg.PopupCancel('Cancelling') raise SystemExit() # PIL supported image types @@ -34,7 +34,7 @@ num_files = len(fnames) # number of iamges found if num_files == 0: - sg.MsgBox('No files in folder') + sg.Popup('No files in folder') raise SystemExit() del flist0 # no longer needed @@ -69,20 +69,21 @@ def get_img_data(f, maxsize = (1200, 850), first = False): # define layout, show and read the form col = [[filename_display_elem], - [image_elem], - [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', - size=(8,2)), file_num_display_elem]] + [image_elem]] -col_files = [[sg.Listbox(values = fnames, size=(60,30), key='listbox')], - [sg.ReadFormButton('Read')]] +col_files = [[sg.Listbox(values = fnames, select_submits=True, size=(60,30), key='listbox')], + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', + size=(8,2)), file_num_display_elem]] layout = [[sg.Column(col_files), sg.Column(col)]] -button, values = form.LayoutAndRead(layout) # Shows form on screen +form.Layout(layout) # Shows form on screen # loop reading the user input and displaying image, filename i=0 while True: + # read the form + button, values = form.Read() # perform button and keyboard operations if button is None: @@ -91,12 +92,13 @@ def get_img_data(f, maxsize = (1200, 850), first = False): i += 1 if i >= num_files: i -= num_files + filename = os.path.join(folder, fnames[i]) elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33'): i -= 1 if i < 0: i = num_files + i - - if button == 'Read': # something from the listbox + filename = os.path.join(folder, fnames[i]) + elif button in ('Read', ''): # something from the listbox f = values["listbox"][0] # selected filename filename = os.path.join(folder, f) # read this file i = fnames.index(f) # update running index @@ -110,5 +112,4 @@ def get_img_data(f, maxsize = (1200, 850), first = False): # update page display file_num_display_elem.Update('File {} of {}'.format(i+1, num_files)) - # read the form - button, values = form.Read() + From f651b49d05a0046cc47acfacecb54639caebff09 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 16:52:22 -0400 Subject: [PATCH 274/521] Initial checkin into Dev branch --- Demo_Img_Viewer.py | 115 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Demo_Img_Viewer.py diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py new file mode 100644 index 000000000..00f23a6d0 --- /dev/null +++ b/Demo_Img_Viewer.py @@ -0,0 +1,115 @@ +import PySimpleGUI as sg +import os +from PIL import Image, ImageTk +import io +""" +Simple Image Browser based on PySimpleGUI +-------------------------------------------- +There are some improvements compared to the PNG browser of the repository: +1. Paging is cyclic, i.e. automatically wraps around if file index is outside +2. Supports all file types that are valid PIL images +3. Limits the maximum form size to the physical screen +4. When selecting an image from the listbox, subsequent paging uses its index +5. Paging performance improved significantly because of using PIL + +Dependecies +------------ +Python v3 +PIL +""" +# Get the folder containing the images from the user +rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') +if not rc or not folder: + sg.PopupCancel('Cancelling') + raise SystemExit() + +# PIL supported image types +img_types = (".png", ".jpg", "jpeg", ".tiff", ".bmp") + +# get list of files in folder +flist0 = os.listdir(folder) + +# create sub list of image files (no sub folders, no wrong file types) +fnames = [f for f in flist0 if os.path.isfile(os.path.join(folder,f)) and f.lower().endswith(img_types)] + +num_files = len(fnames) # number of iamges found +if num_files == 0: + sg.Popup('No files in folder') + raise SystemExit() + +del flist0 # no longer needed + +#------------------------------------------------------------------------------ +# use PIL to read data of one image +#------------------------------------------------------------------------------ +def get_img_data(f, maxsize = (1200, 850), first = False): + """Generate image data using PIL + """ + img = Image.open(f) + img.thumbnail(maxsize) + if first: # tkinter is inactive the first time + bio = io.BytesIO() + img.save(bio, format = "PNG") + del img + return bio.getvalue() + return ImageTk.PhotoImage(img) +#------------------------------------------------------------------------------ + + +# create the form that also returns keyboard events +form = sg.FlexForm('Image Browser', return_keyboard_events=True, + location=(0, 0), use_default_focus=False) + +# make these 2 elements outside the layout as we want to "update" them later +# initialize to the first file in the list +filename = os.path.join(folder, fnames[0]) # name of first file in list +image_elem = sg.Image(data = get_img_data(filename, first = True)) +filename_display_elem = sg.Text(filename, size=(80, 3)) +file_num_display_elem = sg.Text('File 1 of {}'.format(num_files), size=(15,1)) + +# define layout, show and read the form +col = [[filename_display_elem], + [image_elem]] + +col_files = [[sg.Listbox(values = fnames, select_submits=True, size=(60,30), key='listbox')], + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', + size=(8,2)), file_num_display_elem]] + +layout = [[sg.Column(col_files), sg.Column(col)]] + +form.Layout(layout) # Shows form on screen + +# loop reading the user input and displaying image, filename +i=0 +while True: + # read the form + button, values = form.Read() + + # perform button and keyboard operations + if button is None: + break + elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34'): + i += 1 + if i >= num_files: + i -= num_files + filename = os.path.join(folder, fnames[i]) + elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33'): + i -= 1 + if i < 0: + i = num_files + i + filename = os.path.join(folder, fnames[i]) + elif button in ('Read', ''): # something from the listbox + f = values["listbox"][0] # selected filename + filename = os.path.join(folder, f) # read this file + i = fnames.index(f) # update running index + else: + filename = os.path.join(folder, fnames[i]) + + # update window with new image + image_elem.Update(data=get_img_data(filename)) + # update window with filename + filename_display_elem.Update(filename) + # update page display + file_num_display_elem.Update('File {} of {}'.format(i+1, num_files)) + + From 341233f8b754b56246fa3b93ad93cd0fbf3bf5e0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 17:56:01 -0400 Subject: [PATCH 275/521] Renamed select_submits to change_submit in Listbox so that it matches other elements --- PySimpleGUI.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 17ce24ea0..33901a80c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -365,7 +365,7 @@ def __del__(self): # Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, default_values=None, select_mode=None, select_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_values=None, select_mode=None, change_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Listbox Element :param values: @@ -378,7 +378,7 @@ def __init__(self, values, default_values=None, select_mode=None, select_submits self.Values = values self.DefaultValues = default_values self.TKListbox = None - self.SelectSubmits = select_submits + self.ChangeSubmits = change_submits if select_mode == LISTBOX_SELECT_MODE_BROWSE: self.SelectMode = SELECT_MODE_BROWSE elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: @@ -1802,8 +1802,8 @@ def CharWidthInPixels(): col_frame = TkScrollableFrame(tk_row_frame) # do not use yet! not working PackFormIntoFrame(element, col_frame.TKFrame, toplevel_form) col_frame.TKFrame.update() - if element.Size == (None, None): - col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth()/2,height=col_frame.TKFrame.winfo_reqheight()/2) + if element.Size == (None, None): # if no size specified, use column width x column height/2 + col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth(),height=col_frame.TKFrame.winfo_reqheight()/2) else: col_frame.canvas.config(width=element.Size[0],height=element.Size[1]) @@ -1906,6 +1906,8 @@ def CharWidthInPixels(): if width != 0: tkbutton.configure(wraplength=wraplen+10) # set wrap to width of widget tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.BindReturnKey: + element.TKButton.bind('', element.ReturnKeyHandler) if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): focus_set = True element.TKButton.bind('', element.ReturnKeyHandler) @@ -2003,7 +2005,7 @@ def CharWidthInPixels(): element.TKListbox.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKListbox.configure(fg=text_color) - if element.SelectSubmits: + if element.ChangeSubmits: element.TKListbox.bind('<>', element.ListboxSelectHandler) vsb = tk.Scrollbar(listbox_frame, orient="vertical", command=element.TKListbox.yview) element.TKListbox.configure(yscrollcommand=vsb.set) @@ -2181,19 +2183,22 @@ def ConvertFlexToTK(MyFlexForm): if not MyFlexForm.IsTabbedForm: master.title(MyFlexForm.Title) InitializeResults(MyFlexForm) + try: + master.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' + except: + pass PackFormIntoFrame(MyFlexForm, master, MyFlexForm) #....................................... DONE creating and laying out window ..........................# if MyFlexForm.IsTabbedForm: master = MyFlexForm.ParentWindow - master.attributes('-alpha', 0) # hide window while getting info and moving - screen_width = master.winfo_screenwidth() # get window info to move to middle of screen + screen_width = master.winfo_screenwidth() # get window info to move to middle of screen screen_height = master.winfo_screenheight() if MyFlexForm.Location != (None, None): x,y = MyFlexForm.Location elif DEFAULT_WINDOW_LOCATION != (None, None): x,y = DEFAULT_WINDOW_LOCATION else: - master.update_idletasks() # don't forget + master.update_idletasks() # don't forget to do updates or values are bad win_width = master.winfo_width() win_height = master.winfo_height() x = screen_width/2 -win_width/2 @@ -2205,7 +2210,7 @@ def ConvertFlexToTK(MyFlexForm): move_string = '+%i+%i'%(int(x),int(y)) master.geometry(move_string) - master.attributes('-alpha', 255) # Make window visible again + master.attributes('-alpha', 255) # Make window visible again master.update_idletasks() # don't forget return From 716511b887c6b25c859c21738ff86ca8dc55c757 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 17:57:22 -0400 Subject: [PATCH 276/521] New TightLayout recipe. Renamed listbox select_submits to change_submits. --- Demo_Cookbook_Browser.py | 30 +++++++++++++++++++++++++++--- Demo_Matplotlib_Browser.py | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 290fc2ffc..ce9448ee0 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -720,6 +720,30 @@ def TableSimulation(): sg.FlexForm('Table').LayoutAndRead(layout) +def TightLayout(): + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0, 0)) + 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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.ReadFormButton('Start', button_color=('white', 'black')), + sg.ReadFormButton('Stop', button_color=('white', 'black')), + sg.ReadFormButton('Reset', button_color=('white', 'firebrick3')), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'))] + ] + + form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, + auto_size_buttons=False, + default_button_element_size=(12, 1)) + form.Layout(layout) + while True: + button, values = form.Read() + if button is None: + return # -------------------------------- GUI Starts Here -------------------------------# # fig = your figure you want to display. Assumption is that 'fig' holds the # @@ -735,7 +759,7 @@ def TableSimulation(): 'Realtime Buttons':RealtimeButtons, 'Easy Progress Meter':EasyProgressMeter, 'Tabbed Form':TabbedForm, 'Media Player':MediaPlayer, 'Script Launcher':ScriptLauncher, 'Machine Learning':MachineLearning, 'Custom Progress Meter':CustromProgressMeter, 'One Line GUI':OneLineGUI, 'Multiple Columns':MultipleColumns, 'Persistent Form':PersistentForm, 'Canvas Widget':CanvasWidget, 'Input Element Update':InputElementUpdate, - 'Table Simulation':TableSimulation} + 'Table Simulation':TableSimulation, 'Tight Layout':TightLayout} # multiline_elem = sg.Multiline(size=(70,35),pad=(5,(3,90))) @@ -744,8 +768,8 @@ def TableSimulation(): multiline_elem = sg.Multiline(size=(70,35), do_not_clear=True) while True: - sg.ChangeLookAndFeel('LightGreen') - col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), select_submits=True, key='func')], + sg.ChangeLookAndFeel('Dark') + col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), change_submits=True, key='func')], [sg.SimpleButton('Run'), sg.Exit()]] layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], diff --git a/Demo_Matplotlib_Browser.py b/Demo_Matplotlib_Browser.py index 2cf3baeeb..7301b5fda 100644 --- a/Demo_Matplotlib_Browser.py +++ b/Demo_Matplotlib_Browser.py @@ -868,7 +868,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): multiline_elem = g.Multiline(size=(70,35),pad=(5,(3,90))) # define the form layout listbox_values = [key for key in fig_dict.keys()] -col_listbox = [[g.Listbox(values=listbox_values, select_submits=True, size=(28,len(listbox_values)), key='func')], +col_listbox = [[g.Listbox(values=listbox_values, change_submits=True, size=(28, len(listbox_values)), key='func')], [g.T(' '*12), g.Exit(size=(5,2))]] layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], From 50a69f25fca8513b4a498152d15dd903b863d3ef Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 3 Sep 2018 23:58:56 -0400 Subject: [PATCH 277/521] New PopupNoButtons box, added "key" to all elements, form.FindElement method, Combo.Update can update list of allowed values, --- Demo_Cookbook_Browser.py | 10 +++--- Demo_Font_Sizer.py | 15 ++++---- PySimpleGUI.py | 75 ++++++++++++++++++++++++++++++---------- 3 files changed, 69 insertions(+), 31 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index ce9448ee0..2e1cc91b8 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -385,7 +385,7 @@ def MediaPlayer(): sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], - [sg.Text('_' * 30)], + [sg.Text('_' * 20)], [sg.Text(' ' * 30)], [ sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', @@ -721,6 +721,9 @@ def TableSimulation(): def TightLayout(): + """ + Turn off padding in order to get a really tight looking layout. + """ import PySimpleGUI as sg sg.ChangeLookAndFeel('Dark') @@ -765,7 +768,6 @@ def TightLayout(): # multiline_elem = sg.Multiline(size=(70,35),pad=(5,(3,90))) # define the form layout listbox_values = [key for key in fig_dict.keys()] -multiline_elem = sg.Multiline(size=(70,35), do_not_clear=True) while True: sg.ChangeLookAndFeel('Dark') @@ -773,7 +775,7 @@ def TightLayout(): [sg.SimpleButton('Run'), sg.Exit()]] layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], - [sg.Column(col_listbox, pad=(5,(3,2))), multiline_elem], + [sg.Column(col_listbox, pad=(5,(3,2))), sg.Multiline(size=(70,35), do_not_clear=True, key='multi')], ] # create the form and show it without the plot @@ -792,7 +794,7 @@ def TightLayout(): continue if button is '': - multiline_elem.Update(inspect.getsource(func)) + form.FindElement('multi').Update(inspect.getsource(func)) button, values = form.Read() elif button is 'Run': sg.ChangeLookAndFeel('SystemDefault') diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 9107ffef7..355e2d843 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -7,11 +7,11 @@ form = sg.FlexForm("Font size selector") fontSize = 12 -sampleText = sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize)) -slider = sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider') -spin = sg.Spin([sz for sz in range(4,72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin') + layout = [ - [sampleText, spin, slider], + [sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text'), + sg.Spin([sz for sz in range(6, 72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, + key='spin'), sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider')], [sg.OK(), sg.Cancel()] ] @@ -25,11 +25,10 @@ sz_slider = int(values['slider']) sz = sz_spin if sz_spin != fontSize else sz_slider if sz != fontSize: - print(sampleText.Font, sampleText.Size) fontSize = sz font = "Helvetica " + str(fontSize) - sampleText.Update(font=font) - slider.Update(sz) - spin.Update(sz) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) print("Done.") diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 33901a80c..c0a0b4edb 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -170,6 +170,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) MSG_BOX_ERROR = 3 MSG_BOX_OK_CANCEL = 4 MSG_BOX_OK = 0 +MSG_BOX_NO_BUTTONS = 5 # ---------------------------------------------------------------------- # # Cascading structure.... Objects get larger # @@ -305,7 +306,14 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value): + def Update(self, value=None, values=None): + if values is not None: + try: + self.TKCombo['values'] = values + self.TKCombo.current(0) + except: pass + self.Values = values + for index, v in enumerate(self.Values): if v == value: try: @@ -590,7 +598,7 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None, pad=None): + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None): ''' Text Element - Displays text in your form. Can be updated in non-blocking forms :param text: The text to display @@ -609,7 +617,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: bg = background_color - super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad) + super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad, key=key) return def Update(self, new_value = None, background_color=None, text_color=None, font=None): @@ -756,7 +764,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -787,7 +795,7 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH self.BindReturnKey = bind_return_key self.Focus = focus - super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad) + super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) return def ButtonReleaseCallBack(self, parm): @@ -934,7 +942,7 @@ def __del__(self): # Image # # ---------------------------------------------------------------------- # class Image(Element): - def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None), pad=None): + def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None), pad=None, key=None): ''' Image Element :param filename: @@ -947,7 +955,7 @@ def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None if data is None and filename is None: print('* Warning... no image specified in Image Element! *') - super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad) + super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad, key=key) return def Update(self, filename=None, data=None): @@ -971,11 +979,11 @@ def __del__(self): # Canvas # # ---------------------------------------------------------------------- # class Canvas(Element): - def __init__(self, canvas=None, background_color=None, scale=(None, None), size=(None, None), pad=None): + def __init__(self, canvas=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.TKCanvas = canvas - super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, scale=scale, size=size, pad=pad) + super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, scale=scale, size=size, pad=pad, key=key) return def __del__(self): @@ -986,11 +994,11 @@ def __del__(self): # Frame # # ---------------------------------------------------------------------- # class Frame(Element): - def __init__(self, frame=None, background_color=None, scale=(None, None), size=(None, None), pad=None): + def __init__(self, frame=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.TKFrame = frame - super().__init__(ELEM_TYPE_FRAME, background_color=background_color, scale=scale, size=size, pad=pad) + super().__init__(ELEM_TYPE_FRAME, background_color=background_color, scale=scale, size=size, pad=pad, key=key) return def __del__(self): @@ -1348,6 +1356,10 @@ def Refresh(self): def Fill(self, values_dict): FillFormWithValues(self, values_dict) + def FindElement(self, key): + return _FindElementFromKeyInSubForm(self, key) + + def GetScreenDimensions(self): if self.TKrootDestroyed: return None, None @@ -1559,20 +1571,20 @@ def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) -def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field -def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ##################################### ----- RESULTS ------ ################################################## @@ -1745,6 +1757,18 @@ def FillSubformWithValues(form, values_dict): elif element.Type == ELEM_TYPE_INPUT_SPIN: element.Update(value) + +def _FindElementFromKeyInSubForm(form, key): + for row_num, row in enumerate(form.Rows): + for col_num, element in enumerate(row): + if element.Type == ELEM_TYPE_COLUMN: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem + if element.Key == key: + return element + + # ------------------------------------------------------------------------------------------------------------------ # # ===================================== TK CODE STARTS HERE ====================================================== # # ------------------------------------------------------------------------------------------------------------------ # @@ -2395,6 +2419,8 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au elif button_type is MSG_BOX_OK_CANCEL: form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), PopupButton('Cancel', size=(5, 1), button_color=button_color)) + elif button_type is MSG_BOX_NO_BUTTONS: + pass else: form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) @@ -2413,6 +2439,12 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au # MsgBox is the legacy call and show not be used any longer MsgBox = Popup +# --------------------------- PopupNonBlocking --------------------------- +def PopupoNoButtons(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + Popup(*args, button_type=MSG_BOX_NO_BUTTONS, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + return + + # --------------------------- PopupNonBlocking --------------------------- def PopupoNonBlocking(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): Popup(*args, non_blocking=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) @@ -3133,6 +3165,11 @@ def ChangeLookAndFeel(index): 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, 'PROGRESS_DEPTH': 0}, + 'Dark2': {'BACKGROUND': 'gray25', 'TEXT': 'white', 'INPUT': 'white', + 'TEXT_INPUT': 'black', 'SCROLL': 'gray44', 'BUTTON': ('white', '#004F00'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + 'Black': {'BACKGROUND': 'black', 'TEXT': 'white', 'INPUT': 'gray30', 'TEXT_INPUT': 'white', 'SCROLL': 'gray44', 'BUTTON': ('black', 'white'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, From 0c37488dd3e204271c46863671839bea5551774c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 00:30:29 -0400 Subject: [PATCH 278/521] Font Siszer demo updated --- Demo_Font_Sizer.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 355e2d843..40878f2f4 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -8,18 +8,14 @@ fontSize = 12 -layout = [ - [sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text'), - sg.Spin([sz for sz in range(6, 72)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, - key='spin'), sg.Slider(range=(6,50), orientation='h', size=(10,20), change_submits=True, key='slider')], - [sg.OK(), sg.Cancel()] - ] +layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), change_submits=True, key='slider', font=('Helvetica 20')), sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize form.Layout(layout) while True: button, values= form.Read() - if button in (None, 'OK', 'Cancel'): + if button is None: break sz_spin = int(values['spin']) sz_slider = int(values['slider']) From 8fecb75a3e107a936ecc5bac653b38a3ad5c2cb2 Mon Sep 17 00:00:00 2001 From: "Jorj X. McKie" Date: Tue, 4 Sep 2018 10:25:08 -0400 Subject: [PATCH 279/521] New general Docuemtn viewer with improved zooming --- Demo_DOC_Viewer_PIL.py | 238 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 Demo_DOC_Viewer_PIL.py diff --git a/Demo_DOC_Viewer_PIL.py b/Demo_DOC_Viewer_PIL.py new file mode 100644 index 000000000..ac2c82324 --- /dev/null +++ b/Demo_DOC_Viewer_PIL.py @@ -0,0 +1,238 @@ +""" +@created: 2018-08-19 18:00:00 +@author: (c) 2018 Jorj X. McKie +Display a PyMuPDF Document using Tkinter +------------------------------------------------------------------------------- +Dependencies: +------------- +PyMuPDF, PySimpleGUI (requires Python 3), Tkinter, PIL +License: +-------- +GNU GPL V3+ +Description +------------ +Get filename and start displaying page 1. Please note that all file types +of MuPDF are supported (including EPUB e-books and HTML files for example). +Pages can be directly jumped to, or buttons can be used for paging. + +This version contains enhancements: +* Use of PIL improves response times by a factor 3 or more. +* Zooming is now flexible: only one button serves as a toggle. Arrow keys can + be used for moving the window when zooming. + +We also interpret keyboard events (PageDown / PageUp) and mouse wheel actions +to support paging as if a button was clicked. Similarly, we do not include +a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the form. +To improve paging performance, we are not directly creating pixmaps from +pages, but instead from the fitz.DisplayList of the page. A display list +will be stored in a list and looked up by page number. This way, zooming +pixmaps and page re-visits will re-use a once-created display list. + +""" +import sys +import fitz +import PySimpleGUI as sg +import tkinter as tk +from PIL import Image, ImageTk +import time + +if len(sys.argv) == 1: + rc, fname = sg.GetFileBox('Document Browser', 'Document file to open', + file_types = ( + ("PDF Files", "*.pdf"), + ("XPS Files", "*.*xps"), + ("Epub Files", "*.epub"), + ("Fiction Books", "*.fb2"), + ("Comic Books", "*.cbz"), + ("HTML", "*.htm*"), + # add more document types here + ) + ) +else: + fname = sys.argv[1] + +if not fname: + sg.MsgBox("Cancelling:", "No filename supplied") + raise SystemExit("Cancelled: no filename supplied") + +doc = fitz.open(fname) +page_count = len(doc) + +# used for response time statistics only +fitz_img_time = 0.0 +tk_img_time = 0.0 +img_count = 1 + +# allocate storage for page display lists +dlist_tab = [None] * page_count + +title = "PyMuPDF display of '%s', pages: %i" % (fname, page_count) + +def get_page(pno, zoom = False, max_size = None, first = False): + """Return a PNG image for a document page number. + """ + dlist = dlist_tab[pno] # get display list of page number + if not dlist: # create if not yet there + dlist_tab[pno] = doc[pno].getDisplayList() + dlist = dlist_tab[pno] + r = dlist.rect # the page rectangle + clip = r + # ensure image fits screen: + # exploit, but do not exceed width or height + zoom_0 = 1 + if max_size: + zoom_0 = min(1, max_size[0] / r.width, max_size[1] / r.height) + if zoom_0 == 1: + zoom_0 = min(max_size[0] / r.width, max_size[1] / r.height) + mat_0 = fitz.Matrix(zoom_0, zoom_0) + + if not zoom: # show total page + pix = dlist.getPixmap(matrix = mat_0, alpha=False) + else: + mp = r.tl + (r.br - r.tl) * 0.5 # page rect center + w2 = r.width / 2 + h2 = r.height / 2 + clip = r * 0.5 + tl = zoom[0] # old top-left + tl.x += zoom[1] * (w2 / 2) + tl.x = max(0, tl.x) + tl.x = min(w2, tl.x) + tl.y += zoom[2] * (h2 / 2) + tl.y = max(0, tl.y) + tl.y = min(h2, tl.y) + clip = fitz.Rect(tl, tl.x + w2, tl.y + h2) + + mat = mat_0 * fitz.Matrix(2, 2) # zoom matrix + pix = dlist.getPixmap(alpha=False, matrix=mat, clip=clip) + + if first: # first call: tkinter still inactive + img = pix.getPNGData() # so use fitz png output + else: # else take tk photo image + pilimg = Image.frombytes("RGB", [pix.width, pix.height], pix.samples) + img = ImageTk.PhotoImage(pilimg) + + return img, clip.tl # return image, clip position + + +root = tk.Tk() +max_width = root.winfo_screenwidth() - 20 +max_height = root.winfo_screenheight() - 135 +max_size = (max_width, max_height) +root.destroy() +del root + +form = sg.FlexForm(title, return_keyboard_events = True, + location = (0,0), use_default_focus = False) + +cur_page = 0 +data, clip_pos = get_page(cur_page, + zoom = False, + max_size = max_size, + first = True) + +image_elem = sg.Image(data = data) + +goto = sg.InputText(str(cur_page + 1), size=(5, 1), do_not_clear=True, + key = "PageNumber") + +layout = [ + [ + sg.ReadFormButton('Next'), + sg.ReadFormButton('Prev'), + sg.Text('Page:'), + goto, + sg.Text('(%i)' % page_count), + sg.ReadFormButton('Zoom'), + sg.Text('(toggle on/off, use arrows to navigate while zooming)'), + ], + [image_elem], +] + +form.Layout(layout) + +# now define the buttons / events we want to handle +enter_buttons = [chr(13), "Return:13"] +quit_buttons = ["Escape:27", chr(27)] +next_buttons = ["Next", "Next:34", "MouseWheel:Down"] +prev_buttons = ["Prev", "Prior:33", "MouseWheel:Up"] +Up = "Up:38" +Left = "Left:37" +Right = "Right:39" +Down = "Down:40" +zoom_buttons = ["Zoom", Up, Down, Left, Right] + +# all the buttons we will handle +my_keys = enter_buttons + next_buttons + prev_buttons + zoom_buttons + +# old page store and zoom toggle +old_page = 0 +old_zoom = False + +while True: + button, value = form.Read() + if button is None and (value is None or value['PageNumber'] is None): + break + if button in quit_buttons: + break + + zoom_pressed = False + zoom = False + + if button in enter_buttons: + try: + cur_page = int(value['PageNumber']) - 1 # check if valid + while cur_page < 0: + cur_page += page_count + except: + cur_page = 0 # this guy's trying to fool me + + elif button in next_buttons: + cur_page += 1 + elif button in prev_buttons: + cur_page -= 1 + elif button == Up: + zoom = (clip_pos, 0, -1) + elif button == Down: + zoom = (clip_pos, 0, 1) + elif button == Left: + zoom = (clip_pos, -1, 0) + elif button == Right: + zoom = (clip_pos, 1, 0) + elif button == "Zoom": + zoom_pressed = True + zoom = (clip_pos, 0, 0) + + # sanitize page number + if cur_page >= page_count: # wrap around + cur_page = 0 + while cur_page < 0: # pages > 0 look nicer + cur_page += page_count + + if zoom_pressed and old_zoom: + zoom = zoom_pressed = old_zoom = False + + t0 = time.perf_counter() + data, clip_pos = get_page(cur_page, zoom = zoom, max_size = max_size, + first = False) + t1 = time.perf_counter() + image_elem.Update(data = data) + t2 = time.perf_counter() + fitz_img_time += t1 - t0 + tk_img_time += t2 - t1 + img_count += 1 + old_page = cur_page + old_zoom = zoom_pressed or zoom + + # update page number field + if button in my_keys: + goto.Update(str(cur_page + 1)) + + +# print some response time statistics +if img_count > 0: + print("response times for '%s'" % doc.name) + print("%.4f" % (fitz_img_time/img_count), "sec fitz avg. image time") + print("%.4f" % (tk_img_time/img_count), "sec tk avg. image time") + print("%.4f" % ((fitz_img_time + tk_img_time)/img_count), "sec avg. total time") + print(img_count, "images read") + print(page_count, "pages") From ab926279166b9cf6587b4075334223ac46e15a6f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 12:55:25 -0400 Subject: [PATCH 280/521] Check into Dev Branch from Master --- Demo_DOC_Viewer_PIL.py | 238 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 Demo_DOC_Viewer_PIL.py diff --git a/Demo_DOC_Viewer_PIL.py b/Demo_DOC_Viewer_PIL.py new file mode 100644 index 000000000..ac2c82324 --- /dev/null +++ b/Demo_DOC_Viewer_PIL.py @@ -0,0 +1,238 @@ +""" +@created: 2018-08-19 18:00:00 +@author: (c) 2018 Jorj X. McKie +Display a PyMuPDF Document using Tkinter +------------------------------------------------------------------------------- +Dependencies: +------------- +PyMuPDF, PySimpleGUI (requires Python 3), Tkinter, PIL +License: +-------- +GNU GPL V3+ +Description +------------ +Get filename and start displaying page 1. Please note that all file types +of MuPDF are supported (including EPUB e-books and HTML files for example). +Pages can be directly jumped to, or buttons can be used for paging. + +This version contains enhancements: +* Use of PIL improves response times by a factor 3 or more. +* Zooming is now flexible: only one button serves as a toggle. Arrow keys can + be used for moving the window when zooming. + +We also interpret keyboard events (PageDown / PageUp) and mouse wheel actions +to support paging as if a button was clicked. Similarly, we do not include +a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the form. +To improve paging performance, we are not directly creating pixmaps from +pages, but instead from the fitz.DisplayList of the page. A display list +will be stored in a list and looked up by page number. This way, zooming +pixmaps and page re-visits will re-use a once-created display list. + +""" +import sys +import fitz +import PySimpleGUI as sg +import tkinter as tk +from PIL import Image, ImageTk +import time + +if len(sys.argv) == 1: + rc, fname = sg.GetFileBox('Document Browser', 'Document file to open', + file_types = ( + ("PDF Files", "*.pdf"), + ("XPS Files", "*.*xps"), + ("Epub Files", "*.epub"), + ("Fiction Books", "*.fb2"), + ("Comic Books", "*.cbz"), + ("HTML", "*.htm*"), + # add more document types here + ) + ) +else: + fname = sys.argv[1] + +if not fname: + sg.MsgBox("Cancelling:", "No filename supplied") + raise SystemExit("Cancelled: no filename supplied") + +doc = fitz.open(fname) +page_count = len(doc) + +# used for response time statistics only +fitz_img_time = 0.0 +tk_img_time = 0.0 +img_count = 1 + +# allocate storage for page display lists +dlist_tab = [None] * page_count + +title = "PyMuPDF display of '%s', pages: %i" % (fname, page_count) + +def get_page(pno, zoom = False, max_size = None, first = False): + """Return a PNG image for a document page number. + """ + dlist = dlist_tab[pno] # get display list of page number + if not dlist: # create if not yet there + dlist_tab[pno] = doc[pno].getDisplayList() + dlist = dlist_tab[pno] + r = dlist.rect # the page rectangle + clip = r + # ensure image fits screen: + # exploit, but do not exceed width or height + zoom_0 = 1 + if max_size: + zoom_0 = min(1, max_size[0] / r.width, max_size[1] / r.height) + if zoom_0 == 1: + zoom_0 = min(max_size[0] / r.width, max_size[1] / r.height) + mat_0 = fitz.Matrix(zoom_0, zoom_0) + + if not zoom: # show total page + pix = dlist.getPixmap(matrix = mat_0, alpha=False) + else: + mp = r.tl + (r.br - r.tl) * 0.5 # page rect center + w2 = r.width / 2 + h2 = r.height / 2 + clip = r * 0.5 + tl = zoom[0] # old top-left + tl.x += zoom[1] * (w2 / 2) + tl.x = max(0, tl.x) + tl.x = min(w2, tl.x) + tl.y += zoom[2] * (h2 / 2) + tl.y = max(0, tl.y) + tl.y = min(h2, tl.y) + clip = fitz.Rect(tl, tl.x + w2, tl.y + h2) + + mat = mat_0 * fitz.Matrix(2, 2) # zoom matrix + pix = dlist.getPixmap(alpha=False, matrix=mat, clip=clip) + + if first: # first call: tkinter still inactive + img = pix.getPNGData() # so use fitz png output + else: # else take tk photo image + pilimg = Image.frombytes("RGB", [pix.width, pix.height], pix.samples) + img = ImageTk.PhotoImage(pilimg) + + return img, clip.tl # return image, clip position + + +root = tk.Tk() +max_width = root.winfo_screenwidth() - 20 +max_height = root.winfo_screenheight() - 135 +max_size = (max_width, max_height) +root.destroy() +del root + +form = sg.FlexForm(title, return_keyboard_events = True, + location = (0,0), use_default_focus = False) + +cur_page = 0 +data, clip_pos = get_page(cur_page, + zoom = False, + max_size = max_size, + first = True) + +image_elem = sg.Image(data = data) + +goto = sg.InputText(str(cur_page + 1), size=(5, 1), do_not_clear=True, + key = "PageNumber") + +layout = [ + [ + sg.ReadFormButton('Next'), + sg.ReadFormButton('Prev'), + sg.Text('Page:'), + goto, + sg.Text('(%i)' % page_count), + sg.ReadFormButton('Zoom'), + sg.Text('(toggle on/off, use arrows to navigate while zooming)'), + ], + [image_elem], +] + +form.Layout(layout) + +# now define the buttons / events we want to handle +enter_buttons = [chr(13), "Return:13"] +quit_buttons = ["Escape:27", chr(27)] +next_buttons = ["Next", "Next:34", "MouseWheel:Down"] +prev_buttons = ["Prev", "Prior:33", "MouseWheel:Up"] +Up = "Up:38" +Left = "Left:37" +Right = "Right:39" +Down = "Down:40" +zoom_buttons = ["Zoom", Up, Down, Left, Right] + +# all the buttons we will handle +my_keys = enter_buttons + next_buttons + prev_buttons + zoom_buttons + +# old page store and zoom toggle +old_page = 0 +old_zoom = False + +while True: + button, value = form.Read() + if button is None and (value is None or value['PageNumber'] is None): + break + if button in quit_buttons: + break + + zoom_pressed = False + zoom = False + + if button in enter_buttons: + try: + cur_page = int(value['PageNumber']) - 1 # check if valid + while cur_page < 0: + cur_page += page_count + except: + cur_page = 0 # this guy's trying to fool me + + elif button in next_buttons: + cur_page += 1 + elif button in prev_buttons: + cur_page -= 1 + elif button == Up: + zoom = (clip_pos, 0, -1) + elif button == Down: + zoom = (clip_pos, 0, 1) + elif button == Left: + zoom = (clip_pos, -1, 0) + elif button == Right: + zoom = (clip_pos, 1, 0) + elif button == "Zoom": + zoom_pressed = True + zoom = (clip_pos, 0, 0) + + # sanitize page number + if cur_page >= page_count: # wrap around + cur_page = 0 + while cur_page < 0: # pages > 0 look nicer + cur_page += page_count + + if zoom_pressed and old_zoom: + zoom = zoom_pressed = old_zoom = False + + t0 = time.perf_counter() + data, clip_pos = get_page(cur_page, zoom = zoom, max_size = max_size, + first = False) + t1 = time.perf_counter() + image_elem.Update(data = data) + t2 = time.perf_counter() + fitz_img_time += t1 - t0 + tk_img_time += t2 - t1 + img_count += 1 + old_page = cur_page + old_zoom = zoom_pressed or zoom + + # update page number field + if button in my_keys: + goto.Update(str(cur_page + 1)) + + +# print some response time statistics +if img_count > 0: + print("response times for '%s'" % doc.name) + print("%.4f" % (fitz_img_time/img_count), "sec fitz avg. image time") + print("%.4f" % (tk_img_time/img_count), "sec tk avg. image time") + print("%.4f" % ((fitz_img_time + tk_img_time)/img_count), "sec avg. total time") + print(img_count, "images read") + print(page_count, "pages") From 16b1c8310d0263d641d7f6c815040e55f618414d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 13:40:31 -0400 Subject: [PATCH 281/521] New options for PopupGetFile (save_as, no_window), added key to buttons, New Demo_Fill_form from JFong --- Demo_Fill_Form.py | 83 ++++++++++++++++++++++++++++++----------------- PySimpleGUI.py | 81 ++++++++++++++++++++++++++------------------- 2 files changed, 100 insertions(+), 64 deletions(-) diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index 1b8e24e63..c638de531 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -1,52 +1,75 @@ +# from tkinter.filedialog import asksaveasfilename, askopenfilename +import pickle import PySimpleGUI as sg -""" -Show a complex form, save the initial values -When the "Fill" button is clicked, the form will reset to the initial values -""" -def Everything(): - sg.ChangeLookAndFeel('Dark') +def save(values): + sfilename = sg.PopupGetFile('Save Settings', save_as=True, no_window=True) + if not sfilename: + return + with open(sfilename, 'wb') as sf: + pickle.dump(values, sf) + +def load(form): + dfilename = sg.PopupGetFile('Load Settings', no_window=True) + if not dfilename: + return + with open(dfilename, 'rb') as df: + form.Fill(pickle.load(df)) - column1 = [[sg.Text('Column 1', background_color='black', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + +def Everything(): + sg.ChangeLookAndFeel('TanBlue') + + column1 = [ + [sg.Text('Column 1', background_color=sg.DEFAULT_BACKGROUND_COLOR, justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1', key='spin1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3', key='spin3')]] layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10, key='slider'), - sg.Column(column1, background_color='black')], + [sg.InputText('This is my text', key='in1', do_not_clear=True)], + [sg.Checkbox('Checkbox', key='cb1'), sg.Checkbox('My second checkbox!', key='cb2', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", key='rad1', default=True), + sg.Radio('My second Radio!', "RADIO1", key='rad2')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3), + key='multi1', do_not_clear=True), + sg.Multiline(default_text='A second multi-line', size=(35, 3), key='multi2', do_not_clear=True)], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), key='combo', size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), key='slide1', default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'), key='optionmenu')], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3), key='listbox'), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25, key='slide2', ), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75, key='slide3', ), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10, key='slide4'), + sg.Column(column1, background_color='gray34')], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.ReadFormButton('Fill'), sg.Cancel()] + sg.InputText('Default Folder', key='folder', do_not_clear=True), sg.FolderBrowse()], + [sg.ReadFormButton('Exit'), + sg.Text(' ' * 40), sg.ReadFormButton('SaveSettings'), sg.ReadFormButton('LoadSettings')] ] form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1)) + # button, values = form.LayoutAndRead(layout, non_blocking=True) form.Layout(layout) - button, initial_values = form.ReadNonBlocking() while True: button, values = form.Read() - if button in (None, 'Cancel'): + + if button is 'SaveSettings': + save(values) + elif button is 'LoadSettings': + load(form) + elif button in ['Exit', None]: break - form.Fill(initial_values) # fill form with whatever initial values were - sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + # form.CloseNonBlockingForm() + -Everything() +if __name__ == '__main__': + Everything() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c0a0b4edb..ab33c1e85 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1510,64 +1510,64 @@ def __del__(self): # return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): - return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) +def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) +def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- # -def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): - return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) +def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) +def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE AS Element lazy function ------------------------- # -def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad) +def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # -def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- OPEN BUTTON Element lazy function ------------------------- # -def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # -def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # -def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Exit BUTTON Element lazy function ------------------------- # -def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad) +def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # # this is the only button that REQUIRES button text field @@ -2024,7 +2024,6 @@ def CharWidthInPixels(): element.TKListbox.insert(tk.END, item) if element.DefaultValues is not None and item in element.DefaultValues: element.TKListbox.selection_set(index) - # element.TKListbox.selection_set(0,0) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKListbox.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: @@ -2036,6 +2035,7 @@ def CharWidthInPixels(): element.TKListbox.pack(side=tk.LEFT) vsb.pack(side=tk.LEFT, fill='y') listbox_frame.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKListbox.bind('', element.ReturnKeyHandler) # ------------------------- INPUT MULTI LINE element ------------------------- # elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText @@ -2183,7 +2183,8 @@ def CharWidthInPixels(): tkscale.config(highlightthickness=0) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: tkscale.configure(background=element.BackgroundColor) - tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) + if DEFAULT_SCROLLBAR_COLOR != COLOR_SYSTEM_DEFAULT: + tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: tkscale.configure(fg=text_color) tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) @@ -2948,10 +2949,21 @@ def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*") AskForFile = GetFileBox -def PopupGetFile(message, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)): +def PopupGetFile(message, save_as=False, no_window=False, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)): + if no_window: + if save_as: + return tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box + else: + return tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box + + if save_as: + browse_button = SaveAs(file_types=file_types) + else: + browse_button = FileBrowse(file_types=file_types) + with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: layout = [[Text(message, auto_size_text=True)], - [InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)], + [InputText(default_text=default_path, size=size), browse_button], [Ok(), Cancel()]] (button, input_values) = form.LayoutAndRead(layout) @@ -2961,6 +2973,7 @@ def PopupGetFile(message, default_path='', file_types=(("ALL Files", "*.*"),), b path = input_values[0] return path + # ============================== GetTextBox =========# # Get a single line of text # # ===================================================# From 4697d051bf6ea8ec3e16a9d54be7545bb7952172 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 14:07:42 -0400 Subject: [PATCH 282/521] changed select_submits to change_submits --- Demo_Img_Viewer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py index ba243fab8..df075f697 100644 --- a/Demo_Img_Viewer.py +++ b/Demo_Img_Viewer.py @@ -71,7 +71,7 @@ def get_img_data(f, maxsize = (1200, 850), first = False): col = [[filename_display_elem], [image_elem]] -col_files = [[sg.Listbox(values = fnames, select_submits=True, size=(60,30), key='listbox')], +col_files = [[sg.Listbox(values = fnames, change_submits=True, size=(60, 30), key='listbox')], [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2)), file_num_display_elem]] @@ -111,3 +111,5 @@ def get_img_data(f, maxsize = (1200, 850), first = False): filename_display_elem.Update(filename) # update page display file_num_display_elem.Update('File {} of {}'.format(i+1, num_files)) + + From 3af012fb30ed62b472cc6747603da0d3efc80dfb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 14:40:16 -0400 Subject: [PATCH 283/521] New demo that shows how button states can be managed --- Demo_Button_States.py | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Demo_Button_States.py diff --git a/Demo_Button_States.py b/Demo_Button_States.py new file mode 100644 index 000000000..233d56dcd --- /dev/null +++ b/Demo_Button_States.py @@ -0,0 +1,54 @@ +import PySimpleGUI as sg +""" +Demonstrates using a "tight" layout with a Dark theme. +Shows how button states can be controlled by a user application. The program manages the disabled/enabled +states for buttons and changes the text color to show greyed-out (disabled) buttons +""" + +sg.ChangeLookAndFeel('Dark') +sg.SetOptions(element_padding=(0,0)) + +StartButton = sg.ReadFormButton('Start', button_color=('white', 'black')) +StopButton = sg.ReadFormButton('Stop', button_color=('gray34','black')) +ResetButton = sg.ReadFormButton('Reset', button_color=('gray','firebrick3')) +SubmitButton = sg.ReadFormButton('Submit', button_color=('gray34','springgreen4')) + +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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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')], + [StartButton, StopButton, ResetButton, SubmitButton] + ] + +form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12,1)) +form.Layout(layout) +recording = have_data = False +while True: + button, values = form.Read() + if button is None: + exit(69) + if button is 'Start': + StartButton.Update(button_color=('gray34','black')) + StopButton.Update(button_color=('white', 'black')) + ResetButton.Update(button_color=('white', 'firebrick3')) + recording = True + elif button is 'Stop' and recording: + StopButton.Update(button_color=('gray34','black')) + StartButton.Update(button_color=('white', 'black')) + SubmitButton.Update(button_color=('white', 'springgreen4')) + recording = False + have_data = True + elif button is 'Reset': + StopButton.Update(button_color=('gray34','black')) + StartButton.Update(button_color=('white', 'black')) + SubmitButton.Update(button_color=('gray34', 'springgreen4')) + ResetButton.Update(button_color=('gray34', 'firebrick3')) + recording = False + have_data = False + elif button is 'Submit' and have_data: + StopButton.Update(button_color=('gray34','black')) + StartButton.Update(button_color=('white', 'black')) + SubmitButton.Update(button_color=('gray34', 'springgreen4')) + ResetButton.Update(button_color=('gray34', 'firebrick3')) + recording = False + From e251bf1bf4b71a43e4dae90bbd405e1224261552 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 16:57:34 -0400 Subject: [PATCH 284/521] New feature - change_submits for Combo boxes --- PySimpleGUI.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ab33c1e85..426d2fc1d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -232,6 +232,14 @@ def ListboxSelectHandler(self, event): self.ParentForm.TKroot.quit() # kick the users out of the mainloop + def ComboboxSelectHandler(self, event): + MyForm = self.ParentForm + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + def __del__(self): try: self.TKStringVar.__del__() @@ -289,7 +297,7 @@ def __del__(self): # Combo # # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, change_submits=False, key=None, pad=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -301,6 +309,7 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N self.Values = values self.DefaultValue = default_value self.TKComboBox = None + self.ChangeSubmits = change_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR @@ -1996,6 +2005,8 @@ def CharWidthInPixels(): break else: element.TKCombo.current(0) + if element.ChangeSubmits: + element.TKCombo.bind('<>', element.ComboboxSelectHandler) # ------------------------- OPTION MENU (Like ComboBox but different) element ------------------------- # elif element_type == ELEM_TYPE_INPUT_OPTION_MENU: max_line_len = max([len(str(l)) for l in element.Values]) From 8b78d6e95547391f24b1dc7b34ff338fccebf663 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 19:43:22 -0400 Subject: [PATCH 285/521] Refresh of ALL Demos in prep for 2.20 release --- Demo_All_Widgets.py | 17 ++--- Demo_Canvas.py | 13 ++-- Demo_Chat.py | 2 +- Demo_Color.py | 20 ++---- Demo_Columns.py | 4 +- Demo_Compare_Files.py | 6 +- Demo_Cookbook_Browser.py | 18 ++--- Demo_Dictionary.py | 15 +--- Demo_DisplayHash1and256.py | 21 +++--- Demo_ElementBrowser.py | 24 +++++++ Demo_HowDoI.py | 9 +-- Demo_Keyboard_Realtime.py | 7 +- Demo_Keypad.py | 25 ++++--- Demo_Machine_Learning.py | 4 +- Demo_Matplotlib_Ping_Graph_Large.py | 107 ++++++++++++++++++++++++++++ Demo_Media_Player.py | 8 +-- Demo_NonBlocking_Form.py | 3 +- Demo_Pi_LEDs.py | 59 +++++++++++++++ Demo_Pi_Robotics.py | 12 ++-- Demo_Recipes.py | 58 +++++++-------- Demo_Script_Launcher.py | 4 +- Demo_Script_Parameters.py | 2 +- Demo_Super_Simple_Form.py | 26 +++++-- Demo_Tabbed_Form.py | 4 +- 24 files changed, 327 insertions(+), 141 deletions(-) create mode 100644 Demo_ElementBrowser.py create mode 100644 Demo_Matplotlib_Ping_Graph_Large.py create mode 100644 Demo_Pi_LEDs.py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 66f6c5980..cb03220f9 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -2,11 +2,11 @@ def Everything(): - # sg.ChangeLookAndFeel('LightGreen') - # sg.SetOptions(input_elements_background_color=sg.COLOR_SYSTEM_DEFAULT) + sg.ChangeLookAndFeel('Dark') + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) - column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10, 1))], + column1 = [[sg.Text('Column 1', background_color='black', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] @@ -15,17 +15,18 @@ def Everything(): [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#d3dfda')], + sg.Column(column1, background_color='black')], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), @@ -35,7 +36,7 @@ def Everything(): button, values = form.LayoutAndRead(layout) - # sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + +Everything() -sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) -Everything() \ No newline at end of file diff --git a/Demo_Canvas.py b/Demo_Canvas.py index 35eec4942..893c9d4f1 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -1,9 +1,7 @@ import PySimpleGUI as gui -canvas = gui.Canvas(size=(100,100), background_color='red') - layout = [ - [canvas], + [gui.Canvas(size=(100,100), background_color='red', key='canvas')], [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] ] @@ -11,12 +9,13 @@ form.Layout(layout) form.ReadNonBlocking() -cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) +cir = form.FindElement('canvas').TKCanvas.create_oval(50, 50, 100, 100) while True: button, values = form.Read() - if button is None: break + if button is None: + break if button is 'Blue': - canvas.TKCanvas.itemconfig(cir, fill = "Blue") + form.FindElement('canvas').TKCanvas.itemconfig(cir, fill = "Blue") elif button is 'Red': - canvas.TKCanvas.itemconfig(cir, fill = "Red") + form.FindElement('canvas').TKCanvas.itemconfig(cir, fill = "Red") diff --git a/Demo_Chat.py b/Demo_Chat.py index 5e4d793b1..55bba5609 100644 --- a/Demo_Chat.py +++ b/Demo_Chat.py @@ -28,7 +28,7 @@ def ChatBotWithHistory(): ] form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI --- # + # ---===--- Loop taking in user input and using it --- # command_history = [] history_offset = 0 while True: diff --git a/Demo_Color.py b/Demo_Color.py index 142b19cba..14c64ab85 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1684,21 +1684,7 @@ def main(): [g.Submit(), g.Quit(), g.SimpleButton('Show me lots of colors!', button_color=('white','#0e6251'))], ] # [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).LayoutAndShow(layout) - - drop_down_value = drop_down_value[0] - - # ------- Form show ------- # - # layout = [[g.Text('Find color')], - # [g.Text('Demonstration of colors')], - # [g.Text('Enter a color name in text or hex #RRGGBB format')], - # [g.InputText()], - # [g.InputCombo(list_of_colors, size=(20,6)), g.T('Or choose from list')], - # [g.Submit(), g.Quit(), g.SimpleButton('Show me lots of colors!', button_color=('white','#0e6251'))], - # ] - # # [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).LayoutAndShow(layout) - + (button, (hex_input, drop_down_value)) = g.FlexForm('Color Demo', auto_size_text=True, icon=MY_WINDOW_ICON).LayoutAndRead(layout) # ------- OUTPUT results portion ------- # if button == '' or button == 'Quit' or button is None: @@ -1706,6 +1692,8 @@ def main(): elif button == 'Show me lots of colors!': show_all_colors_on_buttons() + drop_down_value = drop_down_value[0] + if hex_input is not '' and hex_input[0] == '#': color_hex = hex_input.upper() color_name = get_name_from_hex(hex_input) @@ -1721,7 +1709,7 @@ def main(): [g.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))], ] - g.FlexForm('Color demo', default_element_size=(100,1), auto_size_text=True, auto_close=True, auto_close_duration=5, icon=MY_WINDOW_ICON).LayoutAndShow(layout) + 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) diff --git a/Demo_Columns.py b/Demo_Columns.py index 2f07b83b7..d58a8fe28 100644 --- a/Demo_Columns.py +++ b/Demo_Columns.py @@ -11,7 +11,6 @@ def ScrollableColumns(): # sg.ChangeLookAndFeel('Dark') - column1 = [[sg.Text('Column 1', justification='center', size=(20, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1', key='spin1', size=(30,1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], @@ -33,12 +32,13 @@ def ScrollableColumns(): for i in range(50): column2.append([sg.T(f'{i}{j}', size=(4, 1), background_color='gray25', text_color='white', pad=(1, 1)) for j in range(10)]) - layout = [[sg.Column(column2, scrollable=True, size=(400,300)), sg.Column(column1, scrollable=True, size=(200,150))], + layout = [[sg.Column(column2, scrollable=True), sg.Column(column1, scrollable=True, size=(200,150))], [sg.OK()]] form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1)) b, v = form.LayoutAndRead(layout) + sg.Popup(v) def NormalColumns(): # Column layout diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index c5ecf7f23..73cdf604e 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -1,13 +1,15 @@ import PySimpleGUI as sg +sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) + def GetFilesToCompare(): with sg.FlexForm('File Compare') as form: form_rows = [[sg.Text('Enter 2 files to comare')], [sg.Text('File 1', size=(15, 1)), sg.InputText(), sg.FileBrowse()], [sg.Text('File 2', size=(15, 1)), sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - rc = form.LayoutAndShow(form_rows) - return rc + button, values = form.LayoutAndRead(form_rows) + return button, values def main(): button, (f1, f2) = GetFilesToCompare() diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 2e1cc91b8..d68e82b07 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -56,7 +56,7 @@ def FileBrowse(): form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - (button, (source_filename,)) = form.LayoutAndShow(form_rows) + (button, (source_filename,)) = form.LayoutAndRead(form_rows) print(button, source_filename) @@ -92,7 +92,7 @@ def Compare2Files(): [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - button, values = form.LayoutAndShow(form_rows) + button, values = form.LayoutAndRead(form_rows) print(button, values) @@ -364,15 +364,12 @@ def MediaPlayer(): image_next = './ButtonGraphics/Next.png' image_exit = './ButtonGraphics/Exit.png' - # 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 form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), font=("Helvetica", 25)) # define layout of the rows layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], - [TextElem], + [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='out')], [sg.ReadFormButton('Restart Song', button_color=(background, background), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), @@ -387,8 +384,7 @@ def MediaPlayer(): border_width=0)], [sg.Text('_' * 20)], [sg.Text(' ' * 30)], - [ - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + [sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), sg.Text(' ' * 2), sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', @@ -398,9 +394,7 @@ def MediaPlayer(): font=("Helvetica", 15))], [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), - sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] - - ] + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] ] # Call the same LayoutAndRead but indicate the form is non-blocking form.LayoutAndRead(layout, non_blocking=True) @@ -412,7 +406,7 @@ def MediaPlayer(): break # If a button was pressed, display it on the GUI by updating the text element if button: - TextElem.Update(button) + form.FindElement('out').Update(button) def ScriptLauncher(): """ diff --git a/Demo_Dictionary.py b/Demo_Dictionary.py index 9b001eae6..1b918b7bf 100644 --- a/Demo_Dictionary.py +++ b/Demo_Dictionary.py @@ -1,20 +1,12 @@ import PySimpleGUI as sg -# THIS FILE REQIRES THE LATEST PySimpleGUI.py FILE -# IT WILL NOT WORK WITH CURRENT PIP RELEASE (2.7) -# -# If you want to use the return values as Dictionary feature, you need to download the PySimpleGUI.py file -# from GitHub and then place it in your project's folder. This SHOULD cause it to use this downloaded version -# instead of the pip installed one, if you've pip installed it. You can always uninstall the pip one :-) - - -# This design pattern shows how to use return values in dictionary form +# THIS FILE REQUIRES VERSION 2.8 OF PySimpleGUI! form = sg.FlexForm('Simple data entry form') # begin with a blank form layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] @@ -22,6 +14,5 @@ button, values = form.LayoutAndRead(layout) -sg.MsgBox(button, values, values[0], values['address'], values['phone']) +sg.MsgBox(button, values, values['name'], values['address'], values['phone']) -print(values) diff --git a/Demo_DisplayHash1and256.py b/Demo_DisplayHash1and256.py index 4aa3db1d0..dfff1e1ba 100644 --- a/Demo_DisplayHash1and256.py +++ b/Demo_DisplayHash1and256.py @@ -55,16 +55,16 @@ def HashManuallyBuiltGUI(): form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] - (button, (source_filename, )) = form.LayoutAndShow(form_rows) + (button, (source_filename, )) = form.LayoutAndRead(form_rows) if button == 'Submit': if source_filename != '': hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') + SG.Popup( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) + else: SG.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') else: - SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') + SG.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') def HashManuallyBuiltGUINonContext(): # ------- Form design ------- # @@ -72,16 +72,16 @@ def HashManuallyBuiltGUINonContext(): form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], [SG.InputText(), SG.FileBrowse()], [SG.Submit(), SG.Cancel()]] - button, (source_filename, ) = form.LayoutAndShow(form_rows) + button, (source_filename, ) = form.LayoutAndRead(form_rows) if button == 'Submit': if source_filename != '': hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.MsgBox( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: SG.MsgBoxError('Display A Hash in PySimpleGUI', 'Illegal filename') + SG.Popup( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) + else: SG.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') else: - SG.MsgBoxError('Display A Hash in PySimpleGUI', '* Cancelled *') + SG.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') @@ -100,15 +100,16 @@ def HashMostCompactGUI(): # ------- OUTPUT GUI results portion ------- # if rc == True: hash = compute_sha1_hash_for_file(source_filename) - SG.MsgBox('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) + SG.Popup('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) else: - SG.MsgBox('Display Hash - Compact GUI', '* Cancelled *') + SG.Popup('Display Hash - Compact GUI', '* Cancelled *') # ---------------------------------------------------------------------- # # Our main calls two GUIs that act identically but use different calls # # ---------------------------------------------------------------------- # def main(): + HashManuallyBuiltGUI() HashManuallyBuiltGUINonContext() HashMostCompactGUI() diff --git a/Demo_ElementBrowser.py b/Demo_ElementBrowser.py new file mode 100644 index 000000000..b75d59fe6 --- /dev/null +++ b/Demo_ElementBrowser.py @@ -0,0 +1,24 @@ +import PySimpleGUI as sg + +def ShowMainForm(): + + listbox_values = ('Text', 'InputText', 'Checkbox', 'Radio Button', 'Listbox', 'Slider' ) + + column2 = [ [sg.Output(size=(50, 20))], + [sg.ReadFormButton('Show Element'), sg.SimpleButton('Exit')]] + + column1 = [[sg.Listbox(values=listbox_values, size=(20, len(listbox_values)), key='listbox')], + [sg.Text('', size=(10, 15))]] + + layout = [[sg.Column(column1) , sg.Column(column2)]] + + form = sg.FlexForm('Element Browser') + form.Layout(layout) + while True: + button, values = form.Read() + if button is None or button == 'Exit': + break + sg.MsgBox(button, values['listbox'][0]) + + +ShowMainForm() diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index f97c6df7f..1c89cbaa0 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -22,12 +22,12 @@ def HowDoI(): form = sg.FlexForm('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, 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=(40,3)) + history_elem = sg.T('', size=(40,3), text_color=sg.BLUES[0]) layout = [ [sg.Text('Ask and your answer will appear here....', size=(40, 1))], [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.T('Command History'), history_elem], + [ 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], [multiline_elem, 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]))] @@ -40,6 +40,7 @@ def HowDoI(): (button, value) = form.Read() if button is 'SEND': query = value['query'].rstrip() + print(query) QueryHowDoI(query, value['Num Answers'], value['full text']) # send the string to HowDoI command_history.append(query) history_offset = len(command_history)-1 @@ -69,7 +70,7 @@ def QueryHowDoI(Query, num_answers, full_text): ''' howdoi_command = HOW_DO_I_COMMAND full_text_option = ' -a' if full_text else '' - t = subprocess.Popen(howdoi_command + ' '+ Query + ' -n ' + str(num_answers)+full_text_option, stdout=subprocess.PIPE) + t = subprocess.Popen(howdoi_command + ' \"'+ Query + '\" -n ' + str(num_answers)+full_text_option, stdout=subprocess.PIPE) (output, err) = t.communicate() print('{:^88}'.format(Query.rstrip())) print('_'*60) diff --git a/Demo_Keyboard_Realtime.py b/Demo_Keyboard_Realtime.py index 258120240..ab48ce736 100644 --- a/Demo_Keyboard_Realtime.py +++ b/Demo_Keyboard_Realtime.py @@ -13,8 +13,9 @@ print(button, value, "exiting") break if button is not None: - print(button) + if len(button) == 1: + print('%s - %s'%(button, ord(button))) + else: + print(button) elif value is None: break - - diff --git a/Demo_Keypad.py b/Demo_Keypad.py index 124f34d08..0c1fbd84d 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -13,34 +13,33 @@ # 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') +in_elem = g.Input(size=(10, 1), do_not_clear=True, key='input') -layout = [[g.Text('Choose Test'), g.DropDown(values=['Input', 'Output', 'Some option']), g.ReadFormButton('Input Option', auto_size_button=True)], +layout = [[g.Text('Enter Your Passcode')], [in_elem], [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], - [g.ReadFormButton('Submit'),g.ReadFormButton('0'), g.ReadFormButton('Clear')], + [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], [out_elem], ] -form = g.FlexForm('Keypad', default_element_size=(5,2), auto_size_buttons=False) +form = g.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False) form.Layout(layout) # Loop forever reading the form's values, updating the Input field keys_entered = '' while True: - button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit + button, values = form.Read() # read the form + if button is None: # if the X button clicked, just exit break - if button == 'Clear': # clear keys if clear button + if button is 'Clear': # clear keys if clear button keys_entered = '' elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button == 'Submit': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button is 'Submit': keys_entered = values['input'] - out_elem.Update(keys_entered) # output the final string - - in_elem.Update(keys_entered) # change the form to reflect current key string + out_elem.Update(keys_entered) # output the final string + in_elem.Update(keys_entered) # change the form to reflect current key string \ No newline at end of file diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index 3d2eeb0b5..118de02e5 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -26,7 +26,7 @@ def MachineLearningGUI(): del(form) sg.SetOptions(text_justification='left') - return button, values + print(button, values) def CustomMeter(): @@ -37,7 +37,7 @@ def CustomMeter(): [progress_bar], [sg.Cancel()]] - # create the form + # create the form` form = sg.FlexForm('Custom Progress Meter') # display the form as a non-blocking form form.LayoutAndRead(layout, non_blocking=True) diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/Demo_Matplotlib_Ping_Graph_Large.py new file mode 100644 index 000000000..20e9b7f8c --- /dev/null +++ b/Demo_Matplotlib_Ping_Graph_Large.py @@ -0,0 +1,107 @@ +import PySimpleGUI as g +import matplotlib.pyplot as plt +import ping +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg +import matplotlib.backends.tkagg as tkagg +import tkinter as tk + +#================================================================================ +# Globals +# These are needed because callback functions are used. +# Need to retain state across calls +#================================================================================ +class MyGlobals: + axis_pings = None + ping_x_array = [] + ping_y_array = [] + +g_my_globals = MyGlobals() + +#================================================================================ +# Performs *** PING! *** +#================================================================================ +def run_a_ping_and_graph(): + global g_my_globals # graphs are global so that can be retained across multiple calls to this callback + + #===================== Do the ping =====================# + response = ping.quiet_ping('google.com',timeout=1000) + if response[0] == 0: + ping_time = 1000 + else: + ping_time = response[0] + #===================== Store current ping in historical array =====================# + g_my_globals.ping_x_array.append(len(g_my_globals.ping_x_array)) + g_my_globals.ping_y_array.append(ping_time) + # ===================== Only graph last 100 items =====================# + if len(g_my_globals.ping_x_array) > 100: + x_array = g_my_globals.ping_x_array[-100:] + y_array = g_my_globals.ping_y_array[-100:] + else: + x_array = g_my_globals.ping_x_array + y_array = g_my_globals.ping_y_array + + # ===================== Call graphinc functions =====================# + g_my_globals.axis_ping.clear() # clear before graphing + g_my_globals.axis_ping.plot(x_array,y_array) # graph the ping values + +#================================================================================ +# Function: Set graph titles and Axis labels +# Sets the text for the subplots +# Have to do this in 2 places... initially when creating and when updating +# So, putting into a function so don't have to duplicate code +#================================================================================ +def set_chart_labels(): + global g_my_globals + + g_my_globals.axis_ping.set_xlabel('Time') + g_my_globals.axis_ping.set_ylabel('Ping (ms)') + g_my_globals.axis_ping.set_title('Current Ping Duration', fontsize = 12) + +def draw(fig, canvas): + # Magic code that draws the figure onto the Canvas Element's canvas + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + canvas.create_image(640 / 2, 480 / 2, image=photo) + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + return photo + +#================================================================================ +# Function: MAIN +#================================================================================ +def main(): + global g_my_globals + + canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + # define the form layout + layout = [[g.Text('Animated Ping', size=(40,1), justification='center', font='Helvetica 20')], + [canvas_elem], + [g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + canvas = canvas_elem.TKCanvas + + fig = plt.figure() + g_my_globals.axis_ping = fig.add_subplot(1,1,1) + set_chart_labels() + plt.tight_layout() + + while True: + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + break + + run_a_ping_and_graph() + photo = draw(fig, canvas) + + +if __name__ == '__main__': + main() + + diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index 87e5586e4..3a78113c3 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -36,16 +36,16 @@ def MediaPlayerGUI(): sg.Text(' ' * 2), sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background,background), image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], - [sg.Text('_'*30)], + [sg.Text('_'*20)], [sg.Text(' '*30)], [ sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), sg.Text(' ' * 2), sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15)), - sg.Text(' ' * 8), + sg.Text(' ' * 2), sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', font=("Helvetica", 15))], - [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), - sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + [sg.Text(' Bass', font=("Helvetica", 15), size=(9, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(7, 1)), sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] ] diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 79693a25f..d4df658b3 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -66,7 +66,7 @@ def RemoteControlExample(): # This is the code that reads and updates your window button, values = form.ReadNonBlocking() if button is not None: - sg.Print(button) + print(button) if button == 'Quit' or values is None: break # time.sleep(.01) @@ -98,6 +98,7 @@ def StatusOutputExample_context_manager(): form.CloseNonBlockingForm() def main(): + StatusOutputExample() RemoteControlExample() StatusOutputExample() sg.MsgBox('End of non-blocking demonstration') diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py new file mode 100644 index 000000000..1c08b9fe8 --- /dev/null +++ b/Demo_Pi_LEDs.py @@ -0,0 +1,59 @@ +import PySimpleGUI as g + +# GUI for switching an LED on and off to GPIO14 + +# GPIO and time library: +import RPi.GPIO as GPIO +import time + +# determine that GPIO numbers are used: +GPIO.setmode(GPIO.BCM) +GPIO.setup(14, GPIO.OUT) + +def SwitchLED(): + varLEDStatus = GPIO.input(14) + + if varLEDStatus == 0: + GPIO.output(14, GPIO.HIGH) + return "LED is switched ON" + else: + GPIO.output(14, GPIO.LOW) + return "LED is switched OFF" + + +def FlashLED(): + for i in range(5): + GPIO.output(14, GPIO.HIGH) + time.sleep(0.5) + GPIO.output(14, GPIO.LOW) + time.sleep(0.5) + +results_elem = g.T('', size=(30,1)) + +layout = [[g.T('Raspberry Pi LEDs')], + [results_elem], + [g.ReadFormButton('Switch LED')], + [g.ReadFormButton('Flash LED')], + [g.ReadFormButton('Show slider value')], + [g.Slider(range=(0, 100), default_value=0, orientation='h', size=(40,20), key='slider')], + [g.Exit()] + ] + +form = g.FlexForm('Raspberry Pi GUI') +form.Layout(layout) + +while True: + button, values = form.Read() + if button is None: + break + if button is 'Switch LED': + results_elem.Update(SwitchLED()) + elif button is 'Flash LED': + results_elem.Update('LED is Flashing') + form.ReadNonBlocking() + FlashLED() + results_elem.Update('') + elif button is 'Show slider value': + results_elem.Update('Slider = %s'%values['slider']) + +g.MsgBox('Done... exiting') diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index 607fa3661..8debc1cb1 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -18,9 +18,9 @@ def RemoteControlExample(): status_display_elem = sg.T('', justification='center', size=(19,1)) form_rows = [[sg.Text('Robotics Remote Control')], [status_display_elem], - [sg.T(' '*10), sg.RealtimeButton('Forward', image_filename=image_forward)], + [sg.T(' '*6), sg.RealtimeButton('Forward', image_filename=image_forward)], [ sg.RealtimeButton('Left', image_filename=image_left), sg.T(' '), sg.RealtimeButton('Right', image_filename=image_right)], - [sg.T(' '*10), sg.RealtimeButton('Reverse', image_filename=image_backward)], + [sg.T(' '*6), sg.RealtimeButton('Reverse', image_filename=image_backward)], [sg.T('')], [sg.Quit(button_color=('black', 'orange'))] ] @@ -51,11 +51,11 @@ def RemoteControlExample_NoGraphics(): # Make a form, but don't use context manager form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) status_display_elem = sg.T('', justification='center', size=(19,1)) - form_rows = [[sg.Text('Robotics Remote Control')], + form_rows = [[sg.Text('Robotics Remote Control', justification='center')], [status_display_elem], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T(' '*8), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '), sg.RealtimeButton('Right')], + [sg.T(' '*8), sg.RealtimeButton('Reverse')], [sg.T('')], [sg.Quit(button_color=('black', 'orange'))] ] diff --git a/Demo_Recipes.py b/Demo_Recipes.py index 529b2480a..fe7c403a6 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -11,7 +11,7 @@ def SourceDestFolders(): [sg.Submit(), sg.Cancel()]) button, values = form.LayoutAndRead(form_rows) - if button == 'Submit': + if button is 'Submit': sg.MsgBox('Submitted', values, 'The user entered source:', values['source'], 'Destination folder:', values['dest'], 'Using button', button) else: sg.MsgBoxError('Cancelled', 'User Cancelled') @@ -22,7 +22,7 @@ def MachineLearningGUI(): form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + [sg.Text('Passes', size =(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], @@ -71,7 +71,7 @@ def Everything(): sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], [sg.Text('_' * 80)], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))] ] + [sg.Submit(), sg.Cancel()] ] button, values = form.LayoutAndRead(layout) @@ -81,7 +81,7 @@ def Everything(): # Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if # you are running multithreaded def Everything_NoContextManager(): - form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], @@ -101,7 +101,7 @@ def Everything_NoContextManager(): [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] + [sg.Submit(), sg.Cancel()] ] button, values = form.LayoutAndRead(layout) @@ -117,9 +117,9 @@ def ProgressMeter(): # Blocking form that doesn't close def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], + with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2), default_button_element_size=(10,2)) as form: + layout = [[(sg.Text('This is where standard out is being routed', size=(40, 1)))], + [sg.Output(size=(80, 20), font=('Courier 10'))], [sg.Multiline(size=(70, 5), enter_submits=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]))]] # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form # if you call LayoutAndRead from here, then you will miss the first button click @@ -127,10 +127,9 @@ def ChatBot(): # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: button, value = form.Read() - if button == 'SEND': - print(value) - else: + if button is not 'SEND': break + print(value[0]) # Shows a form that's a running counter # this is the basic design pattern if you can keep your reading of the @@ -138,16 +137,16 @@ def ChatBot(): # then you will want to use the NonBlockingPeriodicUpdateForm example def NonBlockingPeriodicUpdateForm_ContextManager(): with sg.FlexForm('Running Timer', auto_size_text=True) as form: - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') + text_element = sg.Text('', size=(15, 2), font=('Helvetica', 20), text_color='red', justification='center') layout = [[sg.Text('Non blocking GUI with updates', justification='center')], [text_element], - [sg.T(' ' * 15), sg.Quit()]] + [sg.T(' ' * 22), sg.Quit()]] form.LayoutAndRead(layout, non_blocking=True) for i in range(1,500): text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X + if values is None or button is 'Quit': # if user closed the window using X break time.sleep(.01) else: @@ -171,9 +170,9 @@ def NonBlockingPeriodicUpdateForm(): while True: i += 1 * (timer_running is True) button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + if values is None or button is 'Quit': # if user closed the window using X or clicked Quit button break - elif button == 'Start/Stop': + elif button is 'Start/Stop': timer_running = not timer_running text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) @@ -202,32 +201,35 @@ def ChangeLookAndFeel(colors): scrollbar_color=(colors['INPUT']), element_text_color=colors['TEXT']) +def OneLineGUI(): + return sg.FlexForm('Get filename example').LayoutAndRead( + [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) + #=---------------------------------- main ------------------------------ def main(): - - Everything() + # button, (filename,) = OneLineGUI() + # DebugTe`st() ChatBot() - - sg.ChangeLookAndFeel('BrownBlue') - SourceDestFolders() - sg.ChangeLookAndFeel('BlueMono') Everything() - sg.ChangeLookAndFeel('BluePurple') + SourceDestFolders() + NonBlockingPeriodicUpdateForm_ContextManager() + NonBlockingPeriodicUpdateForm() + ChatBot() Everything() - sg.ChangeLookAndFeel('LightGreen') + sg.ChangeLookAndFeel('GreenTan') Everything() - sg.ChangeLookAndFeel('GreenMono') + # ChatBot() + + SourceDestFolders() MachineLearningGUI() - sg.ChangeLookAndFeel('TealMono') NonBlockingPeriodicUpdateForm() - ChatBot() ProgressMeter() + DebugTest() sg.ChangeLookAndFeel('Purple') Everything_NoContextManager() NonBlockingPeriodicUpdateForm_ContextManager() sg.MsgBox('Done with all recipes') - DebugTest() if __name__ == '__main__': main() diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 807ee013c..9c7f65c84 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -14,7 +14,9 @@ def execute_command_blocking(command, *args): print(out.decode("utf-8")) if err: print(err.decode("utf-8")) - except: pass + except: + out = '' + return out # Executes command and immediately returns. Will not see anything the script outputs def execute_command_nonblocking(command, *args): diff --git a/Demo_Script_Parameters.py b/Demo_Script_Parameters.py index aa16c0658..65c9c9c1e 100644 --- a/Demo_Script_Parameters.py +++ b/Demo_Script_Parameters.py @@ -21,5 +21,5 @@ fname = sys.argv[1] if not fname: - sg.MsgBox("Cancel", "No filename supplied") + sg.Popup("Cancel", "No filename supplied") raise SystemExit("Cancelling: no filename supplied") diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index 54726258a..e404d4e83 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -1,17 +1,31 @@ import PySimpleGUI as sg +# Very basic form. Return values as a dictionary form = sg.FlexForm('Simple data entry form') # begin with a blank form layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], - [sg.Submit(), sg.Cancel()] + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Ok(), sg.Cancel()] ] button, values = form.LayoutAndRead(layout) -sg.MsgBox(button, values['name'], values['address'], values['phone']) +print(button, values['name'], values['address'], values['phone']) -print(values) +form = sg.FlexForm('Simple data entry form') # begin with a blank form + +layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone')], + [sg.Ok(), sg.Cancel()] + ] + +button, values = form.LayoutAndRead(layout) + +name, address, phone = values +sg.MsgBox(button, values[0], values[1], values[2]) \ No newline at end of file diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index 00ac6fd58..3cde91cad 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -35,7 +35,7 @@ def eBaySuperSearcherGUI(): # the form layout with sg.FlexForm('EBay Super Searcher', auto_size_text=True) as form: - with sg.FlexForm('EBay Super Searcher') as form2: + with sg.FlexForm('EBay Super Searcher', auto_size_text=False) as form2: layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], [sg.Text('Choose base configuration to run')], [sg.InputCombo(configs)], @@ -65,7 +65,6 @@ def eBaySuperSearcherGUI(): if i == 0: continue # skip first one layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) - layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) layout_tab_2.append([sg.Text('US Search String Override')]) layout_tab_2.append([sg.InputText(size=(100,1))]) @@ -82,6 +81,7 @@ def eBaySuperSearcherGUI(): if __name__ == '__main__': + # sg.SetOptions(background_color='white') results = eBaySuperSearcherGUI() print(results) sg.MsgBox('Results', results) \ No newline at end of file From 5d3481025ee6d35686ea85f6c95243f6368dd9ba Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 19:47:14 -0400 Subject: [PATCH 286/521] Initial Checkin --- Demo_Timer.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Demo_Timer.py diff --git a/Demo_Timer.py b/Demo_Timer.py new file mode 100644 index 000000000..9031af18c --- /dev/null +++ b/Demo_Timer.py @@ -0,0 +1,47 @@ +import PySimpleGUI as sg +import time + +# form that doen't block +# good for applications with an loop that polls hardware +def Timer(): + sg.ChangeLookAndFeel('TealMono') + # Make a form, but don't use context manager + 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 the rows + form_rows = [[sg.Text('Stopwatch')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadFormButton('Pause/Resume'), sg.ReadFormButton('Reset')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh. + # + # your program's main loop + i = 0 + paused = False + while (True): + # This is the code that reads and updates your window + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = form.ReadNonBlocking() + + if values is None: + break + + if button is 'Reset': + i=0 + elif button is 'Pause/Resume': + paused = not paused + + if not paused: + i += 1 + # Your code begins here + time.sleep(.01) + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + +Timer() \ No newline at end of file From 75970ade87f02105b3b7d8aec58fdb6422c19ffd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 20:42:39 -0400 Subject: [PATCH 287/521] 2.20 Release --- PySimpleGUI.py | 20 ++++++-------------- docs/index.md | 18 ++++++++++++++---- readme.md | 18 ++++++++++++++---- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 426d2fc1d..74e4a6b61 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -6,14 +6,8 @@ import tkinter.font import datetime import sys -import os -import base64 -import tempfile import textwrap -# TODO - Sept 1 2018 - HIGHLY EXPERIMENTAL.... start TK right away with a hidden window -# dummyroot = tk.Tk() -# dummyroot.attributes('-alpha', 0) # hide window while getting info and moving # ----====----====----==== Constants the user CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = 'default_icon.ico' @@ -1069,7 +1063,6 @@ def __del__(self): # ---------------------------------------------------------------------- # # TkScrollableFrame (Used by Column (SOON) # # ---------------------------------------------------------------------- # -# TODO NOT YET WORKING! DO NOT USE. Will be used to make scrollable columns class TkScrollableFrame(tk.Frame): def __init__(self, master, **kwargs): tk.Frame.__init__(self, master, **kwargs) @@ -1254,6 +1247,9 @@ def LayoutAndRead(self,rows, non_blocking=False): self.Show(non_blocking=non_blocking) return self.ReturnValues + def LayoutAndShow(self, rows): + raise DeprecationWarning('LayoutAndShow is no longer supported... change your call to LayoutAndRead') + # ------------------------- ShowForm THIS IS IT! ------------------------- # def Show(self, non_blocking=False): self.Shown = True @@ -1579,19 +1575,15 @@ def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -# this is the only button that REQUIRES button text field def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -# this is the only button that REQUIRES button text field def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) - +# ------------------------- Realtime BUTTON Element lazy function ------------------------- # def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) - -# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -# this is the only button that REQUIRES button text field +# ------------------------- Dummy BUTTON Element lazy function ------------------------- # def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) @@ -2451,7 +2443,7 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au # MsgBox is the legacy call and show not be used any longer MsgBox = Popup -# --------------------------- PopupNonBlocking --------------------------- +# --------------------------- PopupNoButtons --------------------------- def PopupoNoButtons(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): Popup(*args, button_type=MSG_BOX_NO_BUTTONS, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) return diff --git a/docs/index.md b/docs/index.md index 8078be65f..1dbe4c0ef 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 2.11) + (Ver 2.20) [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) @@ -1913,7 +1913,9 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others -| 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel setting, +| 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel settin +| 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) + ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -1969,9 +1971,13 @@ It seemed quite natural to use Python's powerful list constructs when possible. Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. -## Authors +## Author MikeTheWatchGuy +## Demo Code Contributors + +JorjMcKie - PDF and image viewers (plus a number of code suggestions) + ## License GNU Lesser General Public License (LGPL 3) + @@ -1981,6 +1987,7 @@ GNU Lesser General Public License (LGPL 3) + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example +* Numerous users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest. ## How Do I @@ -2000,7 +2007,10 @@ The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. -![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) + + In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. diff --git a/readme.md b/readme.md index 8078be65f..1dbe4c0ef 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 2.11) + (Ver 2.20) [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) @@ -1913,7 +1913,9 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others -| 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel setting, +| 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel settin +| 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) + ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -1969,9 +1971,13 @@ It seemed quite natural to use Python's powerful list constructs when possible. Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. -## Authors +## Author MikeTheWatchGuy +## Demo Code Contributors + +JorjMcKie - PDF and image viewers (plus a number of code suggestions) + ## License GNU Lesser General Public License (LGPL 3) + @@ -1981,6 +1987,7 @@ GNU Lesser General Public License (LGPL 3) + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example +* Numerous users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest. ## How Do I @@ -2000,7 +2007,10 @@ The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. -![snap0109](https://user-images.githubusercontent.com/13696193/42916444-4199b16c-8ad3-11e8-8423-d12e61a58d3d.jpg) + +![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) + + In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. From 667000ea2a18d79d3031faa1e6d29e366d08f7ed Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 4 Sep 2018 23:13:15 -0400 Subject: [PATCH 288/521] NEW form.SaveToDisk and form.LoadFromDisk! Another user submitted feature request --- Demo_Fill_Form.py | 27 ++++++--------------------- PySimpleGUI.py | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index c638de531..d61948834 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -1,24 +1,5 @@ -# from tkinter.filedialog import asksaveasfilename, askopenfilename -import pickle import PySimpleGUI as sg - -def save(values): - sfilename = sg.PopupGetFile('Save Settings', save_as=True, no_window=True) - if not sfilename: - return - with open(sfilename, 'wb') as sf: - pickle.dump(values, sf) - - -def load(form): - dfilename = sg.PopupGetFile('Load Settings', no_window=True) - if not dfilename: - return - with open(dfilename, 'rb') as df: - form.Fill(pickle.load(df)) - - def Everything(): sg.ChangeLookAndFeel('TanBlue') @@ -62,9 +43,13 @@ def Everything(): button, values = form.Read() if button is 'SaveSettings': - save(values) + filename = sg.PopupGetFile('Save Settings', save_as=True, no_window=True) + form.SaveToDisk(filename) + # save(values) elif button is 'LoadSettings': - load(form) + filename = sg.PopupGetFile('Load Settings', no_window=True) + form.LoadFromDisk(filename) + # load(form) elif button in ['Exit', None]: break diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 74e4a6b61..e3947854b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -7,6 +7,7 @@ import datetime import sys import textwrap +import pickle # ----====----====----==== Constants the user CAN safely change ====----====----====----# @@ -1361,10 +1362,29 @@ def Refresh(self): def Fill(self, values_dict): FillFormWithValues(self, values_dict) + def FindElement(self, key): return _FindElementFromKeyInSubForm(self, key) + def SaveToDisk(self, filename): + try: + results = BuildResults(self, False, self) + with open(filename, 'wb') as sf: + pickle.dump(results[1], sf) + except: + print('*** Error saving form to disk ***') + + + def LoadFromDisk(self, filename): + try: + with open(filename, 'rb') as df: + self.Fill(pickle.load(df)) + except: + print('*** Error loading form to disk ***') + + + def GetScreenDimensions(self): if self.TKrootDestroyed: return None, None From 0899b7d9e84d2bf10d6967ac3d52c11686708b0d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 09:04:17 -0400 Subject: [PATCH 289/521] NEW Element - CalendarButton (opens a calendar chooser widget), another fix for Mac buttons --- Demo_Calendar.py | 9 ++ PySimpleGUI.py | 272 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 276 insertions(+), 5 deletions(-) create mode 100644 Demo_Calendar.py diff --git a/Demo_Calendar.py b/Demo_Calendar.py new file mode 100644 index 000000000..d999f3144 --- /dev/null +++ b/Demo_Calendar.py @@ -0,0 +1,9 @@ +import PySimpleGUI as sg + +layout = [[sg.T('Calendar Test')], + [sg.CalendarButton('Choose Date', key='date')], + [sg.Ok(key=1)]] + +form = sg.FlexForm('Calendar') +b,v = form.LayoutAndRead(layout) +sg.Popup(v['date']) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e3947854b..9c57becf8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -8,6 +8,7 @@ import sys import textwrap import pickle +import calendar # ----====----====----==== Constants the user CAN safely change ====----====----====----# @@ -35,7 +36,7 @@ (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long -if sys.platform is 'darwin': +if sys.platform == 'darwin': DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Colors should never be this long else: @@ -137,6 +138,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) BUTTON_TYPE_CLOSES_WIN_ONLY = 6 BUTTON_TYPE_READ_FORM = 7 BUTTON_TYPE_REALTIME = 9 +BUTTON_TYPE_CALENDAR_CHOOSER = 30 # ------------------------- Element types ------------------------- # # class ElementType(Enum): @@ -799,6 +801,7 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH self.BindReturnKey = bind_return_key self.Focus = focus + self.TKCal = None super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) return @@ -829,7 +832,7 @@ def ButtonCallBack(self): strvar = target_element.TKStringVar except: pass else: - strvar = None + strvar = self.TKStringVar filetypes = [] if self.FileTypes is None else self.FileTypes if self.BType == BUTTON_TYPE_BROWSE_FOLDER: folder_name = tk.filedialog.askdirectory() # show the 'get folder' dialog box @@ -876,6 +879,17 @@ def ButtonCallBack(self): if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() _my_windows.Decrement() + elif self.BType == BUTTON_TYPE_CALENDAR_CHOOSER: # this is a return type button so GET RESULTS and destroy window + root = tk.Toplevel() + root.title('Calendar Chooser') + self.TKCal = TKCalendar(master=root, firstweekday=calendar.SUNDAY) + self.TKCal.pack(expand=1, fill='both') + # self.ParentForm.TKRroot.mainloop() + root.update() + # root.mainloop() + # root.update() + # strvar.set(ttkcal.selection) + return def Update(self, new_text=None, button_color=(None, None)): @@ -1174,6 +1188,246 @@ def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# Calendar # +# ---------------------------------------------------------------------- # + +class TKCalendar(ttk.Frame): + # XXX ToDo: cget and configure + + datetime = calendar.datetime.datetime + timedelta = calendar.datetime.timedelta + + def __init__(self, master=None, **kw): + """ + WIDGET-SPECIFIC OPTIONS + + locale, firstweekday, year, month, selectbackground, + selectforeground + """ + # remove custom options from kw before initializating ttk.Frame + fwday = kw.pop('firstweekday', calendar.MONDAY) + year = kw.pop('year', self.datetime.now().year) + month = kw.pop('month', self.datetime.now().month) + locale = kw.pop('locale', None) + sel_bg = kw.pop('selectbackground', '#ecffc4') + sel_fg = kw.pop('selectforeground', '#05640e') + + self._date = self.datetime(year, month, 1) + self._selection = None # no date selected + + ttk.Frame.__init__(self, master, **kw) + + # instantiate proper calendar class + if locale is None: + self._cal = calendar.TextCalendar(fwday) + else: + self._cal = calendar.LocaleTextCalendar(fwday, locale) + + self.__setup_styles() # creates custom styles + self.__place_widgets() # pack/grid used widgets + self.__config_calendar() # adjust calendar columns and setup tags + # configure a canvas, and proper bindings, for selecting dates + self.__setup_selection(sel_bg, sel_fg) + + # store items ids, used for insertion later + self._items = [self._calendar.insert('', 'end', values='') + for _ in range(6)] + # insert dates in the currently empty calendar + self._build_calendar() + + def __setitem__(self, item, value): + if item in ('year', 'month'): + raise AttributeError("attribute '%s' is not writeable" % item) + elif item == 'selectbackground': + self._canvas['background'] = value + elif item == 'selectforeground': + self._canvas.itemconfigure(self._canvas.text, item=value) + else: + ttk.Frame.__setitem__(self, item, value) + + def __getitem__(self, item): + if item in ('year', 'month'): + return getattr(self._date, item) + elif item == 'selectbackground': + return self._canvas['background'] + elif item == 'selectforeground': + return self._canvas.itemcget(self._canvas.text, 'fill') + else: + r = ttk.tclobjs_to_py({item: ttk.Frame.__getitem__(self, item)}) + return r[item] + + def __setup_styles(self): + # custom ttk styles + style = ttk.Style(self.master) + arrow_layout = lambda dir: ( + [('Button.focus', {'children': [('Button.%sarrow' % dir, None)]})] + ) + style.layout('L.TButton', arrow_layout('left')) + style.layout('R.TButton', arrow_layout('right')) + + def __place_widgets(self): + # header frame and its widgets + hframe = ttk.Frame(self) + lbtn = ttk.Button(hframe, style='L.TButton', command=self._prev_month) + rbtn = ttk.Button(hframe, style='R.TButton', command=self._next_month) + self._header = ttk.Label(hframe, width=15, anchor='center') + # the calendar + self._calendar = ttk.Treeview(self, show='', selectmode='none', height=7) + + # pack the widgets + hframe.pack(in_=self, side='top', pady=4, anchor='center') + lbtn.grid(in_=hframe) + self._header.grid(in_=hframe, column=1, row=0, padx=12) + rbtn.grid(in_=hframe, column=2, row=0) + self._calendar.pack(in_=self, expand=1, fill='both', side='bottom') + + def __config_calendar(self): + cols = self._cal.formatweekheader(3).split() + self._calendar['columns'] = cols + self._calendar.tag_configure('header', background='grey90') + self._calendar.insert('', 'end', values=cols, tag='header') + # adjust its columns width + font = tkinter.font.Font() + maxwidth = max(font.measure(col) for col in cols) + for col in cols: + self._calendar.column(col, width=maxwidth, minwidth=maxwidth, + anchor='e') + + def __setup_selection(self, sel_bg, sel_fg): + self._font = tkinter.font.Font() + self._canvas = canvas = tk.Canvas(self._calendar, + background=sel_bg, borderwidth=0, highlightthickness=0) + canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w') + + canvas.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', self._pressed) + + def __minsize(self, evt): + width, height = self._calendar.master.geometry().split('x') + height = height[:height.index('+')] + self._calendar.master.minsize(width, height) + + def _build_calendar(self): + year, month = self._date.year, self._date.month + + # update header text (Month, YEAR) + header = self._cal.formatmonthname(year, month, 0) + self._header['text'] = header.title() + + # update calendar shown dates + cal = self._cal.monthdayscalendar(year, month) + for indx, item in enumerate(self._items): + week = cal[indx] if indx < len(cal) else [] + fmt_week = [('%02d' % day) if day else '' for day in week] + self._calendar.item(item, values=fmt_week) + + def _show_selection(self, text, bbox): + """Configure canvas for a new selection.""" + x, y, width, height = bbox + + textw = self._font.measure(text) + + canvas = self._canvas + canvas.configure(width=width, height=height) + canvas.coords(canvas.text, width - textw, height / 2 - 1) + canvas.itemconfigure(canvas.text, text=text) + canvas.place(in_=self._calendar, x=x, y=y) + + # Callbacks + + def _pressed(self, evt): + """Clicked somewhere in the calendar.""" + x, y, widget = evt.x, evt.y, evt.widget + item = widget.identify_row(y) + column = widget.identify_column(x) + + if not column or not item in self._items: + # clicked in the weekdays row or just outside the columns + return + + item_values = widget.item(item)['values'] + if not len(item_values): # row is empty for this month + return + + text = item_values[int(column[1]) - 1] + if not text: # date is empty + return + + bbox = widget.bbox(item, column) + if not bbox: # calendar not visible yet + return + + # update and then show selection + text = '%02d' % text + self._selection = (text, item, column) + self._show_selection(text, bbox) + + def _prev_month(self): + """Updated calendar to show the previous month.""" + self._canvas.place_forget() + + self._date = self._date - self.timedelta(days=1) + self._date = self.datetime(self._date.year, self._date.month, 1) + self._build_calendar() # reconstuct calendar + + def _next_month(self): + """Update calendar to show the next month.""" + self._canvas.place_forget() + + year, month = self._date.year, self._date.month + self._date = self._date + self.timedelta( + days=calendar.monthrange(year, month)[1] + 1) + self._date = self.datetime(self._date.year, self._date.month, 1) + self._build_calendar() # reconstruct calendar + + # Properties + + @property + def selection(self): + """Return a datetime representing the current selected date.""" + if not self._selection: + return None + + year, month = self._date.year, self._date.month + return self.datetime(year, month, int(self._selection[0])) + +class Calendar(Element): + def __init__(self, scale=(None, None), size=(None, None), pad=None, key=None): + ''' + Image Element + :param filename: + :param scale: Adds multiplier to size (w,h) + :param size: Size of field in characters + ''' + self.tkCalendar = None + + + if data is None and filename is None: + print('* Warning... no image specified in Image Element! *') + super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad, key=key) + return + + def Update(self, filename=None, data=None): + if filename is not None: + image = tk.PhotoImage(file=filename) + elif data is not None: + if type(data) is bytes: + image = tk.PhotoImage(data=data) + else: + image = data + else: return + width, height = image.width(), image.height() + self.tktext_label.configure(image=image, width=width, height=height) + self.tktext_label.image = image + + def __del__(self): + super().__del__() + + + + # ------------------------------------------------------------------------- # # FlexForm CLASS # # ------------------------------------------------------------------------- # @@ -1606,7 +1860,9 @@ def RealtimeButton(button_text, image_filename=None, image_size=(None, None),ima # ------------------------- Dummy BUTTON Element lazy function ------------------------- # def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) - +# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +def CalendarButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CALENDAR_CHOOSER, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ##################################### ----- RESULTS ------ ################################################## def AddToReturnDictionary(form, element, value): @@ -1692,6 +1948,11 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): button_pressed_text = top_level_form.LastButtonClicked if element.BType != BUTTON_TYPE_REALTIME: # Do not clear realtime buttons top_level_form.LastButtonClicked = None + if element.BType == BUTTON_TYPE_CALENDAR_CHOOSER: + try: + value = element.TKCal.selection + except: + value = None elif element.Type == ELEM_TYPE_INPUT_COMBO: value=element.TKStringVar.get() elif element.Type == ELEM_TYPE_INPUT_OPTION_MENU: @@ -1723,8 +1984,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): value = None # if an input type element, update the results - if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ - element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and element.Type!= ELEM_TYPE_COLUMN: + if (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER) or element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and element.Type!= ELEM_TYPE_COLUMN: AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) @@ -1906,6 +2166,8 @@ def CharWidthInPixels(): element.TKText = tktext_label # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: + stringvar = tk.StringVar() + element.TKStringVar = stringvar element.Location = (row_num, col_num) btext = element.ButtonText btype = element.BType From d069cad782c1f9ba2f0c29b22ffb08484aff2f96 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 09:27:35 -0400 Subject: [PATCH 290/521] Acknowledgement for help with Calendar Element --- docs/index.md | 3 ++- readme.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 1dbe4c0ef..33f0275bb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1987,7 +1987,8 @@ GNU Lesser General Public License (LGPL 3) + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example -* Numerous users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest. +* **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest +* [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub ## How Do I diff --git a/readme.md b/readme.md index 1dbe4c0ef..33f0275bb 100644 --- a/readme.md +++ b/readme.md @@ -1987,7 +1987,8 @@ GNU Lesser General Public License (LGPL 3) + * Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example -* Numerous users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest. +* **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest +* [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub ## How Do I From 1eeada1d54748b122feb63f22a0fcda2f14e5f8e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 10:29:36 -0400 Subject: [PATCH 291/521] Fixed Bug introduced when adding calendar. Was creating additional return values! UGH. --- Demo_Cookbook_Browser.py | 25 +++++-------------- PySimpleGUI.py | 52 +++++++++++++--------------------------- 2 files changed, 23 insertions(+), 54 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index d68e82b07..d2fea98d3 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -103,15 +103,10 @@ def AllWidgetsWithContext(): """ import PySimpleGUI as sg # Green & tan color scheme - sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') + sg.ChangeLookAndFeel('GreenTan') + + + # sg.ChangeLookAndFeel('GreenTan') with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: layout = [ @@ -143,15 +138,7 @@ def AllWidgetsNoContext(): import PySimpleGUI as sg # Green & tan color scheme - sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') + sg.ChangeLookAndFeel('GreenTan') form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) layout = [ @@ -791,7 +778,7 @@ def TightLayout(): form.FindElement('multi').Update(inspect.getsource(func)) button, values = form.Read() elif button is 'Run': - sg.ChangeLookAndFeel('SystemDefault') + # sg.ChangeLookAndFeel('SystemDefault') func() break else: diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 9c57becf8..01724acd3 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -770,7 +770,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -802,6 +802,7 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.BindReturnKey = bind_return_key self.Focus = focus self.TKCal = None + self.DefaultValue = None super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) return @@ -892,7 +893,7 @@ def ButtonCallBack(self): return - def Update(self, new_text=None, button_color=(None, None)): + def Update(self, value=None, new_text=None, button_color=(None, None)): try: if new_text is not None: self.TKButton.configure(text=new_text) @@ -900,6 +901,7 @@ def Update(self, new_text=None, button_color=(None, None)): self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: return + self.DefaultValue = value def __del__(self): try: @@ -1193,6 +1195,9 @@ def __del__(self): # ---------------------------------------------------------------------- # class TKCalendar(ttk.Frame): + """ + This code was shamelessly lifted from moshekaplan's repository - moshekaplan/tkinter_components + """ # XXX ToDo: cget and configure datetime = calendar.datetime.datetime @@ -1393,37 +1398,6 @@ def selection(self): year, month = self._date.year, self._date.month return self.datetime(year, month, int(self._selection[0])) -class Calendar(Element): - def __init__(self, scale=(None, None), size=(None, None), pad=None, key=None): - ''' - Image Element - :param filename: - :param scale: Adds multiplier to size (w,h) - :param size: Size of field in characters - ''' - self.tkCalendar = None - - - if data is None and filename is None: - print('* Warning... no image specified in Image Element! *') - super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad, key=key) - return - - def Update(self, filename=None, data=None): - if filename is not None: - image = tk.PhotoImage(file=filename) - elif data is not None: - if type(data) is bytes: - image = tk.PhotoImage(data=data) - else: - image = data - else: return - width, height = image.width(), image.height() - self.tktext_label.configure(image=image, width=width, height=height) - self.tktext_label.image = image - - def __del__(self): - super().__del__() @@ -1984,7 +1958,14 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): value = None # if an input type element, update the results - if (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER) or element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and element.Type!= ELEM_TYPE_COLUMN: + if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ + element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and \ + element.Type!= ELEM_TYPE_COLUMN: + AddToReturnList(form, value) + AddToReturnDictionary(top_level_form, element, value) + elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER) or \ + (element.Type == ELEM_TYPE_BUTTON and element.Target == (None,None) and \ + (element.BType in (BUTTON_TYPE_SAVEAS_FILE, BUTTON_TYPE_BROWSE_FILE, BUTTON_TYPE_BROWSE_FILES, BUTTON_TYPE_BROWSE_FOLDER))): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) @@ -2037,7 +2018,8 @@ def FillSubformWithValues(form, values_dict): element.Update(value) elif element.Type == ELEM_TYPE_INPUT_SPIN: element.Update(value) - + elif element.Type == ELEM_TYPE_BUTTON: + element.Update(value) def _FindElementFromKeyInSubForm(form, key): for row_num, row in enumerate(form.Rows): From 3a0377a496403cb542611ff4a85e351ac4164b0d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 12:23:04 -0400 Subject: [PATCH 292/521] Buttons can have keys now! Browse buttons have values now too. Risky change, but wtf, it's free software right? --- PySimpleGUI.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 01724acd3..897778d6a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -825,31 +825,35 @@ def ButtonCallBack(self): if target[1] < 0: target[1] = self.Position[1] + target[1] strvar = None - if target[0] != None: + if target == (0,0) or target[0] == None: + strvar = self.TKStringVar + elif target[0] != None: if target[0] < 0: target = [self.Position[0] + target[0], target[1]] target_element = self.ParentForm._GetElementAtLocation(target) try: strvar = target_element.TKStringVar except: pass - else: - strvar = self.TKStringVar filetypes = [] if self.FileTypes is None else self.FileTypes if self.BType == BUTTON_TYPE_BROWSE_FOLDER: folder_name = tk.filedialog.askdirectory() # show the 'get folder' dialog box 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) # show the 'get file' dialog box strvar.set(file_name) + self.TKStringVar.set(file_name) elif self.BType == BUTTON_TYPE_BROWSE_FILES: file_name = tk.filedialog.askopenfilenames(filetypes=filetypes) 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) # show the 'get file' dialog box strvar.set(file_name) + self.TKStringVar.set(file_name) elif self.BType == BUTTON_TYPE_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window # first, get the results table built # modify the Results table in the parent FlexForm object @@ -1927,6 +1931,11 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): value = element.TKCal.selection except: value = None + else: + try: + value = element.TKStringVar.get() + except: + value = None elif element.Type == ELEM_TYPE_INPUT_COMBO: value=element.TKStringVar.get() elif element.Type == ELEM_TYPE_INPUT_OPTION_MENU: @@ -1964,8 +1973,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER) or \ - (element.Type == ELEM_TYPE_BUTTON and element.Target == (None,None) and \ - (element.BType in (BUTTON_TYPE_SAVEAS_FILE, BUTTON_TYPE_BROWSE_FILE, BUTTON_TYPE_BROWSE_FILES, BUTTON_TYPE_BROWSE_FOLDER))): + (element.Type == ELEM_TYPE_BUTTON and element.Key is not None and (element.BType in (BUTTON_TYPE_SAVEAS_FILE, BUTTON_TYPE_BROWSE_FILE, BUTTON_TYPE_BROWSE_FILES, BUTTON_TYPE_BROWSE_FOLDER))): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) From 96341667af917b9a975a446c657b666056238b89 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 12:43:41 -0400 Subject: [PATCH 293/521] Fix for button target being None, None instead of 0,0 --- PySimpleGUI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 897778d6a..c7572a980 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -825,9 +825,9 @@ def ButtonCallBack(self): if target[1] < 0: target[1] = self.Position[1] + target[1] strvar = None - if target == (0,0) or target[0] == None: + if target == (None, None): strvar = self.TKStringVar - elif target[0] != None: + else: if target[0] < 0: target = [self.Position[0] + target[0], target[1]] target_element = self.ParentForm._GetElementAtLocation(target) From 86f2f17e24ed6977d1a0539ffb846c1479abe106 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 15:56:25 -0400 Subject: [PATCH 294/521] Borderless windows option for FlexForm --- PySimpleGUI.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c7572a980..de0a9f214 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -11,6 +11,8 @@ import calendar + + # ----====----====----==== Constants the user CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = 'default_icon.ico' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS @@ -1413,7 +1415,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -1453,6 +1455,7 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.ReturnKeyboardEvents = return_keyboard_events self.LastKeyboardEvent = None self.TextJustification = text_justification + self.NoTitleBar = no_titlebar # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -2487,6 +2490,11 @@ def ConvertFlexToTK(MyFlexForm): master.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' except: pass + try: + if MyFlexForm.NoTitleBar: + MyFlexForm.TKroot.wm_overrideredirect(True) + except: + pass PackFormIntoFrame(MyFlexForm, master, MyFlexForm) #....................................... DONE creating and laying out window ..........................# if MyFlexForm.IsTabbedForm: @@ -2579,7 +2587,7 @@ def StartupTK(my_flex_form): ow = _my_windows.NumOpenWindows # print('Starting TK open Windows = {}'.format(ow)) root = tk.Tk() if not ow else tk.Toplevel() - # root = tk.Toplevel() + # root.wm_overrideredirect(True) if my_flex_form.BackgroundColor is not None and my_flex_form.BackgroundColor != COLOR_SYSTEM_DEFAULT: root.configure(background=my_flex_form.BackgroundColor) _my_windows.Increment() @@ -2637,7 +2645,7 @@ def _GetNumLinesNeeded(text, max_line_width): # Exits via an OK button2 press # # Returns nothing # # ===================================================# -def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None): +def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False): ''' Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: @@ -2659,7 +2667,7 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font) as form: + with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -2729,6 +2737,16 @@ def PopupoNonBlocking(*args, button_color=None, auto_close=False, auto_close_dur PopupNoWait = PopupoNonBlocking +# --------------------------- PopupNoFrame --------------------------- +def PopupNoTitlebar(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + Popup(*args, non_blocking=False, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=True) + return + +PopupNoFrame = PopupNoTitlebar +PopupNoBorder = PopupNoTitlebar +PopupAnnoying = PopupNoTitlebar + + # ============================== MsgBoxAutoClose====# # Lazy function. Same as calling MsgBox with parms # # ===================================================# From ce352ea0bfd90716ba72be8a5de83d81b4bd89d9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 19:57:32 -0400 Subject: [PATCH 295/521] New feature - option to remove title bar from forms! Targets for Calendar buttons, hiding tabbed forms until completely built before showing, --- Demo_Calendar.py | 5 +++-- PySimpleGUI.py | 47 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/Demo_Calendar.py b/Demo_Calendar.py index d999f3144..12b48d467 100644 --- a/Demo_Calendar.py +++ b/Demo_Calendar.py @@ -1,9 +1,10 @@ import PySimpleGUI as sg layout = [[sg.T('Calendar Test')], - [sg.CalendarButton('Choose Date', key='date')], + [sg.In('', size=(20,1))], + [sg.CalendarButton('Choose Date', target=(1,0), key='date')], [sg.Ok(key=1)]] -form = sg.FlexForm('Calendar') +form = sg.FlexForm('Calendar', no_titlebar=True) b,v = form.LayoutAndRead(layout) sg.Popup(v['date']) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index de0a9f214..4febcbc4b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -822,6 +822,7 @@ def ButtonCallBack(self): # Buttons modify targets or return from the form # If modifying target, get the element object at the target and modify its StrVar target = self.Target + target_element = None if target[0] == ThisRow: target = [self.Position[0], target[1]] if target[1] < 0: @@ -889,7 +890,7 @@ def ButtonCallBack(self): elif self.BType == BUTTON_TYPE_CALENDAR_CHOOSER: # this is a return type button so GET RESULTS and destroy window root = tk.Toplevel() root.title('Calendar Chooser') - self.TKCal = TKCalendar(master=root, firstweekday=calendar.SUNDAY) + self.TKCal = TKCalendar(master=root, firstweekday=calendar.SUNDAY, target_element=target_element) self.TKCal.pack(expand=1, fill='both') # self.ParentForm.TKRroot.mainloop() root.update() @@ -1209,13 +1210,14 @@ class TKCalendar(ttk.Frame): datetime = calendar.datetime.datetime timedelta = calendar.datetime.timedelta - def __init__(self, master=None, **kw): + def __init__(self, master=None, target_element=None, **kw): """ WIDGET-SPECIFIC OPTIONS locale, firstweekday, year, month, selectbackground, selectforeground """ + self._TargetElement = target_element # remove custom options from kw before initializating ttk.Frame fwday = kw.pop('firstweekday', calendar.MONDAY) year = kw.pop('year', self.datetime.now().year) @@ -1226,7 +1228,6 @@ def __init__(self, master=None, **kw): self._date = self.datetime(year, month, 1) self._selection = None # no date selected - ttk.Frame.__init__(self, master, **kw) # instantiate proper calendar class @@ -1374,6 +1375,10 @@ def _pressed(self, evt): text = '%02d' % text self._selection = (text, item, column) self._show_selection(text, bbox) + year, month = self._date.year, self._date.month + try: + self._TargetElement.Update(self.datetime(year, month, int(self._selection[0]))) + except: pass def _prev_month(self): """Updated calendar to show the previous month.""" @@ -1842,8 +1847,8 @@ def RealtimeButton(button_text, image_filename=None, image_size=(None, None),ima def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -def CalendarButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CALENDAR_CHOOSER, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def CalendarButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ##################################### ----- RESULTS ------ ################################################## def AddToReturnDictionary(form, element, value): @@ -2486,10 +2491,6 @@ def ConvertFlexToTK(MyFlexForm): if not MyFlexForm.IsTabbedForm: master.title(MyFlexForm.Title) InitializeResults(MyFlexForm) - try: - master.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' - except: - pass try: if MyFlexForm.NoTitleBar: MyFlexForm.TKroot.wm_overrideredirect(True) @@ -2518,13 +2519,12 @@ def ConvertFlexToTK(MyFlexForm): move_string = '+%i+%i'%(int(x),int(y)) master.geometry(move_string) - master.attributes('-alpha', 255) # Make window visible again master.update_idletasks() # don't forget return # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# -def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON): +def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON, no_titlebar=False): # takes as input (form, rows, tab name) for each tab global _my_windows @@ -2533,6 +2533,11 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A uber.TKroot = root if title is not None: root.title(title) + try: + root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' + except: + pass + if not len(args): print('******************* SHOW TABBED FORMS ERROR .... no arguments') return @@ -2548,6 +2553,7 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox # framestyle.theme_use('framestyle') tab_control = ttk.Notebook(root) + for num,x in enumerate(args): form, rows, tab_name = x form.AddRows(rows) @@ -2573,7 +2579,16 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A icon = fav_icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon try: uber.TKroot.iconbitmap(icon) except: pass + try: + if no_titlebar: + uber.TKroot.wm_overrideredirect(True) + except: + pass + try: + root.attributes('-alpha', 255) # hide window while building it. makes for smoother 'paint' + except: + pass root.mainloop() if id: root.after_cancel(id) @@ -2587,6 +2602,10 @@ def StartupTK(my_flex_form): ow = _my_windows.NumOpenWindows # print('Starting TK open Windows = {}'.format(ow)) root = tk.Tk() if not ow else tk.Toplevel() + try: + root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' + except: + pass # root.wm_overrideredirect(True) if my_flex_form.BackgroundColor is not None and my_flex_form.BackgroundColor != COLOR_SYSTEM_DEFAULT: root.configure(background=my_flex_form.BackgroundColor) @@ -2597,6 +2616,12 @@ def StartupTK(my_flex_form): # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) my_flex_form.SetIcon(my_flex_form.WindowIcon) + + try: + root.attributes('-alpha', 255) # hide window while building it. makes for smoother 'paint' + except: + pass + if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: root.bind("", my_flex_form._KeyboardCallback) root.bind("", my_flex_form._MouseWheelCallback) From acf4be0a8533c452cc27c8ec36137899bde12752 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 21:18:20 -0400 Subject: [PATCH 296/521] New Demo program! --- Demo_Password_Login.py | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Demo_Password_Login.py diff --git a/Demo_Password_Login.py b/Demo_Password_Login.py new file mode 100644 index 000000000..e8a16b96e --- /dev/null +++ b/Demo_Password_Login.py @@ -0,0 +1,60 @@ +import PySimpleGUI as sg +import hashlib + +""" + Create a secure login for your scripts without having to include your password + in the program. Create an SHA1 hash code for your password using the GUI. Paste into variable in final program + 1. Choose a password + 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password + 3. Type password into the GUI + 4. Copy and paste hash code form GUI into variable named login_password_hash + 5. Run program again and test your login! +""" + +# Use this GUI to get your password's hash code +def HashGeneratorGUI(): + layout = [[sg.T('Password Hash Generator', size=(30,1), font='Any 15')], + [sg.T('Password'), sg.In(key='password')], + [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], + ] + + form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), + text_justification='r', return_keyboard_events=True) + form.Layout(layout) + + while True: + button, values = form.Read() + if button is None: + exit(69) + + password = values['password'] + try: + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + form.FindElement('hash').Update(password_hash) + except: + pass + +# ----------------------------- Paste this code into your program / script ----------------------------- +# determine if a password matches the secret password by comparing SHA1 hash codes +def PasswordMatches(password, hash): + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + if password_hash == hash: + return True + else: + return False + +login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' +password = sg.PopupGetText('Password', password_char='*') +if password == 'gui': # Remove when pasting into your program + HashGeneratorGUI() # Remove when pasting into your program + exit(69) # Remove when pasting into your program +if PasswordMatches(password, login_password_hash): + print('Login SUCCESSFUL') +else: + print('Login FAILED!!') From 466670579970b91a76eabda2445234ee42970485 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 21:25:35 -0400 Subject: [PATCH 297/521] Password login Recipe --- docs/cookbook.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index d623d5e09..4d078a9e8 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -844,7 +844,7 @@ While there is no official support for "Tables" (e.g. there is no Table Element) sg.FlexForm('Table').LayoutAndRead(layout) -## Tight Layout +## Tight Layout with Button States Saw this example layout written in tkinter and liked it so much I duplicated the interface. It's "tight", clean, and has a nice dark look and feel. @@ -906,3 +906,73 @@ In other GUI frameworks this program would be most likely "event driven" with ca SubmitButton.Update(button_color=('gray34', 'springgreen4')) ResetButton.Update(button_color=('gray34', 'firebrick3')) recording = False + +## Password Protection For Scripts + +You get 2 scripts in one. + +Use the upper half to generate your hash code. Then paste it into the code in the lower half. Copy and paste lower 1/2 into your code to get password protection for your script without putting the password into your source code. + +![password entry](https://user-images.githubusercontent.com/13696193/45129440-ab58f000-b151-11e8-8ebe-e519a50b3ead.jpg) + +![password hash](https://user-images.githubusercontent.com/13696193/45129441-ab58f000-b151-11e8-8a46-c2789bb7824e.jpg) + + import PySimpleGUI as sg + import hashlib + + ''' + Create a secure login for your scripts without having to include your password in the program. Create an SHA1 hash code for your password using the GUI. Paste into variable in final program + 1. Choose a password + 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password + 3. Type password into the GUI + 4. Copy and paste hash code form GUI into variable named login_password_hash + 5. Run program again and test your login! + ''' + + # Use this GUI to get your password's hash code + def HashGeneratorGUI(): + layout = [[sg.T('Password Hash Generator', size=(30,1), font='Any 15')], + [sg.T('Password'), sg.In(key='password')], + [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], + ] + + form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), + text_justification='r', return_keyboard_events=True) + form.Layout(layout) + + while True: + button, values = form.Read() + if button is None: + exit(69) + + password = values['password'] + try: + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + form.FindElement('hash').Update(password_hash) + except: + pass + + # ----------------------------- Paste this code into your program / script ----------------------------- + # determine if a password matches the secret password by comparing SHA1 hash codes + def PasswordMatches(password, hash): + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + if password_hash == hash: + return True + else: + return False + + login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' + password = sg.PopupGetText('Password', password_char='*') + if password == 'gui': # Remove when pasting into your program + HashGeneratorGUI() # Remove when pasting into your program + exit(69) # Remove when pasting into your program + if PasswordMatches(password, login_password_hash): + print('Login SUCCESSFUL') + else: + print('Login FAILED!!') From afee485ce59563ae600eeefba87dd6207fa53213 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 21:45:51 -0400 Subject: [PATCH 298/521] Readme formatting --- docs/index.md | 5 +++-- readme.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 33f0275bb..02f34d00c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,17 +13,18 @@ (Ver 2.20) -[Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) + [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) -Lots of documentation available in addition to this Readme File. [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) [COOKBOOK!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) +[Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) + Super-simple GUI to grasp... Powerfully customizable. Create a custom GUI in 5 lines of code. diff --git a/readme.md b/readme.md index 33f0275bb..02f34d00c 100644 --- a/readme.md +++ b/readme.md @@ -13,17 +13,18 @@ (Ver 2.20) -[Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) + [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) -Lots of documentation available in addition to this Readme File. [Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) [COOKBOOK!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) +[Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) + Super-simple GUI to grasp... Powerfully customizable. Create a custom GUI in 5 lines of code. From a0f4d6cfcac8a533e776226c3187be195fdf7074 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 23:16:08 -0400 Subject: [PATCH 299/521] Default should have been default_text --- PySimpleGUI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4febcbc4b..dc74356df 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3308,10 +3308,10 @@ def GetTextBox(title, message, Default='', button_color=None, size=(None, None)) return True, input_values[0] -def PopupGetText(message, Default='', button_color=None, size=(None, None)): +def PopupGetText(message, default_text='', password_char='', button_color=None, size=(None, None)): with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: layout = [[Text(message, auto_size_text=True)], - [InputText(default_text=Default, size=size)], + [InputText(default_text=default_text, size=size, password_char=password_char)], [Ok(), Cancel()]] (button, input_values) = form.LayoutAndRead(layout) From bb4be66dd4a51bba35124c3e970cc1bb0abd5b87 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 5 Sep 2018 23:46:34 -0400 Subject: [PATCH 300/521] Readme type in Popup examples --- docs/index.md | 18 ++++++++++-------- readme.md | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/index.md b/docs/index.md index 02f34d00c..04d657bb3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -294,14 +294,16 @@ The function `PopupTimed` or `PopupAutoClose` are popup windows that will automa Here is a quick-reference showing how the Popup calls look. - print(sg.Popup('Popup')) - print(sg.PopupOk('PopupOk')) - print(sg.PopupYesNo('PopupYesNo')) - print(sg.PopupCancel('PopupCancel')) - print(sg.PopupOkCancel('PopupOkCancel')) - print(sg.PopupError('PopupError')) - print(sg.PopupTimed('PopupTimed')) - print(sg.PopupAutoClose('PopupAutoClose')) + + sg.Popup('Popup') + sg.PopupOk('PopupOk') + sg.PopupYesNo('PopupYesNo') + sg.PopupCancel('PopupCancel') + sg.PopupOkCancel('PopupOkCancel') + sg.PopupError('PopupError') + sg.PopupTimed('PopupTimed') + sg.PopupAutoClose('PopupAutoClose') + ![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) diff --git a/readme.md b/readme.md index 02f34d00c..04d657bb3 100644 --- a/readme.md +++ b/readme.md @@ -294,14 +294,16 @@ The function `PopupTimed` or `PopupAutoClose` are popup windows that will automa Here is a quick-reference showing how the Popup calls look. - print(sg.Popup('Popup')) - print(sg.PopupOk('PopupOk')) - print(sg.PopupYesNo('PopupYesNo')) - print(sg.PopupCancel('PopupCancel')) - print(sg.PopupOkCancel('PopupOkCancel')) - print(sg.PopupError('PopupError')) - print(sg.PopupTimed('PopupTimed')) - print(sg.PopupAutoClose('PopupAutoClose')) + + sg.Popup('Popup') + sg.PopupOk('PopupOk') + sg.PopupYesNo('PopupYesNo') + sg.PopupCancel('PopupCancel') + sg.PopupOkCancel('PopupOkCancel') + sg.PopupError('PopupError') + sg.PopupTimed('PopupTimed') + sg.PopupAutoClose('PopupAutoClose') + ![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) From 7e0728ac4daa7d8674b1f40bcc296a91d7a1c88d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 10:56:55 -0400 Subject: [PATCH 301/521] NEW Movable windows!! --- PySimpleGUI.py | 481 ++++++++++++++++++++++++++----------------------- 1 file changed, 255 insertions(+), 226 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index dc74356df..bd48ec03a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1633,6 +1633,23 @@ def GetScreenDimensions(self): return screen_width, screen_height + + def StartMove(self, event): + self.TKroot.x = event.x + self.TKroot.y = event.y + + def StopMove(self, event): + self.TKroot.x = None + self.TKroot.y = None + + def OnMotion(self, event): + deltax = event.x - self.TKroot.x + deltay = event.y - self.TKroot.y + x = self.TKroot.winfo_x() + deltax + y = self.TKroot.winfo_y() + deltay + self.TKroot.geometry("+%s+%s" % (x, y)) + + def _KeyboardCallback(self, event ): self.LastButtonClicked = None self.FormRemainedOpen = True @@ -2612,6 +2629,16 @@ def StartupTK(my_flex_form): _my_windows.Increment() my_flex_form.TKroot = root + + # Make moveable window + if my_flex_form.NoTitleBar: + root.bind("", my_flex_form.StartMove) + root.bind("", my_flex_form.StopMove) + root.bind("", my_flex_form.OnMotion) + + + + # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) @@ -2660,229 +2687,6 @@ def _GetNumLinesNeeded(text, max_line_width): total_lines_needed = sum(lines_used) return total_lines_needed -# ------------------------------------------------------------------------------------------------------------------ # -# ===================================== Upper PySimpleGUI ============================================================== # -# Pre-built dialog boxes for all your needs # -# ------------------------------------------------------------------------------------------------------------------ # - -# ==================================== MSG BOX =====# -# Display a message wrapping at 60 characters # -# Exits via an OK button2 press # -# Returns nothing # -# ===================================================# -def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False): - ''' - Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. - :param args: - :param button_color: - :param button_type: - :param auto_close: - :param auto_close_duration: - :param icon: - :param line_width: - :param font: - :return: - ''' - if not args: - args_to_print = [''] - else: - args_to_print = args - if line_width != None: - local_line_width = line_width - else: - local_line_width = MESSAGE_BOX_LINE_WIDTH - title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar) as form: - max_line_total, total_lines = 0,0 - for message in args_to_print: - # fancy code to check if string and convert if not is not need. Just always convert to string :-) - # if not isinstance(message, str): message = str(message) - message = str(message) - if message.count('\n'): - message_wrapped = message - else: - message_wrapped = textwrap.fill(message, local_line_width) - message_wrapped_lines = message_wrapped.count('\n')+1 - longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, local_line_width) - max_line_total = max(max_line_total, width_used) - # height = _GetNumLinesNeeded(message, width_used) - height = message_wrapped_lines - # print('Msgbox width, height', width_used, height) - form.AddRow(Text(message_wrapped, auto_size_text=True)) - total_lines += height - - pad = max_line_total-15 if max_line_total > 15 else 1 - pad =1 - if non_blocking: - PopupButton = DummyButton - else: - PopupButton = SimpleButton - # show either an OK or Yes/No depending on paramater - if button_type is MSG_BOX_YES_NO: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) - elif button_type is MSG_BOX_CANCELLED: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is MSG_BOX_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is MSG_BOX_OK_CANCEL: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), - PopupButton('Cancel', size=(5, 1), button_color=button_color)) - elif button_type is MSG_BOX_NO_BUTTONS: - pass - else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) - - if non_blocking: - button, values = form.ReadNonBlocking() - else: - button, values = form.Show() - - return button - - - -# ============================== MsgBox============# -# Lazy function. Same as calling Popup with parms # -# ==================================================# -# MsgBox is the legacy call and show not be used any longer -MsgBox = Popup - -# --------------------------- PopupNoButtons --------------------------- -def PopupoNoButtons(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - Popup(*args, button_type=MSG_BOX_NO_BUTTONS, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return - - -# --------------------------- PopupNonBlocking --------------------------- -def PopupoNonBlocking(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - Popup(*args, non_blocking=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return - -PopupNoWait = PopupoNonBlocking - - -# --------------------------- PopupNoFrame --------------------------- -def PopupNoTitlebar(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - Popup(*args, non_blocking=False, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=True) - return - -PopupNoFrame = PopupNoTitlebar -PopupNoBorder = PopupNoTitlebar -PopupAnnoying = PopupNoTitlebar - - -# ============================== MsgBoxAutoClose====# -# Lazy function. Same as calling MsgBox with parms # -# ===================================================# -def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, font=None): - ''' - Display a standard MsgBox that will automatically close after a specified amount of time - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupTimed = MsgBoxAutoClose -PopupAutoClose = MsgBoxAutoClose - -# ============================== MsgBoxError =====# -# Like MsgBox but presents RED BUTTONS # -# ===================================================# -def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, font=None): - ''' - Display a MsgBox with a red button - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - - -PopupError = MsgBoxError - - -# ============================== MsgBoxCancel =====# -# # -# ===================================================# -def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display a MsgBox with a single "Cancel" button. - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupCancel = MsgBoxCancel - - -# ============================== MsgBoxOK =====# -# Like MsgBox but only 1 button # -# ===================================================# -def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display a MsgBox with a single buttoned labelled "OK" - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupOk = MsgBoxOK - - -# ============================== MsgBoxOKCancel ====# -# Like MsgBox but presents OK and Cancel buttons # -# ===================================================# -def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display MsgBox with 2 buttons, "OK" and "Cancel" - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupOkCancel = MsgBoxOKCancel - - -# ==================================== YesNoBox=====# -# Like MsgBox but presents Yes and No buttons # -# Returns True if Yes was pressed else False # -# ===================================================# -def MsgBoxYesNo(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display MsgBox with 2 buttons, "Yes" and "No" - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - result = MsgBox(*args, button_type=MSG_BOX_YES_NO, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return result - - -PopupYesNo = MsgBoxYesNo - # ============================== PROGRESS METER ========================================== # def ConvertArgsToSingleString(*args): @@ -3267,7 +3071,7 @@ def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*") AskForFile = GetFileBox -def PopupGetFile(message, save_as=False, no_window=False, default_path='', 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 save_as: return tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box @@ -3295,10 +3099,10 @@ def PopupGetFile(message, save_as=False, no_window=False, default_path='', file_ # ============================== GetTextBox =========# # Get a single line of text # # ===================================================# -def GetTextBox(title, message, Default='', button_color=None, size=(None, None)): +def GetTextBox(title, message, default_text='', button_color=None, size=(None, None)): with FlexForm(title, auto_size_text=True, button_color=button_color) as form: layout = [[Text(message, auto_size_text=True)], - [InputText(default_text=Default, size=size)], + [InputText(default_text=default_text, size=size)], [Submit(), Cancel()]] (button, input_values) = form.LayoutAndRead(layout) @@ -3618,6 +3422,231 @@ def ObjToString(obj, extra=' '): for item in sorted(obj.__dict__))) +# ------------------------------------------------------------------------------------------------------------------ # +# ===================================== Upper PySimpleGUI ============================================================== # +# Pre-built dialog boxes for all your needs # +# ------------------------------------------------------------------------------------------------------------------ # + +# ==================================== MSG BOX =====# +# Display a message wrapping at 60 characters # +# Exits via an OK button2 press # +# Returns nothing # +# ===================================================# +def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False): + ''' + Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. + :param args: + :param button_color: + :param button_type: + :param auto_close: + :param auto_close_duration: + :param icon: + :param line_width: + :param font: + :return: + ''' + if not args: + args_to_print = [''] + else: + args_to_print = args + if line_width != None: + local_line_width = line_width + else: + local_line_width = MESSAGE_BOX_LINE_WIDTH + title = args_to_print[0] if args_to_print[0] is not None else 'None' + with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar) as form: + max_line_total, total_lines = 0,0 + for message in args_to_print: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + if message.count('\n'): + message_wrapped = message + else: + message_wrapped = textwrap.fill(message, local_line_width) + message_wrapped_lines = message_wrapped.count('\n')+1 + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, local_line_width) + max_line_total = max(max_line_total, width_used) + # height = _GetNumLinesNeeded(message, width_used) + height = message_wrapped_lines + # print('Msgbox width, height', width_used, height) + form.AddRow(Text(message_wrapped, auto_size_text=True)) + total_lines += height + + pad = max_line_total-15 if max_line_total > 15 else 1 + pad =1 + if non_blocking: + PopupButton = DummyButton + else: + PopupButton = SimpleButton + # show either an OK or Yes/No depending on paramater + if button_type is MSG_BOX_YES_NO: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) + elif button_type is MSG_BOX_CANCELLED: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is MSG_BOX_ERROR: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is MSG_BOX_OK_CANCEL: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), + PopupButton('Cancel', size=(5, 1), button_color=button_color)) + elif button_type is MSG_BOX_NO_BUTTONS: + pass + else: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + + if non_blocking: + button, values = form.ReadNonBlocking() + else: + button, values = form.Show() + + return button + + + +# ============================== MsgBox============# +# Lazy function. Same as calling Popup with parms # +# ==================================================# +# MsgBox is the legacy call and show not be used any longer +MsgBox = Popup + +# --------------------------- PopupNoButtons --------------------------- +def PopupoNoButtons(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + Popup(*args, button_type=MSG_BOX_NO_BUTTONS, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + return + + +# --------------------------- PopupNonBlocking --------------------------- +def PopupoNonBlocking(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + Popup(*args, non_blocking=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + return + +PopupNoWait = PopupoNonBlocking + + +# --------------------------- PopupNoFrame --------------------------- +def PopupNoTitlebar(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + Popup(*args, non_blocking=False, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=True) + return + +PopupNoFrame = PopupNoTitlebar +PopupNoBorder = PopupNoTitlebar +PopupAnnoying = PopupNoTitlebar + + +# ============================== MsgBoxAutoClose====# +# Lazy function. Same as calling MsgBox with parms # +# ===================================================# +def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, font=None): + ''' + Display a standard MsgBox that will automatically close after a specified amount of time + :param args: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: + :return: + ''' + return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + +PopupTimed = MsgBoxAutoClose +PopupAutoClose = MsgBoxAutoClose + +# ============================== MsgBoxError =====# +# Like MsgBox but presents RED BUTTONS # +# ===================================================# +def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, font=None): + ''' + Display a MsgBox with a red button + :param args: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: + :return: + ''' + return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + + +PopupError = MsgBoxError + + +# ============================== MsgBoxCancel =====# +# # +# ===================================================# +def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + ''' + Display a MsgBox with a single "Cancel" button. + :param args: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: + :return: + ''' + return MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + +PopupCancel = MsgBoxCancel + + +# ============================== MsgBoxOK =====# +# Like MsgBox but only 1 button # +# ===================================================# +def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + ''' + Display a MsgBox with a single buttoned labelled "OK" + :param args: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: + :return: + ''' + return MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + +PopupOk = MsgBoxOK + + +# ============================== MsgBoxOKCancel ====# +# Like MsgBox but presents OK and Cancel buttons # +# ===================================================# +def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + ''' + Display MsgBox with 2 buttons, "OK" and "Cancel" + :param args: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: + :return: + ''' + return MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + +PopupOkCancel = MsgBoxOKCancel + + +# ==================================== YesNoBox=====# +# Like MsgBox but presents Yes and No buttons # +# Returns True if Yes was pressed else False # +# ===================================================# +def MsgBoxYesNo(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): + ''' + Display MsgBox with 2 buttons, "Yes" and "No" + :param args: + :param button_color: + :param auto_close: + :param auto_close_duration: + :param font: + :return: + ''' + result = MsgBox(*args, button_type=MSG_BOX_YES_NO, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) + return result + + +PopupYesNo = MsgBoxYesNo + + + def main(): with FlexForm('Demo form..') as form: form_rows = [[Text('You are running the PySimpleGUI.py file itself')], From bc00740d030b650e4bfe4db11adfe9e75b0f9bac Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 11:08:06 -0400 Subject: [PATCH 302/521] NEW Demo - Borderless window (no titlebar) --- Demo_Borderless_Window.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Demo_Borderless_Window.py diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py new file mode 100644 index 000000000..9e1522cd5 --- /dev/null +++ b/Demo_Borderless_Window.py @@ -0,0 +1,33 @@ + +def TightLayout(): + """ + Turn off padding in order to get a really tight looking layout. + """ + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0, 0)) + 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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.ReadFormButton('Start', button_color=('white', 'black')), + sg.ReadFormButton('Stop', button_color=('white', 'black')), + sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4')), + sg.SimpleButton('Exit', button_color=('white', '#00406B')), + ] + ] + + form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, + auto_size_buttons=False, no_titlebar=True, + default_button_element_size=(12, 1)) + form.Layout(layout) + while True: + button, values = form.Read() + if button is None or button == 'Exit': + return + + +TightLayout() \ No newline at end of file From 32a9dc79ce0944dfb7a9306bececaf2f1b72254e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 12:01:19 -0400 Subject: [PATCH 303/521] Release 2.30 refresh of readme and demos Lots of forms went borderless so important that 2.30 be released. --- Demo_Borderless_Window.py | 10 +++----- Demo_Button_States.py | 2 +- Demo_Cookbook_Browser.py | 10 ++++---- Demo_DisplayHash1and256.py | 44 +++++++++++++++++----------------- Demo_HowDoI.py | 14 ++++++++++- Demo_Super_Simple_Form.py | 4 ++-- docs/index.md | 48 +++++++++++++++++++++----------------- readme.md | 48 +++++++++++++++++++++----------------- 8 files changed, 99 insertions(+), 81 deletions(-) diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py index 9e1522cd5..fe243b5ff 100644 --- a/Demo_Borderless_Window.py +++ b/Demo_Borderless_Window.py @@ -4,7 +4,6 @@ def TightLayout(): Turn off padding in order to get a really tight looking layout. """ import PySimpleGUI as sg - sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0, 0)) layout = [[sg.T('User:', pad=((3, 0), 0)), sg.OptionMenu(values=('User 1', 'User 2'), size=(20, 1)), @@ -13,13 +12,10 @@ def TightLayout(): 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.ReadFormButton('Start', button_color=('white', 'black')), - sg.ReadFormButton('Stop', button_color=('white', 'black')), + sg.ReadFormButton('Stop', button_color=('gray50', 'black')), sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4')), - sg.SimpleButton('Exit', button_color=('white', '#00406B')), - ] - ] - + sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')), + sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, auto_size_buttons=False, no_titlebar=True, default_button_element_size=(12, 1)) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index 233d56dcd..d2cbcac60 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -20,7 +20,7 @@ ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1)) + default_button_element_size=(12,1), no_titlebar=True) form.Layout(layout) recording = have_data = False while True: diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index d2fea98d3..d07e67f95 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -716,17 +716,19 @@ def TightLayout(): [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('Stop', button_color=('white', 'black')), - sg.ReadFormButton('Reset', button_color=('white', 'firebrick3')), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'))] + sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4')), + sg.SimpleButton('Exit', button_color=('white', '#00406B')), + ] ] form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, - auto_size_buttons=False, + auto_size_buttons=False, no_titlebar=True, default_button_element_size=(12, 1)) form.Layout(layout) while True: button, values = form.Read() - if button is None: + if button is None or button == 'Exit': return # -------------------------------- GUI Starts Here -------------------------------# diff --git a/Demo_DisplayHash1and256.py b/Demo_DisplayHash1and256.py index dfff1e1ba..bff8a8361 100644 --- a/Demo_DisplayHash1and256.py +++ b/Demo_DisplayHash1and256.py @@ -1,6 +1,6 @@ #!Python 3 import hashlib -import PySimpleGUI as SG +import PySimpleGUI as sg ######################################################################### # DisplayHash # @@ -51,37 +51,37 @@ def compute_sha256_hash_for_file(filename): # ---------------------------------------------------------------------- # def HashManuallyBuiltGUI(): # ------- Form design ------- # - with SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] (button, (source_filename, )) = form.LayoutAndRead(form_rows) if button == 'Submit': if source_filename != '': hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.Popup( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: SG.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') + sg.Popup('Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) + else: sg.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') else: - SG.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') + sg.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') def HashManuallyBuiltGUINonContext(): # ------- Form design ------- # - form = SG.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[SG.Text('SHA-1 and SHA-256 Hashes for the file')], - [SG.InputText(), SG.FileBrowse()], - [SG.Submit(), SG.Cancel()]] + form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] button, (source_filename, ) = form.LayoutAndRead(form_rows) if button == 'Submit': if source_filename != '': hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - SG.Popup( 'Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: SG.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') + sg.Popup('Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) + else: sg.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') else: - SG.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') + sg.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') @@ -94,23 +94,23 @@ def HashManuallyBuiltGUINonContext(): def HashMostCompactGUI(): # ------- INPUT GUI portion ------- # - rc, source_filename = SG.GetFileBox('Display A Hash Using PySimpleGUI', - 'Display a Hash code for file of your choice') + source_filename = sg.PopupGetFile('Display a Hash code for file of your choice') # ------- OUTPUT GUI results portion ------- # - if rc == True: + if source_filename != None: hash = compute_sha1_hash_for_file(source_filename) - SG.Popup('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) + sg.Print(hash) + sg.Popup('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) else: - SG.Popup('Display Hash - Compact GUI', '* Cancelled *') + sg.Popup('Display Hash - Compact GUI', '* Cancelled *') # ---------------------------------------------------------------------- # # Our main calls two GUIs that act identically but use different calls # # ---------------------------------------------------------------------- # def main(): - HashManuallyBuiltGUI() - HashManuallyBuiltGUINonContext() + # HashManuallyBuiltGUI() + # HashManuallyBuiltGUINonContext() HashMostCompactGUI() diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index 1c89cbaa0..b05cc266a 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,6 +1,17 @@ import PySimpleGUI as sg import subprocess +import ctypes +import os +import win32process + +# hwnd = ctypes.windll.kernel32.GetConsoleWindow() +# if hwnd != 0: +# ctypes.windll.user32.ShowWindow(hwnd, 0) +# ctypes.windll.kernel32.CloseHandle(hwnd) +# _, pid = win32process.GetWindowThreadProcessId(hwnd) +# os.system('taskkill /PID ' + str(pid) + ' /f') + # Test this command in a dos window if you are having trouble. HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' @@ -19,7 +30,6 @@ def HowDoI(): # ------- Make a new FlexForm ------- # sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors - form = sg.FlexForm('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, 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=(40,3), text_color=sg.BLUES[0]) @@ -32,6 +42,8 @@ def HowDoI(): 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]))] ] + + form = sg.FlexForm('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True, no_titlebar=True) form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # command_history = [] diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index e404d4e83..4498feea0 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -13,7 +13,7 @@ button, values = form.LayoutAndRead(layout) -print(button, values['name'], values['address'], values['phone']) +print(button, values, values['name'], values['address'], values['phone']) form = sg.FlexForm('Simple data entry form') # begin with a blank form @@ -26,6 +26,6 @@ ] button, values = form.LayoutAndRead(layout) - +print(values) name, address, phone = values sg.MsgBox(button, values[0], values[1], values[2]) \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 04d657bb3..59b939ba6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 2.20) + (Ver 2.30) @@ -52,9 +52,14 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. -PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. + +![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) + + + +PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a more friendly way. It does the layout and boilerplate code for you and presents you with a simple, efficient interface. ![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) @@ -93,10 +98,13 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Single Line Input Buttons including these types: File Browse + Files Browse Folder Browse + SaveAs Non-closing return Close form Realtime + Calendar chooser Checkboxes Radio Buttons Listbox @@ -106,6 +114,7 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Scroll-able Output Images Progress Bar + Calendar chooser Async/Non-Blocking Windows Tabbed forms Persistent Windows @@ -119,11 +128,15 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Set focus Bind return key to buttons Group widgets into a column and place into form anywhere + Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected + Get slider, spinner, combo as they are changed Update elements in a live form Bulk form-fill operation + Save / Load form to/from disk + Borderless (no titlebar) windows An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -784,10 +797,12 @@ This is the definition of the FlexForm object: def FlexForm(title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), + font=None, button_color=None,Font=None, progress_bar_color=(None,None), background_color=None @@ -798,19 +813,19 @@ This is the definition of the FlexForm object: icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, - text_justification=None): - - - + text_justification=None, + no_titlebar=False): Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True if elements should size themselves according to contents + default_button_element_size - Size of buttons on this form + auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label scale - Set size of element to be a multiple of the Element size location - (x,y) Location to place window in pixels + font - Font name and size for elements of the form button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background @@ -822,6 +837,7 @@ Parameter Descriptions. You will find these same parameters specified for each return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this form + no_titlebar - Create window without a titlebar #### Window Location @@ -838,20 +854,6 @@ In addition to `size` there is a `scale` option. `scale` will take the Element' There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar ## Elements @@ -1784,6 +1786,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify | Source File| Description | |--|--| |**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +|**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project @@ -1918,6 +1921,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others | 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel settin | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) +| 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk ### Release Notes diff --git a/readme.md b/readme.md index 04d657bb3..59b939ba6 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 2.20) + (Ver 2.30) @@ -52,9 +52,14 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve the real problems. Do you really want to plod through the mountains of code required to program tkinter? + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. -PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a **much** more friendly way. + +![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) + + + +PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a more friendly way. It does the layout and boilerplate code for you and presents you with a simple, efficient interface. ![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) @@ -93,10 +98,13 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Single Line Input Buttons including these types: File Browse + Files Browse Folder Browse + SaveAs Non-closing return Close form Realtime + Calendar chooser Checkboxes Radio Buttons Listbox @@ -106,6 +114,7 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Scroll-able Output Images Progress Bar + Calendar chooser Async/Non-Blocking Windows Tabbed forms Persistent Windows @@ -119,11 +128,15 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Set focus Bind return key to buttons Group widgets into a column and place into form anywhere + Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected + Get slider, spinner, combo as they are changed Update elements in a live form Bulk form-fill operation + Save / Load form to/from disk + Borderless (no titlebar) windows An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -784,10 +797,12 @@ This is the definition of the FlexForm object: def FlexForm(title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), + font=None, button_color=None,Font=None, progress_bar_color=(None,None), background_color=None @@ -798,19 +813,19 @@ This is the definition of the FlexForm object: icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, - text_justification=None): - - - + text_justification=None, + no_titlebar=False): Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. default_element_size - Size of elements in form in characters (width, height) - auto_size_text - Bool. True if elements should size themselves according to contents + default_button_element_size - Size of buttons on this form + auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label scale - Set size of element to be a multiple of the Element size location - (x,y) Location to place window in pixels + font - Font name and size for elements of the form button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background @@ -822,6 +837,7 @@ Parameter Descriptions. You will find these same parameters specified for each return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this form + no_titlebar - Create window without a titlebar #### Window Location @@ -838,20 +854,6 @@ In addition to `size` there is a `scale` option. `scale` will take the Element' There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. -#### FlexForm - form-level variables overview -A summary of the variables that can be changed when a FlexForm is created - - default_element_size - set default size for all elements in the form - auto_size_text- true/false autosizing turned on / off - scale - set scale value for all elements - button_color- default button color (foreground, background) - font - font name and size for all text items - progress_bar_color - progress bar colors - is_tabbed_form - true/false indicates form is a tabbed or normal form - border_depth - style setting for buttons, input fields - auto_close - true/false indicates if form will automatically close - auto_close_duration - how long in seconds before closing form - icon - filename for icon that's displayed on the window on taskbar ## Elements @@ -1784,6 +1786,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify | Source File| Description | |--|--| |**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +|**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project @@ -1918,6 +1921,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others | 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel settin | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) +| 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk ### Release Notes From 4e5f88f23d06359669e4ba49f6518b785e8077d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 12:10:58 -0400 Subject: [PATCH 304/521] Added back title bar --- Demo_Button_States.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index d2cbcac60..233d56dcd 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -20,7 +20,7 @@ ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1), no_titlebar=True) + default_button_element_size=(12,1)) form.Layout(layout) recording = have_data = False while True: From 3b7c9267c38af9bc4108721bafc73b9fcd9c89d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 15:18:46 -0400 Subject: [PATCH 305/521] More installation instructions --- docs/index.md | 14 ++++++++++++-- readme.md | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 59b939ba6..5f19987b7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -200,8 +200,17 @@ You will see a number of different styles of buttons, data entry fields, etc, in ### Installing pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code +On some systems you need to run pip3. + + + pip3 install PySimpleGUI + +On a Raspberry Pi, this is should work: + + sudo pip3 install --upgrade pysimplegui + +If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. + ### Prerequisites @@ -2024,3 +2033,4 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + diff --git a/readme.md b/readme.md index 59b939ba6..5f19987b7 100644 --- a/readme.md +++ b/readme.md @@ -200,8 +200,17 @@ You will see a number of different styles of buttons, data entry fields, etc, in ### Installing pip install PySimpleGUI - or -Simply download the file - PySimpleGUI.py and import it into your code +On some systems you need to run pip3. + + + pip3 install PySimpleGUI + +On a Raspberry Pi, this is should work: + + sudo pip3 install --upgrade pysimplegui + +If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. + ### Prerequisites @@ -2024,3 +2033,4 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + From be6ee091b1bf380ad7a49b4ad79c01248fd75649 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 15:25:05 -0400 Subject: [PATCH 306/521] Fix for checkbox background color being set to system default. --- PySimpleGUI.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bd48ec03a..e0764e658 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -994,8 +994,10 @@ def Update(self, filename=None, data=None): else: image = data else: return - width, height = image.width(), image.height() - self.tktext_label.configure(image=image, width=width, height=height) + # width, height = image.width(), image.height() + # width, height = image.width(), image.height() + # self.tktext_label.configure(image=image, width=width, height=height) + self.tktext_label.configure(image=image) self.tktext_label.image = image def __del__(self): @@ -2441,7 +2443,10 @@ def CharWidthInPixels(): width, height = photo.width(), photo.height() else: width, height = element_size - element.tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) + if photo is not None: + element.tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) + else: + element.tktext_label = tk.Label(tk_row_frame, width=width, height=height, bd=border_depth) element.tktext_label.image = photo # tktext_label.configure(anchor=tk.NW, image=photo) element.tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) From b471b5dd05365384c4648daf312d27282a27a499 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 16:20:37 -0400 Subject: [PATCH 307/521] Fixed import as g instead of sg bug, made some demos borderless, used form.FindElement where possible, fixed PopupGetFile and PopupGetFolder no_window option --- Demo_Borderless_Window.py | 50 ++++++++++++++--------------- Demo_Chat.py | 16 ++++----- Demo_Chatterbot.py | 22 ++++++------- Demo_Color.py | 42 ++++++++++++------------ Demo_DOC_Viewer_PIL.py | 6 ++-- Demo_HowDoI.py | 17 ++++------ Demo_Keypad.py | 26 +++++++-------- Demo_Matplotlib.py | 10 +++--- Demo_Matplotlib_Animated.py | 12 +++---- Demo_Matplotlib_Animated_Scatter.py | 10 +++--- Demo_Matplotlib_Browser.py | 18 +++++------ Demo_Matplotlib_Ping_Graph.py | 8 ++--- Demo_Matplotlib_Ping_Graph_Large.py | 10 +++--- Demo_Media_Player.py | 7 ++-- Demo_NonBlocking_Form.py | 5 ++- Demo_Pi_LEDs.py | 20 ++++++------ PySimpleGUI.py | 23 +++++++++++-- 17 files changed, 154 insertions(+), 148 deletions(-) diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py index fe243b5ff..51e1663f1 100644 --- a/Demo_Borderless_Window.py +++ b/Demo_Borderless_Window.py @@ -1,29 +1,27 @@ -def TightLayout(): - """ - Turn off padding in order to get a really tight looking layout. - """ - import PySimpleGUI as sg - sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0, 0)) - 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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.ReadFormButton('Start', button_color=('white', 'black')), - sg.ReadFormButton('Stop', button_color=('gray50', 'black')), - sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), - sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')), - sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] - form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, - auto_size_buttons=False, no_titlebar=True, - default_button_element_size=(12, 1)) - form.Layout(layout) - while True: - button, values = form.Read() - if button is None or button == 'Exit': - return +import PySimpleGUI as sg +""" +Turn off padding in order to get a really tight looking layout. +""" +sg.ChangeLookAndFeel('Dark') +sg.SetOptions(element_padding=(0, 0)) +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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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.ReadFormButton('Start', button_color=('white', 'black')), + sg.ReadFormButton('Stop', button_color=('gray50', 'black')), + sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), + sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')), + sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] +form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, + auto_size_buttons=False, no_titlebar=True, + default_button_element_size=(12, 1)) +form.Layout(layout) +while True: + button, values = form.Read() + if button is None or button == 'Exit': + break -TightLayout() \ No newline at end of file diff --git a/Demo_Chat.py b/Demo_Chat.py index 55bba5609..3b80ea7ca 100644 --- a/Demo_Chat.py +++ b/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) - multiline_elem = sg.Multiline(size=(85, 5), enter_submits=True, key='query', do_not_clear=False) - history_elem = sg.T('', size=(20,3)) layout = [ [sg.Text('Your output will go here', size=(40, 1))], [sg.Output(size=(127, 30), font=('Helvetica 10'))], - [sg.T('Command History'), history_elem], - [multiline_elem, + [sg.T('Command History'), sg.T('', size=(20,3), key='history')], + [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.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] ] @@ -39,20 +37,20 @@ def ChatBotWithHistory(): print('The command you entered was {}'.format(query)) command_history.append(query) history_offset = len(command_history)-1 - multiline_elem.Update('') # manually clear input because keyboard events blocks clear - history_elem.Update('\n'.join(command_history[-3:])) + form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear + form.FindElement('history').Update('\n'.join(command_history[-3:])) elif button is None or button is 'EXIT': # quit if exit button or X break elif 'Up' in button and len(command_history): command = command_history[history_offset] 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): history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list command = command_history[history_offset] - multiline_elem.Update(command) + form.FindElement('query').Update(command) elif 'Escape' in button: - multiline_elem.Update('') + form.FindElement('query').Update('') exit(69) diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index 25ac0a301..f7936482d 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as sg from chatterbot import ChatBot import chatterbot.utils @@ -11,17 +11,17 @@ # Create the 'Trainer GUI' # 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 bars = [] 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): - bars.append(g.ProgressBar(100, size=(30, 4))) - texts.append(g.T(' '*20, size=(20,1), justification='right')) + bars.append(sg.ProgressBar(100, size=(30, 4))) + texts.append(sg.T(' ' * 20, size=(20, 1), justification='right')) 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) current_bar = 0 @@ -50,10 +50,10 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar chatbot.train("chatterbot.corpus.english") ################# GUI ################# -with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[g.Output(size=(80, 20))], - [g.Multiline(size=(70, 5), enter_submits=True), - g.ReadFormButton('SEND', bind_return_key=True), g.ReadFormButton('EXIT')]] +with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: + layout = [[sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.ReadFormButton('SEND', bind_return_key=True), sg.ReadFormButton('EXIT')]] form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # @@ -62,7 +62,7 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar if button is not 'SEND': break string = value.rstrip() - print(string.rjust(120)) + print(' '+string) # send the user input to chatbot to get a response response = chatbot.get_response(value.rstrip()) print(response) \ No newline at end of file diff --git a/Demo_Color.py b/Demo_Color.py index 14c64ab85..e27365a6c 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as sg MY_WINDOW_ICON = 'E:\\TheRealMyDocs\\Icons\\The Planets\\jupiter.ico' reverse = {} @@ -1639,13 +1639,13 @@ def show_all_colors_on_buttons(): global reverse global colorhex 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_len = 20 for i, c in enumerate(colors): hex = get_hex_from_name(c) - button1 = g.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)) + button1 = sg.Button(button_text=c, button_color=(get_complementary_hex(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(button2) if (i+1) % row_len == 0: @@ -1656,12 +1656,12 @@ def show_all_colors_on_buttons(): form.Show() -GoodColors = [('#0e6251',g.RGB(255,246,122) ), - ('white', g.RGB(0,74,60)), - (g.RGB(0,210,124),g.RGB(0,74,60) ), - (g.RGB(0,210,87),g.RGB(0,74,60) ), - (g.RGB(0,164,73),g.RGB(0,74,60) ), - (g.RGB(0,74,60),g.RGB(0,74,60) ), +GoodColors = [('#0e6251', sg.RGB(255, 246, 122)), + ('white', sg.RGB(0, 74, 60)), + (sg.RGB(0, 210, 124), sg.RGB(0, 74, 60)), + (sg.RGB(0, 210, 87), sg.RGB(0, 74, 60)), + (sg.RGB(0, 164, 73), sg.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() while True: # ------- Form show ------- # - layout = [[g.Text('Find color')], - [g.Text('Demonstration of colors')], - [g.Text('Enter a color name in text or hex #RRGGBB format')], - [g.InputText()], - [g.Listbox(list_of_colors, size=(20,30)), g.T('Or choose from list')], - [g.Submit(), g.Quit(), g.SimpleButton('Show me lots of colors!', button_color=('white','#0e6251'))], + layout = [[sg.Text('Find color')], + [sg.Text('Demonstration of colors')], + [sg.Text('Enter a color name in text or hex #RRGGBB format')], + [sg.InputText()], + [sg.Listbox(list_of_colors, size=(20, 30)), sg.T('Or choose from list')], + [sg.Submit(), sg.Quit(), sg.SimpleButton('Show me lots of colors!', button_color=('white', '#0e6251'))], ] # [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 ------- # if button == '' or button == 'Quit' or button is None: @@ -1705,11 +1705,11 @@ def main(): complementary_color = get_name_from_hex(complementary_hex) # 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')], - [g.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))], + layout = [[sg.Text('That color and it\'s compliment are shown on these buttons. This form auto-closes')], + [sg.Button(button_text=color_name, button_color=(color_hex, complementary_hex))], + [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) diff --git a/Demo_DOC_Viewer_PIL.py b/Demo_DOC_Viewer_PIL.py index ac2c82324..3c170f3cd 100644 --- a/Demo_DOC_Viewer_PIL.py +++ b/Demo_DOC_Viewer_PIL.py @@ -37,14 +37,14 @@ import time 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 = ( ("PDF Files", "*.pdf"), ("XPS Files", "*.*xps"), ("Epub Files", "*.epub"), ("Fiction Books", "*.fb2"), ("Comic Books", "*.cbz"), - ("HTML", "*.htm*"), + ("HTML", "*.htm*") # add more document types here ) ) @@ -122,7 +122,7 @@ def get_page(pno, zoom = False, max_size = None, first = False): del root 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 data, clip_pos = get_page(cur_page, diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index b05cc266a..ae1b251ce 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -30,15 +30,12 @@ def HowDoI(): # ------- Make a new FlexForm ------- # 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 = [ [sg.Text('Ask and your answer will appear here....', size=(40, 1))], [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.T('Command History'), history_elem], - [multiline_elem, + sg.T('Command History'), sg.T('', size=(40,3), text_color=sg.BLUES[0], key='history')], + [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.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 command_history.append(query) history_offset = len(command_history)-1 - multiline_elem.Update('') # manually clear input because keyboard events blocks clear - history_elem.Update('\n'.join(command_history[-3:])) + form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear + form.FindElement('history').Update('\n'.join(command_history[-3:])) elif button is None or button is 'EXIT': # if exit button or closed using X break elif 'Up' in button and len(command_history): # scroll back in history command = command_history[history_offset] 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 history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list command = command_history[history_offset] - multiline_elem.Update(command) + form.FindElement('query').Update(command) elif 'Escape' in button: # clear currently line - multiline_elem.Update('') + form.FindElement('query').Update('') exit(69) diff --git a/Demo_Keypad.py b/Demo_Keypad.py index 0c1fbd84d..9efa683a2 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -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 @@ -12,19 +12,17 @@ # 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')], - [in_elem], - [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], - [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], - [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], - [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], - [out_elem], + +layout = [[sg.Text('Enter Your Passcode')], + [sg.Input(size=(10, 1), do_not_clear=True, key='input')], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')], + [sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')], + [sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')], + [sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')], + [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) # Loop forever reading the form's values, updating the Input field @@ -40,6 +38,6 @@ keys_entered += button # add the new digit elif button is 'Submit': 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 \ No newline at end of file + form.FindElement('input').Update(keys_entered) # change the form to reflect current key string \ No newline at end of file diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 9dc26dad3..8b5d334dc 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as sg import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasAgg @@ -107,14 +107,14 @@ def draw_figure(canvas, figure, loc=(0, 0)): # information to display. # # --------------------------------------------------------------------------------# 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 -layout = [[g.Text('Plot test')], +layout = [[sg.Text('Plot test')], [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 -form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') +form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index 5f640fea4..60be75ccb 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -1,5 +1,5 @@ from random import randint -import PySimpleGUI as g +import PySimpleGUI as sg from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg from matplotlib.figure import Figure import matplotlib.backends.tkagg as tkagg @@ -14,16 +14,16 @@ def main(): ax.set_ylabel("Y axis") ax.grid() - canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on - slider_elem = g.Slider(range=(0,10000), size=(60,10), orientation='h') + canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on + slider_elem = sg.Slider(range=(0, 10000), size=(60, 10), orientation='h') # 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], [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 - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_Matplotlib_Animated_Scatter.py b/Demo_Matplotlib_Animated_Scatter.py index 53f0e5802..819022983 100644 --- a/Demo_Matplotlib_Animated_Scatter.py +++ b/Demo_Matplotlib_Animated_Scatter.py @@ -1,5 +1,5 @@ from random import randint -import PySimpleGUI as g +import PySimpleGUI as sg from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg from matplotlib.figure import Figure import matplotlib.backends.tkagg as tkagg @@ -7,14 +7,14 @@ 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 - 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], - [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 - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_Matplotlib_Browser.py b/Demo_Matplotlib_Browser.py index 7301b5fda..17ecb0e56 100644 --- a/Demo_Matplotlib_Browser.py +++ b/Demo_Matplotlib_Browser.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as sg import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasAgg @@ -862,21 +862,21 @@ def draw_figure(canvas, figure, loc=(0, 0)): 'Artist Customized Box Plots 2' : ArtistBoxplot2, 'Pyplot Histogram' : PyplotHistogram} -g.ChangeLookAndFeel('LightGreen') +sg.ChangeLookAndFeel('LightGreen') figure_w, figure_h = 650, 650 -canvas_elem = g.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))) +canvas_elem = sg.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on +multiline_elem = sg.Multiline(size=(70, 35), pad=(5, (3, 90))) # define the form layout 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')], - [g.T(' '*12), g.Exit(size=(5,2))]] +col_listbox = [[sg.Listbox(values=listbox_values, change_submits=True, size=(28, len(listbox_values)), key='func')], + [sg.T(' ' * 12), sg.Exit(size=(5, 2))]] -layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))], - [g.Column(col_listbox, pad=(5,(3,330))), canvas_elem, multiline_elem], +layout = [[sg.Text('Matplotlib Plot Test', font=('current 18'))], + [sg.Column(col_listbox, pad=(5, (3, 330))), canvas_elem, multiline_elem], ] # 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) while True: diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index d20755a8d..fc8f7cdd5 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as sg import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasAgg import matplotlib.backends.tkagg as tkagg @@ -640,12 +640,12 @@ def draw(fig, canvas): def main(): 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 - 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 - form = g.FlexForm('Ping Graph', background_color='white') + form = sg.FlexForm('Ping Graph', background_color='white') form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/Demo_Matplotlib_Ping_Graph_Large.py index 20e9b7f8c..e24d86a00 100644 --- a/Demo_Matplotlib_Ping_Graph_Large.py +++ b/Demo_Matplotlib_Ping_Graph_Large.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as sg import matplotlib.pyplot as plt import ping from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg @@ -74,14 +74,14 @@ def draw(fig, canvas): def main(): 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 - 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], - [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 - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index 3a78113c3..b1128f3ed 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -17,14 +17,13 @@ def MediaPlayerGUI(): image_exit = './ButtonGraphics/Exit.png' # 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 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 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), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), @@ -60,7 +59,7 @@ def MediaPlayerGUI(): break # If a button was pressed, display it on the GUI by updating the text element if button: - TextElem.Update(button) + form.FindElement('output').Update(button) MediaPlayerGUI() diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index d4df658b3..05006d16f 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -8,10 +8,9 @@ def StatusOutputExample(): # Make a form, but don't use context manager form = sg.FlexForm('Running Timer', auto_size_text=True) # 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 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')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form.LayoutAndRead(form_rows, non_blocking=True) @@ -25,7 +24,7 @@ def StatusOutputExample(): i=0 while (True): # 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() if button == 'Quit' or values is None: break diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py index 1c08b9fe8..6fb60ca04 100644 --- a/Demo_Pi_LEDs.py +++ b/Demo_Pi_LEDs.py @@ -1,4 +1,4 @@ -import PySimpleGUI as g +import PySimpleGUI as rg # GUI for switching an LED on and off to GPIO14 @@ -28,18 +28,18 @@ def FlashLED(): GPIO.output(14, GPIO.LOW) 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], - [g.ReadFormButton('Switch LED')], - [g.ReadFormButton('Flash LED')], - [g.ReadFormButton('Show slider value')], - [g.Slider(range=(0, 100), default_value=0, orientation='h', size=(40,20), key='slider')], - [g.Exit()] + [rg.ReadFormButton('Switch LED')], + [rg.ReadFormButton('Flash LED')], + [rg.ReadFormButton('Show slider value')], + [rg.Slider(range=(0, 100), default_value=0, orientation='h', size=(40, 20), key='slider')], + [rg.Exit()] ] -form = g.FlexForm('Raspberry Pi GUI') +form = rg.FlexForm('Raspberry Pi GUI') form.Layout(layout) while True: @@ -56,4 +56,4 @@ def FlashLED(): elif button is 'Show slider value': results_elem.Update('Slider = %s'%values['slider']) -g.MsgBox('Done... exiting') +rg.MsgBox('Done... exiting') diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e0764e658..765658c1c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3043,7 +3043,17 @@ def GetPathBox(title, message, default_path='', button_color=None, size=(None, N 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: layout = [[Text(message, auto_size_text=True)], [InputText(default_text=default_path, size=size), FolderBrowse()], @@ -3078,10 +3088,17 @@ def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*") def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_types=(("ALL Files", "*.*"),), 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 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: - 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: browse_button = SaveAs(file_types=file_types) From de045f6e8210f3443ffed56a639198c89f1dd4d8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 16:54:56 -0400 Subject: [PATCH 308/521] New OpenCV Demo --- Demo_OpenCV.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Demo_OpenCV.py diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py new file mode 100644 index 000000000..d326979d6 --- /dev/null +++ b/Demo_OpenCV.py @@ -0,0 +1,58 @@ +import cv2 as cv +from PIL import Image +import tempfile +import PySimpleGUI as sg +import os + +""" +Demo program to open and play a file using OpenCV +Unsure how to get the frames coming from OpenCV into the right format, so saving each frame to +a temp file. Clearly... clearly... this is not the optimal solution and one is being searched for now. + +Until then enjoy it working somewhat slowly. +""" + +def main(): + filename = sg.PopupGetFile('Filename to play') + if filename is None: + exit(69) + vidFile = cv.VideoCapture(filename) + # ---===--- Get some Stats --- # + num_frames = vidFile.get(cv.CAP_PROP_FRAME_COUNT) + fps = vidFile.get(cv.CAP_PROP_FPS) + + sg.ChangeLookAndFeel('Dark') + + # define the form layout + layout = [[sg.Text('OpenCV Demo', size=(40, 1), justification='center', font='Helvetica 20')], + [sg.Image(filename='', key='image')], + [sg.Slider(range=(0, num_frames), size=(60, 10), orientation='h', key='slider')], + [sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + + # ---===--- LOOP through video file by frame --- # + i = 0 + temp_filename = next(tempfile._get_candidate_names()) + '.png' + while vidFile.isOpened(): + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + os.remove(temp_filename) + exit(69) + ret, frame = vidFile.read() + if not ret: # if out of data stop looping + break + + form.FindElement('slider').Update(i) + i += 1 + + with open(temp_filename, 'wb') as f: + Image.fromarray(frame).save(temp_filename, 'PNG') # save the PIL image as file + form.FindElement('image').Update(filename=temp_filename) + + +main() \ No newline at end of file From c9656c781519ec4a8977b7536931fa27e037a71f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 17:08:29 -0400 Subject: [PATCH 309/521] Removed window border --- Demo_OpenCV.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index d326979d6..f7b9f68c7 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -30,7 +30,7 @@ def main(): [sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', no_titlebar=True) form.Layout(layout) form.ReadNonBlocking() From d39d12c3277f3676694a5ab4c21b17240e14481f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 18:02:37 -0400 Subject: [PATCH 310/521] Sized controls to fit 1280x720 video --- Demo_OpenCV.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index f7b9f68c7..9d32d465c 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -12,6 +12,7 @@ Until then enjoy it working somewhat slowly. """ + def main(): filename = sg.PopupGetFile('Filename to play') if filename is None: @@ -24,10 +25,10 @@ def main(): sg.ChangeLookAndFeel('Dark') # define the form layout - layout = [[sg.Text('OpenCV Demo', size=(40, 1), justification='center', font='Helvetica 20')], + layout = [[sg.Text('OpenCV Demo', size=(15, 1),pad=((510,0),3), justification='center', font='Helvetica 20')], [sg.Image(filename='', key='image')], - [sg.Slider(range=(0, num_frames), size=(60, 10), orientation='h', key='slider')], - [sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + [sg.Slider(range=(0, num_frames), size=(115, 10), orientation='h', key='slider')], + [sg.ReadFormButton('Exit', size=(10, 2), pad=((600, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', no_titlebar=True) From 30f964f6a940c61f6555ebb75133872088e0802a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 20:29:11 -0400 Subject: [PATCH 311/521] The "Grab Anywhere" option... default is ON --- PySimpleGUI.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 765658c1c..2ce054d01 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1422,7 +1422,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -1463,6 +1463,7 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.LastKeyboardEvent = None self.TextJustification = text_justification self.NoTitleBar = no_titlebar + self.GrabAnywhere = grab_anywhere # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -2636,7 +2637,7 @@ def StartupTK(my_flex_form): my_flex_form.TKroot = root # Make moveable window - if my_flex_form.NoTitleBar: + if my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere: root.bind("", my_flex_form.StartMove) root.bind("", my_flex_form.StopMove) root.bind("", my_flex_form.OnMotion) From 630f321fa3d07b1423b8e928ba322ec09e5e3034 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 21:30:26 -0400 Subject: [PATCH 312/521] Fix for *args crash in python 3.4. Had no idea was broken. OpenCV window sizing, Fix for tables in cookbook --- Demo_Cookbook_Browser.py | 9 ++++++--- Demo_OpenCV.py | 5 +++-- PySimpleGUI.py | 13 ++++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index d07e67f95..2207db3fc 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -431,7 +431,10 @@ def Launcher(): def ExecuteCommandSubprocess(command, *args): try: - sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + expanded_args = [] + for a in args: + expanded_args += a + sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() if out: print(out.decode("utf-8")) @@ -691,12 +694,12 @@ def TableSimulation(): Display data in a table format """ import PySimpleGUI as sg + sg.ChangeLookAndFeel('Dark1') layout = [[sg.T('Table Test')]] for i in range(20): - row = [sg.T(f'Row {i} ', size=(10, 1))] - layout.append([sg.T(f'{i}{j}', size=(4, 1), background_color='white', pad=(1, 1)) for j in range(10)]) + layout.append([sg.T('{} {}'.format(i,j), size=(4, 1), background_color='black', pad=(1, 1)) for j in range(10)]) sg.FlexForm('Table').LayoutAndRead(layout) diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index 9d32d465c..67acba935 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -14,7 +14,8 @@ def main(): - filename = sg.PopupGetFile('Filename to play') + filename = 'C:/Python/MIDIVideo/PlainVideos/- 08-30 Ted Talk/TED Talk Short - Video+.mp4' + # filename = sg.PopupGetFile('Filename to play') if filename is None: exit(69) vidFile = cv.VideoCapture(filename) @@ -31,7 +32,7 @@ def main(): [sg.ReadFormButton('Exit', size=(10, 2), pad=((600, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', no_titlebar=True) + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', no_titlebar=True, location=(0,0)) form.Layout(layout) form.ReadNonBlocking() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 2ce054d01..de9e43f2d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1646,11 +1646,14 @@ def StopMove(self, event): self.TKroot.y = None def OnMotion(self, event): - deltax = event.x - self.TKroot.x - deltay = event.y - self.TKroot.y - x = self.TKroot.winfo_x() + deltax - y = self.TKroot.winfo_y() + deltay - self.TKroot.geometry("+%s+%s" % (x, y)) + try: + deltax = event.x - self.TKroot.x + deltay = event.y - self.TKroot.y + x = self.TKroot.winfo_x() + deltax + y = self.TKroot.winfo_y() + deltay + self.TKroot.geometry("+%s+%s" % (x, y)) + except: + pass def _KeyboardCallback(self, event ): From 436f9c35d9bb24d80b1dcbbdebbc0d11abdadaf9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 21:56:20 -0400 Subject: [PATCH 313/521] Had to turn off grab_anywhere... causes problems when you have sliders! Drat! --- PySimpleGUI.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index de9e43f2d..18db4c0e1 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1422,7 +1422,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -1638,12 +1638,16 @@ def GetScreenDimensions(self): def StartMove(self, event): - self.TKroot.x = event.x - self.TKroot.y = event.y + try: + self.TKroot.x = event.x + self.TKroot.y = event.y + except: pass def StopMove(self, event): - self.TKroot.x = None - self.TKroot.y = None + try: + self.TKroot.x = None + self.TKroot.y = None + except: pass def OnMotion(self, event): try: From 405bcf7cbc3c0079368417a37ec4a095f3d0bf33 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 21:58:16 -0400 Subject: [PATCH 314/521] Turning back on Grab Anywhere! If you have a slider, turn it off, that simple --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 18db4c0e1..e3f31fdf8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1422,7 +1422,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title From ac44b5bdaa04463834e5b7aaa91c35fa08098f88 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 6 Sep 2018 23:17:40 -0400 Subject: [PATCH 315/521] Justification setting for Input elements.... Finally can make tables! Demo fo tables --- Demo_Table_Simulation.py | 19 +++++++++++++++++++ PySimpleGUI.py | 12 ++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 Demo_Table_Simulation.py diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py new file mode 100644 index 000000000..b61b263c4 --- /dev/null +++ b/Demo_Table_Simulation.py @@ -0,0 +1,19 @@ +import PySimpleGUI as sg + +def TableSimulation(): + """ + Display data in a table format + """ + # sg.ChangeLookAndFeel('Dark') + + layout = [[sg.T('Table Using Combos and Input Elements', font='Any 18')]] + + for i in range(20): + inputs = [sg.In('{}{}'.format(i,j), size=(8, 1), pad=(1, 1), justification='right') for j in range(10)] + inputs = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info')), *inputs] + layout.append(inputs) + + sg.FlexForm('Table').LayoutAndRead(layout) + + +TableSimulation() \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e3f31fdf8..393a690a2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -261,7 +261,8 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): + def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', + justification=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): ''' Input a line of text Element :param default_text: Default value to display @@ -277,6 +278,7 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR self.Focus = focus self.do_not_clear = do_not_clear + self.Justification = justification super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) @@ -2251,7 +2253,13 @@ def CharWidthInPixels(): element.TKStringVar = tk.StringVar() element.TKStringVar.set(default_text) show = element.PasswordCharacter if element.PasswordCharacter else "" - element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show) + if element.Justification is not None: + justification = element.Justification + else: + justification = DEFAULT_TEXT_JUSTIFICATION + justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT + anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE + element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show, justify=justify) element.TKEntry.bind('', element.ReturnKeyHandler) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKEntry.configure(background=element.BackgroundColor) From c905acdd3d955bbcf84c0c8a2afec184071ad9b6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 10:32:05 -0400 Subject: [PATCH 316/521] Demo Table Simulation - one way to make a table in PSG --- Demo_Table_Simulation.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index b61b263c4..66f208c60 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -5,15 +5,32 @@ def TableSimulation(): Display data in a table format """ # sg.ChangeLookAndFeel('Dark') - - layout = [[sg.T('Table Using Combos and Input Elements', font='Any 18')]] + sg.SetOptions(element_padding=(0,0)) + layout = [[sg.T('Table Using Combos and Input Elements', font='Any 18')], + [sg.T('Row, Cal to change'), + sg.In(key='inputrow', justification='right', size=(8,1), pad=(1,1), do_not_clear=True), + sg.In(key='inputcol', size=(8,1), pad=(1,1), justification='right', do_not_clear=True), + sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)]] for i in range(20): - inputs = [sg.In('{}{}'.format(i,j), size=(8, 1), pad=(1, 1), justification='right') for j in range(10)] + inputs = [sg.In('{}{}'.format(i,j), size=(8, 1), pad=(1, 1), justification='right', key=(i,j), do_not_clear=True) for j in range(10)] inputs = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info')), *inputs] layout.append(inputs) - sg.FlexForm('Table').LayoutAndRead(layout) + form = sg.FlexForm('Table', return_keyboard_events=True) + form.Layout(layout) + while True: + button, values = form.Read() + if button is None: + break + try: + location = (int(values['inputrow']), int(values['inputcol'])) + target_element = form.FindElement(location) + new_value = values['value'] + if target_element is not None and new_value != '': + target_element.Update(new_value) + except: + pass TableSimulation() \ No newline at end of file From fdab86b66f839ee640fedbb221d58c078838ecc5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 10:33:23 -0400 Subject: [PATCH 317/521] Turn off grab_anywhere on Demos of realtime buttons due to error message from tkinter --- Demo_All_Widgets.py | 2 +- Demo_Borderless_Window.py | 6 +++++- Demo_Font_Sizer.py | 2 +- Demo_Pi_Robotics.py | 4 ++-- Demo_Timer.py | 19 +++++++------------ 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index cb03220f9..15d81ce3c 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -4,7 +4,7 @@ def Everything(): sg.ChangeLookAndFeel('Dark') - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) column1 = [[sg.Text('Column 1', background_color='black', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py index 51e1663f1..1d615059e 100644 --- a/Demo_Borderless_Window.py +++ b/Demo_Borderless_Window.py @@ -1,8 +1,9 @@ - import PySimpleGUI as sg + """ Turn off padding in order to get a really tight looking layout. """ + sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0, 0)) layout = [[sg.T('User:', pad=((3, 0), 0)), sg.OptionMenu(values=('User 1', 'User 2'), size=(20, 1)), @@ -15,10 +16,13 @@ sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')), sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] + form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, auto_size_buttons=False, no_titlebar=True, default_button_element_size=(12, 1)) + form.Layout(layout) + while True: button, values = form.Read() if button is None or button == 'Exit': diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 40878f2f4..bcc53e55d 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -4,7 +4,6 @@ import PySimpleGUI as sg -form = sg.FlexForm("Font size selector") fontSize = 12 @@ -12,6 +11,7 @@ sg.Slider(range=(6,172), orientation='h', size=(10,20), change_submits=True, key='slider', font=('Helvetica 20')), sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize +form = sg.FlexForm("Font size selector", grab_anywhere=False) form.Layout(layout) while True: button, values= form.Read() diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index 8debc1cb1..23c7c501c 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -14,7 +14,7 @@ def RemoteControlExample(): image_left = 'ButtonGraphics/RobotLeft.png' image_right = 'ButtonGraphics/RobotRight.png' sg.SetOptions(border_width=0, button_color=('black', back), background_color=back, element_background_color=back, text_element_background_color=back) - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) status_display_elem = sg.T('', justification='center', size=(19,1)) form_rows = [[sg.Text('Robotics Remote Control')], [status_display_elem], @@ -49,7 +49,7 @@ def RemoteControlExample(): def RemoteControlExample_NoGraphics(): # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) status_display_elem = sg.T('', justification='center', size=(19,1)) form_rows = [[sg.Text('Robotics Remote Control', justification='center')], [status_display_elem], diff --git a/Demo_Timer.py b/Demo_Timer.py index 9031af18c..1f76d1e51 100644 --- a/Demo_Timer.py +++ b/Demo_Timer.py @@ -4,36 +4,31 @@ # form that doen't block # good for applications with an loop that polls hardware def Timer(): - sg.ChangeLookAndFeel('TealMono') + sg.ChangeLookAndFeel('Dark') # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) + form = sg.FlexForm('Running Timer', grab_anywhere=False, no_titlebar=True, auto_size_buttons=False) # Create a text element that will be updated with status information on the GUI itself # Create the rows form_rows = [[sg.Text('Stopwatch')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause/Resume'), sg.ReadFormButton('Reset')]] + [sg.ReadFormButton('Pause'), sg.ReadFormButton('Reset'), sg.Exit()]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh. + form.Layout(form_rows) # # your program's main loop i = 0 paused = False while (True): # This is the code that reads and updates your window - form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) button, values = form.ReadNonBlocking() + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - if values is None: + if values is None or button == 'Exit': break if button is 'Reset': i=0 - elif button is 'Pause/Resume': + elif button is 'Pause': paused = not paused if not paused: From 32787277447fd672519c910d514b730d1767f3a9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 13:25:56 -0400 Subject: [PATCH 318/521] Added ability to disable a Combobox... can also create as disabled --- PySimpleGUI.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 393a690a2..b8698561f 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -298,7 +298,7 @@ def __del__(self): # Combo # # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, change_submits=False, key=None, pad=None): + def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, change_submits=False, disabled=False, key=None, pad=None): ''' Input Combo Box Element (also called Dropdown box) :param values: @@ -309,14 +309,15 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N ''' self.Values = values self.DefaultValue = default_value - self.TKComboBox = None self.ChangeSubmits = change_submits + self.TKCombo = None + self.InitializeAsDisabled = disabled bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value=None, values=None): + def Update(self, value=None, values=None, disabled=False): if values is not None: try: self.TKCombo['values'] = values @@ -324,6 +325,8 @@ def Update(self, value=None, values=None): except: pass self.Values = values + self.TKCombo['state'] = 'disable' if disabled else 'enable' + for index, v in enumerate(self.Values): if v == value: try: @@ -335,7 +338,7 @@ def Update(self, value=None, values=None): def __del__(self): try: - self.TKComboBox.__del__() + self.TKCombo.__del__() except: pass super().__del__() @@ -2302,6 +2305,8 @@ def CharWidthInPixels(): element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) # element.TKCombo['state']='readonly' element.TKCombo['values'] = element.Values + if element.InitializeAsDisabled: + element.TKCombo['state'] = 'disabled' # if element.BackgroundColor is not None: # element.TKCombo.configure(background=element.BackgroundColor) element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) From 54e249de59159c4bdfec85f4b6a6d96c9ddc6a81 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 16:37:50 -0400 Subject: [PATCH 319/521] NEW Color Chooser Button --- PySimpleGUI.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b8698561f..d13aea9d6 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,6 +1,7 @@ #!/usr/bin/env 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 @@ -141,6 +142,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) BUTTON_TYPE_READ_FORM = 7 BUTTON_TYPE_REALTIME = 9 BUTTON_TYPE_CALENDAR_CHOOSER = 30 +BUTTON_TYPE_COLOR_CHOOSER = 40 # ------------------------- Element types ------------------------- # # class ElementType(Enum): @@ -853,6 +855,10 @@ def ButtonCallBack(self): file_name = tk.filedialog.askopenfilename(filetypes=filetypes) # show the 'get file' dialog box 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 + strvar.set(color) + self.TKStringVar.set(color) elif self.BType == BUTTON_TYPE_BROWSE_FILES: file_name = tk.filedialog.askopenfilenames(filetypes=filetypes) file_name = ';'.join(file_name) @@ -1878,9 +1884,13 @@ def RealtimeButton(button_text, image_filename=None, image_size=(None, None),ima # ------------------------- Dummy BUTTON Element lazy function ------------------------- # def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) -# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +# ------------------------- Calendar Chooser Button lazy function ------------------------- # def CalendarButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- Calendar Chooser Button lazy function ------------------------- # +def ColorChooserButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_COLOR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ##################################### ----- RESULTS ------ ################################################## def AddToReturnDictionary(form, element, value): @@ -2013,6 +2023,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER) or \ + (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_COLOR_CHOOSER) or \ (element.Type == ELEM_TYPE_BUTTON and element.Key is not None and (element.BType in (BUTTON_TYPE_SAVEAS_FILE, BUTTON_TYPE_BROWSE_FILE, BUTTON_TYPE_BROWSE_FILES, BUTTON_TYPE_BROWSE_FOLDER))): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) From 5a2aa66934a4889c738b19377f2cfdb65a0af4d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 18:04:23 -0400 Subject: [PATCH 320/521] RELEASE 3.0 --- Demo_Cookbook_Browser.py | 8 ++- Demo_DOC_Viewer_PIL.py | 4 +- Demo_Font_Sizer.py | 4 -- Demo_Timer.py | 5 +- docs/index.md | 116 +++++++++++++++++++++++++++++++++++++-- readme.md | 116 +++++++++++++++++++++++++++++++++++++-- 6 files changed, 232 insertions(+), 21 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 2207db3fc..70351f515 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -757,17 +757,19 @@ def TightLayout(): while True: sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0,0)) + col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), change_submits=True, key='func')], - [sg.SimpleButton('Run'), sg.Exit()]] + [sg.SimpleButton('Run', pad=((30,0),0)), sg.Exit(button_color=('white', 'firebrick4'))]] layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], - [sg.Column(col_listbox, pad=(5,(3,2))), sg.Multiline(size=(70,35), do_not_clear=True, key='multi')], + [sg.Column(col_listbox), sg.Multiline(size=(70,35), do_not_clear=True, key='multi')], ] # create the form and show it without the plot # form.Layout(layout) - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(8,2),auto_size_buttons=False) + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(10,1),auto_size_buttons=False, no_titlebar=True) button, values = form.LayoutAndRead(layout) # show it all again and get buttons while True: diff --git a/Demo_DOC_Viewer_PIL.py b/Demo_DOC_Viewer_PIL.py index 3c170f3cd..423be3eef 100644 --- a/Demo_DOC_Viewer_PIL.py +++ b/Demo_DOC_Viewer_PIL.py @@ -52,7 +52,7 @@ fname = sys.argv[1] if not fname: - sg.MsgBox("Cancelling:", "No filename supplied") + sg.Popup("Cancelling:", "No filename supplied") raise SystemExit("Cancelled: no filename supplied") doc = fitz.open(fname) @@ -122,7 +122,7 @@ def get_page(pno, zoom = False, max_size = None, first = False): del root form = sg.FlexForm(title, return_keyboard_events = True, - location = (0,0), use_default_focus = False, no_titlebar=True) + location = (0,0), use_default_focus = False, no_titlebar=False) cur_page = 0 data, clip_pos = get_page(cur_page, diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index bcc53e55d..e79e686e4 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -3,13 +3,9 @@ # that adjusts the size of text displayed import PySimpleGUI as sg - - fontSize = 12 - layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), sg.Slider(range=(6,172), orientation='h', size=(10,20), change_submits=True, key='slider', font=('Helvetica 20')), sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] - sz = fontSize form = sg.FlexForm("Font size selector", grab_anywhere=False) form.Layout(layout) diff --git a/Demo_Timer.py b/Demo_Timer.py index 1f76d1e51..8aa1d5fdd 100644 --- a/Demo_Timer.py +++ b/Demo_Timer.py @@ -5,13 +5,14 @@ # good for applications with an loop that polls hardware def Timer(): sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0,0)) # Make a form, but don't use context manager form = sg.FlexForm('Running Timer', grab_anywhere=False, no_titlebar=True, auto_size_buttons=False) # Create a text element that will be updated with status information on the GUI itself # Create the rows - form_rows = [[sg.Text('Stopwatch')], + form_rows = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause'), sg.ReadFormButton('Reset'), sg.Exit()]] + [sg.ReadFormButton('Pause'), sg.ReadFormButton('Reset'), sg.Exit(button_color=('white','firebrick4'))]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form.Layout(form_rows) # diff --git a/docs/index.md b/docs/index.md index 5f19987b7..0d1a0a463 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 2.30) + (Ver 3.00) @@ -823,7 +823,8 @@ This is the definition of the FlexForm object: return_keyboard_events=False, use_default_focus=True, text_justification=None, - no_titlebar=False): + no_titlebar=False, + grab_anywhere=True): Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. @@ -847,6 +848,7 @@ Parameter Descriptions. You will find these same parameters specified for each use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar + grab_anywhere - Grab any location on the window to move the window #### Window Location @@ -1234,6 +1236,8 @@ The Types of buttons include: * Close Form * Read Form * Realtime +* Calendar Chooser +* Color Chooser Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. @@ -1242,6 +1246,10 @@ Folder Browse - When clicked a folder browse dialog box is opened. The results File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. +Calendar Chooser - Opens a graphical calendar to select a date. + +Color Chooser - Opens a color chooser dialog + Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. @@ -1281,10 +1289,13 @@ These Pre-made buttons are some of the most important elements of all because th ![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) + #### Button targets + +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. -The FileBrowse, FolderBrowse, FileSaveAs buttons all fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The default value for `targe` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. +If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value. Let's examine this form as an example: @@ -1303,6 +1314,33 @@ The code for the entire form could be: [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] +**Save & Open Buttons** + +There are 3 different types of File/Folder open dialog box available. If you are looking for a file to open, the `FileBrowse` is what you want. If you want to save a file, `SaveAs` is the button. If you want to get a folder name, then `FolderBrowse` is the button to use. + + +![open](https://user-images.githubusercontent.com/13696193/45243804-2b529780-b2c3-11e8-90dc-6c9061db2a1e.jpg) + + +![folder](https://user-images.githubusercontent.com/13696193/45243805-2b529780-b2c3-11e8-95ee-fec3c0b11319.jpg) + + +![saveas](https://user-images.githubusercontent.com/13696193/45243807-2beb2e00-b2c3-11e8-8549-ba71cdc05951.jpg) + + + +**Calendar Buttons** + +These buttons pop up a calendar chooser window. The chosen date is returned as a string. + +![calendar](https://user-images.githubusercontent.com/13696193/45243374-99965a80-b2c1-11e8-8311-49777835ca40.jpg) + +**Color Chooser Buttons** + +These buttons pop up a standard color chooser window. The result is returned as a tuple. One of the returned values is an RGB hex representation. + +![color](https://user-images.githubusercontent.com/13696193/45243375-99965a80-b2c1-11e8-9779-b71bed85fab6.jpg) + **Custom Buttons** Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. @@ -1405,8 +1443,10 @@ The return value for `EasyProgressMeter` is: `True` if meter updated correctly `False` if user clicked the Cancel button, closed the form, or vale reached the max value. **Customized Progress Bar** + If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + You setup the progress meter by calling my_meter = ProgressMeter(title, @@ -1433,6 +1473,30 @@ Putting it all together you get this design pattern The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) + + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form` + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + #### Output The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. @@ -1786,7 +1850,26 @@ Use realtime keyboard capture by calling elif value is None: break +## Updating Elements + +This is a somewhat advanced topic... + +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. + +In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. + +Here's the key's version.... +We have an InputText field that we want to update. When the Element was created we used this call: + + sg.Input(key='input') +To update or change the value for that Input Element, we use this contruct: + + form.FindElement('input').Update('new text') + +Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. + +See the Font Sizer demo for example source code. ## Sample Applications @@ -1796,6 +1879,8 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |--|--| |**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form |**Demo_Borderless_Window.py**| Create clean looking windows with no border +|**Demo_Button_States.py**| One way of implementing disabling of buttons +|**Demo_Calendar.py** | Demo of the Calendar Chooser button |**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project @@ -1804,11 +1889,15 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form |**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk +|**Demo Font Sizer.py** | Demonstrates Elements updating other Elements |**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them |**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors |**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files |**Demo_Keyboard.py** | Using blocking keyboard events |**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events |**Demo_Machine_Learning.py** | A sample Machine Learning front end @@ -1819,13 +1908,18 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices |**Demo_NonBlocking_Form.py** | a basic async form +|** Demo_OpenCV.py** | Integrated with OpenCV +|** Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_Pi_LEDs.py** | Control GPIO using buttons |**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons |**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files |**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook |**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature +|**Demo_Table_Simulation.py** | Use input fields to display and edit tables +|**Demo_Timer.py** | Simple non-blocking form ## Packages Used In Demos @@ -1931,6 +2025,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel settin | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk +| 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option ### Release Notes @@ -1950,11 +2045,19 @@ Listboxes are still without scrollwheels. The mouse can drag to see more items. 2.9 COLUMNS! This is the biggest feature and had the biggest impact on the code base. It was a difficult feature to add, but it was worth it. Can now make even more layouts. Almost any layout is possible with this addition. +.................. insert releases 2.9 to 2.30 ................. + +3.0 We've come a long way baby! Time for a major revision bump. One reason is that the numbers started to confuse people the latest release was 2.30, but some people read it as 2.3 and thought it went backwards. I kinda messed up the 2.x series of numbers, so why not start with a clean slate. A lot has happened anyway so it's well earned. + +One change that will set PySimpleGUI apart is the parlor trick of being able to move the window by clicking on it anywhere. This is turned on by default. It's not a common way to interact with windows. Normally you have to move using the titlebar. Not so with PySimpleGUI. Now you can drag using any part of the window. You will want to turn this off for windows with sliders. This feature is enabled in the FlexForm call. + +Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to FlexForm. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. + ### Upcoming Make suggestions people! Future release features -Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. WxPython is higher priority. @@ -1986,6 +2089,8 @@ It seemed quite natural to use Python's powerful list constructs when possible. **Dictionaries** Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. +You can also look up elements using their keys. This is an excellent way to update elements in reaction to another element. Call `form.FindElement(key)` to get the Element. + ## Author MikeTheWatchGuy @@ -2034,3 +2139,4 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + diff --git a/readme.md b/readme.md index 5f19987b7..0d1a0a463 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 2.30) + (Ver 3.00) @@ -823,7 +823,8 @@ This is the definition of the FlexForm object: return_keyboard_events=False, use_default_focus=True, text_justification=None, - no_titlebar=False): + no_titlebar=False, + grab_anywhere=True): Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. @@ -847,6 +848,7 @@ Parameter Descriptions. You will find these same parameters specified for each use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar + grab_anywhere - Grab any location on the window to move the window #### Window Location @@ -1234,6 +1236,8 @@ The Types of buttons include: * Close Form * Read Form * Realtime +* Calendar Chooser +* Color Chooser Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. @@ -1242,6 +1246,10 @@ Folder Browse - When clicked a folder browse dialog box is opened. The results File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. +Calendar Chooser - Opens a graphical calendar to select a date. + +Color Chooser - Opens a color chooser dialog + Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. @@ -1281,10 +1289,13 @@ These Pre-made buttons are some of the most important elements of all because th ![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) + #### Button targets + +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. -The FileBrowse, FolderBrowse, FileSaveAs buttons all fill-in values into a text input field somewhere on the form. The location of the TextInput element is specified by the `Target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The default value for `targe` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. -The default value for `Target` is `(ThisRow, -1)`. ThisRow is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. +If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value. Let's examine this form as an example: @@ -1303,6 +1314,33 @@ The code for the entire form could be: [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] +**Save & Open Buttons** + +There are 3 different types of File/Folder open dialog box available. If you are looking for a file to open, the `FileBrowse` is what you want. If you want to save a file, `SaveAs` is the button. If you want to get a folder name, then `FolderBrowse` is the button to use. + + +![open](https://user-images.githubusercontent.com/13696193/45243804-2b529780-b2c3-11e8-90dc-6c9061db2a1e.jpg) + + +![folder](https://user-images.githubusercontent.com/13696193/45243805-2b529780-b2c3-11e8-95ee-fec3c0b11319.jpg) + + +![saveas](https://user-images.githubusercontent.com/13696193/45243807-2beb2e00-b2c3-11e8-8549-ba71cdc05951.jpg) + + + +**Calendar Buttons** + +These buttons pop up a calendar chooser window. The chosen date is returned as a string. + +![calendar](https://user-images.githubusercontent.com/13696193/45243374-99965a80-b2c1-11e8-8311-49777835ca40.jpg) + +**Color Chooser Buttons** + +These buttons pop up a standard color chooser window. The result is returned as a tuple. One of the returned values is an RGB hex representation. + +![color](https://user-images.githubusercontent.com/13696193/45243375-99965a80-b2c1-11e8-9779-b71bed85fab6.jpg) + **Custom Buttons** Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. @@ -1405,8 +1443,10 @@ The return value for `EasyProgressMeter` is: `True` if meter updated correctly `False` if user clicked the Cancel button, closed the form, or vale reached the max value. **Customized Progress Bar** + If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. + You setup the progress meter by calling my_meter = ProgressMeter(title, @@ -1433,6 +1473,30 @@ Putting it all together you get this design pattern The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) + + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form` + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + #### Output The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. @@ -1786,7 +1850,26 @@ Use realtime keyboard capture by calling elif value is None: break +## Updating Elements + +This is a somewhat advanced topic... + +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. + +In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. + +Here's the key's version.... +We have an InputText field that we want to update. When the Element was created we used this call: + + sg.Input(key='input') +To update or change the value for that Input Element, we use this contruct: + + form.FindElement('input').Update('new text') + +Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. + +See the Font Sizer demo for example source code. ## Sample Applications @@ -1796,6 +1879,8 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |--|--| |**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form |**Demo_Borderless_Window.py**| Create clean looking windows with no border +|**Demo_Button_States.py**| One way of implementing disabling of buttons +|**Demo_Calendar.py** | Demo of the Calendar Chooser button |**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project @@ -1804,11 +1889,15 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form |**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk +|**Demo Font Sizer.py** | Demonstrates Elements updating other Elements |**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them |**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors |**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files |**Demo_Keyboard.py** | Using blocking keyboard events |**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events |**Demo_Machine_Learning.py** | A sample Machine Learning front end @@ -1819,13 +1908,18 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices |**Demo_NonBlocking_Form.py** | a basic async form +|** Demo_OpenCV.py** | Integrated with OpenCV +|** Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_Pi_LEDs.py** | Control GPIO using buttons |**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons |**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files |**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook |**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature +|**Demo_Table_Simulation.py** | Use input fields to display and edit tables +|**Demo_Timer.py** | Simple non-blocking form ## Packages Used In Demos @@ -1931,6 +2025,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.11.0 | Aug 29, 2018 - Lots of little changes that are needed for the demo programs to work. Buttons have their own default element size, fix for Mac default button color, padding support for all elements, option to immediately return if list box gets selected, FilesBrowse button, Canvas Element, Frame Element, Slider resolution option, Form.Refresh method, better text wrapping, 'SystemDefault' look and feel settin | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk +| 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option ### Release Notes @@ -1950,11 +2045,19 @@ Listboxes are still without scrollwheels. The mouse can drag to see more items. 2.9 COLUMNS! This is the biggest feature and had the biggest impact on the code base. It was a difficult feature to add, but it was worth it. Can now make even more layouts. Almost any layout is possible with this addition. +.................. insert releases 2.9 to 2.30 ................. + +3.0 We've come a long way baby! Time for a major revision bump. One reason is that the numbers started to confuse people the latest release was 2.30, but some people read it as 2.3 and thought it went backwards. I kinda messed up the 2.x series of numbers, so why not start with a clean slate. A lot has happened anyway so it's well earned. + +One change that will set PySimpleGUI apart is the parlor trick of being able to move the window by clicking on it anywhere. This is turned on by default. It's not a common way to interact with windows. Normally you have to move using the titlebar. Not so with PySimpleGUI. Now you can drag using any part of the window. You will want to turn this off for windows with sliders. This feature is enabled in the FlexForm call. + +Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to FlexForm. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. + ### Upcoming Make suggestions people! Future release features -Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. +Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. WxPython is higher priority. @@ -1986,6 +2089,8 @@ It seemed quite natural to use Python's powerful list constructs when possible. **Dictionaries** Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. +You can also look up elements using their keys. This is an excellent way to update elements in reaction to another element. Call `form.FindElement(key)` to get the Element. + ## Author MikeTheWatchGuy @@ -2034,3 +2139,4 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + From b6cb352cb34b2831c473aad67c4665bab69b9205 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 21:12:57 -0400 Subject: [PATCH 321/521] Credit for window move code --- docs/index.md | 1 + readme.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/index.md b/docs/index.md index 0d1a0a463..2ba4bc29b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2110,6 +2110,7 @@ GNU Lesser General Public License (LGPL 3) + * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub +* [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. ## How Do I diff --git a/readme.md b/readme.md index 0d1a0a463..2ba4bc29b 100644 --- a/readme.md +++ b/readme.md @@ -2110,6 +2110,7 @@ GNU Lesser General Public License (LGPL 3) + * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub +* [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. ## How Do I From aaedeae32696f824be6890dafb17fde7139b803a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 22:13:15 -0400 Subject: [PATCH 322/521] New feature - keep_on_top setting in FlexForm --- Demo_All_Widgets.py | 2 ++ Demo_Cookbook_Browser.py | 7 ++++--- PySimpleGUI.py | 9 ++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 15d81ce3c..39a21ef35 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -1,3 +1,5 @@ +#!/usr/bin/env Python3 + import PySimpleGUI as sg diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 70351f515..2442e5b02 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -431,9 +431,10 @@ def Launcher(): def ExecuteCommandSubprocess(command, *args): try: - expanded_args = [] - for a in args: - expanded_args += a + # expanded_args = [] + # for a in args: + # expanded_args += a + expanded_args = [*args] sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() if out: diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d13aea9d6..94eea372c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1433,7 +1433,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -1475,6 +1475,7 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.TextJustification = text_justification self.NoTitleBar = no_titlebar self.GrabAnywhere = grab_anywhere + self.KeepOnTop = keep_on_top # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -1647,7 +1648,6 @@ def GetScreenDimensions(self): return screen_width, screen_height - def StartMove(self, event): try: self.TKroot.x = event.x @@ -2666,15 +2666,14 @@ def StartupTK(my_flex_form): _my_windows.Increment() my_flex_form.TKroot = root - # Make moveable window if my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere: root.bind("", my_flex_form.StartMove) root.bind("", my_flex_form.StopMove) root.bind("", my_flex_form.OnMotion) - - + if my_flex_form.KeepOnTop: + root.wm_attributes("-topmost", 1) # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) # root.bind('', MyFlexForm.DestroyedCallback()) From ceb09ae62ce1d5342497039094aa96335d2d2de5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 23:15:49 -0400 Subject: [PATCH 323/521] Fixed broken realtime buttons --- PySimpleGUI.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 94eea372c..333689961 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -815,12 +815,16 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) return + # Realtime button release callback def ButtonReleaseCallBack(self, parm): r, c = self.Position + self.LastButtonClickedWasRealtime = False self.ParentForm.LastButtonClicked = None + # Realtime button callback def ButtonPressCallBack(self, parm): r, c = self.Position + self.ParentForm.LastButtonClickedWasRealtime = True self.ParentForm.LastButtonClicked = self.ButtonText # ------- Button Callback ------- # @@ -1468,6 +1472,7 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.ReturnValuesDictionary = {} self.DictionaryKeyCounter = 0 self.LastButtonClicked = None + self.LastButtonClickedWasRealtime = False self.UseDictionary = False self.UseDefaultFocus = use_default_focus self.ReturnKeyboardEvents = return_keyboard_events @@ -1936,7 +1941,8 @@ def BuildResults(form, initialize_only, top_level_form): form.ReturnValuesDictionary = {} form.ReturnValuesList = [] BuildResultsForSubform(form, initialize_only, top_level_form) - top_level_form.LastButtonClicked = None + if not top_level_form.LastButtonClickedWasRealtime: + top_level_form.LastButtonClicked = None return form.ReturnValues def BuildResultsForSubform(form, initialize_only, top_level_form): From a968100ab8ef2b11b6d7af0088ecd62aa0d51c14 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 23:23:45 -0400 Subject: [PATCH 324/521] Various fixes --- Demo_Cookbook_Browser.py | 13 ++++++------- Demo_NonBlocking_Form.py | 2 +- Demo_Pi_Robotics.py | 29 ++++++++++++++++------------- Demo_Script_Launcher.py | 13 ++++++++++--- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 2442e5b02..99a1fbee9 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -274,7 +274,7 @@ def RealtimeButtons(): import PySimpleGUI as sg # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) form_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' ' * 10), sg.RealtimeButton('Forward')], @@ -431,10 +431,9 @@ def Launcher(): def ExecuteCommandSubprocess(command, *args): try: - # expanded_args = [] - # for a in args: - # expanded_args += a - expanded_args = [*args] + expanded_args = [] + for a in args: + expanded_args += a sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() if out: @@ -757,8 +756,8 @@ def TightLayout(): listbox_values = [key for key in fig_dict.keys()] while True: - sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0,0)) + # sg.ChangeLookAndFeel('Dark') + # sg.SetOptions(element_padding=(0,0)) col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), change_submits=True, key='func')], [sg.SimpleButton('Run', pad=((30,0),0)), sg.Exit(button_color=('white', 'firebrick4'))]] diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 05006d16f..09071a6b9 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -97,9 +97,9 @@ def StatusOutputExample_context_manager(): form.CloseNonBlockingForm() def main(): - StatusOutputExample() RemoteControlExample() StatusOutputExample() + StatusOutputExample() sg.MsgBox('End of non-blocking demonstration') # StatusOutputExample_context_manager() diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index 23c7c501c..e7efa24b2 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -8,19 +8,22 @@ def RemoteControlExample(): # Make a form, but don't use context manager + sg.SetOptions(element_padding=(0,0)) back ='#eeeeee' image_forward = 'ButtonGraphics/RobotForward.png' image_backward = 'ButtonGraphics/RobotBack.png' image_left = 'ButtonGraphics/RobotLeft.png' image_right = 'ButtonGraphics/RobotRight.png' + sg.SetOptions(border_width=0, button_color=('black', back), background_color=back, element_background_color=back, text_element_background_color=back) + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) - status_display_elem = sg.T('', justification='center', size=(19,1)) + form_rows = [[sg.Text('Robotics Remote Control')], - [status_display_elem], - [sg.T(' '*6), sg.RealtimeButton('Forward', image_filename=image_forward)], - [ sg.RealtimeButton('Left', image_filename=image_left), sg.T(' '), sg.RealtimeButton('Right', image_filename=image_right)], - [sg.T(' '*6), sg.RealtimeButton('Reverse', image_filename=image_backward)], + [sg.T('', justification='center', size=(19,1), key='status')], + [ sg.RealtimeButton('Forward', image_filename=image_forward, pad=((50,0),0))], + [ sg.RealtimeButton('Left', image_filename=image_left), sg.RealtimeButton('Right', image_filename=image_right, pad=((50,0), 0))], + [ sg.RealtimeButton('Reverse', image_filename=image_backward, pad=((50,0),0))], [sg.T('')], [sg.Quit(button_color=('black', 'orange'))] ] @@ -37,9 +40,9 @@ def RemoteControlExample(): # This is the code that reads and updates your window button, values = form.ReadNonBlocking() if button is not None: - status_display_elem.Update(button) + form.FindElement('status').Update(button) else: - status_display_elem.Update('') + form.FindElement('status').Update('') # if user clicked quit button OR closed the form using the X, then break out of loop if button == 'Quit' or values is None: break @@ -50,11 +53,11 @@ def RemoteControlExample(): def RemoteControlExample_NoGraphics(): # Make a form, but don't use context manager form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) - status_display_elem = sg.T('', justification='center', size=(19,1)) + form_rows = [[sg.Text('Robotics Remote Control', justification='center')], - [status_display_elem], + [sg.T('', justification='center', size=(19,1), key='status')], [sg.T(' '*8), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '), sg.RealtimeButton('Right')], + [ sg.RealtimeButton('Left'), sg.T(' '), sg.RealtimeButton('Right')], [sg.T(' '*8), sg.RealtimeButton('Reverse')], [sg.T('')], [sg.Quit(button_color=('black', 'orange'))] @@ -72,9 +75,9 @@ def RemoteControlExample_NoGraphics(): # This is the code that reads and updates your window button, values = form.ReadNonBlocking() if button is not None: - status_display_elem.Update(button) + form.FindElement('status').Update(button) else: - status_display_elem.Update('') + form.FindElement('status').Update('') # if user clicked quit button OR closed the form using the X, then break out of loop if button == 'Quit' or values is None: break @@ -89,7 +92,7 @@ def main(): RemoteControlExample_NoGraphics() # Uncomment to get the fancy graphics version. Be sure and download the button images! RemoteControlExample() - sg.MsgBox('End of non-blocking demonstration') + # sg.Popup('End of non-blocking demonstration') if __name__ == '__main__': diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 9c7f65c84..9260ff2cc 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -3,12 +3,16 @@ import ntpath import subprocess -LOCATION_OF_YOUR_SCRIPTS = 'C:/Python/PycharmProjects/GooeyGUI/' +LOCATION_OF_YOUR_SCRIPTS = '' # Execute the command. Will not see the output from the command until it completes. def execute_command_blocking(command, *args): + expanded_args = [] + for a in args: + expanded_args.append(a) + # expanded_args += a try: - sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() if out: print(out.decode("utf-8")) @@ -20,8 +24,11 @@ def execute_command_blocking(command, *args): # Executes command and immediately returns. Will not see anything the script outputs def execute_command_nonblocking(command, *args): + expanded_args = [] + for a in args: + expanded_args += a try: - sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) except: pass def Launcher2(): From 96f7bfce45277acd3bbf674dd158c390809878d8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 7 Sep 2018 23:54:34 -0400 Subject: [PATCH 325/521] Added color chooser --- Demo_Color.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Demo_Color.py b/Demo_Color.py index e27365a6c..cfc22bee9 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1674,17 +1674,18 @@ def main(): list_of_colors = [c for c in colors] printable = '\n'.join(map(str, list_of_colors)) # show_all_colors_on_buttons() + sg.SetOptions(element_padding=(0,0)) while True: # ------- Form show ------- # layout = [[sg.Text('Find color')], [sg.Text('Demonstration of colors')], [sg.Text('Enter a color name in text or hex #RRGGBB format')], - [sg.InputText()], - [sg.Listbox(list_of_colors, size=(20, 30)), sg.T('Or choose from list')], - [sg.Submit(), sg.Quit(), sg.SimpleButton('Show me lots of colors!', button_color=('white', '#0e6251'))], + [sg.InputText(key='hex')], + [sg.Listbox(list_of_colors, size=(20, 30), key='listbox'), sg.T('Or choose from list')], + [sg.Submit(), sg.SimpleButton('Many buttons', button_color=('white', '#0e6251')), sg.ColorChooserButton( 'Chooser', target=(3,0)), sg.Quit(),], ] # [g.Multiline(DefaultText=str(printable), Size=(30,20))]] - (button, (hex_input, drop_down_value)) = sg.FlexForm('Color Demo', auto_size_text=True, icon=MY_WINDOW_ICON).LayoutAndRead(layout) + button, values = sg.FlexForm('Color Demo', auto_size_buttons=False).LayoutAndRead(layout) # ------- OUTPUT results portion ------- # if button == '' or button == 'Quit' or button is None: @@ -1692,13 +1693,16 @@ def main(): elif button == 'Show me lots of colors!': show_all_colors_on_buttons() - drop_down_value = drop_down_value[0] + drop_down_value = values['listbox'] + hex_input = values['hex'] + if hex_input == '' and len(drop_down_value) == 0: + continue if hex_input is not '' and hex_input[0] == '#': color_hex = hex_input.upper() color_name = get_name_from_hex(hex_input) - else: - color_name = drop_down_value + elif drop_down_value is not None: + color_name = drop_down_value[0] color_hex = get_hex_from_name(color_name) complementary_hex = get_complementary_hex(color_hex) From 8712c09e0863a1b2436a68cf15256deed4aa8811 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 01:12:43 -0400 Subject: [PATCH 326/521] Added correct sizing to ComboBoxes - how height matches user requested height --- Demo_Table_Simulation.py | 5 +++-- PySimpleGUI.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index 66f208c60..a96ef9554 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -14,10 +14,11 @@ def TableSimulation(): for i in range(20): inputs = [sg.In('{}{}'.format(i,j), size=(8, 1), pad=(1, 1), justification='right', key=(i,j), do_not_clear=True) for j in range(10)] - inputs = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info')), *inputs] + line = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info'))] + line.append(inputs) layout.append(inputs) - form = sg.FlexForm('Table', return_keyboard_events=True) + form = sg.FlexForm('Table', return_keyboard_events=True, grab_anywhere=False) form.Layout(layout) while True: diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 333689961..eb5d899f4 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -861,6 +861,7 @@ def ButtonCallBack(self): self.TKStringVar.set(file_name) elif self.BType == BUTTON_TYPE_COLOR_CHOOSER: color = tk.colorchooser.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: @@ -2028,8 +2029,8 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): element.Type!= ELEM_TYPE_COLUMN: AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) - elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER) or \ - (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_COLOR_CHOOSER) or \ + elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER and element.Target == (None,None)) or \ + (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_COLOR_CHOOSER and element.Target == (None,None)) or \ (element.Type == ELEM_TYPE_BUTTON and element.Key is not None and (element.BType in (BUTTON_TYPE_SAVEAS_FILE, BUTTON_TYPE_BROWSE_FILE, BUTTON_TYPE_BROWSE_FILES, BUTTON_TYPE_BROWSE_FOLDER))): AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) @@ -2320,6 +2321,8 @@ def CharWidthInPixels(): # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox combostyle.theme_use('combostyle') element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) + if element.Size[1] != 1 and element.Size[1] is not None: + element.TKCombo.configure(height=element.Size[1]) # element.TKCombo['state']='readonly' element.TKCombo['values'] = element.Values if element.InitializeAsDisabled: From 1268885f3c3f05adfd9d07c361ced9faac78ddae Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 13:54:28 -0400 Subject: [PATCH 327/521] TURNED OFF the grab_anywhere parameter for non-blocking forms. New #! line at top of file. Beginning of new Menu Element (in progress don't use) --- PySimpleGUI.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index eb5d899f4..1d9032ccb 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,4 +1,4 @@ -#!/usr/bin/env Python3 +#!/usr/bin/python3 import tkinter as tk from tkinter import filedialog from tkinter.colorchooser import askcolor @@ -12,8 +12,6 @@ import calendar - - # ----====----====----==== Constants the user CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = 'default_icon.ico' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS @@ -162,6 +160,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 ELEM_TYPE_COLUMN = 555 +ELEM_TYPE_MENU = 600 ELEM_TYPE_PROGRESS_BAR = 200 ELEM_TYPE_BLANK = 100 @@ -1218,7 +1217,6 @@ def __del__(self): # ---------------------------------------------------------------------- # # Calendar # # ---------------------------------------------------------------------- # - class TKCalendar(ttk.Frame): """ This code was shamelessly lifted from moshekaplan's repository - moshekaplan/tkinter_components @@ -1428,7 +1426,27 @@ def selection(self): return self.datetime(year, month, int(self._selection[0])) +# ---------------------------------------------------------------------- # +# Canvas # +# ---------------------------------------------------------------------- # +class Menu(Element): + def __init__(self, text, command=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.Command = command + self.Text = text + self.TKMenu = None + super().__init__(ELEM_TYPE_MENU, background_color=background_color, scale=scale, size=size, pad=pad, key=key) + return + + def MenuItemChosenCallback(self): + print('IN MENU ITEM CALLBACK') + self.ParentForm.LastButtonClicked = 'Menu' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def __del__(self): + super().__del__() # ------------------------------------------------------------------------- # @@ -2501,6 +2519,13 @@ def CharWidthInPixels(): if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKCanvas.configure(background=element.BackgroundColor) element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- Canvas element ------------------------- # + elif element_type == ELEM_TYPE_MENU: + element.TKMenu = tk.Menu(toplevel_form.TKroot) + filemenu = tk.Menu(element.TKMenu, tearoff=0) + filemenu.add_command(label="Open", command=element.MenuItemChosenCallback) + element.TKMenu.add_cascade(label="File", menu=filemenu) + toplevel_form.TKroot.configure(menu=element.TKMenu) # ------------------------- Frame element ------------------------- # elif element_type == ELEM_TYPE_FRAME: width, height = element_size @@ -2676,7 +2701,7 @@ def StartupTK(my_flex_form): my_flex_form.TKroot = root # Make moveable window - if my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere: + if (my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere) and not my_flex_form.NonBlocking: root.bind("", my_flex_form.StartMove) root.bind("", my_flex_form.StopMove) root.bind("", my_flex_form.OnMotion) From bd0bdd8c3baa088a3ab35f91f1ce3a9b64918e6a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 15:15:23 -0400 Subject: [PATCH 328/521] Bug fixes. Had to add a "Show Code" button to get around weird bug with select boxes returning on change --- Demo_Cookbook_Browser.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 99a1fbee9..6051c347f 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -274,7 +274,7 @@ def RealtimeButtons(): import PySimpleGUI as sg # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) form_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' ' * 10), sg.RealtimeButton('Forward')], @@ -759,21 +759,23 @@ def TightLayout(): # sg.ChangeLookAndFeel('Dark') # sg.SetOptions(element_padding=(0,0)) - col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), change_submits=True, key='func')], - [sg.SimpleButton('Run', pad=((30,0),0)), sg.Exit(button_color=('white', 'firebrick4'))]] + col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),min(len(listbox_values), 20)), change_submits=False, key='func')], + [sg.ReadFormButton('Run', pad=(0,0)), sg.ReadFormButton('Show Code', button_color=('white', 'gray25'), pad=(0,0)), sg.Exit(button_color=('white', 'firebrick4'), pad=(0,0))]] layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], - [sg.Column(col_listbox), sg.Multiline(size=(70,35), do_not_clear=True, key='multi')], + [sg.Column(col_listbox), sg.Multiline(size=(50,min(len(listbox_values), 20)), do_not_clear=True, key='multi')], ] # create the form and show it without the plot # form.Layout(layout) - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(10,1),auto_size_buttons=False, no_titlebar=True) - button, values = form.LayoutAndRead(layout) + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(9,1),auto_size_buttons=False, grab_anywhere=False) + form.Layout(layout) # show it all again and get buttons while True: - if button is None or button is 'Exit': + button, values = form.Read() + + if button is None or button == 'Exit': exit(69) try: choice = values['func'][0] @@ -781,12 +783,14 @@ def TightLayout(): except: continue - if button is '': + if button == 'Show Code' and values['multi']: form.FindElement('multi').Update(inspect.getsource(func)) - button, values = form.Read() - elif button is 'Run': + elif button is 'Run' and values['func']: # sg.ChangeLookAndFeel('SystemDefault') + form.CloseNonBlockingForm() func() break else: - button, values = form.Read() + print('ILLEGAL values') + break + From c9625b548b227c140737a86d3e1f01380f4e8cd3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 15:15:43 -0400 Subject: [PATCH 329/521] minor edit --- PySimpleGUI.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1d9032ccb..3652050ea 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -231,7 +231,6 @@ def ListboxSelectHandler(self, event): self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop - def ComboboxSelectHandler(self, event): MyForm = self.ParentForm # first, get the results table built From 699a6912d28f70ec2482548f83ce3adf40c70e6e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 15:32:38 -0400 Subject: [PATCH 330/521] grab_anywhere option now available for non-blocking forms, but defaults to False for non-blocking. More Cookbook cleanup --- Demo_Cookbook_Browser.py | 14 +++++++------- PySimpleGUI.py | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 6051c347f..0e7664913 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -108,7 +108,7 @@ def AllWidgetsWithContext(): # sg.ChangeLookAndFeel('GreenTan') - with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: + with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], @@ -140,7 +140,7 @@ def AllWidgetsNoContext(): # Green & tan color scheme sg.ChangeLookAndFeel('GreenTan') - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], @@ -274,7 +274,7 @@ def RealtimeButtons(): import PySimpleGUI as sg # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) + form = sg.FlexForm('Robotics Remote Control') form_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' ' * 10), sg.RealtimeButton('Forward')], @@ -319,8 +319,8 @@ def TabbedForm(): """ import PySimpleGUI as sg - with sg.FlexForm('', auto_size_text=True) as form: - with sg.FlexForm('', auto_size_text=True) as form2: + with sg.FlexForm('') as form: + with sg.FlexForm('') as form2: layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], @@ -352,7 +352,7 @@ def MediaPlayer(): image_exit = './ButtonGraphics/Exit.png' # 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', default_element_size=(20, 1), font=("Helvetica", 25)) # define layout of the rows layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], @@ -623,7 +623,7 @@ def CanvasWidget(): [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] ] - form = gui.FlexForm('Canvas test') + form = gui.FlexForm('Canvas test', grab_anywhere=True) form.Layout(layout) form.ReadNonBlocking() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3652050ea..3843414f0 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1455,7 +1455,7 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=None, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -2700,7 +2700,8 @@ def StartupTK(my_flex_form): my_flex_form.TKroot = root # Make moveable window - if (my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere) and not my_flex_form.NonBlocking: + if ((my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere in (None, True)) and not my_flex_form.NonBlocking) or \ + (my_flex_form.GrabAnywhere == True and my_flex_form.NonBlocking): root.bind("", my_flex_form.StartMove) root.bind("", my_flex_form.StopMove) root.bind("", my_flex_form.OnMotion) From ebb0dbb03a5a549cce2af7ff4e16c3c33987502d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 16:26:38 -0400 Subject: [PATCH 331/521] RELEASE 3.0.2 --- Demo_All_Widgets.py | 3 ++- Demo_Timer.py | 2 +- docs/index.md | 35 ++++++++++++++++++++++++++++++----- readme.md | 35 ++++++++++++++++++++++++++++++----- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 39a21ef35..0a89a42f3 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -40,5 +40,6 @@ def Everything(): sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) -Everything() +if __name__ == '__main__': + Everything() diff --git a/Demo_Timer.py b/Demo_Timer.py index 8aa1d5fdd..cff69f768 100644 --- a/Demo_Timer.py +++ b/Demo_Timer.py @@ -7,7 +7,7 @@ def Timer(): sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0,0)) # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', grab_anywhere=False, no_titlebar=True, auto_size_buttons=False) + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False) # Create a text element that will be updated with status information on the GUI itself # Create the rows form_rows = [[sg.Text('')], diff --git a/docs/index.md b/docs/index.md index 2ba4bc29b..e43b5e93e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.00) + (Ver 3.00.02) @@ -199,11 +199,11 @@ You will see a number of different styles of buttons, data entry fields, etc, in ### Installing - pip install PySimpleGUI -On some systems you need to run pip3. + pip install --upgrade PySimpleGUI +On some systems you need to run pip3. - pip3 install PySimpleGUI + pip3 install --upgrade PySimpleGUI On a Raspberry Pi, this is should work: @@ -824,7 +824,8 @@ This is the definition of the FlexForm object: use_default_focus=True, text_justification=None, no_titlebar=False, - grab_anywhere=True): + grab_anywhere=True + keep_on_top=False): Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. @@ -849,6 +850,7 @@ Parameter Descriptions. You will find these same parameters specified for each text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window + keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. #### Window Location @@ -865,6 +867,29 @@ In addition to `size` there is a `scale` option. `scale` will take the Element' There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. +#### No Titlebar + +Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. + +Be sure an provide your user an "exit" button or they will not be able to close the window! When no titlebar is enabled, there will be no icon on your taskbar for the window. Without an exit button you will need to kill via taskmanager... not fun. + +Windows with no titlebar rely on the grab anywhere option to be enabled or else you will be unable to move the window. + +Windows without a titlebar can be used to easily create a floating launcher. + + +![floating launcher](https://user-images.githubusercontent.com/13696193/45258246-71bafb80-b382-11e8-9f5e-79421e6c00bb.jpg) + + +#### Grab Anywhere + +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. + +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. + +#### Always on top + +To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. ## Elements diff --git a/readme.md b/readme.md index 2ba4bc29b..e43b5e93e 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.00) + (Ver 3.00.02) @@ -199,11 +199,11 @@ You will see a number of different styles of buttons, data entry fields, etc, in ### Installing - pip install PySimpleGUI -On some systems you need to run pip3. + pip install --upgrade PySimpleGUI +On some systems you need to run pip3. - pip3 install PySimpleGUI + pip3 install --upgrade PySimpleGUI On a Raspberry Pi, this is should work: @@ -824,7 +824,8 @@ This is the definition of the FlexForm object: use_default_focus=True, text_justification=None, no_titlebar=False, - grab_anywhere=True): + grab_anywhere=True + keep_on_top=False): Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. @@ -849,6 +850,7 @@ Parameter Descriptions. You will find these same parameters specified for each text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window + keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. #### Window Location @@ -865,6 +867,29 @@ In addition to `size` there is a `scale` option. `scale` will take the Element' There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. +#### No Titlebar + +Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. + +Be sure an provide your user an "exit" button or they will not be able to close the window! When no titlebar is enabled, there will be no icon on your taskbar for the window. Without an exit button you will need to kill via taskmanager... not fun. + +Windows with no titlebar rely on the grab anywhere option to be enabled or else you will be unable to move the window. + +Windows without a titlebar can be used to easily create a floating launcher. + + +![floating launcher](https://user-images.githubusercontent.com/13696193/45258246-71bafb80-b382-11e8-9f5e-79421e6c00bb.jpg) + + +#### Grab Anywhere + +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. + +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. + +#### Always on top + +To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. ## Elements From 0163597224621169b2713d5d75cf440a165d1ce1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 19:37:37 -0400 Subject: [PATCH 332/521] NEW Floating Toolbar demo --- Demo_Floating_Toolbar.py | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Demo_Floating_Toolbar.py diff --git a/Demo_Floating_Toolbar.py b/Demo_Floating_Toolbar.py new file mode 100644 index 000000000..5b17d327d --- /dev/null +++ b/Demo_Floating_Toolbar.py @@ -0,0 +1,77 @@ +import PySimpleGUI as sg +import subprocess +import os +import sys + +""" + Demo_Toolbar - A floating toolbar with quick launcher + + One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout + You can setup a specific program to launch when a button is clicked, or use the + Combobox to select a .py file found in the root folder, and run that file. + +""" + +ROOT_PATH = './' + +def Launcher(): + + def print(line): + form.FindElement('output').Update(line) + + sg.ChangeLookAndFeel('Dark') + + namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] + + sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) + layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), + sg.ReadFormButton('Run', button_color=('white', '#00168B')), + sg.ReadFormButton('Program 1'), + sg.ReadFormButton('Program 2'), + sg.ReadFormButton('Program 3', button_color=('white', '#35008B')), + sg.SimpleButton('EXIT', button_color=('white','firebrick3'))], + [sg.T('', text_color='white', size=(50,1), key='output')]] + + form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True) + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button is 'EXIT' or button is None: + break # exit button clicked + if button is 'Program 1': + print('Run your program 1 here!') + elif button is 'Program 2': + print('Run your program 2 here!') + elif button is 'Run': + file = value['demofile'] + print('Launching %s'%file) + ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) + else: + print(button) + +def ExecuteCommandSubprocess(command, *args, wait=False): + try: + if sys.platform == 'linux': + arg_string = '' + for arg in args: + arg_string += ' ' + str(arg) + sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if wait: + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + + +if __name__ == '__main__': + Launcher() + From 74bfa9bb149e9dfa70218e1af2d6b57dd08dcd74 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 8 Sep 2018 22:54:27 -0400 Subject: [PATCH 333/521] More about Async forms --- docs/index.md | 67 ++++++++++++++++++++++++++++++++++++++------------- readme.md | 67 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 100 insertions(+), 34 deletions(-) diff --git a/docs/index.md b/docs/index.md index e43b5e93e..f12346583 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1732,15 +1732,53 @@ The `ReadFormButton` Element creates a button that when clicked will return cont ## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. +So you want to be a wizard do ya? Well go boldly! -When do you use a non-blocking form? A couple of examples are +Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. + +When to use a non-blocking form: * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -Word of warning... starting with version 2.2 there is a change in the return values from the`ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. + + +### Instead of ReadNonBlocking --- Use `change_submits = True` + +Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. + +***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. + +**Examples** + + + +Or another example is you have an input field that changes as you press buttons on an on-screen keypad. + +![keypad 3](https://user-images.githubusercontent.com/13696193/45260275-a2198e80-b3b0-11e8-85fe-a4ce6484510f.jpg) + + +2. When a slider or a spinner moves it changes the size of the text somewhere on the form. + + +![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) + + +### Periodically Calling`ReadNonBlocking` + +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. + +There are 2 methods of interacting with non-blocking forms. +1. Read the form just as you would a normal form +2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values + + With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + + #### Exiting a Non-Blocking Form +Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. + The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: @@ -1748,22 +1786,21 @@ The proper code to check if the user has exited the form will be a polling-loop if values is None or button == 'Quit': break + We're going to build an app that does the latter. It's going to update our form with a running clock. The basic flow and functions you will be calling are: Setup - - form = FlexForm() form_rows = ..... form.LayoutAndRead(form_rows, non_blocking=True) - Periodic refresh - form.ReadNonBlocking() + form.ReadNonBlocking() or form.Refresh() + If you need to close the form form.CloseNonBlockingForm() @@ -1782,11 +1819,10 @@ See the sample code on the GitHub named Demo Media Player for another example of # form that doesn't block # Make a form, but don't use context manager form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows + + # Create the layout form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], [sg.SimpleButton('Quit')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form.LayoutAndRead(form_rows, non_blocking=True) @@ -1798,7 +1834,7 @@ See the sample code on the GitHub named Demo Media Player for another example of # for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break @@ -1807,17 +1843,14 @@ See the sample code on the GitHub named Demo Media Player for another example of form.CloseNonBlockingForm() - What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. -That's it... this example follows the async design pattern well. - ## Keyboard & Mouse Capture -Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call return_keyboard_events that is set to True in order to get keys returned along with buttons. +Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. Keys and scroll-wheel events are returned in exactly the same way as buttons. diff --git a/readme.md b/readme.md index e43b5e93e..f12346583 100644 --- a/readme.md +++ b/readme.md @@ -1732,15 +1732,53 @@ The `ReadFormButton` Element creates a button that when clicked will return cont ## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! While the majority of GUIs are a simple exercise to "collect input values and return with them", there are instances where we want to continue executing while the form is open. These are "asynchronous" forms and require special options, new SDK calls, and **great care**. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. +So you want to be a wizard do ya? Well go boldly! -When do you use a non-blocking form? A couple of examples are +Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. + +When to use a non-blocking form: * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -Word of warning... starting with version 2.2 there is a change in the return values from the`ReadNonBlocking` call. Previously the function returned 2 values, except when the form is closed using the "X" which returned a single value of `None`. The *new* way is that `ReadNonBlocking` always returns 2 values. If the user closed the form with the "X" then the return values will be None, None. You will want to key off the second value to catch this case. +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. + + +### Instead of ReadNonBlocking --- Use `change_submits = True` + +Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. + +***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. + +**Examples** + + + +Or another example is you have an input field that changes as you press buttons on an on-screen keypad. + +![keypad 3](https://user-images.githubusercontent.com/13696193/45260275-a2198e80-b3b0-11e8-85fe-a4ce6484510f.jpg) + + +2. When a slider or a spinner moves it changes the size of the text somewhere on the form. + + +![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) + + +### Periodically Calling`ReadNonBlocking` + +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. + +There are 2 methods of interacting with non-blocking forms. +1. Read the form just as you would a normal form +2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values + + With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + + #### Exiting a Non-Blocking Form +Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. + The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: @@ -1748,22 +1786,21 @@ The proper code to check if the user has exited the form will be a polling-loop if values is None or button == 'Quit': break + We're going to build an app that does the latter. It's going to update our form with a running clock. The basic flow and functions you will be calling are: Setup - - form = FlexForm() form_rows = ..... form.LayoutAndRead(form_rows, non_blocking=True) - Periodic refresh - form.ReadNonBlocking() + form.ReadNonBlocking() or form.Refresh() + If you need to close the form form.CloseNonBlockingForm() @@ -1782,11 +1819,10 @@ See the sample code on the GitHub named Demo Media Player for another example of # form that doesn't block # Make a form, but don't use context manager form = sg.FlexForm('Running Timer', auto_size_text=True) - # 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)) - # Create the rows + + # Create the layout form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], [sg.SimpleButton('Quit')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form.LayoutAndRead(form_rows, non_blocking=True) @@ -1798,7 +1834,7 @@ See the sample code on the GitHub named Demo Media Player for another example of # for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break @@ -1807,17 +1843,14 @@ See the sample code on the GitHub named Demo Media Player for another example of form.CloseNonBlockingForm() - What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. -That's it... this example follows the async design pattern well. - ## Keyboard & Mouse Capture -Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call return_keyboard_events that is set to True in order to get keys returned along with buttons. +Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. Keys and scroll-wheel events are returned in exactly the same way as buttons. From 4c0997736593c4ad563d13d9b3700ab57aa74a72 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 9 Sep 2018 12:22:45 -0400 Subject: [PATCH 334/521] Fix for Update of Button Element --- PySimpleGUI.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3843414f0..c9a00233c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -160,7 +160,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 ELEM_TYPE_COLUMN = 555 -ELEM_TYPE_MENU = 600 +ELEM_TYPE_MENUBAR = 600 ELEM_TYPE_PROGRESS_BAR = 200 ELEM_TYPE_BLANK = 100 @@ -922,6 +922,8 @@ def Update(self, value=None, new_text=None, button_color=(None, None)): self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: return + if new_text is not None: + self.ButtonText = new_text self.DefaultValue = value def __del__(self): @@ -1435,12 +1437,12 @@ def __init__(self, text, command=None, background_color=None, scale=(None, None) self.Text = text self.TKMenu = None - super().__init__(ELEM_TYPE_MENU, background_color=background_color, scale=scale, size=size, pad=pad, key=key) + super().__init__(ELEM_TYPE_MENUBAR, background_color=background_color, scale=scale, size=size, pad=pad, key=key) return - def MenuItemChosenCallback(self): - print('IN MENU ITEM CALLBACK') - self.ParentForm.LastButtonClicked = 'Menu' + def MenuItemChosenCallback(self, item_chosen): + # print('IN MENU ITEM CALLBACK', item_chosen) + self.ParentForm.LastButtonClicked = item_chosen self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop @@ -2518,12 +2520,15 @@ def CharWidthInPixels(): if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKCanvas.configure(background=element.BackgroundColor) element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - # ------------------------- Canvas element ------------------------- # - elif element_type == ELEM_TYPE_MENU: + # ------------------------- MENUBAR element ------------------------- # + elif element_type == ELEM_TYPE_MENUBAR: element.TKMenu = tk.Menu(toplevel_form.TKroot) filemenu = tk.Menu(element.TKMenu, tearoff=0) - filemenu.add_command(label="Open", command=element.MenuItemChosenCallback) + filemenu.add_command(label="Open", command=lambda: Menu.MenuItemChosenCallback(element,'Open')) element.TKMenu.add_cascade(label="File", menu=filemenu) + helpmenu = tk.Menu(element.TKMenu) + element.TKMenu.add_cascade(label='Help', menu=helpmenu) + helpmenu.add('command', label='About...', command=lambda: Menu.MenuItemChosenCallback(element, 'About...')) toplevel_form.TKroot.configure(menu=element.TKMenu) # ------------------------- Frame element ------------------------- # elif element_type == ELEM_TYPE_FRAME: From 03b21c4eca262a56a594ee806589ffa60474c120 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 9 Sep 2018 12:28:07 -0400 Subject: [PATCH 335/521] New Floating Timer Demo (Desktop Widget) --- Demo_Desktop_Widget_Timer.py | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Demo_Desktop_Widget_Timer.py diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py new file mode 100644 index 000000000..6fd26db51 --- /dev/null +++ b/Demo_Desktop_Widget_Timer.py @@ -0,0 +1,61 @@ +import PySimpleGUI as sg +import time + +""" + + Timer Desktop Widget + Creates a floating timer that is always on top of other windows + You move it by grabbing anywhere on the window + Good example of how to do a non-blocking, polling program using PySimpleGUI + +""" + + +# form that doen't block +# good for applications with an loop that polls hardware +def Timer(): + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0,0)) + # Make a form, but don't use context manager + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) + # Create a text element that will be updated with status information on the GUI itself + # Create the rows + form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadFormButton('Pause', key='button'), sg.ReadFormButton('Reset'), sg.Exit(button_color=('white','firebrick4'))]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.Layout(form_rows) + # + # your program's main loop + i = 0 + paused = False + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + #form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + x = divmod(i, 100) + y = divmod(x[0], 60) + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format(y[0], y[1], x[1])) + if values is None or button == 'Exit': + break + #print(button) + if button is 'Reset': + i=0 + elif button == 'Pause': + paused = True + element = form.FindElement('button') + element.Update(new_text='Run') + elif button == 'Run': + paused = False + element = form.FindElement('button') + element.Update(new_text='Pause') + + if not paused: + i += 1 + # Your code begins here + time.sleep(.01) + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + +Timer() \ No newline at end of file From cc71b7616111b990544019414cb98c802ed25622 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 9 Sep 2018 13:25:33 -0400 Subject: [PATCH 336/521] Compacted and commented code. Make more efficient by reading non-blocking only when timer is running --- Demo_Desktop_Widget_Timer.py | 49 +++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 6fd26db51..f9b771810 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -2,59 +2,68 @@ import time """ - Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI + Can be used to poll hardware when running on a Pi + NOTE - you will get a warning message printed when you exit using exit button. + It will look something like: + invalid command name "1616802625480StopMove" """ - -# form that doen't block -# good for applications with an loop that polls hardware def Timer(): + # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0,0)) # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - # Create a text element that will be updated with status information on the GUI itself - # Create the rows + # Create the form layout form_rows = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.ReadFormButton('Pause', key='button'), sg.ReadFormButton('Reset'), sg.Exit(button_color=('white','firebrick4'))]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) # - # your program's main loop - i = 0 + # ---------------- main loop ---------------- + current_time = 0 paused = False + start_time = int(round(time.time()*100)) while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - #form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - x = divmod(i, 100) - y = divmod(x[0], 60) - form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format(y[0], y[1], x[1])) + # --------- Read and update window -------- + if not paused: + button, values = form.ReadNonBlocking() + current_time = int(round(time.time()*100)) - start_time + else: + button, values = form.Read() + + # --------- Do Button Operations -------- if values is None or button == 'Exit': break - #print(button) if button is 'Reset': - i=0 + start_time = int(round(time.time()*100)) + current_time = 0 + paused_time = start_time elif button == 'Pause': paused = True + paused_time = int(round(time.time()*100)) element = form.FindElement('button') element.Update(new_text='Run') elif button == 'Run': paused = False + start_time = start_time + int(round(time.time()*100)) - paused_time element = form.FindElement('button') element.Update(new_text='Pause') - if not paused: - i += 1 - # Your code begins here + # --------- Display timer in window -------- + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + (current_time // 100) % 60, + current_time % 100)) time.sleep(.01) + # --------- After loop -------- + # Broke out of main loop. Close the window. form.CloseNonBlockingForm() From 38a18042eaa5e8b1934d665923cf640635b91f53 Mon Sep 17 00:00:00 2001 From: fluxrider Date: Sun, 9 Sep 2018 19:27:29 -0400 Subject: [PATCH 337/521] Listbox: in Update(), point to the new values. --- PySimpleGUI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c9a00233c..155e5e1d6 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -420,6 +420,7 @@ def Update(self, values): for item in values: self.TKListbox.insert(tk.END, item) self.TKListbox.selection_set(0, 0) + self.Values = values def SetValue(self, values): for index, item in enumerate(self.Values): From 9f4f7d125e0f7c5d5c8859f44107cb5850a3080f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 9 Sep 2018 23:22:10 -0400 Subject: [PATCH 338/521] MENUS! Updated Desktop Timer Widget --- Demo_Desktop_Widget_Timer.py | 4 +-- PySimpleGUI.py | 63 +++++++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index f9b771810..3fc230abd 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -15,13 +15,13 @@ def Timer(): # ---------------- Create Form ---------------- - sg.ChangeLookAndFeel('Dark') + sg.ChangeLookAndFeel('Black') sg.SetOptions(element_padding=(0,0)) # Make a form, but don't use context manager # Create the form layout form_rows = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause', key='button'), sg.ReadFormButton('Reset'), sg.Exit(button_color=('white','firebrick4'))]] + [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), sg.ReadFormButton('Reset', button_color=('white', '#007339')), sg.Exit(button_color=('white','firebrick4'))]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c9a00233c..d0548d632 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -922,8 +922,6 @@ def Update(self, value=None, new_text=None, button_color=(None, None)): self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: return - if new_text is not None: - self.ButtonText = new_text self.DefaultValue = value def __del__(self): @@ -1431,10 +1429,10 @@ def selection(self): # Canvas # # ---------------------------------------------------------------------- # class Menu(Element): - def __init__(self, text, command=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, menu_definition, command=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.Command = command - self.Text = text + self.MenuDefinition = menu_definition self.TKMenu = None super().__init__(ELEM_TYPE_MENUBAR, background_color=background_color, scale=scale, size=size, pad=pad, key=key) @@ -2117,6 +2115,41 @@ def _FindElementFromKeyInSubForm(form, key): return element +def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False): + if type(sub_menu_info) is str: + if not is_sub_menu and not skip: + # print(f'Adding command {sub_menu_info}') + top_menu.add_command(label=sub_menu_info, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + else: + i = 0 + while i < (len(sub_menu_info)): + item = sub_menu_info[i] + if i != len(sub_menu_info) - 1: + if type(sub_menu_info[i+1]) == list: + new_menu = tk.Menu(top_menu) + top_menu.add_cascade(label=sub_menu_info[i], menu=new_menu) + AddMenuItem(new_menu, sub_menu_info[i+1], element, is_sub_menu=True) + i += 1 # skip the next one + else: + AddMenuItem(top_menu, item, element) + else: + AddMenuItem(top_menu, item, element) + i += 1 + + + + + # print(f'Looping through {sub_menu_info}') + # print(f'Type is {type(sub_menu_info)}') + # if type(sub_menu_info[1]) is list: + # new_menu = tk.Menu(top_menu) + # top_menu.add_cascade(label=sub_menu_info[0], menu=new_menu) + # AddMenuItem(new_menu, sub_menu_info[1], element, is_sub_menu=True) + # else: + # for item in sub_menu_info: + # AddMenuItem(top_menu, item, element) + + # ------------------------------------------------------------------------------------------------------------------ # # ===================================== TK CODE STARTS HERE ====================================================== # # ------------------------------------------------------------------------------------------------------------------ # @@ -2522,13 +2555,21 @@ def CharWidthInPixels(): element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: - element.TKMenu = tk.Menu(toplevel_form.TKroot) - filemenu = tk.Menu(element.TKMenu, tearoff=0) - filemenu.add_command(label="Open", command=lambda: Menu.MenuItemChosenCallback(element,'Open')) - element.TKMenu.add_cascade(label="File", menu=filemenu) - helpmenu = tk.Menu(element.TKMenu) - element.TKMenu.add_cascade(label='Help', menu=helpmenu) - helpmenu.add('command', label='About...', command=lambda: Menu.MenuItemChosenCallback(element, 'About...')) + menu_def = (('File', ('Open', 'Save')), + ('Help', 'About...'),) + # ('Help',)) + + menu_def = element.MenuDefinition + + element.TKMenu = tk.Menu(toplevel_form.TKroot, tearoff=0) # create the menubar + menubar = element.TKMenu + for menu_entry in menu_def: + # print(f'Adding a Menubar ENTRY') + baritem = tk.Menu(menubar) + menubar.add_cascade(label=menu_entry[0], menu=baritem) + if len(menu_entry) > 1: + AddMenuItem(baritem, menu_entry[1], element) + toplevel_form.TKroot.configure(menu=element.TKMenu) # ------------------------- Frame element ------------------------- # elif element_type == ELEM_TYPE_FRAME: From ce4f456cb38d1259f31463357ac2d77c1ae41043 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 9 Sep 2018 23:31:13 -0400 Subject: [PATCH 339/521] Demo for MENUS! --- Demo_Menus.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Demo_Menus.py diff --git a/Demo_Menus.py b/Demo_Menus.py new file mode 100644 index 000000000..1d7625f9b --- /dev/null +++ b/Demo_Menus.py @@ -0,0 +1,42 @@ +import PySimpleGUI as sg + +""" + Demonstration of MENUS! + How do menus work? Like buttons is how. + Check out the variable menu_def for a hint on how to + define menus +""" +def TestMenus(): + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('LightGreen') + sg.SetOptions(element_padding=(0, 0)) + + menu_def = [['File', ['Open', 'Save',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['Help', 'About...'],] + + layout = [ + [sg.Menu(menu_def)], + [sg.Output(size=(60,20))] + ] + + form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12, 1)) + form.Layout(layout) + form.ReadNonBlocking() # so the print message will show up... yes, a kludge + + print('Give those menus a try!') + while True: + button, values = form.Read() + if button is None or button == 'Exit': + return + print('Button = ', button) + if button == 'About...': + sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...') + elif button == 'Open': + filename = sg.PopupGetFile('file to open', no_window=True) + print(filename) + + +TestMenus() \ No newline at end of file From 6f80065afec96a44cc9a1b8f0193992eaa126643 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 00:24:29 -0400 Subject: [PATCH 340/521] New readme --- docs/index.md | 17 +++++++++-------- readme.md | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/index.md b/docs/index.md index f12346583..49714acd7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -585,11 +585,11 @@ The third is the 'compact form'. It compacts down into 2 lines of code. One li You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. -### How GUI Programming in Python Should Look +### How GUI Programming in Python Should Look? -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? +Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. Let's look at this one. @@ -1745,7 +1745,7 @@ When to use a non-blocking form: If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. -### Instead of ReadNonBlocking --- Use `change_submits = True` +### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. @@ -1753,18 +1753,19 @@ Any time you are thinking "I want an X Element to cause a Y Element to do someth **Examples** - - -Or another example is you have an input field that changes as you press buttons on an on-screen keypad. +One example is you have an input field that changes as you press buttons on an on-screen keypad. ![keypad 3](https://user-images.githubusercontent.com/13696193/45260275-a2198e80-b3b0-11e8-85fe-a4ce6484510f.jpg) -2. When a slider or a spinner moves it changes the size of the text somewhere on the form. +Another example, a slider or a spinner move changes the size of the text somewhere on the form. ![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) +A final example... changing a text field as a user types into another field. + + ### Periodically Calling`ReadNonBlocking` diff --git a/readme.md b/readme.md index f12346583..49714acd7 100644 --- a/readme.md +++ b/readme.md @@ -585,11 +585,11 @@ The third is the 'compact form'. It compacts down into 2 lines of code. One li You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. -### How GUI Programming in Python Should Look +### How GUI Programming in Python Should Look? -GUI programming in Python is a mess. tkinter kinda sucks. Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? +Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these widgets. Put the rows together and you've got a form. +The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. Let's look at this one. @@ -1745,7 +1745,7 @@ When to use a non-blocking form: If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. -### Instead of ReadNonBlocking --- Use `change_submits = True` +### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. @@ -1753,18 +1753,19 @@ Any time you are thinking "I want an X Element to cause a Y Element to do someth **Examples** - - -Or another example is you have an input field that changes as you press buttons on an on-screen keypad. +One example is you have an input field that changes as you press buttons on an on-screen keypad. ![keypad 3](https://user-images.githubusercontent.com/13696193/45260275-a2198e80-b3b0-11e8-85fe-a4ce6484510f.jpg) -2. When a slider or a spinner moves it changes the size of the text somewhere on the form. +Another example, a slider or a spinner move changes the size of the text somewhere on the form. ![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) +A final example... changing a text field as a user types into another field. + + ### Periodically Calling`ReadNonBlocking` From 8ebc7852ddadf4644408ced708293e3bedb2b470 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 10:02:56 -0400 Subject: [PATCH 341/521] Add more pip installation info --- docs/index.md | 6 ++++++ readme.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/index.md b/docs/index.md index 49714acd7..644af77a3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -209,6 +209,12 @@ On a Raspberry Pi, this is should work: sudo pip3 install --upgrade pysimplegui +Some users have found that upgrading required using an extra flag on the pip `--no-cache-dir` and you can force the version number too by adding `==version` onto the end + + pip install --upgrade --no-cache-dir PySimpleGUI==3.0.3 + + + If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. diff --git a/readme.md b/readme.md index 49714acd7..644af77a3 100644 --- a/readme.md +++ b/readme.md @@ -209,6 +209,12 @@ On a Raspberry Pi, this is should work: sudo pip3 install --upgrade pysimplegui +Some users have found that upgrading required using an extra flag on the pip `--no-cache-dir` and you can force the version number too by adding `==version` onto the end + + pip install --upgrade --no-cache-dir PySimpleGUI==3.0.3 + + + If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. From 9f831a9f9c60da7c0ab6791d85e22c763f5d598c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 11:27:49 -0400 Subject: [PATCH 342/521] RELEASE 3.01.00 --- PySimpleGUI.py | 15 +-------------- docs/index.md | 24 +++++++++++++++++++++++- readme.md | 24 +++++++++++++++++++++++- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d0548d632..7302c2b90 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -420,6 +420,7 @@ def Update(self, values): for item in values: self.TKListbox.insert(tk.END, item) self.TKListbox.selection_set(0, 0) + self.Values = values def SetValue(self, values): for index, item in enumerate(self.Values): @@ -2136,20 +2137,6 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) AddMenuItem(top_menu, item, element) i += 1 - - - - # print(f'Looping through {sub_menu_info}') - # print(f'Type is {type(sub_menu_info)}') - # if type(sub_menu_info[1]) is list: - # new_menu = tk.Menu(top_menu) - # top_menu.add_cascade(label=sub_menu_info[0], menu=new_menu) - # AddMenuItem(new_menu, sub_menu_info[1], element, is_sub_menu=True) - # else: - # for item in sub_menu_info: - # AddMenuItem(top_menu, item, element) - - # ------------------------------------------------------------------------------------------------------------------ # # ===================================== TK CODE STARTS HERE ====================================================== # # ------------------------------------------------------------------------------------------------------------------ # diff --git a/docs/index.md b/docs/index.md index 644af77a3..495cc5f93 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.00.02) + (Ver 3.01.0) @@ -137,6 +137,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Bulk form-fill operation Save / Load form to/from disk Borderless (no titlebar) windows + Always on top + Menus An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -1915,6 +1917,25 @@ Use realtime keyboard capture by calling elif value is None: break +## Menus + +Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. + +This definition: + + menu_def = [['File', ['Open', 'Save', 'Exit',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['Help', 'About...'],] + +Note the placement of ',' and of []. It's tricky to get the nested menus correct that implement cascading menus. See how paste has Special and Normal as a list after it. This means that Paste has a cascading menu with items Special and Normal. + +They menu_def layout produced this window: + +![menu](https://user-images.githubusercontent.com/13696193/45306723-56b7cb00-b4eb-11e8-8cbd-faef0c90f8b4.jpg) + + + + ## Updating Elements This is a somewhat advanced topic... @@ -2091,6 +2112,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option +| 3.01.0 | Sept 10, 2018 - Menus! (sort of a big deal), ### Release Notes diff --git a/readme.md b/readme.md index 644af77a3..495cc5f93 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.00.02) + (Ver 3.01.0) @@ -137,6 +137,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Bulk form-fill operation Save / Load form to/from disk Borderless (no titlebar) windows + Always on top + Menus An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -1915,6 +1917,25 @@ Use realtime keyboard capture by calling elif value is None: break +## Menus + +Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. + +This definition: + + menu_def = [['File', ['Open', 'Save', 'Exit',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['Help', 'About...'],] + +Note the placement of ',' and of []. It's tricky to get the nested menus correct that implement cascading menus. See how paste has Special and Normal as a list after it. This means that Paste has a cascading menu with items Special and Normal. + +They menu_def layout produced this window: + +![menu](https://user-images.githubusercontent.com/13696193/45306723-56b7cb00-b4eb-11e8-8cbd-faef0c90f8b4.jpg) + + + + ## Updating Elements This is a somewhat advanced topic... @@ -2091,6 +2112,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option +| 3.01.0 | Sept 10, 2018 - Menus! (sort of a big deal), ### Release Notes From a8f674a44ac00a39207b736665e282bbfd513c02 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 12:37:45 -0400 Subject: [PATCH 343/521] Removed all externally created elements - replaced with calls to form.FindElement. Many recipes updated to new preferred design patterns --- docs/cookbook.md | 446 +++++++++++++++++++++++++---------------------- 1 file changed, 236 insertions(+), 210 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 4d078a9e8..a90dd3d40 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -115,87 +115,102 @@ Browse to get 2 file names that can be then compared. Uses a context manager --------------- ## Nearly All Widgets with Green Color Theme with Context Manager -Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method. +Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, ***the preferred method***. -![green everything](https://user-images.githubusercontent.com/13696193/43937043-7d0794be-9c29-11e8-8591-31373ddd5c34.jpg) +![cookbook all elements](https://user-images.githubusercontent.com/13696193/45308495-9bddfc00-b4ef-11e8-9c6a-32edf6b1d925.jpg) + + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: + + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - # Green & tan color scheme - sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') - - with sg.FlexForm('Everything bagel', default_element_size=(40, 1)) as form: layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + sg.Column(column1, background_color='#F7F3EC')], [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))]] + [sg.Submit(), sg.Cancel()] + ] button, values = form.LayoutAndRead(layout) + ------------- ### All Widgets No Context Manager -![green everything](https://user-images.githubusercontent.com/13696193/43937043-7d0794be-9c29-11e8-8591-31373ddd5c34.jpg) +Same form as above with no Context Manager. Use this pattern when you are in a hurry, don't have time to do things right, or it's throw-away code.... the legit use of this design is when you have non-blocking forms that update the form far away in the code from the form creation. Perhaps you show your form, get some input, then down in your event loop you want to execute another read or have an event loop where form.ReadNonBlocking is called. + +Turning your form into forms that use a Contact Manage is quite easy. Change your FlexForm call from + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) + +to + + with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: + +Be sure and place the with statement at the top of your GUI code and indent you code under it. import PySimpleGUI as sg - # Green & tan color scheme - sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') - - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) + sg.ChangeLookAndFeel('GreenTan') + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) + + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] - ] + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] button, values = form.LayoutAndRead(layout) ----- +----------- + + + ## Non-Blocking Form With Periodic Update An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. @@ -206,10 +221,8 @@ An async form that has a button read loop. A Text Element is updated periodical form = sg.FlexForm('Running Timer') # create a text element that will be updated periodically - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') - - form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], - [text_element], + form_rows = [[sg.Text('Stopwatch', size=(20, 2), justification='center')], + [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] form.LayoutAndRead(form_rows, non_blocking=True) @@ -220,42 +233,19 @@ An async form that has a button read loop. A Text Element is updated periodical while True: i += 1 * (timer_running is True) button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - elif button == 'Start/Stop': + break + elif button == 'Start/Stop': timer_running = not timer_running - text_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)) time.sleep(.01) - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - del (form) ----- -## Async Form (Non-Blocking) with Context Manager -Like the previous recipe, this form is an async form. The difference is that this form uses a context manager. -![non-blocking 2](https://user-images.githubusercontent.com/13696193/43955456-4d5d9ef8-9c6e-11e8-8598-80dddf8eba6f.jpg) - import PySimpleGUI as sg - import time - with sg.FlexForm('Running Timer') as form: - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') - layout = [[sg.Text('Non blocking GUI with updates', justification='center')], - [text_element], - [sg.T(' ' * 15), sg.Quit()]] - form.LayoutAndRead(layout, non_blocking=True) +-------- - for i in range(1, 500): - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X - break - time.sleep(.01) - else: - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() ----- ## Callback Function Simulation The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. @@ -389,15 +379,12 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 image_next = './ButtonGraphics/Next.png' image_exit = './ButtonGraphics/Exit.png' - # 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 form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), font=("Helvetica", 25)) # define layout of the rows 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), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), @@ -437,7 +424,7 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 break # If a button was pressed, display it on the GUI by updating the text element if button: - TextElem.Update(button) + form.FindElement('output).Update(button) ---- ## Script Launcher - Persistent Form This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadFormButton` instead of `sg.SimpleButton`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. @@ -495,15 +482,7 @@ A standard non-blocking GUI with lots of inputs. import PySimpleGUI as sg # Green & tan color scheme - sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') + sg.ChangeLookAndFeel('GreenTan') sg.SetOptions(text_justification='right') @@ -539,28 +518,26 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an import PySimpleGUI as sg - def CustomMeter(): - # create the progress bar element - progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) - # layout the form - layout = [[sg.Text('A custom progress meter')], - [progress_bar], - [sg.Cancel()]] - - # create the form - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break + # layout the form + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progbar')], + [sg.Cancel()]] + + # create the form + form = sg.FlexForm('Custom Progress Meter') + # display the form as a non-blocking form + form.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i+1) - # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() + form.FindElement('progbar').UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open + form.CloseNonBlockingForm() + ---- @@ -595,7 +572,8 @@ This example uses a Column. There is a Listbox on the left that is 3 rows high. To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. -![snap0202](https://user-images.githubusercontent.com/13696193/44234671-27749f00-a175-11e8-9e66-a3fccf6c077e.jpg) +![cookbook columns](https://user-images.githubusercontent.com/13696193/45309948-f6c52280-b4f2-11e8-8691-a45fa0e06c50.jpg) + import PySimpleGUI as sg @@ -636,13 +614,12 @@ This simple program keep a form open, taking input values until the user termina form = sg.FlexForm('Math') - output = sg.Txt('', size=(8,1)) layout = [ [sg.Txt('Enter values to calculate')], [sg.In(size=(8,1), key='numerator')], [sg.Txt('_' * 10)], [sg.In(size=(8,1), key='denominator')], - [output], + [sg.Txt('', size=(8,1), key='output') ], [sg.ReadFormButton('Calculate', bind_return_key=True)]] form.Layout(layout) @@ -658,7 +635,7 @@ This simple program keep a form open, taking input values until the user termina except: calc = 'Invalid' - output.Update(calc) + form.FindElement('output').Update(calc) else: break @@ -676,31 +653,28 @@ The Canvas Element is one of the few tkinter objects that are directly accessibl ![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) - - - import PySimpleGUI as gui - - canvas = gui.Canvas(size=(100,100), background_color='red') + import PySimpleGUI as sg layout = [ - [canvas], - [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] - ] + [sg.Canvas(size=(100, 100), background_color='red', key= 'canvas')], + [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue')] + ] - form = gui.FlexForm('Canvas test') + form = sg.FlexForm('Canvas test') form.Layout(layout) form.ReadNonBlocking() + canvas = form.FindElement('canvas') cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) while True: button, values = form.Read() if button is None: break - if button is 'Blue': - canvas.TKCanvas.itemconfig(cir, fill = "Blue") + if button is 'Blue': + canvas.TKCanvas.itemconfig(cir, fill="Blue") elif button is 'Red': - canvas.TKCanvas.itemconfig(cir, fill = "Red") + canvas.TKCanvas.itemconfig(cir, fill="Red") ## Input Element Update @@ -719,9 +693,7 @@ There are a number of features used in this Recipe including: - import PySimpleGUI as g - - # g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons + import PySimpleGUI as sg # Demonstrates a number of PySimpleGUI features including: # Default element size @@ -731,38 +703,34 @@ There are a number of features used in this Recipe including: # Update of elements in form (Text, Input) # do_not_clear of Input elements - # 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')], - [in_elem], - [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], - [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], - [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], - [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], - [out_elem], + layout = [[sg.Text('Enter Your Passcode')], + [sg.Input(size=(10, 1), do_not_clear=True, justification='right', key='input')], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')], + [sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')], + [sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')], + [sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')], + [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], ] - form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) + form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False) form.Layout(layout) # Loop forever reading the form's values, updating the Input field keys_entered = '' while True: button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit - break - if button is 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': + if button is None: # if the X button clicked, just exit + break + if button is 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button is 'Submit': + keys_entered += button # add the new digit + elif button is 'Submit': 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 ## Animated Matplotlib Graph @@ -788,17 +756,17 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to ax.set_ylabel("Y axis") ax.grid() - canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on - layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [canvas_elem], + [g.Canvas(size=(640, 480), key='canvas')], [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) form.ReadNonBlocking() + canvas_elem = form.FindElement('canvas') + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) canvas = canvas_elem.TKCanvas @@ -825,24 +793,80 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) # time.sleep(.1) - if __name__ == '__main__': - main() - - + if __name__ == '__main__': + main() ## Tables While there is no official support for "Tables" (e.g. there is no Table Element), it is possible to display information in a tabular way. This only works for smaller tables because there is no way to scroll a window or a column element. Until scrollable columns are implemented there is little use in creating a Table Element. -![simpletable](https://user-images.githubusercontent.com/13696193/44960497-c667fd80-aece-11e8-988c-5fa7dfdb90a6.jpg) +This Recipe contains a number of concepts beyond just tables. It has menus, and 'realtime' keyboard input. Working with large numbers of elements takes time to layout. Once laid out it should be OK. + + +![table 2](https://user-images.githubusercontent.com/13696193/45310830-5de3d680-b4f5-11e8-925a-7c2a7b8b1922.jpg) + + - layout = [[sg.T('Table Test')]] + import PySimpleGUI as sg + + menu_def = [['File', ['Open', 'Save', 'Exit']], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['Help', 'About...'],] + + sg.SetOptions(element_padding=(0,0)) + layout = [ [sg.Menu(menu_def)], + [sg.T('Table Using Combos and Input Elements', font='Any 18')], + [sg.T('Row, Cal to change'), + sg.In(key='inputrow', justification='right', size=(8,1), pad=(1,1), do_not_clear=True), + sg.In(key='inputcol', size=(8,1), pad=(1,1), justification='right', do_not_clear=True), + sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)]] for i in range(20): - row = [sg.T(f'Row {i} ', size=(10,1))] - layout.append([sg.T(f'{i}{j}', size=(4,1), background_color='white', pad=(1,1)) for j in range(10)]) + inputs = [sg.In(size=(18, 1), pad=(1, 1), justification='right', key=(i,j), do_not_clear=True) for j in range(10)] + line = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info'))] + line.append(inputs) + layout.append(inputs) + + form = sg.FlexForm('Table', return_keyboard_events=True, grab_anywhere=False) + form.Layout(layout) + + while True: + button, values = form.Read() + if button is None: + break + if button == 'Open': + filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) + if filename is not None: + with open(filename, "r") as infile: + reader = csv.reader(infile) + # first_row = next(reader, None) # skip the headers + data = list(reader) # read everything else into a list of rows + sg.Print(data) + for i, row in enumerate(data): + for j, item in enumerate(row): + print(i,j, item) + # form.FindElement(key=(i,j)).Update(item) + location = (i,j) + try: + # location = (int(values['inputrow']), int(values['inputcol'])) + target_element = form.FindElement(location) + new_value = item + # new_value = values['value'] + if target_element is not None and new_value != '': + target_element.Update(new_value) + except: + pass + if button == 'Exit': + break + try: + location = (int(values['inputrow']), int(values['inputcol'])) + target_element = form.FindElement(location) + new_value = values['value'] + if target_element is not None and new_value != '': + target_element.Update(new_value) + except: + pass - sg.FlexForm('Table').LayoutAndRead(layout) ## Tight Layout with Button States @@ -856,26 +880,26 @@ In other GUI frameworks this program would be most likely "event driven" with ca import PySimpleGUI as sg + """ + Demonstrates using a "tight" layout with a Dark theme. + Shows how button states can be controlled by a user application. The program manages the disabled/enabled + states for buttons and changes the text color to show greyed-out (disabled) buttons + """ sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0, 0)) - - StartButton = sg.ReadFormButton('Start', button_color=('white', 'black')) - StopButton = sg.ReadFormButton('Stop', button_color=('gray34', 'black')) - ResetButton = sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3')) - SubmitButton = sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4')) - - 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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')], - [StartButton, StopButton, ResetButton, SubmitButton] - ] + sg.SetOptions(element_padding=(0,0)) + + 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='start'), + sg.ReadFormButton('Stop', button_color=('gray34', 'black'), key='stop'), + sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3'), key='reset'), + sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4'), key='submit')] + ] - form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, - auto_size_buttons=False, - default_button_element_size=(12, 1)) + form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12,1)) form.Layout(layout) recording = have_data = False while True: @@ -883,28 +907,28 @@ In other GUI frameworks this program would be most likely "event driven" with ca if button is None: exit(69) if button is 'Start': - StartButton.Update(button_color=('gray34', 'black')) - StopButton.Update(button_color=('white', 'black')) - ResetButton.Update(button_color=('white', 'firebrick3')) + form.FindElement('start').Update(button_color=('gray34','black')) + form.FindElement('stop').Update(button_color=('white', 'black')) + form.FindElement('reset').Update(button_color=('white', 'firebrick3')) recording = True - elif button is 'Stop' and recording: - StopButton.Update(button_color=('gray34', 'black')) - StartButton.Update(button_color=('white', 'black')) - SubmitButton.Update(button_color=('white', 'springgreen4')) + elif button is 'Stop' and recording: + form.FindElement('stop').Update(button_color=('gray34','black')) + form.FindElement('start').Update(button_color=('white', 'black')) + form.FindElement('submit').Update(button_color=('white', 'springgreen4')) recording = False - have_data = True - elif button is 'Reset': - StopButton.Update(button_color=('gray34', 'black')) - StartButton.Update(button_color=('white', 'black')) - SubmitButton.Update(button_color=('gray34', 'springgreen4')) - ResetButton.Update(button_color=('gray34', 'firebrick3')) + have_data = True + elif button is 'Reset': + form.FindElement('stop').Update(button_color=('gray34','black')) + form.FindElement('start').Update(button_color=('white', 'black')) + form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) + form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) recording = False - have_data = False - elif button is 'Submit' and have_data: - StopButton.Update(button_color=('gray34', 'black')) - StartButton.Update(button_color=('white', 'black')) - SubmitButton.Update(button_color=('gray34', 'springgreen4')) - ResetButton.Update(button_color=('gray34', 'firebrick3')) + have_data = False + elif button is 'Submit' and have_data: + form.FindElement('stop').Update(button_color=('gray34','black')) + form.FindElement('start').Update(button_color=('white', 'black')) + form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) + form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) recording = False ## Password Protection For Scripts @@ -976,3 +1000,5 @@ Use the upper half to generate your hash code. Then paste it into the code in t print('Login SUCCESSFUL') else: print('Login FAILED!!') + + From b2dc9869d006ceef25fd3802540a6e0bc5c6f861 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 16:49:04 -0400 Subject: [PATCH 344/521] New Update capability for Spinner Elements. Can set value, values. Removed buggy code in button wrapping, added key to progressbar --- PySimpleGUI.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7302c2b90..4ee4e4cb6 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -550,11 +550,16 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, new_value): - try: - self.TKStringVar.set(new_value) - except: pass - self.DefaultValue = new_value + def Update(self, new_value=None, new_values=None ): + if new_value is not None: + try: + self.TKStringVar.set(new_value) + except: pass + self.DefaultValue = new_value + if new_values != None: + self.Values = new_values + self.TKSpinBox.configure(values=new_values) + def SpinChangedHandler(self, event): # first, get the results table built @@ -936,7 +941,7 @@ def __del__(self): # ProgreessBar # # ---------------------------------------------------------------------- # class ProgressBar(Element): - def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None, pad=None): + def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None, key=None, pad=None): ''' Progress Bar Element :param max_value: @@ -959,7 +964,7 @@ def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False - super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text, pad=pad) + super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text, key=key, pad=pad) return def UpdateBar(self, current_count, max=None): @@ -994,7 +999,6 @@ def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None self.Filename = filename self.Data = data self.tktext_label = None - if data is None and filename is None: print('* Warning... no image specified in Image Element! *') super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad, key=key) @@ -2266,9 +2270,6 @@ def CharWidthInPixels(): else: width = 0 height= toplevel_form.DefaultButtonElementSize[1] - lines = btext.split('\n') - max_line_len = max([len(l) for l in lines]) - num_lines = len(lines) if element.ButtonColor != (None, None)and element.ButtonColor != DEFAULT_BUTTON_COLOR: bc = element.ButtonColor elif toplevel_form.ButtonColor != (None, None) and toplevel_form.ButtonColor != DEFAULT_BUTTON_COLOR: From 6b79ea988d78a513ef14bb7f5f3cbe4f154ff5ce Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 16:56:56 -0400 Subject: [PATCH 345/521] Another missed and element.BackgroundColor != COLOR_SYSTEM_DEFAULT --- PySimpleGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4ee4e4cb6..0c3dfb2ce 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2445,7 +2445,7 @@ def CharWidthInPixels(): element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) if default_value is None: element.TKCheckbutton.configure(state='disable') - if element.BackgroundColor is not None: + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKCheckbutton.configure(background=element.BackgroundColor) element.TKCheckbutton.configure(selectcolor=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: From 7f6ac376e2a5aefe7cf00b5cce135730e9e9efa5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 17:08:11 -0400 Subject: [PATCH 346/521] New Recipe - Floating Toolbar --- docs/cookbook.md | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/docs/cookbook.md b/docs/cookbook.md index a90dd3d40..a38ca74c1 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1002,3 +1002,88 @@ Use the upper half to generate your hash code. Then paste it into the code in t print('Login FAILED!!') +## Desktop Floating Toolbar + +This is a cool one! (Sorry about the code pastes... I'm working in it) + +Impress your friends at what a tool-wizard you are by popping a custom toolbar that you keep in the corner of your screen. It stays on top of all your other windows. + + +![toolbar gray](https://user-images.githubusercontent.com/13696193/45324308-bfb73700-b51b-11e8-90e7-ab24f3d6e61d.jpg) + +You can easily change colors to match your background by changing a couple of parameters in the code. + +![toolbar black](https://user-images.githubusercontent.com/13696193/45324307-bfb73700-b51b-11e8-8709-6c3c23f737c4.jpg) + + + import PySimpleGUI as sg + import subprocess + import os + import sys + + """ + Demo_Toolbar - A floating toolbar with quick launcher One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout + You can setup a specific program to launch when a button is clicked, or use the Combobox to select a .py file found in the root folder, and run that file. """ + + ROOT_PATH = './' + + def Launcher(): + + def print(line): + form.FindElement('output').Update(line) + + sg.ChangeLookAndFeel('Dark') + + namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] + + sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) + layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), + sg.ReadFormButton('Run', button_color=('white', '#00168B')), + sg.ReadFormButton('Program 1'), + sg.ReadFormButton('Program 2'), + sg.ReadFormButton('Program 3', button_color=('white', '#35008B')), + sg.SimpleButton('EXIT', button_color=('white','firebrick3'))], + [sg.T('', text_color='white', size=(50,1), key='output')]] + + form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True) + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button is 'EXIT' or button is None: + break # exit button clicked + if button is 'Program 1': + print('Run your program 1 here!') + elif button is 'Program 2': + print('Run your program 2 here!') + elif button is 'Run': + file = value['demofile'] + print('Launching %s'%file) + ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) + else: + print(button) + + def ExecuteCommandSubprocess(command, *args, wait=False): + try: + if sys.platform == 'linux': + arg_string = '' + for arg in args: + arg_string += ' ' + str(arg) + sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if wait: + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + + + if __name__ == '__main__': + Launcher() From cfcbb1f69f66236b38f95f43a01d48ca1a0c1e43 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 17:17:02 -0400 Subject: [PATCH 347/521] Fix comment in recipe --- docs/cookbook.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index a38ca74c1..1373dae63 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1049,8 +1049,8 @@ You can easily change colors to match your background by changing a couple of pa form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI --- # - while True: + # ---===--- Loop taking in user input (buttons) --- # + while True: (button, value) = form.Read() if button is 'EXIT' or button is None: break # exit button clicked From efb82e241c667fc174fc7b4c3ebdef9bf307d45b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 17:29:23 -0400 Subject: [PATCH 348/521] Menu Recipe --- docs/cookbook.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 1373dae63..1a89b3afd 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1,7 +1,7 @@ # The PySimpleGUI Cookbook -You will find all of these Recipes in a single Python file ([Demo_Cookbook.py](https://github.com/MikeTheWatchGuy/PySimpleGUI/blob/master/Demo_Cookbook.py)) located on the project's GitHub page. This program will allow you to view the source code and the window that it produces. +You will find all of these Recipes in a single Python file ([Demo_Cookbook.py](https://github.com/MikeTheWatchGuy/PySimpleGUI/blob/master/Demo_Cookbook.py)) located on the project's GitHub page. This program will allow you to view the source code and the window that it produces. You can also download over 50 demo programs that are ready to run. You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. @@ -1087,3 +1087,49 @@ You can easily change colors to match your background by changing a couple of pa if __name__ == '__main__': Launcher() + + +## Menus + +Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. + +Menu's are defined separately from the GUI form. To add one to your form, simply insert sg.Menu(menu_layout). The meny definition is a list of menu choices and submenus. They are a list of lists. Copy the Recipe and play with it. You'll eventualy get when you're looking for. + +If you double click the dashed line at the top of the list of choices, that menu will tear off and become a floating toolbar. How cool! + + +![tear off](https://user-images.githubusercontent.com/13696193/45307668-9aabcf80-b4ed-11e8-9b2b-8564d4bf82a8.jpg) + + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('LightGreen') + sg.SetOptions(element_padding=(0, 0)) + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['Help', 'About...'],] + + # ------ GUI Defintion ------ # + layout = [ + [sg.Menu(menu_def)], + [sg.Output(size=(60,20))] + ] + + form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12, 1)) + form.Layout(layout) + + # ------ Loop & Process button menu choices ------ # + while True: + button, values = form.Read() + if button is None or button == 'Exit': + return + print('Button = ', button) + # ------ Process menu choices ------ # + if button == 'About...': + sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...') + elif button == 'Open': + filename = sg.PopupGetFile('file to open', no_window=True) + print(filename) From 080450c6913d79d92df69df44b0410d268e00145 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 17:35:21 -0400 Subject: [PATCH 349/521] Fix for button not updating when Update changed the text --- Demo_Desktop_Widget_Timer.py | 1 - PySimpleGUI.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 3fc230abd..149f89d78 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -37,7 +37,6 @@ def Timer(): current_time = int(round(time.time()*100)) - start_time else: button, values = form.Read() - # --------- Do Button Operations -------- if values is None or button == 'Exit': break diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0c3dfb2ce..273018d81 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -924,6 +924,7 @@ def Update(self, value=None, new_text=None, button_color=(None, None)): try: if new_text is not None: self.TKButton.configure(text=new_text) + self.ButtonText = new_text if button_color != (None, None): self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: From ef8c1a28574c0f2adfce0e6c57b8f0f6e99c3c38 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 18:42:05 -0400 Subject: [PATCH 350/521] Floating toolbar, Cookbook update --- Demo_All_Widgets.py | 77 +++++++++++++++----------------- Demo_Desktop_Floating_Toolbar.py | 77 ++++++++++++++++++++++++++++++++ docs/cookbook.md | 77 +++++++++++++++++++++++++++++++- 3 files changed, 189 insertions(+), 42 deletions(-) create mode 100644 Demo_Desktop_Floating_Toolbar.py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 0a89a42f3..d4cee3c31 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -1,45 +1,40 @@ #!/usr/bin/env Python3 - import PySimpleGUI as sg +sg.ChangeLookAndFeel('GreenTan') + +form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) + +column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + +layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] +] + +button, values = form.LayoutAndRead(layout) + +sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + -def Everything(): - sg.ChangeLookAndFeel('Dark') - - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) - - column1 = [[sg.Text('Column 1', background_color='black', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='black')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - - sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) - - -if __name__ == '__main__': - Everything() diff --git a/Demo_Desktop_Floating_Toolbar.py b/Demo_Desktop_Floating_Toolbar.py new file mode 100644 index 000000000..5b17d327d --- /dev/null +++ b/Demo_Desktop_Floating_Toolbar.py @@ -0,0 +1,77 @@ +import PySimpleGUI as sg +import subprocess +import os +import sys + +""" + Demo_Toolbar - A floating toolbar with quick launcher + + One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout + You can setup a specific program to launch when a button is clicked, or use the + Combobox to select a .py file found in the root folder, and run that file. + +""" + +ROOT_PATH = './' + +def Launcher(): + + def print(line): + form.FindElement('output').Update(line) + + sg.ChangeLookAndFeel('Dark') + + namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] + + sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) + layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), + sg.ReadFormButton('Run', button_color=('white', '#00168B')), + sg.ReadFormButton('Program 1'), + sg.ReadFormButton('Program 2'), + sg.ReadFormButton('Program 3', button_color=('white', '#35008B')), + sg.SimpleButton('EXIT', button_color=('white','firebrick3'))], + [sg.T('', text_color='white', size=(50,1), key='output')]] + + form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True) + + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = form.Read() + if button is 'EXIT' or button is None: + break # exit button clicked + if button is 'Program 1': + print('Run your program 1 here!') + elif button is 'Program 2': + print('Run your program 2 here!') + elif button is 'Run': + file = value['demofile'] + print('Launching %s'%file) + ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) + else: + print(button) + +def ExecuteCommandSubprocess(command, *args, wait=False): + try: + if sys.platform == 'linux': + arg_string = '' + for arg in args: + arg_string += ' ' + str(arg) + sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if wait: + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + + +if __name__ == '__main__': + Launcher() + diff --git a/docs/cookbook.md b/docs/cookbook.md index 1a89b3afd..7352c3ad6 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -988,7 +988,7 @@ Use the upper half to generate your hash code. Then paste it into the code in t password_hash = sha1hash.hexdigest() if password_hash == hash: return True - else: + else: return False login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' @@ -1089,6 +1089,81 @@ You can easily change colors to match your background by changing a couple of pa Launcher() + + +## Desktop Floating Widget + +This is a little widget you can leave running on your desktop. Will hopefully see more of these for things like checking email, checking server pings, displaying system information, dashboards, etc +. +Much of the code is handling the button states in a fancy way. It could be much simpler if you don't change the button text based on state. + + + import PySimpleGUI as sg + import time + + """ + Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. + It will look something like: invalid command name "1616802625480StopMove"""" + + # ---------------- Create Form ---------------- + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0,0)) + # Make a form, but don't use context manager + # Create the form layout + form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), sg.ReadFormButton('Reset', button_color=('white', '#007339')), sg.Exit(button_color=('white','firebrick4'))]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) + form.Layout(form_rows) + # + # ---------------- main loop ---------------- + current_time = 0 + paused = False + start_time = int(round(time.time()*100)) + while (True): + # --------- Read and update window -------- + if not paused: + button, values = form.ReadNonBlocking() + current_time = int(round(time.time()*100)) - start_time + else: + button, values = form.Read() + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + if button is 'Reset': + start_time = int(round(time.time()*100)) + current_time = 0 + paused_time = start_time + elif button == 'Pause': + paused = True + paused_time = int(round(time.time()*100)) + element = form.FindElement('button') + element.Update(new_text='Run') + elif button == 'Run': + paused = False + start_time = start_time + int(round(time.time()*100)) - paused_time + element = form.FindElement('button') + element.Update(new_text='Pause') + + # --------- Display timer in window -------- + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + (current_time // 100) % 60, + current_time % 100)) + time.sleep(.01) + + + # --------- After loop -------- + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + + + + + + + ## Menus Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. From d92d103d7eaeaba3011208a2dfb1d00e1c7a95e9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 19:17:53 -0400 Subject: [PATCH 351/521] New Demo - YouTube-DL.exe front end for subtitles --- Demo_Youtube-dl_Frontend.py | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Demo_Youtube-dl_Frontend.py diff --git a/Demo_Youtube-dl_Frontend.py b/Demo_Youtube-dl_Frontend.py new file mode 100644 index 000000000..e4aa2edb2 --- /dev/null +++ b/Demo_Youtube-dl_Frontend.py @@ -0,0 +1,71 @@ +import PySimpleGUI as sg +import subprocess + +""" +Simple wrapper for youtube-dl.exe. +Paste the youtube link into the GUI. The GUI link is queried when you click Get List. +Get List will populate the pulldown list with the language options available for the video. +Choose the language to download and click Download +""" + +def DownloadSubtitlesGUI(): + sg.ChangeLookAndFeel('Dark') + + combobox = sg.InputCombo(values=['',], size=(10,1), key='lang') + layout = [ + [sg.Text('Subtitle Grabber', size=(40, 1), font=('Any 15'))], + [sg.T('YouTube Link'),sg.In(default_text='',size=(60,1), key='link', do_not_clear=True) ], + [sg.Output(size=(90,20), font='Courier 12')], + [sg.ReadFormButton('Get List')], + [sg.T('Language Code'), combobox, sg.ReadFormButton('Download')], + [sg.SimpleButton('Exit', button_color=('white', 'firebrick3'))] + ] + + form = sg.FlexForm('Subtitle Grabber launcher', text_justification='r', default_element_size=(15,1), font=('Any 14')) + form.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, gui) = form.Read() + if button in ('EXIT', None): + break # exit button clicked + link = gui['link'] + if button is 'Get List': + print('Getting list of subtitles....') + form.Refresh() + command = [f'C:/Python/PycharmProjects/GooeyGUI/youtube-dl --list-subs {link}',] + output = ExecuteCommandSubprocess(command, wait=True, quiet=True) + lang_list = [o[:5].rstrip() for o in output.split('\n') if 'vtt' in o] + lang_list = sorted(lang_list) + combobox.Update(values=lang_list) + print('Done') + + elif button is 'Download': + lang = gui['lang'] + if lang is '': + lang = 'en' + print(f'Downloading subtitle for {lang}...') + form.Refresh() + command = (f'C:/Python/PycharmProjects/GooeyGUI/youtube-dl --sub-lang {lang} --write-sub {link}',) + ExecuteCommandSubprocess(command, wait=True) + print('Done') + + +def ExecuteCommandSubprocess(command, wait=False, quiet=True, *args): + try: + sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if wait: + out, err = sp.communicate() + if not quiet: + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: return '' + + return (out.decode('utf-8')) + + +if __name__ == '__main__': + DownloadSubtitlesGUI() + From a56cdb97359427cad78707f4bee75589bd72dfb4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 20:20:15 -0400 Subject: [PATCH 352/521] Fix in Spinner update. Wasn't working in forms that returned on change --- PySimpleGUI.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 273018d81..1634cf1e6 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -551,14 +551,16 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None return def Update(self, new_value=None, new_values=None ): + if new_values != None: + old_value = self.TKStringVar.get() + self.Values = new_values + self.TKSpinBox.configure(values=new_values) + self.TKStringVar.set(old_value) if new_value is not None: try: self.TKStringVar.set(new_value) except: pass self.DefaultValue = new_value - if new_values != None: - self.Values = new_values - self.TKSpinBox.configure(values=new_values) def SpinChangedHandler(self, event): From 40983fb873eb18fd26559d43afcdd2e091ec1f6d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 20:24:04 -0400 Subject: [PATCH 353/521] Updated Menu demo --- Demo_Menus.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Demo_Menus.py b/Demo_Menus.py index 1d7625f9b..7b3c884f2 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -6,16 +6,27 @@ Check out the variable menu_def for a hint on how to define menus """ +def SecondForm(): + + layout = [[sg.Text('The second form is small \nHere to show that opening a window using a window works')], + [sg.OK()]] + + form = sg.FlexForm('Second Form') + b, v = form.LayoutAndRead(layout) + + def TestMenus(): import PySimpleGUI as sg sg.ChangeLookAndFeel('LightGreen') sg.SetOptions(element_padding=(0, 0)) - menu_def = [['File', ['Open', 'Save',]], + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Properties']], ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] + # ------ GUI Defintion ------ # layout = [ [sg.Menu(menu_def)], [sg.Output(size=(60,20))] @@ -24,19 +35,22 @@ def TestMenus(): form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12, 1)) form.Layout(layout) - form.ReadNonBlocking() # so the print message will show up... yes, a kludge - print('Give those menus a try!') + # ------ Loop & Process button menu choices ------ # while True: button, values = form.Read() if button is None or button == 'Exit': return print('Button = ', button) + # ------ Process menu choices ------ # if button == 'About...': sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...') elif button == 'Open': filename = sg.PopupGetFile('file to open', no_window=True) print(filename) + elif button == 'Properties': + SecondForm() + TestMenus() \ No newline at end of file From 4200b78bd2278986f52980843642815e7ee38a00 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 22:51:04 -0400 Subject: [PATCH 354/521] Turned off grab_anywhere because text is being copied. Turn off grab_anywhere in PopupGetText --- Demo_Password_Login.py | 8 +++----- PySimpleGUI.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Demo_Password_Login.py b/Demo_Password_Login.py index e8a16b96e..c6040e3de 100644 --- a/Demo_Password_Login.py +++ b/Demo_Password_Login.py @@ -19,7 +19,7 @@ def HashGeneratorGUI(): ] form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), - text_justification='r', return_keyboard_events=True) + text_justification='r', return_keyboard_events=True, grab_anywhere=False) form.Layout(layout) while True: @@ -44,10 +44,8 @@ def PasswordMatches(password, hash): sha1hash = hashlib.sha1() sha1hash.update(password_utf) password_hash = sha1hash.hexdigest() - if password_hash == hash: - return True - else: - return False + return password_hash == hash + login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' password = sg.PopupGetText('Password', password_char='*') diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1634cf1e6..ab4dbcdca 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3224,7 +3224,7 @@ def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_ # Get a single line of text # # ===================================================# def GetTextBox(title, message, default_text='', button_color=None, size=(None, None)): - with FlexForm(title, auto_size_text=True, button_color=button_color) as form: + with FlexForm(title, auto_size_text=True, button_color=button_color, grab_anywhere=False) as form: layout = [[Text(message, auto_size_text=True)], [InputText(default_text=default_text, size=size)], [Submit(), Cancel()]] @@ -3237,7 +3237,7 @@ def GetTextBox(title, message, default_text='', button_color=None, size=(None, N def PopupGetText(message, default_text='', password_char='', button_color=None, size=(None, None)): - 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, grab_anywhere=False) as form: layout = [[Text(message, auto_size_text=True)], [InputText(default_text=default_text, size=size, password_char=password_char)], [Ok(), Cancel()]] From 6f3a8ddb2b49ec1ef51cb529b2aa1d3697f5347f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 23:04:47 -0400 Subject: [PATCH 355/521] Fix for grab anywhere in password recipe --- docs/cookbook.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 7352c3ad6..d5a98b353 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -677,7 +677,7 @@ The Canvas Element is one of the few tkinter objects that are directly accessibl canvas.TKCanvas.itemconfig(cir, fill="Red") -## Input Element Update +## Keypad Touchscreen Entry - Input Element Update This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. There are a number of features used in this Recipe including: @@ -961,7 +961,7 @@ Use the upper half to generate your hash code. Then paste it into the code in t ] form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), - text_justification='r', return_keyboard_events=True) + text_justification='r', return_keyboard_events=True, grab_anywhere=False) form.Layout(layout) while True: @@ -1160,10 +1160,6 @@ Much of the code is handling the button states in a fancy way. It could be much - - - - ## Menus Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. From 5a59f4753b0fb7c7483991dd6a89e52e4a5a4771 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 10 Sep 2018 23:24:20 -0400 Subject: [PATCH 356/521] New Demo - Chat without history... a simplified chat --- Demo_Chat.py | 77 +++++++++++++-------------------------- Demo_Chat_With_History.py | 58 +++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 52 deletions(-) create mode 100644 Demo_Chat_With_History.py diff --git a/Demo_Chat.py b/Demo_Chat.py index 3b80ea7ca..db2b610a9 100644 --- a/Demo_Chat.py +++ b/Demo_Chat.py @@ -1,58 +1,31 @@ import PySimpleGUI as sg ''' -A chatbot with history -Scroll up and down through prior commands using the arrow keys -Special keyboard keys: - Up arrow - scroll up in commands - Down arrow - scroll down in commands - Escape - clear current command - Control C - exit form +A chat window. Add call to your send-routine, print the response and you're done ''' -def ChatBotWithHistory(): - # ------- Make a new FlexForm ------- # - sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors +# ------- Make a new FlexForm ------- # +sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors + +form = sg.FlexForm('Chat window', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2)) + +layout = [ + [sg.Text('Your output will go here', size=(40, 1))], + [sg.Output(size=(127, 30), font=('Helvetica 10'))], + [sg.Multiline(size=(85, 5), enter_submits=True, key='query'), + 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]))] + ] +form.Layout(layout) + +# ---===--- Loop taking in user input and using it --- # +while True: + (button, value) = form.Read() + if button is 'SEND': + query = value['query'].rstrip() + # EXECUTE YOUR COMMAND HERE + print('The command you entered was {}'.format(query)) + elif button is None or button is 'EXIT': # quit if exit button or X + break +exit(69) - 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) - - layout = [ - [sg.Text('Your output will go here', size=(40, 1))], - [sg.Output(size=(127, 30), font=('Helvetica 10'))], - [sg.T('Command History'), sg.T('', size=(20,3), key='history')], - [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.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] - ] - form.Layout(layout) - - # ---===--- Loop taking in user input and using it --- # - command_history = [] - history_offset = 0 - while True: - (button, value) = form.Read() - if button is 'SEND': - query = value['query'].rstrip() - # EXECUTE YOUR COMMAND HERE - print('The command you entered was {}'.format(query)) - command_history.append(query) - history_offset = len(command_history)-1 - form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear - form.FindElement('history').Update('\n'.join(command_history[-3:])) - elif button is None or button is 'EXIT': # quit if exit button or X - break - elif 'Up' in button and len(command_history): - command = command_history[history_offset] - history_offset -= 1 * (history_offset > 0) # decrement is not zero - form.FindElement('query').Update(command) - elif 'Down' in button and len(command_history): - history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list - command = command_history[history_offset] - form.FindElement('query').Update(command) - elif 'Escape' in button: - form.FindElement('query').Update('') - - exit(69) - - -ChatBotWithHistory() diff --git a/Demo_Chat_With_History.py b/Demo_Chat_With_History.py new file mode 100644 index 000000000..3b80ea7ca --- /dev/null +++ b/Demo_Chat_With_History.py @@ -0,0 +1,58 @@ +import PySimpleGUI as sg + +''' +A chatbot with history +Scroll up and down through prior commands using the arrow keys +Special keyboard keys: + Up arrow - scroll up in commands + Down arrow - scroll down in commands + Escape - clear current command + Control C - exit form +''' + +def ChatBotWithHistory(): + # ------- Make a new FlexForm ------- # + sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors + + 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) + + layout = [ + [sg.Text('Your output will go here', size=(40, 1))], + [sg.Output(size=(127, 30), font=('Helvetica 10'))], + [sg.T('Command History'), sg.T('', size=(20,3), key='history')], + [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.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] + ] + form.Layout(layout) + + # ---===--- Loop taking in user input and using it --- # + command_history = [] + history_offset = 0 + while True: + (button, value) = form.Read() + if button is 'SEND': + query = value['query'].rstrip() + # EXECUTE YOUR COMMAND HERE + print('The command you entered was {}'.format(query)) + command_history.append(query) + history_offset = len(command_history)-1 + form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear + form.FindElement('history').Update('\n'.join(command_history[-3:])) + elif button is None or button is 'EXIT': # quit if exit button or X + break + elif 'Up' in button and len(command_history): + command = command_history[history_offset] + history_offset -= 1 * (history_offset > 0) # decrement is not zero + form.FindElement('query').Update(command) + elif 'Down' in button and len(command_history): + history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list + command = command_history[history_offset] + form.FindElement('query').Update(command) + elif 'Escape' in button: + form.FindElement('query').Update('') + + exit(69) + + +ChatBotWithHistory() From c79b0be31deb415fcbe0a87a3a756fb6247c1599 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 11 Sep 2018 08:38:38 -0400 Subject: [PATCH 357/521] Added Enable/Disable to all input elements! Refresh of many Demo programs --- Demo_Button_States.py | 38 +++--- Demo_Cookbook_Browser.py | 111 +++++++++--------- Demo_Desktop_Widget_Timer.py | 103 ++++++++--------- Demo_Keyboard.py | 2 +- Demo_Keypad.py | 99 +++++++++------- Demo_Matplotlib_Ping_Graph.py | 2 +- Demo_PNG_Viewer.py | 56 +++++---- Demo_Password_Login.py | 4 +- Demo_Super_Simple_Form.py | 17 +-- Demo_Table_Simulation.py | 60 ++++++++-- PySimpleGUI.py | 211 +++++++++++++++++++++------------- 11 files changed, 395 insertions(+), 308 deletions(-) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index 233d56dcd..fa5d5d9f7 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -8,15 +8,13 @@ sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0,0)) -StartButton = sg.ReadFormButton('Start', button_color=('white', 'black')) -StopButton = sg.ReadFormButton('Stop', button_color=('gray34','black')) -ResetButton = sg.ReadFormButton('Reset', button_color=('gray','firebrick3')) -SubmitButton = sg.ReadFormButton('Submit', button_color=('gray34','springgreen4')) - 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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')], - [StartButton, StopButton, ResetButton, SubmitButton] + [sg.ReadFormButton('Start', button_color=('white', 'black'), key='start'), + sg.ReadFormButton('Stop', button_color=('gray34', 'black'), key='stop'), + sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3'), key='reset'), + sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4'), key='submit')] ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, @@ -28,27 +26,27 @@ if button is None: exit(69) if button is 'Start': - StartButton.Update(button_color=('gray34','black')) - StopButton.Update(button_color=('white', 'black')) - ResetButton.Update(button_color=('white', 'firebrick3')) + form.FindElement('start').Update(button_color=('gray34','black')) + form.FindElement('stop').Update(button_color=('white', 'black')) + form.FindElement('reset').Update(button_color=('white', 'firebrick3')) recording = True elif button is 'Stop' and recording: - StopButton.Update(button_color=('gray34','black')) - StartButton.Update(button_color=('white', 'black')) - SubmitButton.Update(button_color=('white', 'springgreen4')) + form.FindElement('stop').Update(button_color=('gray34','black')) + form.FindElement('start').Update(button_color=('white', 'black')) + form.FindElement('submit').Update(button_color=('white', 'springgreen4')) recording = False have_data = True elif button is 'Reset': - StopButton.Update(button_color=('gray34','black')) - StartButton.Update(button_color=('white', 'black')) - SubmitButton.Update(button_color=('gray34', 'springgreen4')) - ResetButton.Update(button_color=('gray34', 'firebrick3')) + form.FindElement('stop').Update(button_color=('gray34','black')) + form.FindElement('start').Update(button_color=('white', 'black')) + form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) + form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) recording = False have_data = False elif button is 'Submit' and have_data: - StopButton.Update(button_color=('gray34','black')) - StartButton.Update(button_color=('white', 'black')) - SubmitButton.Update(button_color=('gray34', 'springgreen4')) - ResetButton.Update(button_color=('gray34', 'firebrick3')) + form.FindElement('stop').Update(button_color=('gray34','black')) + form.FindElement('start').Update(button_color=('white', 'black')) + form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) + form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) recording = False diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 0e7664913..2b378c364 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -109,25 +109,34 @@ def AllWidgetsWithContext(): # sg.ChangeLookAndFeel('GreenTan') with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: + + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + layout = [ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], + sg.Column(column1, background_color='#F7F3EC')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))]] + [sg.Submit(), sg.Cancel()] + ] button, values = form.LayoutAndRead(layout) @@ -137,31 +146,37 @@ def AllWidgetsNoContext(): """ import PySimpleGUI as sg - # Green & tan color scheme sg.ChangeLookAndFeel('GreenTan') form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) + + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92'))] - ] + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] button, values = form.LayoutAndRead(layout) @@ -175,10 +190,9 @@ def NonBlockingWithUpdates(): form = sg.FlexForm('Running Timer') # create a text element that will be updated periodically - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], - [text_element], + [ sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] form.LayoutAndRead(form_rows, non_blocking=True) @@ -193,7 +207,7 @@ def NonBlockingWithUpdates(): break elif button == 'Start/Stop': timer_running = not timer_running - text_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)) time.sleep(.01) # if the loop finished then need to close the form for the user @@ -208,14 +222,13 @@ def NonBlockingWithContext(): import time with sg.FlexForm('Running Timer') as form: - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center') layout = [[sg.Text('Non blocking GUI with updates', justification='center')], - [text_element], + [sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center', key='output')], [sg.T(' ' * 15), sg.Quit()]] form.LayoutAndRead(layout, non_blocking=True) for i in range(1, 500): - text_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() if values is None or button == 'Quit': # if user closed the window using X break @@ -451,16 +464,7 @@ def MachineLearning(): """ import PySimpleGUI as sg - # Green & tan color scheme - sg.SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - input_elements_background_color='#F7F3EC', - button_color=('white', '#475841'), - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color='#F7F3EC') + sg.ChangeLookAndFeel('LightGreen') sg.SetOptions(text_justification='right') @@ -645,8 +649,6 @@ def InputElementUpdate(): """ import PySimpleGUI as g - # g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons - # Demonstrates a number of PySimpleGUI features including: # Default element size # auto_size_buttons @@ -655,17 +657,13 @@ def InputElementUpdate(): # Update of elements in form (Text, Input) # do_not_clear of Input elements - # 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')], - [in_elem], + [g.Input(size=(10, 1), do_not_clear=True, key='input')], [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], - [out_elem], + [ g.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='output')], ] form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) @@ -684,9 +682,9 @@ def InputElementUpdate(): keys_entered += button # add the new digit elif button is 'Submit': keys_entered = values['input'] - out_elem.Update(keys_entered) # output the final string + form.FindElement('outpput').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 def TableSimulation(): @@ -751,13 +749,12 @@ def TightLayout(): 'Table Simulation':TableSimulation, 'Tight Layout':TightLayout} -# multiline_elem = sg.Multiline(size=(70,35),pad=(5,(3,90))) # define the form layout listbox_values = [key for key in fig_dict.keys()] while True: - # sg.ChangeLookAndFeel('Dark') - # sg.SetOptions(element_padding=(0,0)) + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0,0)) col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),min(len(listbox_values), 20)), change_submits=False, key='func')], [sg.ReadFormButton('Run', pad=(0,0)), sg.ReadFormButton('Show Code', button_color=('white', 'gray25'), pad=(0,0)), sg.Exit(button_color=('white', 'firebrick4'), pad=(0,0))]] diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 149f89d78..76040c509 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -7,63 +7,62 @@ You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi - + NOTE - you will get a warning message printed when you exit using exit button. It will look something like: invalid command name "1616802625480StopMove" """ -def Timer(): - # ---------------- Create Form ---------------- - sg.ChangeLookAndFeel('Black') - sg.SetOptions(element_padding=(0,0)) - # Make a form, but don't use context manager - # Create the form layout - form_rows = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), sg.ReadFormButton('Reset', button_color=('white', '#007339')), sg.Exit(button_color=('white','firebrick4'))]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - form.Layout(form_rows) - # - # ---------------- main loop ---------------- - current_time = 0 - paused = False - start_time = int(round(time.time()*100)) - while (True): - # --------- Read and update window -------- - if not paused: - button, values = form.ReadNonBlocking() - current_time = int(round(time.time()*100)) - start_time - else: - button, values = form.Read() - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - if button is 'Reset': - start_time = int(round(time.time()*100)) - current_time = 0 - paused_time = start_time - elif button == 'Pause': - paused = True - paused_time = int(round(time.time()*100)) - element = form.FindElement('button') - element.Update(new_text='Run') - elif button == 'Run': - paused = False - start_time = start_time + int(round(time.time()*100)) - paused_time - element = form.FindElement('button') - element.Update(new_text='Pause') - - # --------- Display timer in window -------- - form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, - (current_time // 100) % 60, - current_time % 100)) - time.sleep(.01) +# ---------------- Create Form ---------------- +sg.ChangeLookAndFeel('Black') +sg.SetOptions(element_padding=(0, 0)) +# Make a form, but don't use context manager +# Create the form layout +form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), + sg.ReadFormButton('Reset', button_color=('white', '#007339')), + sg.Exit(button_color=('white', 'firebrick4'))]] +# Layout the rows of the form and perform a read. Indicate the form is non-blocking! +form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) +form.Layout(form_rows) +# +# ---------------- main loop ---------------- +current_time = 0 +paused = False +start_time = int(round(time.time() * 100)) +while (True): + # --------- Read and update window -------- + if not paused: + button, values = form.ReadNonBlocking() + current_time = int(round(time.time() * 100)) - start_time + else: + button, values = form.Read() + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + if button is 'Reset': + start_time = int(round(time.time() * 100)) + current_time = 0 + paused_time = start_time + elif button == 'Pause': + paused = True + paused_time = int(round(time.time() * 100)) + element = form.FindElement('button') + element.Update(text='Run') + elif button == 'Run': + paused = False + start_time = start_time + int(round(time.time() * 100)) - paused_time + element = form.FindElement('button') + element.Update(text='Pause') - # --------- After loop -------- + # --------- Display timer in window -------- + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + (current_time // 100) % 60, + current_time % 100)) + time.sleep(.01) - # Broke out of main loop. Close the window. - form.CloseNonBlockingForm() +# --------- After loop -------- -Timer() \ No newline at end of file +# Broke out of main loop. Close the window. +form.CloseNonBlockingForm() diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index a2ac060cb..bde67fdbe 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -18,7 +18,7 @@ print(button, "exiting") break if len(button) == 1: - text_elem.Update(new_value='%s - %s'%(button, ord(button))) + text_elem.Update(value='%s - %s' % (button, ord(button))) if button is not None: text_elem.Update(button) diff --git a/Demo_Keypad.py b/Demo_Keypad.py index 9efa683a2..fe0363636 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -1,43 +1,56 @@ -import PySimpleGUI as sg - -# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons - -# Demonstrates a number of PySimpleGUI features including: -# Default element size -# auto_size_buttons -# ReadFormButton -# Dictionary return values -# Update of elements in form (Text, Input) -# do_not_clear of Input elements - - -# create the 2 Elements we want to control outside the form - -layout = [[sg.Text('Enter Your Passcode')], - [sg.Input(size=(10, 1), do_not_clear=True, key='input')], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')], - [sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')], - [sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')], - [sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')], - [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], - ] - -form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False) -form.Layout(layout) - -# Loop forever reading the form's values, updating the Input field -keys_entered = '' -while True: - button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit - break - if button is 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button is 'Submit': - keys_entered = values['input'] - form.FindElement('out').Update(keys_entered) # output the final string - - form.FindElement('input').Update(keys_entered) # change the form to reflect current key string \ No newline at end of file +from tkinter import * +from random import randint +import PySimpleGUI as g +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg +from matplotlib.figure import Figure +import matplotlib.backends.tkagg as tkagg +import tkinter as Tk + + +def main(): + fig = Figure() + + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() + + layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + [g.Canvas(size=(640, 480), key='canvas')], + [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the form and show it without the plot + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') + form.Layout(layout) + form.ReadNonBlocking() + + canvas_elem = form.FindElement('canvas') + + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas + + dpts = [randint(0, 10) for x in range(10000)] + for i in range(len(dpts)): + button, values = form.ReadNonBlocking() + if button is 'Exit' or values is None: + exit(69) + + ax.cla() + ax.grid() + + ax.plot(range(20), dpts[i:i + 20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640 / 2, 480 / 2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + # time.sleep(.1) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index fc8f7cdd5..c58c28744 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -645,7 +645,7 @@ def main(): layout = [[canvas_elem, sg.ReadFormButton('Exit', pad=(0, (210, 0)))]] # create the form and show it without the plot - form = sg.FlexForm('Ping Graph', background_color='white') + form = sg.FlexForm('Ping Graph', background_color='white', grab_anywhere=True) form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py index 7d6bcd7d4..1af28f72a 100644 --- a/Demo_PNG_Viewer.py +++ b/Demo_PNG_Viewer.py @@ -4,9 +4,9 @@ # Simple Image Browser based on PySimpleGUI # Get the folder containing the images from the user -rc, folder = sg.GetPathBox('Image Browser', 'Image folder to open', default_path='') -if rc is False or folder is '': - sg.MsgBoxCancel('Cancelling') +folder = sg.PopupGetFolder('Image folder to open') +if folder is None: + sg.PopupCancel('Cancelling') exit(0) # get list of PNG files in folder @@ -14,52 +14,62 @@ filenames_only = [f for f in os.listdir(folder) if '.png' in f] if len(png_files) == 0: - sg.MsgBox('No PNG images in folder') + sg.Popup('No PNG images in folder') exit(0) + +# define menu layout +menu = [['File', ['Open Folder', 'Exit']], ['Help', ['About',]]] # create the form that also returns keyboard events form = sg.FlexForm('Image Browser', return_keyboard_events=True, location=(0,0), use_default_focus=False ) -# make these 2 elements outside the layout because want to "update" them later -# initialize to the first PNG file in the list -image_elem = sg.Image(filename=png_files[0]) -filename_display_elem = sg.Text(png_files[0], size=(80, 3)) -file_num_display_elem = sg.Text('File 1 of {}'.format(len(png_files)), size=(15,1)) - # define layout, show and read the form -col = [[filename_display_elem], - [image_elem], - [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2)), file_num_display_elem]] +col = [[sg.Text(png_files[0], size=(80, 3), key='filename')], + [sg.Image(filename=png_files[0], key='image')], + [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2)), + sg.Text('File 1 of {}'.format(len(png_files)), size=(15,1), key='filenum')]] col_files = [[sg.Listbox(values=filenames_only, size=(60,30), key='listbox')], [sg.ReadFormButton('Read')]] -layout = [[sg.Column(col_files), sg.Column(col)]] +layout = [[sg.Menu(menu)], [sg.Column(col_files), sg.Column(col)]] button, values = form.LayoutAndRead(layout) # Shows form on screen # loop reading the user input and displaying image, filename i=0 while True: - # perform button and keyboard operations + # --------------------- Button & Keyboard --------------------- if button is None: break elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34') and i < len(png_files)-1: i += 1 elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33') and i > 0: i -= 1 + elif button == 'Exit': + exit(69) + + filename = folder + '/' + values['listbox'][0] if button == 'Read' else png_files[i] - if button == 'Read': - filename = folder + '\\' + values['listbox'][0] - # print(filename) - else: - filename = png_files[i] + # ----------------- Menu choices ----------------- + if button == 'Open Folder': + newfolder = sg.PopupGetFolder('New folder', no_window=True) + if newfolder is None: + continue + folder = newfolder + png_files = [folder + '/' + f for f in os.listdir(folder) if '.png' in f] + filenames_only = [f for f in os.listdir(folder) if '.png' in f] + form.FindElement('listbox').Update(values=filenames_only) + form.Refresh() + i = 0 + elif button == 'About': + sg.Popup('Demo PNG Viewer Program', 'Please give PySimpleGUI a try!') # update window with new image - image_elem.Update(filename=filename) + form.FindElement('image').Update(filename=filename) # update window with filename - filename_display_elem.Update(filename) + form.FindElement('filename').Update(filename) # update page display - file_num_display_elem.Update('File {} of {}'.format(i+1, len(png_files))) + form.FindElement('filenum').Update('File {} of {}'.format(i+1, len(png_files))) # read the form button, values = form.Read() diff --git a/Demo_Password_Login.py b/Demo_Password_Login.py index c6040e3de..be3e764af 100644 --- a/Demo_Password_Login.py +++ b/Demo_Password_Login.py @@ -9,6 +9,8 @@ 3. Type password into the GUI 4. Copy and paste hash code form GUI into variable named login_password_hash 5. Run program again and test your login! + 6. Are you paying attention? The first person that can post an issue on GitHub with the + matching password to the hash code in this example gets a $5 PayPal payment """ # Use this GUI to get your password's hash code @@ -47,7 +49,7 @@ def PasswordMatches(password, hash): return password_hash == hash -login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' +login_password_hash = 'e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4' password = sg.PopupGetText('Password', password_char='*') if password == 'gui': # Remove when pasting into your program HashGeneratorGUI() # Remove when pasting into your program diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index 4498feea0..a1039249d 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -13,19 +13,4 @@ button, values = form.LayoutAndRead(layout) -print(button, values, values['name'], values['address'], values['phone']) - -form = sg.FlexForm('Simple data entry form') # begin with a blank form - -layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('phone')], - [sg.Ok(), sg.Cancel()] - ] - -button, values = form.LayoutAndRead(layout) -print(values) -name, address, phone = values -sg.MsgBox(button, values[0], values[1], values[2]) \ No newline at end of file +sg.Popup(button, values, values['name'], values['address'], values['phone']) diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index a96ef9554..b8d9ed0ba 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -1,30 +1,68 @@ +import csv import PySimpleGUI as sg def TableSimulation(): """ Display data in a table format """ - # sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0,0)) - layout = [[sg.T('Table Using Combos and Input Elements', font='Any 18')], - [sg.T('Row, Cal to change'), + + menu_def = [['File', ['Open', 'Save', 'Exit']], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['Help', 'About...'],] + + columm_layout = [[]] + + MAX_ROWS = 60 + MAX_COL = 10 + for i in range(MAX_ROWS): + inputs = [sg.T('{}'.format(i), size=(4,1), justification='right')] + [sg.In(size=(10, 1), pad=(1, 1), justification='right', key=(i,j), do_not_clear=True) for j in range(MAX_COL)] + columm_layout.append(inputs) + + layout = [ [sg.Menu(menu_def)], + [sg.T('Table Using Combos and Input Elements', font='Any 18')], + [sg.T('Type in a row, column and value. The form will update the values in realtime as you type'), sg.In(key='inputrow', justification='right', size=(8,1), pad=(1,1), do_not_clear=True), sg.In(key='inputcol', size=(8,1), pad=(1,1), justification='right', do_not_clear=True), - sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)]] - - for i in range(20): - inputs = [sg.In('{}{}'.format(i,j), size=(8, 1), pad=(1, 1), justification='right', key=(i,j), do_not_clear=True) for j in range(10)] - line = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info'))] - line.append(inputs) - layout.append(inputs) + sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)], + [sg.Column(columm_layout, size=(815,600), scrollable=True)]] form = sg.FlexForm('Table', return_keyboard_events=True, grab_anywhere=False) form.Layout(layout) while True: button, values = form.Read() - if button is None: + # --- Process buttons --- # + if button is None or button == 'Exit': break + elif button == 'About...': + sg.Popup('Demo of table capabilities') + elif button == 'Open': + filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) + # --- populate table with file contents --- # + if filename is not None: + with open(filename, "r") as infile: + reader = csv.reader(infile) + try: + data = list(reader) # read everything else into a list of rows + except: + sg.PopupError('Error reading file') + continue + # clear the table + [form.FindElement((i,j)).Update('') for j in range(MAX_COL) for i in range(MAX_ROWS)] + + for i, row in enumerate(data): + for j, item in enumerate(row): + location = (i,j) + try: # try the best we can at reading and filling the table + target_element = form.FindElement(location) + new_value = item + if target_element is not None and new_value != '': + target_element.Update(new_value) + except: + pass + + # if a valid table location entered, change that location's value try: location = (int(values['inputrow']), int(values['inputcol'])) target_element = form.FindElement(location) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ab4dbcdca..3c0946a01 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -282,11 +282,16 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, new_value): - try: - self.TKStringVar.set(new_value) - except: pass - self.DefaultText = new_value + def Update(self, value=None, disable=None): + if disable is True: + self.TKEntry['state'] = 'disabled' + elif disable is False: + self.TKEntry['state'] = 'normal' + if value is not None: + try: + self.TKStringVar.set(value) + except: pass + self.DefaultText = value def Get(self): return self.TKStringVar.get() @@ -317,23 +322,24 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value=None, values=None, disabled=False): + def Update(self, value=None, values=None, disable=None): if values is not None: try: self.TKCombo['values'] = values self.TKCombo.current(0) except: pass self.Values = values - - self.TKCombo['state'] = 'disable' if disabled else 'enable' - - for index, v in enumerate(self.Values): - if v == value: - try: - self.TKCombo.current(index) - except: pass - self.DefaultValue = value - break + for index, v in enumerate(self.Values): + if v == value: + try: + self.TKCombo.current(index) + except: pass + self.DefaultValue = value + break + if disable == True: + self.TKCombo['state'] = 'disable' + elif disable == False: + self.TKCombo['state'] = 'enable' def __del__(self): @@ -365,14 +371,21 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value): - for index, v in enumerate(self.Values): - if v == value: - try: - self.TKStringVar.set(value) - except: pass - self.DefaultValue = value - break + def Update(self, value=None, values=None, disable=None): + if values is not None: + self.Values = values + if self.Values is not None: + for index, v in enumerate(self.Values): + if v == value: + try: + self.TKStringVar.set(value) + except: pass + self.DefaultValue = value + break + if disable == True: + self.TKOptionMenu['state'] = 'disabled' + elif disable == False: + self.TKOptionMenu['state'] = 'normal' def __del__(self): @@ -415,12 +428,19 @@ def __init__(self, values, default_values=None, select_mode=None, change_submits super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, values): - self.TKListbox.delete(0, 'end') - for item in values: - self.TKListbox.insert(tk.END, item) - self.TKListbox.selection_set(0, 0) - self.Values = values + def Update(self, values=None, disable=None): + if disable == True: + self.TKListbox.configure(state='disabled') + elif disable == False: + self.TKListbox.configure(state='normal') + if values is not None: + self.TKListbox.delete(0, 'end') + for item in values: + self.TKListbox.insert(tk.END, item) + self.TKListbox.selection_set(0, 0) + self.Values = values + + def SetValue(self, values): for index, item in enumerate(self.Values): @@ -466,14 +486,17 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) - def Update(self, value): - if not value: - return + def Update(self, value=None, disable=None): location = EncodeRadioRowCol(self.Position[0], self.Position[1]) - try: - self.TKIntVar.set(location) - except: pass - self.InitialState = value + if value is not None: + try: + self.TKIntVar.set(location) + except: pass + self.InitialState = value + if disable == True: + self.TKRadio['state'] = 'disabled' + elif disable == False: + self.TKRadio['state'] = 'normal' def __del__(self): try: @@ -508,15 +531,16 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a def Get(self): return self.TKIntVar.get() - def Update(self, value): - try: - if value is None: - self.TKCheckbutton.configure(state='disabled') - else: - self.TKCheckbutton.configure(state='normal') + def Update(self, value=None, disable=None): + if value is not None: + try: self.TKIntVar.set(value) - except: pass - self.InitialState = value + self.InitialState = value + except: pass + if disable == True: + self.TKCheckbutton.configure(state='disabled') + elif disable == False: + self.TKCheckbutton.configure(state='normal') def __del__(self): @@ -550,17 +574,21 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, new_value=None, new_values=None ): - if new_values != None: + def Update(self, value=None, values=None, disable=None): + if values != None: old_value = self.TKStringVar.get() - self.Values = new_values - self.TKSpinBox.configure(values=new_values) + self.Values = values + self.TKSpinBox.configure(values=values) self.TKStringVar.set(old_value) - if new_value is not None: + if value is not None: try: - self.TKStringVar.set(new_value) + self.TKStringVar.set(value) except: pass - self.DefaultValue = new_value + self.DefaultValue = value + if disable == True: + self.TKSpinBox.configure(state='disabled') + elif disable == False: + self.TKSpinBox.configure(state='normal') def SpinChangedHandler(self, event): @@ -601,12 +629,17 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, new_value): - try: - self.TKText.delete('1.0', tk.END) - self.TKText.insert(1.0, new_value) - except: pass - self.DefaultText = new_value + def Update(self, value=None, disable=None): + if value is not None: + try: + self.TKText.delete('1.0', tk.END) + self.TKText.insert(1.0, value) + except: pass + self.DefaultText = value + if disable == True: + self.TKText.configure(state='disabled') + elif disable == False: + self.TKText.configure(state='normal') def Get(self): return self.TKText.get(1.0, tk.END) @@ -641,11 +674,11 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad, key=key) return - def Update(self, new_value = None, background_color=None, text_color=None, font=None): - if new_value is not None: - self.DisplayText=new_value + def Update(self, value = None, background_color=None, text_color=None, font=None): + if value is not None: + self.DisplayText=value stringvar = self.TKStringVar - stringvar.set(new_value) + stringvar.set(value) if background_color is not None: self.TKText.configure(background=background_color) if text_color is not None: @@ -690,17 +723,18 @@ def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], st s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", troughrelief=relief, borderwidth=border_width, thickness=width) self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate') - def Update(self, count, max=None): + def Update(self, count=None, max=None): if max is not None: self.Max = max try: self.TKProgressBarForReal.config(maximum=max) except: return False - if count > self.Max: return False - try: - self.TKProgressBarForReal['value'] = count - except: return False + if count is not None and count > self.Max: return False + if count is not None: + try: + self.TKProgressBarForReal['value'] = count + except: return False return True def __del__(self): @@ -922,16 +956,23 @@ def ButtonCallBack(self): return - def Update(self, value=None, new_text=None, button_color=(None, None)): + def Update(self, value=None, text=None, button_color=(None, None), disable=None): try: - if new_text is not None: - self.TKButton.configure(text=new_text) - self.ButtonText = new_text + if text is not None: + self.TKButton.configure(text=text) + self.ButtonText = text if button_color != (None, None): self.TKButton.config(foreground=button_color[0], background=button_color[1]) except: return - self.DefaultValue = value + if value is not None: + self.DefaultValue = value + if disable == True: + self.TKButton['state'] = 'disabled' + elif disable == False: + self.TKButton['state'] = 'normal' + + def __del__(self): try: @@ -1089,13 +1130,18 @@ def __init__(self, range=(None,None), default_value=None, resolution=None, orien super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) return - def Update(self, value, range=(None, None)): - try: - self.TKIntVar.set(value) - if range != (None, None): - self.TKScale.config(from_ = range[0], to_ = range[1]) - except: pass - self.DefaultValue = value + def Update(self, value=None, range=(None, None), disable=None): + if value is not None: + try: + self.TKIntVar.set(value) + if range != (None, None): + self.TKScale.config(from_ = range[0], to_ = range[1]) + except: pass + self.DefaultValue = value + if disable == True: + self.TKScale['state'] = 'disabled' + elif disable == False: + self.TKScale['state'] = 'normal' def SliderChangedHandler(self, event): # first, get the results table built @@ -2737,8 +2783,7 @@ def StartupTK(my_flex_form): my_flex_form.TKroot = root # Make moveable window - if ((my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere in (None, True)) and not my_flex_form.NonBlocking) or \ - (my_flex_form.GrabAnywhere == True and my_flex_form.NonBlocking): + if (my_flex_form.GrabAnywhere is not False and not (my_flex_form.NonBlocking and my_flex_form.GrabAnywhere is not True)): root.bind("", my_flex_form.StartMove) root.bind("", my_flex_form.StopMove) root.bind("", my_flex_form.OnMotion) @@ -3556,7 +3601,7 @@ def ObjToString(obj, extra=' '): # Exits via an OK button2 press # # Returns nothing # # ===================================================# -def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False): +def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, keep_on_top=False): ''' Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: @@ -3578,7 +3623,7 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar) as form: + with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, keep_on_top=keep_on_top) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) From ea0ea8a18bf9db280a20b85c7ee8569957ad8bb1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 11 Sep 2018 10:09:48 -0400 Subject: [PATCH 358/521] Demonstration of disabling elements --- Demo_Disable_Elements.py | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Demo_Disable_Elements.py diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py new file mode 100644 index 000000000..e33721420 --- /dev/null +++ b/Demo_Disable_Elements.py @@ -0,0 +1,61 @@ +import PySimpleGUI as sg + +""" +Turn off padding in order to get a really tight looking layout. +""" + +sg.ChangeLookAndFeel('Dark') +sg.SetOptions(element_padding=(0, 0)) +layout = [ + [sg.T('Notes:', pad=((3, 0), 0)), sg.In(size=(44, 1), background_color='white', text_color='black', key='notes')], + [sg.T('Output:', pad=((3, 0), 0)), sg.T('', size=(44, 1), text_color='white', key='output')], + [sg.CBox('Checkbox:', default=True, pad=((3, 0), 0), key='cbox'), sg.Listbox((1,2,3,4),size=(8,3),key='listbox'), + sg.Radio('Radio 1', default=True, group_id='1', key='radio1'), sg.Radio('Radio 2', default=False, group_id='1', key='radio2')], + [sg.Spin((1,2,3,4),1, key='spin'), sg.OptionMenu((1,2,3,4), key='option'), sg.Combo(values=(1,2,3,4),key='combo')], + [sg.Multiline('Multiline', size=(20,3), key='multi')], + [sg.Slider((1,10), size=(20,20), orientation='h', key='slider')], + [sg.ReadFormButton('Enable', button_color=('white', 'black')), + sg.ReadFormButton('Disable', button_color=('white', 'black')), + sg.ReadFormButton('Reset', button_color=('white', '#9B0023'), key='reset'), + sg.ReadFormButton('Values', button_color=('white', 'springgreen4')), + sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] + +form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, + auto_size_buttons=False, keep_on_top=True, grab_anywhere=False, + default_button_element_size=(12, 1)) + +form.Layout(layout) + +while True: + button, values = form.Read() + if button is None or button == 'Exit': + break + elif button == 'Disable': + form.FindElement('cbox').Update(disable=True) + form.FindElement('listbox').Update(disable=True) + form.FindElement('radio1').Update(disable=True) + form.FindElement('radio2').Update(disable=True) + form.FindElement('spin').Update(disable=True) + form.FindElement('option').Update(disable=True) + form.FindElement('combo').Update(disable=True) + form.FindElement('reset').Update(disable=True) + form.FindElement('notes').Update(disable=True) + form.FindElement('multi').Update(disable=True) + form.FindElement('slider').Update(disable=True) + elif button == 'Enable': + form.FindElement('cbox').Update(disable=False) + form.FindElement('listbox').Update(disable=False) + form.FindElement('radio1').Update(disable=False) + form.FindElement('radio2').Update(disable=False) + form.FindElement('spin').Update(disable=False) + form.FindElement('option').Update(disable=False) + form.FindElement('combo').Update(disable=False) + form.FindElement('reset').Update(disable=False) + form.FindElement('notes').Update(disable=False) + form.FindElement('multi').Update(disable=False) + form.FindElement('slider').Update(disable=False) + elif button == 'Values': + sg.Popup(values, keep_on_top=True) + + + From 8830699f73a8b8f2bf1da2b112f44f2de3965ac4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 11 Sep 2018 12:16:29 -0400 Subject: [PATCH 359/521] Bug fix in image update --- PySimpleGUI.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3c0946a01..02bf9b86e 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1057,10 +1057,9 @@ def Update(self, filename=None, data=None): else: image = data else: return - # width, height = image.width(), image.height() - # width, height = image.width(), image.height() - # self.tktext_label.configure(image=image, width=width, height=height) - self.tktext_label.configure(image=image) + width, height = image.width(), image.height() + self.tktext_label.configure(image=image, width=width, height=height) + # self.tktext_label.configure(image=image) self.tktext_label.image = image def __del__(self): From 1f2819c9a93833b805cc36541eaadb055e438237 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 11 Sep 2018 14:59:25 -0400 Subject: [PATCH 360/521] Renamed all of the Update 'disable' parameters to be 'disabled' --- Demo_Disable_Elements.py | 44 ++++++++++++++--------------- PySimpleGUI.py | 60 ++++++++++++++++++++-------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index e33721420..9580d2638 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -31,29 +31,29 @@ if button is None or button == 'Exit': break elif button == 'Disable': - form.FindElement('cbox').Update(disable=True) - form.FindElement('listbox').Update(disable=True) - form.FindElement('radio1').Update(disable=True) - form.FindElement('radio2').Update(disable=True) - form.FindElement('spin').Update(disable=True) - form.FindElement('option').Update(disable=True) - form.FindElement('combo').Update(disable=True) - form.FindElement('reset').Update(disable=True) - form.FindElement('notes').Update(disable=True) - form.FindElement('multi').Update(disable=True) - form.FindElement('slider').Update(disable=True) + form.FindElement('cbox').Update(disabled=True) + form.FindElement('listbox').Update(disabled=True) + form.FindElement('radio1').Update(disabled=True) + form.FindElement('radio2').Update(disabled=True) + form.FindElement('spin').Update(disabled=True) + form.FindElement('option').Update(disabled=True) + form.FindElement('combo').Update(disabled=True) + form.FindElement('reset').Update(disabled=True) + form.FindElement('notes').Update(disabled=True) + form.FindElement('multi').Update(disabled=True) + form.FindElement('slider').Update(disabled=True) elif button == 'Enable': - form.FindElement('cbox').Update(disable=False) - form.FindElement('listbox').Update(disable=False) - form.FindElement('radio1').Update(disable=False) - form.FindElement('radio2').Update(disable=False) - form.FindElement('spin').Update(disable=False) - form.FindElement('option').Update(disable=False) - form.FindElement('combo').Update(disable=False) - form.FindElement('reset').Update(disable=False) - form.FindElement('notes').Update(disable=False) - form.FindElement('multi').Update(disable=False) - form.FindElement('slider').Update(disable=False) + form.FindElement('cbox').Update(disabled=False) + form.FindElement('listbox').Update(disabled=False) + form.FindElement('radio1').Update(disabled=False) + form.FindElement('radio2').Update(disabled=False) + form.FindElement('spin').Update(disabled=False) + form.FindElement('option').Update(disabled=False) + form.FindElement('combo').Update(disabled=False) + form.FindElement('reset').Update(disabled=False) + form.FindElement('notes').Update(disabled=False) + form.FindElement('multi').Update(disabled=False) + form.FindElement('slider').Update(disabled=False) elif button == 'Values': sg.Popup(values, keep_on_top=True) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 02bf9b86e..173a74bf5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -282,10 +282,10 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value=None, disable=None): - if disable is True: + def Update(self, value=None, disabled=None): + if disabled is True: self.TKEntry['state'] = 'disabled' - elif disable is False: + elif disabled is False: self.TKEntry['state'] = 'normal' if value is not None: try: @@ -322,7 +322,7 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value=None, values=None, disable=None): + def Update(self, value=None, values=None, disabled=None): if values is not None: try: self.TKCombo['values'] = values @@ -336,9 +336,9 @@ def Update(self, value=None, values=None, disable=None): except: pass self.DefaultValue = value break - if disable == True: + if disabled == True: self.TKCombo['state'] = 'disable' - elif disable == False: + elif disabled == False: self.TKCombo['state'] = 'enable' @@ -371,7 +371,7 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, value=None, values=None, disable=None): + def Update(self, value=None, values=None, disabled=None): if values is not None: self.Values = values if self.Values is not None: @@ -382,9 +382,9 @@ def Update(self, value=None, values=None, disable=None): except: pass self.DefaultValue = value break - if disable == True: + if disabled == True: self.TKOptionMenu['state'] = 'disabled' - elif disable == False: + elif disabled == False: self.TKOptionMenu['state'] = 'normal' @@ -428,10 +428,10 @@ def __init__(self, values, default_values=None, select_mode=None, change_submits super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad) - def Update(self, values=None, disable=None): - if disable == True: + def Update(self, values=None, disabled=None): + if disabled == True: self.TKListbox.configure(state='disabled') - elif disable == False: + elif disabled == False: self.TKListbox.configure(state='normal') if values is not None: self.TKListbox.delete(0, 'end') @@ -486,16 +486,16 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) - def Update(self, value=None, disable=None): + def Update(self, value=None, disabled=None): location = EncodeRadioRowCol(self.Position[0], self.Position[1]) if value is not None: try: self.TKIntVar.set(location) except: pass self.InitialState = value - if disable == True: + if disabled == True: self.TKRadio['state'] = 'disabled' - elif disable == False: + elif disabled == False: self.TKRadio['state'] = 'normal' def __del__(self): @@ -531,15 +531,15 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a def Get(self): return self.TKIntVar.get() - def Update(self, value=None, disable=None): + def Update(self, value=None, disabled=None): if value is not None: try: self.TKIntVar.set(value) self.InitialState = value except: pass - if disable == True: + if disabled == True: self.TKCheckbutton.configure(state='disabled') - elif disable == False: + elif disabled == False: self.TKCheckbutton.configure(state='normal') @@ -574,7 +574,7 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, value=None, values=None, disable=None): + def Update(self, value=None, values=None, disabled=None): if values != None: old_value = self.TKStringVar.get() self.Values = values @@ -585,9 +585,9 @@ def Update(self, value=None, values=None, disable=None): self.TKStringVar.set(value) except: pass self.DefaultValue = value - if disable == True: + if disabled == True: self.TKSpinBox.configure(state='disabled') - elif disable == False: + elif disabled == False: self.TKSpinBox.configure(state='normal') @@ -629,16 +629,16 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, value=None, disable=None): + def Update(self, value=None, disabled=None): if value is not None: try: self.TKText.delete('1.0', tk.END) self.TKText.insert(1.0, value) except: pass self.DefaultText = value - if disable == True: + if disabled == True: self.TKText.configure(state='disabled') - elif disable == False: + elif disabled == False: self.TKText.configure(state='normal') def Get(self): @@ -956,7 +956,7 @@ def ButtonCallBack(self): return - def Update(self, value=None, text=None, button_color=(None, None), disable=None): + def Update(self, value=None, text=None, button_color=(None, None), disabled=None): try: if text is not None: self.TKButton.configure(text=text) @@ -967,9 +967,9 @@ def Update(self, value=None, text=None, button_color=(None, None), disable=None) return if value is not None: self.DefaultValue = value - if disable == True: + if disabled == True: self.TKButton['state'] = 'disabled' - elif disable == False: + elif disabled == False: self.TKButton['state'] = 'normal' @@ -1129,7 +1129,7 @@ def __init__(self, range=(None,None), default_value=None, resolution=None, orien super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) return - def Update(self, value=None, range=(None, None), disable=None): + def Update(self, value=None, range=(None, None), disabled=None): if value is not None: try: self.TKIntVar.set(value) @@ -1137,9 +1137,9 @@ def Update(self, value=None, range=(None, None), disable=None): self.TKScale.config(from_ = range[0], to_ = range[1]) except: pass self.DefaultValue = value - if disable == True: + if disabled == True: self.TKScale['state'] = 'disabled' - elif disable == False: + elif disabled == False: self.TKScale['state'] = 'normal' def SliderChangedHandler(self, event): From 24de0ff8b53f57f81cd678942feb361e48a6f35f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 11 Sep 2018 16:09:36 -0400 Subject: [PATCH 361/521] RELEASE 3.1.2 --- PySimpleGUI.py | 10 +++++----- docs/index.md | 7 +++++-- readme.md | 7 +++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 173a74bf5..ec399fb1c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -67,11 +67,11 @@ TRANSPARENT_BUTTON = ('#F0F0F0', '#F0F0F0') #-------------------------------------------------------------------------------- # Progress Bar Relief Choices -RELIEF_RAISED= 'raised' -RELIEF_SUNKEN= 'sunken' -RELIEF_FLAT= 'flat' -RELIEF_RIDGE= 'ridge' -RELIEF_GROOVE= 'groove' +RELIEF_RAISED = 'raised' +RELIEF_SUNKEN = 'sunken' +RELIEF_FLAT = 'flat' +RELIEF_RIDGE = 'ridge' +RELIEF_GROOVE = 'groove' RELIEF_SOLID = 'solid' DEFAULT_PROGRESS_BAR_COLOR = (GREENS[0], '#D0D0D0') # a nice green progress bar diff --git a/docs/index.md b/docs/index.md index 495cc5f93..0f1218c52 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.01.0) + (Ver 3.1.2) @@ -2112,7 +2112,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option -| 3.01.0 | Sept 10, 2018 - Menus! (sort of a big deal), +| 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) +| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) ### Release Notes @@ -2140,6 +2141,8 @@ One change that will set PySimpleGUI apart is the parlor trick of being able to Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to FlexForm. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. +3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. + ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index 495cc5f93..0f1218c52 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.01.0) + (Ver 3.1.2) @@ -2112,7 +2112,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.20.0 | Sept 4, 2018 - Some sizable features this time around of interest to advanced users. Renaming of the MsgBox functions to Popup. Renaming GetFile, etc, to PopupGetFile. High-level windowing capabilities start with Popup, PopupNoWait/PopupNonblocking, PopupNoButtons, default icon, change_submits option for Listbox/Combobox/Slider/Spin/, New OptionMenu element, updating elements after shown, system defaul color option for progress bars, new button type (Dummy Button) that only closes a window, SCROLLABLE Columns!! (yea, playing in the Big League now), LayoutAndShow function removed, form.Fill - bulk updates to forms, FindElement - find element based on key value (ALL elements have keys now), no longer use grid packing for row elements (a potentially huge change), scrolled text box sizing changed, new look and feel themes (Dark, Dark2, Black, Tan, TanBlue, DarkTanBlue, DarkAmber, DarkBlue, Reds, Green) | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option -| 3.01.0 | Sept 10, 2018 - Menus! (sort of a big deal), +| 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) +| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) ### Release Notes @@ -2140,6 +2141,8 @@ One change that will set PySimpleGUI apart is the parlor trick of being able to Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to FlexForm. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. +3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. + ### Upcoming Make suggestions people! Future release features From 94e18b299306176304728df4a53275fd3b011ba1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 12 Sep 2018 13:46:06 -0400 Subject: [PATCH 362/521] Font feature added to Input Text fields... can't believe it wasn't implemented. Has the beginnings of the Treeview element. Should hold off using it for now though. --- PySimpleGUI.py | 103 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 86 insertions(+), 17 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ec399fb1c..1724a72de 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -95,6 +95,13 @@ SELECT_MODE_SINGLE = tk.SINGLE LISTBOX_SELECT_MODE_SINGLE = 'single' +TREEVIEW_SELECT_MODE_NONE = tk.NONE +TREEVIEW_SELECT_MODE_BROWSE = tk.BROWSE +TREEVIEW_SELECT_MODE_EXTENDED = tk.EXTENDED +DEFAULT_TREEVIEW_SECECT_MODE = TREEVIEW_SELECT_MODE_EXTENDED + + + # DEFAULT_METER_ORIENTATION = 'Vertical' # ----====----====----==== Constants the user should NOT f-with ====----====----====----# ThisRow = 555666777 # magic number @@ -163,6 +170,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_MENUBAR = 600 ELEM_TYPE_PROGRESS_BAR = 200 ELEM_TYPE_BLANK = 100 +ELEM_TYPE_TREEVIEW = 700 # ------------------------- MsgBox Buttons Types ------------------------- # MSG_BOX_YES_NO = 1 @@ -262,7 +270,7 @@ def __del__(self): # ---------------------------------------------------------------------- # class InputText(Element): def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', - justification=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): + justification=None, background_color=None, text_color=None, font=None, do_not_clear=False, key=None, focus=False, pad=None): ''' Input a line of text Element :param default_text: Default value to display @@ -279,7 +287,7 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto self.Focus = focus self.do_not_clear = do_not_clear self.Justification = justification - super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, font=font) def Update(self, value=None, disabled=None): @@ -761,9 +769,9 @@ def __init__(self, parent, width, height, bd, background_color=None, text_color= self.output.configure(fg=text_color) self.vsb = tk.Scrollbar(frame, orient="vertical", command=self.output.yview) self.output.configure(yscrollcommand=self.vsb.set) - self.output.pack(side="left", fill="both") - self.vsb.pack(side="left", fill="y") - frame.pack(side="left", padx=pad[0], pady=pad[1]) + self.output.pack(side="left", fill="both", expand=True) + self.vsb.pack(side="left", fill="y", expand=False) + frame.pack(side="left", padx=pad[0], pady=pad[1], expand=True, fill='y') self.previous_stdout = sys.stdout self.previous_stderr = sys.stderr @@ -1162,10 +1170,10 @@ def __init__(self, master, **kwargs): # create a canvas object and a vertical scrollbar for scrolling it self.vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) - self.vscrollbar.pack(side='right', fill="y", expand="false") + self.vscrollbar.pack(side='right', fill="y", expand="true") self.hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL) - self.hscrollbar.pack(side='bottom', fill="x", expand="false") + self.hscrollbar.pack(side='bottom', fill="x", expand="true") self.canvas = tk.Canvas(self, yscrollcommand=self.vscrollbar.set, xscrollcommand=self.hscrollbar.set) self.canvas.pack(side="left", fill="both", expand=True) @@ -1179,17 +1187,20 @@ def __init__(self, master, **kwargs): # create a frame inside the canvas which will be scrolled with it self.TKFrame = tk.Frame(self.canvas, **kwargs) - self.canvas.create_window(0, 0, window=self.TKFrame, anchor="nw") + self.frame_id = self.canvas.create_window(0, 0, window=self.TKFrame, anchor="nw") self.canvas.config(borderwidth=0, highlightthickness=0) self.TKFrame.config(borderwidth=0, highlightthickness=0) self.config(borderwidth=0, highlightthickness=0) + self.canvas.bind("", self.resize_frame) self.bind('', self.set_scrollregion) self.bind_mouse_scroll(self.canvas, self.yscroll) self.bind_mouse_scroll(self.hscrollbar, self.xscroll) self.bind_mouse_scroll(self.vscrollbar, self.yscroll) + def resize_frame(self, e): + self.canvas.itemconfig(self.frame_id, height=e.height, width=e.width) def yscroll(self, event): if event.num == 5 or event.delta < 0: @@ -1482,9 +1493,8 @@ def selection(self): # Canvas # # ---------------------------------------------------------------------- # class Menu(Element): - def __init__(self, menu_definition, command=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, menu_definition, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR - self.Command = command self.MenuDefinition = menu_definition self.TKMenu = None @@ -1501,6 +1511,47 @@ def __del__(self): super().__del__() +# ---------------------------------------------------------------------- # +# TreeView # +# ---------------------------------------------------------------------- # +class Treeview(Element): + def __init__(self, values, column_headings=None, display_columns=None, show=None, tags=None, label=None, image=None, readonly=None, disabled=False, select_mode=None, children_hidden=False, font=None, justification='left', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + self.Values = values + self.ColumnHeadings = column_headings + self.ColumnsToDisplay = display_columns + self.Show = show + self.ChildrenHidden = children_hidden + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.TextColor = text_color + self.Disabled = disabled + self.ReadOnly = readonly + self.Image = image + self.Label = label + self.Tags = tags + self.Justification = justification + self.InitialState = None + self.SelectMode = select_mode + self.TKTreeview = None + + super().__init__(ELEM_TYPE_TREEVIEW, text_color=text_color, background_color=background_color, scale=scale, font=font, size=size, pad=pad, key=key) + return + + + def __del__(self): + super().__del__() + + +class TreeviewItem(object): + def __init__(self, text=None, image=None, values=None, hidden=False, tags=None ): + self.Text = text + self.Image = image + self.Vales = values + self.Hidden = hidden + self.Tags = tags + + + + # ------------------------------------------------------------------------- # # FlexForm CLASS # # ------------------------------------------------------------------------- # @@ -2259,7 +2310,7 @@ def CharWidthInPixels(): col_frame = tk.Frame(tk_row_frame) PackFormIntoFrame(element, col_frame, toplevel_form) - col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # @@ -2301,7 +2352,7 @@ def CharWidthInPixels(): tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) - tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill='both', expand=True) element.TKText = tktext_label # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: @@ -2367,14 +2418,14 @@ def CharWidthInPixels(): else: justification = DEFAULT_TEXT_JUSTIFICATION justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT - anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE + # anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show, justify=justify) element.TKEntry.bind('', element.ReturnKeyHandler) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKEntry.configure(background=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKEntry.configure(fg=text_color) - element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='x') if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): focus_set = True element.TKEntry.focus_set() @@ -2476,7 +2527,7 @@ def CharWidthInPixels(): if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKText.configure(background=element.BackgroundColor) element.TKText.vbar.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) - element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') if element.EnterSubmits: element.TKText.bind('', element.ReturnKeyHandler) if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): @@ -2556,7 +2607,7 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font, pad=element.Pad) - element.TKOut.pack(side=tk.LEFT) + element.TKOut.pack(side=tk.LEFT, expand=True, fill='both') # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: if element.Filename is not None: @@ -2641,10 +2692,28 @@ def CharWidthInPixels(): tkscale.configure(fg=text_color) tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) element.TKScale = tkscale + # ------------------------- Treeview element ------------------------- # + elif element_type == ELEM_TYPE_TREEVIEW: + width, height = element_size + anchor = tk.W if element.Justification == 'left' else tk.E + element.TKTreeview = ttk.Treeview(tk_row_frame, columns=element.ColumnHeadings, + displaycolumns=element.ColumnsToDisplay, show=element.Show, height=height, selectmode=element.SelectMode) + treeview = element.TKTreeview + for heading in element.ColumnHeadings: + treeview.heading(heading, text=heading) + treeview.column(heading, width=width*CharWidthInPixels(), anchor=anchor) + for value in element.Values: + id = treeview.insert('', 'end', text=value, values=value) + print(id) + for i in range(5): + treeview.insert(id, 'end', text=value, values=i) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKTreeview.configure(background=element.BackgroundColor) + element.TKTreeview.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) - tk_row_frame.pack(side=tk.TOP, anchor='sw', padx=DEFAULT_MARGINS[0]) + tk_row_frame.pack(side=tk.TOP, anchor='sw', padx=DEFAULT_MARGINS[0], expand=True, fill='both') if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: tk_row_frame.configure(background=form.BackgroundColor) From 90010026ac0d4198bc7ae8ce9231d2fbc8db3a62 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 12 Sep 2018 13:58:16 -0400 Subject: [PATCH 363/521] New Popup option.... background, text colors Still need to add to add those popup calls! --- PySimpleGUI.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1724a72de..8ae295637 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3669,7 +3669,7 @@ def ObjToString(obj, extra=' '): # Exits via an OK button2 press # # Returns nothing # # ===================================================# -def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, keep_on_top=False): +def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, keep_on_top=False): ''' Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. :param args: @@ -3691,7 +3691,7 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, keep_on_top=keep_on_top) as form: + with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, keep_on_top=keep_on_top) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -3708,7 +3708,7 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines # print('Msgbox width, height', width_used, height) - form.AddRow(Text(message_wrapped, auto_size_text=True)) + form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) total_lines += height pad = max_line_total-15 if max_line_total > 15 else 1 @@ -3719,18 +3719,18 @@ def Popup(*args, button_color=None, button_type=MSG_BOX_OK, auto_close=False, au PopupButton = SimpleButton # show either an OK or Yes/No depending on paramater if button_type is MSG_BOX_YES_NO: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) elif button_type is MSG_BOX_CANCELLED: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) elif button_type is MSG_BOX_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) elif button_type is MSG_BOX_OK_CANCEL: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), PopupButton('Cancel', size=(5, 1), button_color=button_color)) elif button_type is MSG_BOX_NO_BUTTONS: pass else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) if non_blocking: button, values = form.ReadNonBlocking() From 18584aa533403821ba6e6ae1a97aa7bf263b2bfc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 12 Sep 2018 16:19:41 -0400 Subject: [PATCH 364/521] Change to TEXT WRAPPING beware, backed out the form resizing --- PySimpleGUI.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 8ae295637..65d4da1fd 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2315,6 +2315,7 @@ def CharWidthInPixels(): col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # elif element_type == ELEM_TYPE_TEXT: + # auto_size_text = element.AutoSizeText display_text = element.DisplayText # text to display if auto_size_text is False: width, height=element_size @@ -2344,7 +2345,7 @@ def CharWidthInPixels(): tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth, font=font) # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS wraplen = tktext_label.winfo_reqwidth()+40 # width of widget in Pixels - if not auto_size_text: + if not auto_size_text and height == 1: wraplen = 0 # print("wraplen, width, height", wraplen, width, height) tktext_label.configure(anchor=anchor, wraplen=wraplen) # set wrap to width of widget @@ -2713,8 +2714,7 @@ def CharWidthInPixels(): #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) - tk_row_frame.pack(side=tk.TOP, anchor='sw', padx=DEFAULT_MARGINS[0], expand=True, fill='both') - + tk_row_frame.pack(side=tk.TOP, anchor='sw', padx=DEFAULT_MARGINS[0], expand=True) if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: tk_row_frame.configure(background=form.BackgroundColor) if not toplevel_form.IsTabbedForm: From 57396f3dc116993d8462b0c501883ec833817cb7 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 12 Sep 2018 16:46:35 -0400 Subject: [PATCH 365/521] NEW Demos - Floating CPU utlization widget, Compound element - Spinner, refresh of the other Demos --- Demo_Cookbook_Browser.py | 2 +- Demo_Desktop_Widget_CPU_Utilization.py | 49 ++++++++++++++++++++++++++ Demo_Disable_Elements.py | 14 ++++++++ Demo_Fill_Form.py | 2 +- Demo_OpenCV.py | 2 +- Demo_Pi_LEDs.py | 21 +++++------ Demo_Spinner_Compound_Element.py | 34 ++++++++++++++++++ Demo_Table_Simulation.py | 2 +- 8 files changed, 109 insertions(+), 17 deletions(-) create mode 100644 Demo_Desktop_Widget_CPU_Utilization.py create mode 100644 Demo_Spinner_Compound_Element.py diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index 2b378c364..f188253dd 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -682,7 +682,7 @@ def InputElementUpdate(): keys_entered += button # add the new digit elif button is 'Submit': keys_entered = values['input'] - form.FindElement('outpput').Update(keys_entered) # output the final string + form.FindElement('output').Update(keys_entered) # output the final string form.FindElement('input').Update(keys_entered) # change the form to reflect current key string diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py new file mode 100644 index 000000000..9ba089523 --- /dev/null +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -0,0 +1,49 @@ +import PySimpleGUI as sg +import time +import psutil + +""" + PSUTIL Desktop Widget + Creates a floating CPU utilization window that is always on top of other windows + You move it by grabbing anywhere on the window + Good example of how to do a non-blocking, polling program using PySimpleGUI + Use the spinner to adjust the number of seconds between readings of the CPU utilizaiton + + NOTE - you will get a warning message printed when you exit using exit button. + It will look something like: + invalid command name "1616802625480StopMove" +""" + +# ---------------- Create Form ---------------- +sg.ChangeLookAndFeel('Black') +form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] +# Layout the rows of the form and perform a read. Indicate the form is non-blocking! +form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) +form.Layout(form_rows) + +# ---------------- main loop ---------------- +while (True): + # --------- Read and update window -------- + button, values = form.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + interval = int(values['spin']) + except: + interval = 1 + + cpu_percent = psutil.cpu_percent(interval=interval) + + # --------- Display timer in window -------- + + form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + + +# --------- After loop -------- + +# Broke out of main loop. Close the window. +form.CloseNonBlockingForm() diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index 9580d2638..4741c4b03 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -26,6 +26,20 @@ form.Layout(layout) +form.ReadNonBlocking() + +form.FindElement('cbox').Update(disabled=True) +form.FindElement('listbox').Update(disabled=True) +form.FindElement('radio1').Update(disabled=True) +form.FindElement('radio2').Update(disabled=True) +form.FindElement('spin').Update(disabled=True) +form.FindElement('option').Update(disabled=True) +form.FindElement('combo').Update(disabled=True) +form.FindElement('reset').Update(disabled=True) +form.FindElement('notes').Update(disabled=True) +form.FindElement('multi').Update(disabled=True) +form.FindElement('slider').Update(disabled=True) + while True: button, values = form.Read() if button is None or button == 'Exit': diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index d61948834..aaa0ae187 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -35,7 +35,7 @@ def Everything(): sg.Text(' ' * 40), sg.ReadFormButton('SaveSettings'), sg.ReadFormButton('LoadSettings')] ] - form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1)) + form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1), grab_anywhere=False) # button, values = form.LayoutAndRead(layout, non_blocking=True) form.Layout(layout) diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index 67acba935..2c8feb7be 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -32,7 +32,7 @@ def main(): [sg.ReadFormButton('Exit', size=(10, 2), pad=((600, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', no_titlebar=True, location=(0,0)) + form = sg.FlexForm('Demo Application - OpenCV Integration', no_titlebar=False, location=(0,0)) form.Layout(layout) form.ReadNonBlocking() diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py index 6fb60ca04..ec89ab118 100644 --- a/Demo_Pi_LEDs.py +++ b/Demo_Pi_LEDs.py @@ -12,8 +12,8 @@ def SwitchLED(): varLEDStatus = GPIO.input(14) - - if varLEDStatus == 0: + varLedStatus = 0 + if varLedStatus == 0: GPIO.output(14, GPIO.HIGH) return "LED is switched ON" else: @@ -28,32 +28,27 @@ def FlashLED(): GPIO.output(14, GPIO.LOW) time.sleep(0.5) -results_elem = rg.T('', size=(30, 1)) - layout = [[rg.T('Raspberry Pi LEDs')], - [results_elem], + [rg.T('', size=(14, 1), key='output')], [rg.ReadFormButton('Switch LED')], [rg.ReadFormButton('Flash LED')], - [rg.ReadFormButton('Show slider value')], - [rg.Slider(range=(0, 100), default_value=0, orientation='h', size=(40, 20), key='slider')], [rg.Exit()] ] -form = rg.FlexForm('Raspberry Pi GUI') +form = rg.FlexForm('Raspberry Pi GUI', grab_anywhere=False) form.Layout(layout) while True: button, values = form.Read() if button is None: break + if button is 'Switch LED': - results_elem.Update(SwitchLED()) + form.FindElement('output').Update(SwitchLED()) elif button is 'Flash LED': - results_elem.Update('LED is Flashing') + form.FindElement('output').Update('LED is Flashing') form.ReadNonBlocking() FlashLED() - results_elem.Update('') - elif button is 'Show slider value': - results_elem.Update('Slider = %s'%values['slider']) + form.FindElement('output').Update('') rg.MsgBox('Done... exiting') diff --git a/Demo_Spinner_Compound_Element.py b/Demo_Spinner_Compound_Element.py new file mode 100644 index 000000000..ec13d2401 --- /dev/null +++ b/Demo_Spinner_Compound_Element.py @@ -0,0 +1,34 @@ +import PySimpleGUI as sg + +""" + Demo of how to combine elements into your own custom element +""" + +sg.SetOptions(element_padding=(0,0)) +sg.ChangeLookAndFeel('Dark') +# --- Define our "Big-Button-Spinner" compound element. Has 2 buttons and an input field --- # +NewSpinner = [sg.ReadFormButton('-', size=(4,1), font='Any 12'), + sg.In('0', size=(5,1), font='Any 14', justification='r', key='spin'), + sg.ReadFormButton('+', size=(4,1), font='Any 12')] +# --- Define Window --- # +layout = [ + [sg.Text('Spinner simulation')], + NewSpinner, + [sg.T('')], + [sg.Ok()] + ] + +form = sg.FlexForm('Spinner simulation') +form.Layout(layout) + +# --- Event Loop --- # +counter = 0 +while True: + button, value = form.Read() + + if button == 'Ok' or button is None: # be nice to your user, always have an exit from your form + break + + # --- do spinner stuff --- # + counter += 1 if button =='+' else -1 if button == '-' else 0 + form.FindElement('spin').Update(counter) diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index b8d9ed0ba..14860b3b2 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -25,7 +25,7 @@ def TableSimulation(): sg.In(key='inputrow', justification='right', size=(8,1), pad=(1,1), do_not_clear=True), sg.In(key='inputcol', size=(8,1), pad=(1,1), justification='right', do_not_clear=True), sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)], - [sg.Column(columm_layout, size=(815,600), scrollable=True)]] + [sg.Column(columm_layout, size=(800,600), scrollable=True)]] form = sg.FlexForm('Table', return_keyboard_events=True, grab_anywhere=False) form.Layout(layout) From bb990fca051284a624395434f2a8b2dd5d8322f5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 12 Sep 2018 18:31:39 -0400 Subject: [PATCH 366/521] New Recipes Toolbars, Explanation of the "Event Loop" --- Demo_Spinner_Compound_Element.py | 8 ++--- docs/cookbook.md | 58 +++++++++++++++++++++++++++++++- docs/index.md | 57 +++++++++++++++++++++++++++++-- readme.md | 57 +++++++++++++++++++++++++++++-- 4 files changed, 171 insertions(+), 9 deletions(-) diff --git a/Demo_Spinner_Compound_Element.py b/Demo_Spinner_Compound_Element.py index ec13d2401..49ef2cc35 100644 --- a/Demo_Spinner_Compound_Element.py +++ b/Demo_Spinner_Compound_Element.py @@ -5,11 +5,11 @@ """ sg.SetOptions(element_padding=(0,0)) -sg.ChangeLookAndFeel('Dark') +# sg.ChangeLookAndFeel('Dark') # --- Define our "Big-Button-Spinner" compound element. Has 2 buttons and an input field --- # -NewSpinner = [sg.ReadFormButton('-', size=(4,1), font='Any 12'), - sg.In('0', size=(5,1), font='Any 14', justification='r', key='spin'), - sg.ReadFormButton('+', size=(4,1), font='Any 12')] +NewSpinner = [sg.ReadFormButton('-', size=(2,1), font='Any 12'), + sg.In('0', size=(2,1), font='Any 14', justification='r', key='spin'), + sg.ReadFormButton('+', size=(2,1), font='Any 12')] # --- Define Window --- # layout = [ [sg.Text('Spinner simulation')], diff --git a/docs/cookbook.md b/docs/cookbook.md index d5a98b353..47ae0e4da 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1004,11 +1004,23 @@ Use the upper half to generate your hash code. Then paste it into the code in t ## Desktop Floating Toolbar +#### Hiding your windows commmand window +For this and the Time & CPU Widgets you may wish to consider using a tool or technique that will hide your Windows Command Prompt window. I recommend the techniques found on this site: + +[http://www.robvanderwoude.com/battech_hideconsole.php](http://www.robvanderwoude.com/battech_hideconsole.php) + +At the moment I'm using the technique that involves wscript and a script named RunNHide.vbs. They are working beautifully. I'm using a hotkey program and launch by using this script with the command "python.exe insert_program_here.py". I guess the next widget should be one that shows all the programs launched this way so you can kill any bad ones. If you don't properly catch the exit button on your form then your while loop is going to keep on working while your window is no longer there so be careful in your code to always have exit explicitly handled. + + +### Floating toolbar + This is a cool one! (Sorry about the code pastes... I'm working in it) Impress your friends at what a tool-wizard you are by popping a custom toolbar that you keep in the corner of your screen. It stays on top of all your other windows. + + ![toolbar gray](https://user-images.githubusercontent.com/13696193/45324308-bfb73700-b51b-11e8-90e7-ab24f3d6e61d.jpg) You can easily change colors to match your background by changing a couple of parameters in the code. @@ -1091,12 +1103,13 @@ You can easily change colors to match your background by changing a couple of pa -## Desktop Floating Widget +## Desktop Floating Widget - Timer This is a little widget you can leave running on your desktop. Will hopefully see more of these for things like checking email, checking server pings, displaying system information, dashboards, etc . Much of the code is handling the button states in a fancy way. It could be much simpler if you don't change the button text based on state. +![timer](https://user-images.githubusercontent.com/13696193/45336349-26a31300-b551-11e8-8b06-d1232ff8ca10.jpg) import PySimpleGUI as sg import time @@ -1159,6 +1172,49 @@ Much of the code is handling the button states in a fancy way. It could be much form.CloseNonBlockingForm() +## Desktop Floating Widget - CPU Utilization + +Like the Timer widget above, this script can be kept running. You will need the package psutil installed in order to run this Recipe. +The spinner changes the number of seconds between reads. + + +![cpu widget 2](https://user-images.githubusercontent.com/13696193/45456096-77348080-b6b7-11e8-8906-6663c31ad0eb.jpg) + + + + import PySimpleGUI as sg + import psutil + + # ---------------- Create Form ---------------- + sg.ChangeLookAndFeel('Black') + form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) + form.Layout(form_rows) + + # ---------------- main loop ---------------- + while (True): + # --------- Read and update window -------- + button, values = form.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + interval = int(values['spin']) + except: + interval = 1 + + cpu_percent = psutil.cpu_percent(interval=interval) + + # --------- Display timer in window -------- + + form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() ## Menus diff --git a/docs/index.md b/docs/index.md index 0f1218c52..e472b237d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -137,8 +137,9 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Bulk form-fill operation Save / Load form to/from disk Borderless (no titlebar) windows - Always on top + Always on top windows Menus + No async programming required (no callbacks to worry about) An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -181,6 +182,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in --- ### Design Goals + > Copy, Paste, Run. `PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. @@ -188,12 +190,16 @@ You will see a number of different styles of buttons, data entry fields, etc, in > Be Pythonic Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. - A form is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values +- Linear programming instead of callbacks + + ----- @@ -593,7 +599,7 @@ The third is the 'compact form'. It compacts down into 2 lines of code. One li You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. -### How GUI Programming in Python Should Look? +### How GUI Programming in Python Should Look? At least for beginners Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. @@ -747,6 +753,53 @@ This sample program demonstrates these 2 steps as well as how to address the ret sg.Popup(button, values, values[0], values['address'], values['phone']) + +## The Event Loop / Callback Functions + +All GUIs have a few things in common, one of them being an "event loop" of some sort. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. This simple scenarios are front-end GUIs where you call sg.GetFile for example and then call your program that does something with the file. + +Event Loops are used in programs where the window stays open after button presses. The program processes button clicks a loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. + +This little program has a typical Event Loop + +![pi leds](https://user-images.githubusercontent.com/13696193/45448517-8cea7b80-b6a0-11e8-8dbe-eeefea2e93c1.jpg) + + + + import PySimpleGUI as sg + layout = [[sg.T('Raspberry Pi LEDs')], + [sg.ReadFormButton('Turn LED On')], + [sg.ReadFormButton('Turn LED Off')], + [sg.Exit()]] + + form = sg.FlexForm('Raspberry Pi GUI', grab_anywhere=False) + form.Layout(layout) + + # ---- Event Loop ---- # + while True: + button, values = form.Read() + + # ---- Process Button Clicks ---- # + if button is None or button == 'Exit': + break + if button == 'Turn LED Off': + turn_LED_off() + elif button == 'Turn LED On': + turn_LED_on() + + # ---- After Event Loop ---- # + sg.Popup('Done... exiting') + + + +In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) + +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions. A function you define would be called when a button is clicked. This requires you to write code where data is shared between these callback functions. There is a lot more communications that have to happen between parts of your program. + +One of the larger hurdles for beginners to GUI programming are these callback functions. PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simple read your button click and take appropriate action. + +Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible tradeoff to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. + --- ## All Widgets / Elements diff --git a/readme.md b/readme.md index 0f1218c52..e472b237d 100644 --- a/readme.md +++ b/readme.md @@ -137,8 +137,9 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Bulk form-fill operation Save / Load form to/from disk Borderless (no titlebar) windows - Always on top + Always on top windows Menus + No async programming required (no callbacks to worry about) An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... @@ -181,6 +182,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in --- ### Design Goals + > Copy, Paste, Run. `PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. @@ -188,12 +190,16 @@ You will see a number of different styles of buttons, data entry fields, etc, in > Be Pythonic Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + - Forms are represented as Python lists. - A form is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values +- Linear programming instead of callbacks + + ----- @@ -593,7 +599,7 @@ The third is the 'compact form'. It compacts down into 2 lines of code. One li You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. -### How GUI Programming in Python Should Look? +### How GUI Programming in Python Should Look? At least for beginners Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. @@ -747,6 +753,53 @@ This sample program demonstrates these 2 steps as well as how to address the ret sg.Popup(button, values, values[0], values['address'], values['phone']) + +## The Event Loop / Callback Functions + +All GUIs have a few things in common, one of them being an "event loop" of some sort. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. This simple scenarios are front-end GUIs where you call sg.GetFile for example and then call your program that does something with the file. + +Event Loops are used in programs where the window stays open after button presses. The program processes button clicks a loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. + +This little program has a typical Event Loop + +![pi leds](https://user-images.githubusercontent.com/13696193/45448517-8cea7b80-b6a0-11e8-8dbe-eeefea2e93c1.jpg) + + + + import PySimpleGUI as sg + layout = [[sg.T('Raspberry Pi LEDs')], + [sg.ReadFormButton('Turn LED On')], + [sg.ReadFormButton('Turn LED Off')], + [sg.Exit()]] + + form = sg.FlexForm('Raspberry Pi GUI', grab_anywhere=False) + form.Layout(layout) + + # ---- Event Loop ---- # + while True: + button, values = form.Read() + + # ---- Process Button Clicks ---- # + if button is None or button == 'Exit': + break + if button == 'Turn LED Off': + turn_LED_off() + elif button == 'Turn LED On': + turn_LED_on() + + # ---- After Event Loop ---- # + sg.Popup('Done... exiting') + + + +In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) + +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions. A function you define would be called when a button is clicked. This requires you to write code where data is shared between these callback functions. There is a lot more communications that have to happen between parts of your program. + +One of the larger hurdles for beginners to GUI programming are these callback functions. PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simple read your button click and take appropriate action. + +Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible tradeoff to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. + --- ## All Widgets / Elements From 473430f6dc5ba80c5765971663804f9b85508891 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 00:27:33 -0400 Subject: [PATCH 367/521] Renamed Treeview to be Table,the offoical Table Element. Created New function name PrepareForUpdate that is same as ReadNonBlocking --- PySimpleGUI.py | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 65d4da1fd..b17fe4446 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -95,10 +95,10 @@ SELECT_MODE_SINGLE = tk.SINGLE LISTBOX_SELECT_MODE_SINGLE = 'single' -TREEVIEW_SELECT_MODE_NONE = tk.NONE -TREEVIEW_SELECT_MODE_BROWSE = tk.BROWSE -TREEVIEW_SELECT_MODE_EXTENDED = tk.EXTENDED -DEFAULT_TREEVIEW_SECECT_MODE = TREEVIEW_SELECT_MODE_EXTENDED +TABLE_SELECT_MODE_NONE = tk.NONE +TABLE_SELECT_MODE_BROWSE = tk.BROWSE +TABLE_SELECT_MODE_EXTENDED = tk.EXTENDED +DEFAULT_TABLE_SECECT_MODE = TABLE_SELECT_MODE_EXTENDED @@ -170,7 +170,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_MENUBAR = 600 ELEM_TYPE_PROGRESS_BAR = 200 ELEM_TYPE_BLANK = 100 -ELEM_TYPE_TREEVIEW = 700 +ELEM_TYPE_TABLE = 700 # ------------------------- MsgBox Buttons Types ------------------------- # MSG_BOX_YES_NO = 1 @@ -1514,26 +1514,20 @@ def __del__(self): # ---------------------------------------------------------------------- # # TreeView # # ---------------------------------------------------------------------- # -class Treeview(Element): - def __init__(self, values, column_headings=None, display_columns=None, show=None, tags=None, label=None, image=None, readonly=None, disabled=False, select_mode=None, children_hidden=False, font=None, justification='left', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): +class Table(Element): + def __init__(self, values, headings=None, visible_column_map=None, select_mode=None, scrollable=None, font=None, justification='left', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.Values = values - self.ColumnHeadings = column_headings - self.ColumnsToDisplay = display_columns - self.Show = show - self.ChildrenHidden = children_hidden + self.ColumnHeadings = headings + self.ColumnsToDisplay = visible_column_map self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.TextColor = text_color - self.Disabled = disabled - self.ReadOnly = readonly - self.Image = image - self.Label = label - self.Tags = tags self.Justification = justification + self.Scrollable = scrollable self.InitialState = None self.SelectMode = select_mode self.TKTreeview = None - super().__init__(ELEM_TYPE_TREEVIEW, text_color=text_color, background_color=background_color, scale=scale, font=font, size=size, pad=pad, key=key) + super().__init__(ELEM_TYPE_TABLE, text_color=text_color, background_color=background_color, scale=scale, font=font, size=size, pad=pad, key=key) return @@ -1550,8 +1544,6 @@ def __init__(self, text=None, image=None, values=None, hidden=False, tags=None ) self.Tags = tags - - # ------------------------------------------------------------------------- # # FlexForm CLASS # # ------------------------------------------------------------------------- # @@ -1732,6 +1724,10 @@ def ReadNonBlocking(self, Message=''): # return None, None return BuildResults(self, False, self) + # Another name for ReadNonBlocking. + PrepareForUpdate = ReadNonBlocking + + def Refresh(self): if self.TKrootDestroyed: return @@ -2693,19 +2689,26 @@ def CharWidthInPixels(): tkscale.configure(fg=text_color) tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) element.TKScale = tkscale - # ------------------------- Treeview element ------------------------- # - elif element_type == ELEM_TYPE_TREEVIEW: + # ------------------------- TABLE element ------------------------- # + elif element_type == ELEM_TYPE_TABLE: width, height = element_size anchor = tk.W if element.Justification == 'left' else tk.E + if element.ColumnsToDisplay is None: + displaycolumns = element.ColumnHeadings + else: + displaycolumns = [] + for i, should_display in enumerate(element.ColumnsToDisplay): + if should_display: + displaycolumns.append(element.ColumnHeadings[i]) element.TKTreeview = ttk.Treeview(tk_row_frame, columns=element.ColumnHeadings, - displaycolumns=element.ColumnsToDisplay, show=element.Show, height=height, selectmode=element.SelectMode) + displaycolumns=displaycolumns, show='headings', height=height, selectmode=element.SelectMode) treeview = element.TKTreeview for heading in element.ColumnHeadings: treeview.heading(heading, text=heading) treeview.column(heading, width=width*CharWidthInPixels(), anchor=anchor) for value in element.Values: id = treeview.insert('', 'end', text=value, values=value) - print(id) + # print(id) for i in range(5): treeview.insert(id, 'end', text=value, values=i) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: From ec01f332ce11b129cd04c93200d4f1274b81900e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 11:46:08 -0400 Subject: [PATCH 368/521] New Element - Table element. Still buggy but usable. Needs working scrollbars, Removed MsgBox's, Change with columns due to scollable frame change, Rewoked ALL Popup calls to include a ton of options. --- PySimpleGUI.py | 411 +++++++++++++++++++------------------------------ 1 file changed, 159 insertions(+), 252 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b17fe4446..7318368f7 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -172,13 +172,13 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_BLANK = 100 ELEM_TYPE_TABLE = 700 -# ------------------------- MsgBox Buttons Types ------------------------- # -MSG_BOX_YES_NO = 1 -MSG_BOX_CANCELLED = 2 -MSG_BOX_ERROR = 3 -MSG_BOX_OK_CANCEL = 4 -MSG_BOX_OK = 0 -MSG_BOX_NO_BUTTONS = 5 +# ------------------------- Popup Buttons Types ------------------------- # +POPUP_BUTTONS_YES_NO = 1 +POPUP_BUTTONS_CANCELLED = 2 +POPUP_BUTTONS_ERROR = 3 +POPUP_BUTTONS_OK_CANCEL = 4 +POPUP_BUTTONS_OK = 0 +POPUP_BUTTONS_NO_BUTTONS = 5 # ---------------------------------------------------------------------- # # Cascading structure.... Objects get larger # @@ -307,6 +307,11 @@ def Get(self): def __del__(self): super().__del__() + +# ------------------------- INPUT TEXT Element lazy functions ------------------------- # +In = InputText +Input = InputText + # ---------------------------------------------------------------------- # # Combo # # ---------------------------------------------------------------------- # @@ -357,6 +362,10 @@ def __del__(self): pass super().__del__() +# ------------------------- INPUT COMBO Element lazy functions ------------------------- # +Combo = InputCombo +DropDown = InputCombo +Drop = InputCombo # ---------------------------------------------------------------------- # # Option Menu # @@ -403,6 +412,10 @@ def __del__(self): pass super().__del__() + +# ------------------------- OPTION MENU Element lazy functions ------------------------- # +OptionMenu = InputOptionMenu + # ---------------------------------------------------------------------- # # Listbox # # ---------------------------------------------------------------------- # @@ -554,6 +567,13 @@ def Update(self, value=None, disabled=None): def __del__(self): super().__del__() + +# ------------------------- CHECKBOX Element lazy functions ------------------------- # +CB = Checkbox +CBox = Checkbox +Check = Checkbox + + # ---------------------------------------------------------------------- # # Spin # # ---------------------------------------------------------------------- # @@ -699,6 +719,11 @@ def __del__(self): super().__del__() +# ------------------------- Text Element lazy functions ------------------------- # +Txt = Text +T = Text + + # ---------------------------------------------------------------------- # # TKProgressBar # # Emulate the TK ProgressBar using canvas and rectangles @@ -1170,10 +1195,10 @@ def __init__(self, master, **kwargs): # create a canvas object and a vertical scrollbar for scrolling it self.vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) - self.vscrollbar.pack(side='right', fill="y", expand="true") + self.vscrollbar.pack(side='right', fill="y", expand="false") self.hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL) - self.hscrollbar.pack(side='bottom', fill="x", expand="true") + self.hscrollbar.pack(side='bottom', fill="x", expand="false") self.canvas = tk.Canvas(self, yscrollcommand=self.vscrollbar.set, xscrollcommand=self.hscrollbar.set) self.canvas.pack(side="left", fill="both", expand=True) @@ -1192,7 +1217,6 @@ def __init__(self, master, **kwargs): self.TKFrame.config(borderwidth=0, highlightthickness=0) self.config(borderwidth=0, highlightthickness=0) - self.canvas.bind("", self.resize_frame) self.bind('', self.set_scrollregion) self.bind_mouse_scroll(self.canvas, self.yscroll) @@ -1511,14 +1535,19 @@ def __del__(self): super().__del__() + # ---------------------------------------------------------------------- # -# TreeView # +# Table # # ---------------------------------------------------------------------- # class Table(Element): - def __init__(self, values, headings=None, visible_column_map=None, select_mode=None, scrollable=None, font=None, justification='left', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=10, select_mode=None, scrollable=None, font=None, justification='left', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.Values = values self.ColumnHeadings = headings self.ColumnsToDisplay = visible_column_map + self.ColumnWidths = col_widths + self.MaxColumnWidth = max_col_width + self.DefaultColumnWidth = def_col_width + self.AutoSizeColumns = auto_size_columns self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.TextColor = text_color self.Justification = justification @@ -1535,13 +1564,7 @@ def __del__(self): super().__del__() -class TreeviewItem(object): - def __init__(self, text=None, image=None, values=None, hidden=False, tags=None ): - self.Text = text - self.Image = image - self.Vales = values - self.Hidden = hidden - self.Tags = tags + # ------------------------------------------------------------------------- # @@ -1884,56 +1907,10 @@ def _Close(self): def __del__(self): return -# ====================================================================== # -# BUTTON Lazy Functions # -# ====================================================================== # +# =========================================================================== # +# Button Lazy Functions so the caller doesn't have to define a bunch of stuff # +# =========================================================================== # -# ------------------------- INPUT TEXT Element lazy functions ------------------------- # -In = InputText -Input = InputText -#### TODO REMOVE THESE COMMENTS - was the old way, but want to keep around for a bit just in case -# def In(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): -# return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) - -# def Input(default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', background_color=None, text_color=None, do_not_clear=False, key=None, focus=False): -# return InputText(default_text=default_text, scale=scale, size=size, auto_size_text=auto_size_text, password_char=password_char, background_color=background_color, text_color=text_color, do_not_clear=do_not_clear, focus=focus, key=key) - -# ------------------------- CHECKBOX Element lazy functions ------------------------- # -CB = Checkbox -CBox = Checkbox -Check = Checkbox - -# ------------------------- INPUT COMBO Element lazy functions ------------------------- # - -Combo = InputCombo -DropDown = InputCombo -Drop = InputCombo - - -# ------------------------- OPTION MENU Element lazy functions ------------------------- # - -OptionMenu = InputOptionMenu - - - -# def Combo(values, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None): -# return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text, background_color=background_color) -# -# def DropDown(values, scale=(None, None), size=(None, None), auto_size_text=None): -# return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) -# -# def Drop(values, scale=(None, None), size=(None, None), auto_size_text=None): -# return InputCombo(values=values, scale=scale, size=size, auto_size_text=auto_size_text) -# ------------------------- TEXT Element lazy functions ------------------------- # - -Txt = Text -T = Text - -# def Txt(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): -# return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) -# -# def T(display_text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, justification=None): -# return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification) # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): @@ -2306,7 +2283,7 @@ def CharWidthInPixels(): col_frame = tk.Frame(tk_row_frame) PackFormIntoFrame(element, col_frame, toplevel_form) - col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') + col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) # ------------------------- TEXT element ------------------------- # @@ -2693,6 +2670,17 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_TABLE: width, height = element_size anchor = tk.W if element.Justification == 'left' else tk.E + + column_widths = {} + for row in element.Values: + for i,col in enumerate(row): + col_len = min(len(str(col)), element.MaxColumnWidth) + try: + if col_len > column_widths[i]: + column_widths[i] = col_len + except: + column_widths[i] = col_len + if element.ColumnsToDisplay is None: displaycolumns = element.ColumnHeadings else: @@ -2700,20 +2688,34 @@ def CharWidthInPixels(): for i, should_display in enumerate(element.ColumnsToDisplay): if should_display: displaycolumns.append(element.ColumnHeadings[i]) - element.TKTreeview = ttk.Treeview(tk_row_frame, columns=element.ColumnHeadings, + displaycolumns = ['Row',] + displaycolumns + column_headings = ['Row',] + element.ColumnHeadings + # scrollable_frame = TkScrollableFrame(tk_row_frame) + element.TKTreeview = ttk.Treeview(tk_row_frame, columns=column_headings, displaycolumns=displaycolumns, show='headings', height=height, selectmode=element.SelectMode) treeview = element.TKTreeview - for heading in element.ColumnHeadings: + treeview.heading('Row', text='Row') # make a dummy heading + treeview.column('Row', width=50, anchor=anchor) + for i, heading in enumerate(element.ColumnHeadings): treeview.heading(heading, text=heading) + if element.AutoSizeColumns: + width = column_widths[i] + else: + try: + width = element.ColumnWidths[i] + except: + width = element.DefaultColumnWidth treeview.column(heading, width=width*CharWidthInPixels(), anchor=anchor) - for value in element.Values: + for i, value in enumerate(element.Values): + value = [i] + value id = treeview.insert('', 'end', text=value, values=value) # print(id) - for i in range(5): - treeview.insert(id, 'end', text=value, values=i) + # for i in range(5): + # treeview.insert(id, 'end', text=value, values=i) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKTreeview.configure(background=element.BackgroundColor) - element.TKTreeview.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') + # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') + element.TKTreeview.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) @@ -3247,21 +3249,8 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au # True/False, path # # (True if Submit was pressed, false otherwise) # # ---------------------------------------------------------------------- # -def GetPathBox(title, message, default_path='', button_color=None, size=(None, None)): - with FlexForm(title, auto_size_text=True, button_color=button_color) as form: - layout = [[Text(message, auto_size_text=True)], - [InputText(default_text=default_path, size=size), FolderBrowse()], - [Submit(), Cancel()]] - - (button, input_values) = form.LayoutAndRead(layout) - if button != 'Submit': - return False,None - else: - path = input_values[0] - return True, path - -def PopupGetFolder(message, default_path='', no_window=False, button_color=None, size=(None, None)): +def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): if no_window: root = tk.Tk() try: @@ -3272,8 +3261,9 @@ def PopupGetFolder(message, default_path='', no_window=False, button_color=None, root.destroy() return folder_name - with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: - layout = [[Text(message, auto_size_text=True)], + with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), FolderBrowse()], [Ok(), Cancel()]] @@ -3305,6 +3295,7 @@ def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*") 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, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): if no_window: root = tk.Tk() try: @@ -3318,13 +3309,11 @@ def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_ root.destroy() return filename - if save_as: - browse_button = SaveAs(file_types=file_types) - else: - browse_button = FileBrowse(file_types=file_types) + browse_button = SaveAs(file_types=file_types) if save_as else FileBrowse(file_types=file_types) - with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form: - layout = [[Text(message, auto_size_text=True)], + with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, + no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), browse_button], [Ok(), Cancel()]] @@ -3335,26 +3324,13 @@ def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_ path = input_values[0] return path - -# ============================== GetTextBox =========# -# Get a single line of text # -# ===================================================# -def GetTextBox(title, message, default_text='', button_color=None, size=(None, None)): - with FlexForm(title, auto_size_text=True, button_color=button_color, grab_anywhere=False) as form: - layout = [[Text(message, auto_size_text=True)], - [InputText(default_text=default_text, size=size)], - [Submit(), Cancel()]] - - (button, input_values) = form.LayoutAndRead(layout) - if button != 'Submit': - return False,None - else: - return True, input_values[0] - - -def PopupGetText(message, default_text='', password_char='', button_color=None, size=(None, None)): - with FlexForm(title=message, auto_size_text=True, button_color=button_color, grab_anywhere=False) as form: - layout = [[Text(message, auto_size_text=True)], +##################################### +# PopupGetText # +##################################### +def PopupGetText(message, default_text='', password_char='', size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, + background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], [InputText(default_text=default_text, size=size, password_char=password_char)], [Ok(), Cancel()]] @@ -3663,28 +3639,31 @@ def ObjToString(obj, extra=' '): # ------------------------------------------------------------------------------------------------------------------ # -# ===================================== Upper PySimpleGUI ============================================================== # -# Pre-built dialog boxes for all your needs # +# ===================================== Upper PySimpleGUI ======================================================== # +# Pre-built dialog boxes for all your needs These are the "high level API calls # # ------------------------------------------------------------------------------------------------------------------ # -# ==================================== MSG BOX =====# -# Display a message wrapping at 60 characters # -# Exits via an OK button2 press # -# Returns nothing # -# ===================================================# -def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=MSG_BOX_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, keep_on_top=False): - ''' - Show message box. Displays one line per user supplied argument. Takes any Type of variable to display. +# ----------------------------------- The mighty Popup! ------------------------------------------------------------ # + +def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + """ + Popup = Display a message in a small window. Many options available :param args: :param button_color: + :param background_color: + :param text_color: :param button_type: :param auto_close: :param auto_close_duration: + :param non_blocking: :param icon: :param line_width: :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: :return: - ''' + """ if not args: args_to_print = [''] else: @@ -3694,7 +3673,7 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, keep_on_top=keep_on_top) as form: + with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -3710,7 +3689,6 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt max_line_total = max(max_line_total, width_used) # height = _GetNumLinesNeeded(message, width_used) height = message_wrapped_lines - # print('Msgbox width, height', width_used, height) form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) total_lines += height @@ -3721,16 +3699,16 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt else: PopupButton = SimpleButton # show either an OK or Yes/No depending on paramater - if button_type is MSG_BOX_YES_NO: + if button_type is POPUP_BUTTONS_YES_NO: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) - elif button_type is MSG_BOX_CANCELLED: + elif button_type is POPUP_BUTTONS_CANCELLED: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is MSG_BOX_ERROR: + elif button_type is POPUP_BUTTONS_ERROR: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is MSG_BOX_OK_CANCEL: + elif button_type is POPUP_BUTTONS_OK_CANCEL: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), PopupButton('Cancel', size=(5, 1), button_color=button_color)) - elif button_type is MSG_BOX_NO_BUTTONS: + elif button_type is POPUP_BUTTONS_NO_BUTTONS: pass else: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) @@ -3746,145 +3724,74 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt # ============================== MsgBox============# # Lazy function. Same as calling Popup with parms # +# This function WILL Disappear perhaps today # # ==================================================# -# MsgBox is the legacy call and show not be used any longer -MsgBox = Popup +# MsgBox is the legacy call and should not be used any longer +def MsgBox(*args): + raise DeprecationWarning('MsgBox is no longer supported... change your call to Popup') + # --------------------------- PopupNoButtons --------------------------- -def PopupoNoButtons(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - Popup(*args, button_type=MSG_BOX_NO_BUTTONS, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return +def PopupNoButtons(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=POPUP_BUTTONS_NO_BUTTONS, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) # --------------------------- PopupNonBlocking --------------------------- -def PopupoNonBlocking(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - Popup(*args, non_blocking=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return +def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) -PopupNoWait = PopupoNonBlocking +PopupNoWait = PopupNonBlocking -# --------------------------- PopupNoFrame --------------------------- -def PopupNoTitlebar(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - Popup(*args, non_blocking=False, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=True) - return + +# --------------------------- PopupNoTitlebar --------------------------- +def PopupNoTitlebar(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=True, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) PopupNoFrame = PopupNoTitlebar PopupNoBorder = PopupNoTitlebar PopupAnnoying = PopupNoTitlebar -# ============================== MsgBoxAutoClose====# -# Lazy function. Same as calling MsgBox with parms # -# ===================================================# -def MsgBoxAutoClose(*args, button_color=None, auto_close=True, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, font=None): - ''' - Display a standard MsgBox that will automatically close after a specified amount of time - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupTimed = MsgBoxAutoClose -PopupAutoClose = MsgBoxAutoClose - -# ============================== MsgBoxError =====# -# Like MsgBox but presents RED BUTTONS # -# ===================================================# -def MsgBoxError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, font=None): - ''' - Display a MsgBox with a red button - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) +# --------------------------- PopupAutoClose --------------------------- +def PopupAutoClose(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +PopupTimed = PopupAutoClose -PopupError = MsgBoxError +# --------------------------- PopupError --------------------------- +def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, + font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, non_blocking=False, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) -# ============================== MsgBoxCancel =====# -# # -# ===================================================# -def MsgBoxCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display a MsgBox with a single "Cancel" button. - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_type=MSG_BOX_CANCELLED, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupCancel = MsgBoxCancel - - -# ============================== MsgBoxOK =====# -# Like MsgBox but only 1 button # -# ===================================================# -def MsgBoxOK(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display a MsgBox with a single buttoned labelled "OK" - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_type=MSG_BOX_OK, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupOk = MsgBoxOK - - -# ============================== MsgBoxOKCancel ====# -# Like MsgBox but presents OK and Cancel buttons # -# ===================================================# -def MsgBoxOKCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display MsgBox with 2 buttons, "OK" and "Cancel" - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - return MsgBox(*args, button_type=MSG_BOX_OK_CANCEL, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - -PopupOkCancel = MsgBoxOKCancel - - -# ==================================== YesNoBox=====# -# Like MsgBox but presents Yes and No buttons # -# Returns True if Yes was pressed else False # -# ===================================================# -def MsgBoxYesNo(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None): - ''' - Display MsgBox with 2 buttons, "Yes" and "No" - :param args: - :param button_color: - :param auto_close: - :param auto_close_duration: - :param font: - :return: - ''' - result = MsgBox(*args, button_type=MSG_BOX_YES_NO, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font) - return result +# --------------------------- PopupCancel --------------------------- +def PopupCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_type=POPUP_BUTTONS_CANCELLED, button_color=button_color, auto_close=auto_close, + auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +# --------------------------- PopupOK --------------------------- +def PopupOK(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_type=POPUP_BUTTONS_OK, button_color=button_color, auto_close=auto_close, + auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) -PopupYesNo = MsgBoxYesNo +# --------------------------- PopupOKCancel --------------------------- +def PopupOKCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_type=POPUP_BUTTONS_OK_CANCEL, button_color=button_color, auto_close=auto_close, + auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +# --------------------------- PopupYesNo --------------------------- +def PopupYesNo(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): + Popup(*args, button_type=POPUP_BUTTONS_YES_NO, button_color=button_color, auto_close=auto_close, + auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) def main(): From a9dbea4093610800f65cde38baad7e7813072721 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 11:46:36 -0400 Subject: [PATCH 369/521] Removed GetFileBox --- PySimpleGUI.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7318368f7..8f3e4716d 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3274,27 +3274,9 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), path = input_values[0] return path -# ============================== GetFileBox =========# -# Like the Get folder box but for files # -# ===================================================# -def GetFileBox(title, message, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)): - with FlexForm(title, auto_size_text=True, button_color=button_color) as form: - layout = [[Text(message, auto_size_text=True)], - [InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)], - [Submit(), Cancel()]] - - (button, input_values) = form.LayoutAndRead(layout) - if button != 'Submit': - return False,None - else: - path = input_values[0] - return True, path - -GetFile = GetFileBox -AskForFile = GetFileBox - - -def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)): +##################################### +# PopupGetFile # +##################################### def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): if no_window: root = tk.Tk() From 3a46858e199cc89ab2ee579af3ff085bf7439609 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 12:13:27 -0400 Subject: [PATCH 370/521] New demo program that shows how to use the Table Element --- Demo_Table_Element.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Demo_Table_Element.py diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py new file mode 100644 index 000000000..a095cc71a --- /dev/null +++ b/Demo_Table_Element.py @@ -0,0 +1,26 @@ +import csv +import PySimpleGUI as sg + +filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) +# --- populate table with file contents --- # +data = [] +if filename is not None: + with open(filename, "r") as infile: + reader = csv.reader(infile) + try: + data = list(reader) # read everything else into a list of rows + except: + sg.PopupError('Error reading file') + exit(69) + +sg.SetOptions(element_padding=(0, 0)) + +col_layout = [[sg.Table(values=data, headings=[x for x in range(len(data[0]))], max_col_width=8, + auto_size_columns=False, justification='right', size=(8, len(data)))]] + +layout = [[sg.Column(col_layout, size=(1200,600), scrollable=True)],] + +form = sg.FlexForm('Table', grab_anywhere=False) +b, v = form.LayoutAndRead(layout) + +exit(69) From 1a8f63befe97ed034f1ca4af3f000cf4f19bed7b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 13:58:15 -0400 Subject: [PATCH 371/521] PONG! New demo --- Demo_Pong.py | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 Demo_Pong.py diff --git a/Demo_Pong.py b/Demo_Pong.py new file mode 100644 index 000000000..a56580cd1 --- /dev/null +++ b/Demo_Pong.py @@ -0,0 +1,167 @@ +import random +import PySimpleGUI as gui +""" + Pong code supplied by Daniel Young (Neonzz) + Modified. Original code: https://www.pygame.org/project/3649/5739 +""" + +class Ball: + def __init__(self, canvas, bat, bat2, color): + self.canvas = canvas + self.bat = bat + self.bat2 = bat2 + self.playerScore = 0 + self.player1Score = 0 + self.drawP1 = None + self.drawP = None + self.id = self.canvas.create_oval(10, 10, 35, 35, fill=color) + self.canvas.move(self.id, 327, 220) + self.canvas_height = self.canvas.winfo_height() + self.canvas_width = self.canvas.winfo_width() + self.x = random.choice([-2.5, 2.5]) + self.y = -2.5 + + def checkwin(self): + winner = None + if self.playerScore == 10: + winner = 'Player left wins' + # gameOver = True + if self.player1Score == 10: + winner = 'Player Right' + # gameOver = True + return winner + + def checkForgameOver(self): + gameOver = False + if self.playerScore == 10 or self.player1Score == 10: + gameOver = True + return gameOver + return gameOver + + def updatep(self, val): + self.canvas.delete(self.drawP) + self.drawP = self.canvas.create_text(170, 50, font=('freesansbold.ttf', 40), text=str(val), fill='white') + + def updatep1(self, val): + self.canvas.delete(self.drawP1) + self.drawP1 = self.canvas.create_text(550, 50, font=('freesansbold.ttf', 40), text=str(val), fill='white') + + def hit_bat(self, pos): + bat_pos = self.canvas.coords(self.bat.id) + if pos[2] >= bat_pos[0] and pos[0] <= bat_pos[2]: + if pos[3] >= bat_pos[1] and pos[3] <= bat_pos[3]: + return True + return False + + def hit_bat2(self, pos): + bat_pos = self.canvas.coords(self.bat2.id) + if pos[2] >= bat_pos[0] and pos[0] <= bat_pos[2]: + if pos[3] >= bat_pos[1] and pos[3] <= bat_pos[3]: + return True + return False + + def draw(self): + self.canvas.move(self.id, self.x, self.y) + pos = self.canvas.coords(self.id) + if pos[1] <= 0: + self.y = 4 + if pos[3] >= self.canvas_height: + self.y = -4 + if pos[0] <= 0: + self.player1Score += 1 + self.canvas.move(self.id, 327, 220) + self.x = 4 + self.updatep1(self.player1Score) + if pos[2] >= self.canvas_width: + self.playerScore += 1 + self.canvas.move(self.id, -327, -220) + self.x = -4 + self.updatep(self.playerScore) + if self.hit_bat(pos): + self.x = 4 + if self.hit_bat2(pos): + self.x = -4 + + +class pongbat(): + def __init__(self, canvas, color): + self.canvas = canvas + self.id = self.canvas.create_rectangle(40, 200, 25, 310, fill=color) + self.canvas_height = self.canvas.winfo_height() + self.canvas_width = self.canvas.winfo_width() + self.y = 0 + + self.canvas.bind_all('w', self.up) + self.canvas.bind_all('s', self.down) + + def up(self, evt): + self.y = -5 + + def down(self, evt): + self.y = 5 + + def draw(self): + self.canvas.move(self.id, 0, self.y) + pos = self.canvas.coords(self.id) + if pos[1] <= 0: + self.y = 0 + if pos[3] >= 400: + self.y = -0 + + +class pongbat2(): + def __init__(self, canvas, color): + self.canvas = canvas + self.id = self.canvas.create_rectangle(680, 200, 660, 310, fill=color) + self.canvas_height = self.canvas.winfo_height() + self.canvas_width = self.canvas.winfo_width() + self.y = 0 + self.canvas.bind_all('', self.up) + self.canvas.bind_all('', self.down) + + def up(self, evt): + self.y = -5 + + def down(self, evt): + self.y = 5 + + def draw(self): + self.canvas.move(self.id, 0, self.y) + pos = self.canvas.coords(self.id) + if pos[1] <= 0: + self.y = 0 + if pos[3] >= 400: + self.y = -0 + + +def pong(): + layout = [ [gui.Canvas(size=(700, 400), background_color='black', key='canvas')], + [gui.T(''), gui.ReadFormButton('Quit')]] + + form = gui.FlexForm('Canvas test') + form.Layout(layout) + form.ReadNonBlocking() # TODO Replace with call to Finalize once code released + + canvas = form.FindElement('canvas').TKCanvas + + canvas.create_line(350, 0, 350, 400, fill='white') + bat1 = pongbat(canvas, 'white') + bat2 = pongbat2(canvas, 'white') + ball1 = Ball(canvas, bat1, bat2, 'green') + + while True: + ball1.draw() + bat1.draw() + bat2.draw() + button, values = form.ReadNonBlocking() + if button is None and values is None or button == 'Quit': + exit(69) + if ball1.checkwin(): + gui.Popup('Game End', ball1.checkwin() + ' won!!') + canvas.after(10) + +if __name__ == '__main__': + pong() + + + From a74ec9bdae80b1f086927f3441ae12c06d3f23a6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 17:24:55 -0400 Subject: [PATCH 372/521] Added showing top 8 CPU processeses by utilization --- Demo_Desktop_Widget_CPU_Utilization.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 9ba089523..00d09d6e0 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -1,6 +1,6 @@ import PySimpleGUI as sg -import time import psutil +import operator """ PSUTIL Desktop Widget @@ -16,8 +16,8 @@ # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') -form_rows = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], +form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], + [sg.Text('', size=(30, 8), font=('Courier', 10),text_color='white', justification='left', key='processes')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) @@ -38,12 +38,18 @@ cpu_percent = psutil.cpu_percent(interval=interval) + top = {proc.name() : proc.cpu_percent() for proc in psutil.process_iter()} + + top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) + top_sorted.pop(0) + display_string = '' + for proc, cpu in top_sorted: + display_string += f'{cpu:2.0f} {proc}\n' # --------- Display timer in window -------- form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') - - -# --------- After loop -------- + # form.FindElement('processes').Update('\n'.join(top_sorted)) + form.FindElement('processes').Update(display_string) # Broke out of main loop. Close the window. form.CloseNonBlockingForm() From f112907e894896a945ecc4eb635c061df8612a05 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 19:57:58 -0400 Subject: [PATCH 373/521] Removed f-strings, fixed Raspberry Pi launching issue. New function names for ReadNonBlocking - Finalize, PreRead --- Demo_Desktop_Floating_Toolbar.py | 16 ++++++++++------ Demo_Desktop_Widget_CPU_Utilization.py | 9 +++++---- PySimpleGUI.py | 2 ++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Demo_Desktop_Floating_Toolbar.py b/Demo_Desktop_Floating_Toolbar.py index 5b17d327d..07d806f5a 100644 --- a/Demo_Desktop_Floating_Toolbar.py +++ b/Demo_Desktop_Floating_Toolbar.py @@ -16,8 +16,8 @@ def Launcher(): - def print(line): - form.FindElement('output').Update(line) + # def print(line): + # form.FindElement('output').Update(line) sg.ChangeLookAndFeel('Dark') @@ -56,11 +56,15 @@ def ExecuteCommandSubprocess(command, *args, wait=False): try: if sys.platform == 'linux': arg_string = '' - for arg in args: - arg_string += ' ' + str(arg) - sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + arg_string = ' '.join([str(arg) for arg in args]) + # for arg in args: + # arg_string += ' ' + str(arg) + print('python3 ' + arg_string) + sp = subprocess.Popen(['python3 ', arg_string ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) else: - sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + arg_string = ' '.join([str(arg) for arg in args]) + sp = subprocess.Popen([command, arg_string], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if wait: out, err = sp.communicate() diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 00d09d6e0..79540a133 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -19,7 +19,7 @@ form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], [sg.Text('', size=(30, 8), font=('Courier', 10),text_color='white', justification='left', key='processes')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] -# Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) @@ -38,16 +38,17 @@ cpu_percent = psutil.cpu_percent(interval=interval) + # --------- Create list of top % CPU porocesses -------- top = {proc.name() : proc.cpu_percent() for proc in psutil.process_iter()} top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) top_sorted.pop(0) display_string = '' for proc, cpu in top_sorted: - display_string += f'{cpu:2.0f} {proc}\n' - # --------- Display timer in window -------- + display_string += '{} {}\n'.format(cpu, proc) - form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + # --------- Display timer in window -------- + form.FindElement('text').Update('CPU {}'.format(cpu_percent)) # form.FindElement('processes').Update('\n'.join(top_sorted)) form.FindElement('processes').Update(display_string) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 8f3e4716d..e90589dd5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1749,6 +1749,8 @@ def ReadNonBlocking(self, Message=''): # Another name for ReadNonBlocking. PrepareForUpdate = ReadNonBlocking + Finalize = ReadNonBlocking + PreRead = ReadNonBlocking def Refresh(self): From 317f90b0c51d6d941e4ab2558729b43f500c7f25 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Sep 2018 20:08:35 -0400 Subject: [PATCH 374/521] Typos --- Demo_Desktop_Widget_CPU_Utilization.py | 2 +- Demo_Desktop_Widget_Timer.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 79540a133..8710b1573 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -20,7 +20,7 @@ [sg.Text('', size=(30, 8), font=('Courier', 10),text_color='white', justification='left', key='processes')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] -form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) +form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) # ---------------- main loop ---------------- diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 76040c509..c02219997 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -16,17 +16,16 @@ # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') sg.SetOptions(element_padding=(0, 0)) -# Make a form, but don't use context manager -# Create the form layout + form_rows = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), sg.ReadFormButton('Reset', button_color=('white', '#007339')), sg.Exit(button_color=('white', 'firebrick4'))]] -# Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) -# + # ---------------- main loop ---------------- current_time = 0 paused = False From 4f43f7bcafc7ce26cb995c341dae9ca0fb155527 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 14 Sep 2018 11:54:10 -0400 Subject: [PATCH 375/521] RELEASE 3.2.0 --- Demo_Desktop_Widget_CPU_Utilization.py | 113 ++++++++++++++++--------- docs/index.md | 15 +++- readme.md | 15 +++- 3 files changed, 99 insertions(+), 44 deletions(-) diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 8710b1573..7f7e30695 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -1,7 +1,10 @@ import PySimpleGUI as sg import psutil +import time +from threading import Thread import operator + """ PSUTIL Desktop Widget Creates a floating CPU utilization window that is always on top of other windows @@ -14,43 +17,73 @@ invalid command name "1616802625480StopMove" """ -# ---------------- Create Form ---------------- -sg.ChangeLookAndFeel('Black') -form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], - [sg.Text('', size=(30, 8), font=('Courier', 10),text_color='white', justification='left', key='processes')], - [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] - -form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) -form.Layout(form_rows) - -# ---------------- main loop ---------------- -while (True): - # --------- Read and update window -------- - button, values = form.ReadNonBlocking() - - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - try: - interval = int(values['spin']) - except: - interval = 1 - - cpu_percent = psutil.cpu_percent(interval=interval) - - # --------- Create list of top % CPU porocesses -------- - top = {proc.name() : proc.cpu_percent() for proc in psutil.process_iter()} - - top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) - top_sorted.pop(0) - display_string = '' - for proc, cpu in top_sorted: - display_string += '{} {}\n'.format(cpu, proc) - - # --------- Display timer in window -------- - form.FindElement('text').Update('CPU {}'.format(cpu_percent)) - # form.FindElement('processes').Update('\n'.join(top_sorted)) - form.FindElement('processes').Update(display_string) - -# Broke out of main loop. Close the window. -form.CloseNonBlockingForm() + +g_interval = 1 +g_cpu_percent = 0 +g_procs = None +g_exit = False + +def CPU_thread(args): + global g_interval, g_cpu_percent, g_procs, g_exit + + while not g_exit: + g_cpu_percent = psutil.cpu_percent(interval=g_interval) + g_procs = psutil.process_iter() + + +def main(): + global g_interval, g_procs, g_exit + + # ---------------- Create Form ---------------- + sg.ChangeLookAndFeel('Black') + form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], + [sg.Text('', size=(30, 8), font=('Courier New', 12),text_color='white', justification='left', key='processes')], + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')], + ] + + form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) + form.Layout(form_rows) + thread = Thread(target=CPU_thread,args=(None,)) + thread.start() + # ---------------- main loop ---------------- + while (True): + # --------- Read and update window -------- + button, values = form.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + g_interval = int(values['spin']) + except: + g_interval = 1 + + # cpu_percent = psutil.cpu_percent(interval=interval) + cpu_percent = g_cpu_percent + time.sleep(.1) + + display_string = '' + if g_procs: + # --------- Create list of top % CPU porocesses -------- + top = {proc.name() : proc.cpu_percent() for proc in g_procs} + + top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) + if top_sorted: + top_sorted.pop(0) + display_string = '' + for proc, cpu in top_sorted: + display_string += '{} {}\n'.format(cpu, proc) + + + # --------- Display timer in window -------- + form.FindElement('text').Update('CPU {}'.format(cpu_percent)) + form.FindElement('processes').Update(display_string) + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + g_exit = True + thread.join() + exit(69) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index e472b237d..f30d52bbe 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.1.2) + (Ver 3.2.0) @@ -222,9 +222,17 @@ Some users have found that upgrading required using an extra flag on the pip `-- pip install --upgrade --no-cache-dir PySimpleGUI==3.0.3 - If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. +`tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: +``` +ImportError: No module named tkinter +``` +then you need to install `tkinter`. Be sure and get the Python 3 version. +``` +sudo apt-get install python3-tk +``` + ### Prerequisites @@ -2167,6 +2175,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) +| 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). ### Release Notes @@ -2196,6 +2205,8 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. +3.2.0 Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. + ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index e472b237d..f30d52bbe 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.1.2) + (Ver 3.2.0) @@ -222,9 +222,17 @@ Some users have found that upgrading required using an extra flag on the pip `-- pip install --upgrade --no-cache-dir PySimpleGUI==3.0.3 - If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. +`tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: +``` +ImportError: No module named tkinter +``` +then you need to install `tkinter`. Be sure and get the Python 3 version. +``` +sudo apt-get install python3-tk +``` + ### Prerequisites @@ -2167,6 +2175,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) +| 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). ### Release Notes @@ -2196,6 +2205,8 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. +3.2.0 Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. + ### Upcoming Make suggestions people! Future release features From 21bbb7fca856d1b8696ad5527a273fa9148b0611 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 14 Sep 2018 12:17:19 -0400 Subject: [PATCH 376/521] Changed ReadNonBlocking to Finalize for forms needing to do an Update prior to Read --- Demo_Button_Click.py | 27 +++++++++++++ Demo_Canvas.py | 2 +- Demo_Columns.py | 6 +-- Demo_Cookbook_Browser.py | 2 +- Demo_Disable_Elements.py | 2 +- Demo_Matplotlib_Animated.py | 2 +- Demo_Matplotlib_Animated_Scatter.py | 2 +- Demo_Matplotlib_Ping_Graph.py | 2 +- Demo_Matplotlib_Ping_Graph_Large.py | 2 +- Demo_Pong.py | 61 +++++++++++++++++------------ Demo_Popups.py | 24 ++++++++++++ Demo_Recipes.py | 1 + 12 files changed, 99 insertions(+), 34 deletions(-) create mode 100644 Demo_Button_Click.py create mode 100644 Demo_Popups.py diff --git a/Demo_Button_Click.py b/Demo_Button_Click.py new file mode 100644 index 000000000..2a6b89ec9 --- /dev/null +++ b/Demo_Button_Click.py @@ -0,0 +1,27 @@ +import PySimpleGUI as sg +import winsound + + +sg.ChangeLookAndFeel('Dark') +sg.SetOptions(element_padding=(0,0)) + +layout = [ + [sg.ReadFormButton('Start', button_color=('white', 'black'), key='start'), + sg.ReadFormButton('Stop', button_color=('white', 'black'), key='stop'), + sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='reset'), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='submit')] + ] + +form = sg.FlexForm("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12,1)) +form.Layout(layout) +form.Finalize() + +form.FindElement('submit').Update(disabled=True) + +recording = have_data = False +while True: + button, values = form.Read() + if button is None: + exit(69) + winsound.PlaySound("ButtonClick.wav", 1) diff --git a/Demo_Canvas.py b/Demo_Canvas.py index 893c9d4f1..a717c4a9d 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -7,7 +7,7 @@ form = gui.FlexForm('Canvas test') form.Layout(layout) -form.ReadNonBlocking() +form.Finalize() cir = form.FindElement('canvas').TKCanvas.create_oval(50, 50, 100, 100) diff --git a/Demo_Columns.py b/Demo_Columns.py index d58a8fe28..9ca240a26 100644 --- a/Demo_Columns.py +++ b/Demo_Columns.py @@ -35,7 +35,7 @@ def ScrollableColumns(): layout = [[sg.Column(column2, scrollable=True), sg.Column(column1, scrollable=True, size=(200,150))], [sg.OK()]] - form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1)) + form = sg.FlexForm('Form Fill Demonstration', grab_anywhere=False, default_element_size=(40, 1)) b, v = form.LayoutAndRead(layout) sg.Popup(v) @@ -53,9 +53,9 @@ def NormalColumns(): # Display the form and get values # If you're willing to not use the "context manager" design pattern, then it's possible # to collapse the form display and read down to a single line of code. - button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + button, values = sg.FlexForm('Compact 1-line form with column', grab_anywhere=False).LayoutAndRead(layout) sg.Popup(button, values, line_width=200) -NormalColumns() +# NormalColumns() ScrollableColumns() \ No newline at end of file diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py index f188253dd..2eeb06d14 100644 --- a/Demo_Cookbook_Browser.py +++ b/Demo_Cookbook_Browser.py @@ -754,7 +754,7 @@ def TightLayout(): while True: sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0,0)) + # sg.SetOptions(element_padding=(0,0)) col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),min(len(listbox_values), 20)), change_submits=False, key='func')], [sg.ReadFormButton('Run', pad=(0,0)), sg.ReadFormButton('Show Code', button_color=('white', 'gray25'), pad=(0,0)), sg.Exit(button_color=('white', 'firebrick4'), pad=(0,0))]] diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index 4741c4b03..cf351a8f8 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -26,7 +26,7 @@ form.Layout(layout) -form.ReadNonBlocking() +form.Finalize() form.FindElement('cbox').Update(disabled=True) form.FindElement('listbox').Update(disabled=True) diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index 60be75ccb..da813c473 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -25,7 +25,7 @@ def main(): # create the form and show it without the plot form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) - form.ReadNonBlocking() + form.Finalize() graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) canvas = canvas_elem.TKCanvas diff --git a/Demo_Matplotlib_Animated_Scatter.py b/Demo_Matplotlib_Animated_Scatter.py index 819022983..0005d681e 100644 --- a/Demo_Matplotlib_Animated_Scatter.py +++ b/Demo_Matplotlib_Animated_Scatter.py @@ -16,7 +16,7 @@ def main(): # create the form and show it without the plot form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) - form.ReadNonBlocking() + form.Finalize() canvas = canvas_elem.TKCanvas diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index c58c28744..39111a989 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -647,7 +647,7 @@ def main(): # create the form and show it without the plot form = sg.FlexForm('Ping Graph', background_color='white', grab_anywhere=True) form.Layout(layout) - form.ReadNonBlocking() + form.Finalize() canvas = canvas_elem.TKCanvas diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/Demo_Matplotlib_Ping_Graph_Large.py index e24d86a00..23bb678f6 100644 --- a/Demo_Matplotlib_Ping_Graph_Large.py +++ b/Demo_Matplotlib_Ping_Graph_Large.py @@ -83,7 +83,7 @@ def main(): # create the form and show it without the plot form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') form.Layout(layout) - form.ReadNonBlocking() + form.Finalize() canvas = canvas_elem.TKCanvas diff --git a/Demo_Pong.py b/Demo_Pong.py index a56580cd1..0c03d69b0 100644 --- a/Demo_Pong.py +++ b/Demo_Pong.py @@ -1,5 +1,7 @@ import random -import PySimpleGUI as gui +import PySimpleGUI as sg +import time + """ Pong code supplied by Daniel Young (Neonzz) Modified. Original code: https://www.pygame.org/project/3649/5739 @@ -23,20 +25,12 @@ def __init__(self, canvas, bat, bat2, color): def checkwin(self): winner = None - if self.playerScore == 10: + if self.playerScore >= 10: winner = 'Player left wins' - # gameOver = True - if self.player1Score == 10: + if self.player1Score >= 10: winner = 'Player Right' - # gameOver = True return winner - def checkForgameOver(self): - gameOver = False - if self.playerScore == 10 or self.player1Score == 10: - gameOver = True - return gameOver - return gameOver def updatep(self, val): self.canvas.delete(self.drawP) @@ -91,9 +85,6 @@ def __init__(self, canvas, color): self.canvas_width = self.canvas.winfo_width() self.y = 0 - self.canvas.bind_all('w', self.up) - self.canvas.bind_all('s', self.down) - def up(self, evt): self.y = -5 @@ -106,7 +97,7 @@ def draw(self): if pos[1] <= 0: self.y = 0 if pos[3] >= 400: - self.y = -0 + self.y = 0 class pongbat2(): @@ -116,8 +107,6 @@ def __init__(self, canvas, color): self.canvas_height = self.canvas.winfo_height() self.canvas_width = self.canvas.winfo_width() self.y = 0 - self.canvas.bind_all('', self.up) - self.canvas.bind_all('', self.down) def up(self, evt): self.y = -5 @@ -131,33 +120,57 @@ def draw(self): if pos[1] <= 0: self.y = 0 if pos[3] >= 400: - self.y = -0 + self.y = 0 def pong(): - layout = [ [gui.Canvas(size=(700, 400), background_color='black', key='canvas')], - [gui.T(''), gui.ReadFormButton('Quit')]] - - form = gui.FlexForm('Canvas test') + # ------------- Define GUI layout ------------- + layout = [[sg.Canvas(size=(700, 400), background_color='black', key='canvas')], + [sg.T(''), sg.ReadFormButton('Quit')]] + # ------------- Create window ------------- + form = sg.FlexForm('Canvas test', return_keyboard_events=True) form.Layout(layout) - form.ReadNonBlocking() # TODO Replace with call to Finalize once code released + form.ReadNonBlocking() # TODO Replace with call to form.Finalize once code released + # ------------- Get the tkinter Canvas we're drawing on ------------- canvas = form.FindElement('canvas').TKCanvas + # ------------- Create line down center, the bats and ball ------------- canvas.create_line(350, 0, 350, 400, fill='white') bat1 = pongbat(canvas, 'white') bat2 = pongbat2(canvas, 'white') ball1 = Ball(canvas, bat1, bat2, 'green') + # ------------- Event Loop ------------- while True: + # ------------- Draw ball and bats ------------- ball1.draw() bat1.draw() bat2.draw() + + # ------------- Read the form, get keypresses ------------- button, values = form.ReadNonBlocking() + + # ------------- If quit ------------- if button is None and values is None or button == 'Quit': exit(69) + # ------------- Keypresses ------------- + if button is not None: + if button.startswith('Up'): + bat2.up(2) + elif button.startswith('Down'): + bat2.down(2) + elif button == 'w': + bat1.up(1) + elif button == 's': + bat1.down(1) + if ball1.checkwin(): - gui.Popup('Game End', ball1.checkwin() + ' won!!') + sg.Popup('Game Over', ball1.checkwin() + ' won!!') + + + # ------------- Bottom of loop, delay between animations ------------- + # time.sleep(.01) canvas.after(10) if __name__ == '__main__': diff --git a/Demo_Popups.py b/Demo_Popups.py new file mode 100644 index 000000000..f5692b9f7 --- /dev/null +++ b/Demo_Popups.py @@ -0,0 +1,24 @@ +import PySimpleGUI as sg + + + +print(sg.PopupGetFolder('Get text', background_color='blue', text_color='white')) +print(sg.PopupGetFile('Get text', background_color='blue', text_color='white')) +print(sg.PopupGetFolder('Get text', background_color='blue', text_color='white')) + + +sg.Popup('Simple popup') + +sg.PopupNonBlocking('Non Blocking') +sg.PopupError('Error') +sg.PopupYesNo('Yes No') +sg.PopupNoTitlebar('No titlebar') +sg.PopupNoBorder('No border') +sg.PopupNoFrame('No frame') +sg.PopupNoButtons('No Buttons') +sg.PopupCancel('Cancel') +sg.PopupOKCancel('OK Cancel') +sg.PopupAutoClose('Autoclose') +print(sg.PopupGetText('Get text')) +print(sg.PopupGetFile('Get File')) +print(sg.PopupGetFolder('Get folder')) diff --git a/Demo_Recipes.py b/Demo_Recipes.py index fe7c403a6..972a199ae 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -209,6 +209,7 @@ def OneLineGUI(): def main(): # button, (filename,) = OneLineGUI() # DebugTe`st() + sg.MsgBox('Hello') ChatBot() Everything() SourceDestFolders() From 3c57788f77b2fec24cb390cd71cbd2a1def6986e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 14 Sep 2018 12:18:45 -0400 Subject: [PATCH 377/521] Call Finalize --- Demo_Pong.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Pong.py b/Demo_Pong.py index 0c03d69b0..0e883804a 100644 --- a/Demo_Pong.py +++ b/Demo_Pong.py @@ -130,7 +130,7 @@ def pong(): # ------------- Create window ------------- form = sg.FlexForm('Canvas test', return_keyboard_events=True) form.Layout(layout) - form.ReadNonBlocking() # TODO Replace with call to form.Finalize once code released + form.Finalize() # TODO Replace with call to form.Finalize once code released # ------------- Get the tkinter Canvas we're drawing on ------------- canvas = form.FindElement('canvas').TKCanvas From 4a9c24b420cfaa7bec926803497cc2bbfe4233ca Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 14 Sep 2018 12:20:28 -0400 Subject: [PATCH 378/521] Button Click needed for button state demo --- ButtonClick.wav | Bin 0 -> 2952 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ButtonClick.wav diff --git a/ButtonClick.wav b/ButtonClick.wav new file mode 100644 index 0000000000000000000000000000000000000000..f774f70e432d8f6ed436c8c32ed8ea42555735a3 GIT binary patch literal 2952 zcmW+&2~?HU7CzHI+{bTl1_p0u4quMW)svcsR`hX8ob*#O5lR@QVL8^*&Qc)~XZDKRkbv8>8zDgzW zZ`3c`05ilkpi3QIlv(hYx(uViWw;LH!zwTp_Joa~H=GFCz&y18ye2~J-QB7?63Il`>Jb^1*dPR;wI06W)_t)9&;Sdbr$E{!~9#Q1A9#JiQ-wniIVyXhN@R#?q)gATjbB=o2|UsNJwh zktx#-4BRq(acsehNns1SbTMLFJ8Q2s1YaBQpARplow-nY`iI~fgHCSwEA{4h-j3}F z+4RiKPE+GMrz?XQ)s zuhyLM72Qk0U)TH;I+Tu$IIKVFbvGouXWdi1yLrM6hrZ)ltu2x{{8r0;Pf7K;mh+X9 zJ@K{4GN!pku5S36KHGSS<+w{#W!rERPJboa;b+D^=aC?HXk&POXn9znGr*O`JBy38 z+n>nCmugaLhE`WJuC9B~xVT|X_5IdI)uDF!(;UXkyLNU$QoDks-`ga z`j$1GdEOUAw%h~ugD$eOc#S5vA@Acx>Y3a8r!~yGNA(i1W+vVgWE z-Y~9*bvIrOBihu^+bGZVKAPtI6qPul&n`L)omD9uCezU;{4bD3BgF$>w0*@x>|?%KK7*HlOxTs&BLj`T`bOtf{f*#CV`%7F zrwX0udMl*JIo$P&-MppsF-~i7`Yn=Uj3ezG zsc4a72WT<|sC~vf)ytd%2bu)Gq(`6$0gk@JG@YbUi^7Fy3LFY1DWG2TtItYEwDyf&)d7{b8M41E1v;_Q3O0lrl9vUC-xD73&>+M4(|im;HEe&K4JkZ zj@`2Fvx792Ut-0)j$h&<hrm`TKS&$EyEjX^|VG1VVhBt(nBG2|Y)hlk+j$*=e<`3k?_kN#d8i=X(jZPvPh5OPs&LF?p4$d)J39hHSg zg8P29#A|caLy{r8k})y`ua^C>@-yUFAnTaQ+14`7yG`!ex< z5RLk)4IoK;F7ud&x7w8~-8xE3eXr6zzRUDqzIc}4>&KL@m@To7@J!l6%w*FAXAk)a zewUZ=u3|p#B0~7LVm0d}XR?ugOsC5OtcMizY4HWEWofh@i=t)JvVWqF>=ybSJ;>Hl z$OqFytS_C;ZqS)5ioMP1XbbJZcGKDHC;C2*V~<4#PL&^j7^}WS*^gqi+Ic5Ab7 z7yY*1^8A10Ra~a$;$6lp@((jpo9j5Cf9Z%desLrk^^Wm|?kv!=9c5aniL?wejchZY zCu_|}l4yQHm~oa|FzyqV*+pAt4)$9QZJC))l1+i1HN(hWL*TdcnfMH8hjMWPNXHw& z%ftoCvm8$HtlJ3rKfx)_F`X(J;yiB{@r)f-eMKfC3YDLr-Bcm=Y`J>mOJfA zkzg+q_0}!^tCh*a?XUTEd$hP>H;I$>FqvoTa)F&D_Syco(j4(CtrUV?mD9u>1^v~& zDI?%E`95^Zt#Gl*hc)VFm=EgV5}1mLP&CfP9f*aOkXjr^Hef==;7d3H@5ZTk1U`tz z;79mV+?V`_^GIhBrX3VlMCdp}Pvp6q{Ih0-eoS(pY@q=_e%caBF5gNzt(;ODV z?y=o$F!!)rUd8tEN_K&N#UAm&>>4kp#e6oM@9*y*KAv{qTd0#?r*VE?4)?L{qK&^K zFNle1w6s;W{5!ZN*8;a(44NcWyW}|Kke|!%M4((FE{W;lsu(Y-MY4EWt`MVSnaGhF z Date: Sat, 15 Sep 2018 00:49:05 -0400 Subject: [PATCH 379/521] NEW OneLineProgressMeter, Fix for num windows open bug when using EasyProgressMeters --- PySimpleGUI.py | 112 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 27 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e90589dd5..d2a05608b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1044,6 +1044,7 @@ def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text, key=key, pad=pad) return + # returns False if update failed def UpdateBar(self, current_count, max=None): if self.ParentForm.TKrootDestroyed: return False @@ -2952,7 +2953,7 @@ def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,No local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) - form = FlexForm(title, auto_size_text=True) + form = FlexForm(title, auto_size_text=True, grab_anywhere=True) # Form using a horizontal bar if local_orientation[0].lower() == 'h': @@ -2996,10 +2997,12 @@ def _ProgressMeterUpdate(bar, value, text_elem, *args): if value >= bar.MaxValue or not rc: bar.BarExpired = True bar.ParentForm._Close() + if rc: # if update was OK but bar expired, decrement num windows + _my_windows.Decrement() if bar.ParentForm.RootNeedsDestroying: try: bar.ParentForm.TKroot.destroy() - _my_windows.Decrement() + # _my_windows.Decrement() except: pass bar.ParentForm.RootNeedsDestroying = False bar.ParentForm.__del__() @@ -3071,42 +3074,42 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, # STATIC VARIABLE! # This is a very clever form of static variable using a function attribute # If the variable doesn't yet exist, then it will create it and initialize with the 3rd parameter - EasyProgressMeter.EasyProgressMeterData = getattr(EasyProgressMeter, 'EasyProgressMeterData', EasyProgressMeterDataClass()) + EasyProgressMeter.Data = getattr(EasyProgressMeter, 'Data', EasyProgressMeterDataClass()) # if no meter currently running - if EasyProgressMeter.EasyProgressMeterData.MeterID is None: # Starting a new meter + if EasyProgressMeter.Data.MeterID is None: # Starting a new meter if int(current_value) >= int(max_value): return False - del(EasyProgressMeter.EasyProgressMeterData) - EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) - EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() - message = "\n".join([line for line in EasyProgressMeter.EasyProgressMeterData.StatMessages]) - EasyProgressMeter.EasyProgressMeterData.MeterID, EasyProgressMeter.EasyProgressMeterData.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) - EasyProgressMeter.EasyProgressMeterData.ParentForm = EasyProgressMeter.EasyProgressMeterData.MeterID.ParentForm + del(EasyProgressMeter.Data) + EasyProgressMeter.Data = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) + EasyProgressMeter.Data.ComputeProgressStats() + message = "\n".join([line for line in EasyProgressMeter.Data.StatMessages]) + EasyProgressMeter.Data.MeterID, EasyProgressMeter.Data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) + EasyProgressMeter.Data.ParentForm = EasyProgressMeter.Data.MeterID.ParentForm return True # if exactly the same values as before, then ignore. - if EasyProgressMeter.EasyProgressMeterData.MaxValue == max_value and EasyProgressMeter.EasyProgressMeterData.CurrentValue == current_value: + if EasyProgressMeter.Data.MaxValue == max_value and EasyProgressMeter.Data.CurrentValue == current_value: return True - if EasyProgressMeter.EasyProgressMeterData.MaxValue != int(max_value): - EasyProgressMeter.EasyProgressMeterData.MeterID = None - EasyProgressMeter.EasyProgressMeterData.ParentForm = None - del(EasyProgressMeter.EasyProgressMeterData) - EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass() # setup a new progress meter + if EasyProgressMeter.Data.MaxValue != int(max_value): + EasyProgressMeter.Data.MeterID = None + EasyProgressMeter.Data.ParentForm = None + del(EasyProgressMeter.Data) + EasyProgressMeter.Data = EasyProgressMeterDataClass() # setup a new progress meter return True # HAVE to return TRUE or else the new meter will thing IT is failing when it hasn't - EasyProgressMeter.EasyProgressMeterData.CurrentValue = int(current_value) - EasyProgressMeter.EasyProgressMeterData.MaxValue = int(max_value) - EasyProgressMeter.EasyProgressMeterData.ComputeProgressStats() + EasyProgressMeter.Data.CurrentValue = int(current_value) + EasyProgressMeter.Data.MaxValue = int(max_value) + EasyProgressMeter.Data.ComputeProgressStats() message = '' - for line in EasyProgressMeter.EasyProgressMeterData.StatMessages: + for line in EasyProgressMeter.Data.StatMessages: message = message + str(line) + '\n' - message = "\n".join(EasyProgressMeter.EasyProgressMeterData.StatMessages) + message = "\n".join(EasyProgressMeter.Data.StatMessages) args= args + (message,) - rc = _ProgressMeterUpdate(EasyProgressMeter.EasyProgressMeterData.MeterID, current_value, - EasyProgressMeter.EasyProgressMeterData.MeterText, *args) + rc = _ProgressMeterUpdate(EasyProgressMeter.Data.MeterID, current_value, + EasyProgressMeter.Data.MeterText, *args) # if counter >= max then the progress meter is all done. Indicate none running - if current_value >= EasyProgressMeter.EasyProgressMeterData.MaxValue or not rc: - EasyProgressMeter.EasyProgressMeterData.MeterID = None - del(EasyProgressMeter.EasyProgressMeterData) - EasyProgressMeter.EasyProgressMeterData = EasyProgressMeterDataClass() # setup a new progress meter + if current_value >= EasyProgressMeter.Data.MaxValue or not rc: + EasyProgressMeter.Data.MeterID = None + del(EasyProgressMeter.Data) + EasyProgressMeter.Data = EasyProgressMeterDataClass() # setup a new progress meter return False # even though at the end, return True so don't cause error with the app return rc # return whatever the update told us @@ -3120,6 +3123,61 @@ def EasyProgressMeterCancel(title, *args): return True +# global variable containing dictionary will all currently running one-line progress meters. +_one_line_progress_meters = {} + +# ============================== OneLineProgressMeter =====# +def OneLineProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None, key=None): + + global _one_line_progress_meters + + local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is not None else border_width + try: + meter_data = _one_line_progress_meters[key] + except: # a new meater is starting + if int(current_value) >= int(max_value): # if already expired then it's an old meter, ignore + return False + meter_data = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) + _one_line_progress_meters[key] = meter_data + meter_data.ComputeProgressStats() + message = "\n".join([line for line in meter_data.StatMessages]) + meter_data.MeterID, meter_data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) + meter_data.ParentForm = meter_data.MeterID.ParentForm + return True + + # if exactly the same values as before, then ignore, return success. + if meter_data.MaxValue == max_value and meter_data.CurrentValue == current_value: + return True + meter_data.CurrentValue = int(current_value) + meter_data.MaxValue = int(max_value) + meter_data.ComputeProgressStats() + message = '' + for line in meter_data.StatMessages: + message = message + str(line) + '\n' + message = "\n".join(meter_data.StatMessages) + args= args + (message,) + rc = _ProgressMeterUpdate(meter_data.MeterID, current_value, + meter_data.MeterText, *args) + # if counter >= max then the progress meter is all done. Indicate none running + if current_value >= meter_data.MaxValue or not rc: + del _one_line_progress_meters[key] + return False + + return rc # return whatever the update told us + + +def OneLineProgressMeterCancel(key): + global _one_line_progress_meters + + try: + meter_data = _one_line_progress_meters[key] + except: # meter is already deleted + return + OneLineProgressMeter('', meter_data.MaxValue, meter_data.MaxValue, key=key) + + + + # input is #RRGGBB # output is #RRGGBB def GetComplimentaryHex(color): From eb8b581fcffe07f297f513c0029798bfb3072edf Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 15 Sep 2018 13:42:53 -0400 Subject: [PATCH 380/521] New featrure - OneLineProgressMeters, New Demo_Progress_Meters --- Demo_Progress_Meters.py | 45 +++++++++++++++++++++++++++++++++++++++++ PySimpleGUI.py | 3 +-- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 Demo_Progress_Meters.py diff --git a/Demo_Progress_Meters.py b/Demo_Progress_Meters.py new file mode 100644 index 000000000..9b013e455 --- /dev/null +++ b/Demo_Progress_Meters.py @@ -0,0 +1,45 @@ +from time import sleep +import PySimpleGUI as sg + +""" + Demonstration of multiple OneLineProgressMeter's + + Shows how 2 progress meters can be running at the same time. + Note -- If the user wants to cancel a meter, it's important to use the "Cancel" button, not the X + If the software determined that a meter should be cancelled early, + calling OneLineProgresMeterCancel(key) will cancel the meter with the matching key +""" + +sg.ChangeLookAndFeel('Dark') + +layout = [ + [sg.T('One-Line Progress Meter Demo', font=('Any 18'))], + [sg.T('Outer Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountOuter', do_not_clear=True), + sg.T('Delay'), sg.In(default_text='10', key='TimeOuter', size=(5,1), do_not_clear=True), sg.T('ms')], + [sg.T('Inner Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountInner', do_not_clear=True) , + sg.T('Delay'), sg.In(default_text='10', key='TimeInner', size=(5,1), do_not_clear=True), sg.T('ms')], + [sg.SimpleButton('Show', pad=((0,0), 3), bind_return_key=True), sg.T('me the meters!')] + ] + +form = sg.FlexForm('One-Line Progress Meter Demo') +form.Layout(layout) + +while True: + button, values = form.Read() + if button is None: + break + if button == 'Show': + max_outer = int(values['CountOuter']) + max_inner = int(values['CountInner']) + delay_inner = int(values['TimeInner']) + delay_outer = int(values['TimeOuter']) + for i in range(max_outer): + if not sg.OneLineProgressMeter('Outer Loop', i+1, max_outer, 'outer'): + break + sleep(delay_outer/1000) + for j in range(max_inner): + if not sg.OneLineProgressMeter('Inner Loop', j+1, max_inner, 'inner'): + break + sleep(delay_inner/1000) + +exit(69) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d2a05608b..0c2156503 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3127,7 +3127,7 @@ def EasyProgressMeterCancel(title, *args): _one_line_progress_meters = {} # ============================== OneLineProgressMeter =====# -def OneLineProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None, key=None): +def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): global _one_line_progress_meters @@ -3162,7 +3162,6 @@ def OneLineProgressMeter(title, current_value, max_value, *args, orientation=Non if current_value >= meter_data.MaxValue or not rc: del _one_line_progress_meters[key] return False - return rc # return whatever the update told us From 90c5634ff83f92e8fceb3432e7d67454c95bea48 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 15 Sep 2018 15:44:57 -0400 Subject: [PATCH 381/521] CPU Widget made more efficient, new Table Element settings, Updated Progress Bar Recipe, New Pandas table demo --- Demo_Desktop_Widget_CPU_Utilization.py | 12 +++-- Demo_Table_Element.py | 4 +- Demo_Table_Pandas.py | 40 +++++++++++++++ PySimpleGUI.py | 23 +++++---- docs/cookbook.md | 8 +-- docs/index.md | 70 ++++++++++---------------- readme.md | 70 ++++++++++---------------- 7 files changed, 118 insertions(+), 109 deletions(-) create mode 100644 Demo_Table_Pandas.py diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 7f7e30695..12cde3432 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -17,7 +17,7 @@ invalid command name "1616802625480StopMove" """ - +# globale used to communicate with thread.. yea yea... it's working fine g_interval = 1 g_cpu_percent = 0 g_procs = None @@ -38,11 +38,11 @@ def main(): sg.ChangeLookAndFeel('Black') form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], [sg.Text('', size=(30, 8), font=('Courier New', 12),text_color='white', justification='left', key='processes')], - [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')], - ] + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')],] form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) + # start cpu measurement thread thread = Thread(target=CPU_thread,args=(None,)) thread.start() # ---------------- main loop ---------------- @@ -58,9 +58,11 @@ def main(): except: g_interval = 1 - # cpu_percent = psutil.cpu_percent(interval=interval) + # cpu_percent = psutil.cpu_percent(interval=interval) # if don't wan to use a task cpu_percent = g_cpu_percent - time.sleep(.1) + + # let the GUI run ever 700ms regardless of CPU polling time. makes window be more responsive + time.sleep(.7) display_string = '' if g_procs: diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py index a095cc71a..19d21639e 100644 --- a/Demo_Table_Element.py +++ b/Demo_Table_Element.py @@ -15,8 +15,8 @@ sg.SetOptions(element_padding=(0, 0)) -col_layout = [[sg.Table(values=data, headings=[x for x in range(len(data[0]))], max_col_width=8, - auto_size_columns=False, justification='right', size=(8, len(data)))]] +col_layout = [[sg.Table(values=data[1:][:], headings=[data[0][x] for x in range(len(data[0]))], max_col_width=25, + auto_size_columns=True, display_row_numbers=True, justification='right', size=(None, len(data)))]] layout = [[sg.Column(col_layout, size=(1200,600), scrollable=True)],] diff --git a/Demo_Table_Pandas.py b/Demo_Table_Pandas.py new file mode 100644 index 000000000..0c00e773c --- /dev/null +++ b/Demo_Table_Pandas.py @@ -0,0 +1,40 @@ +import pandas as pd +import PySimpleGUI as sg + +""" + + Display a CSV file using Table Element and Pandas + Thank you to for writing this demo + +""" + + +def table_example(): + filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files", "*.csv"),)) + # --- populate table with file contents --- # + data = [] + header_list = [] + if filename is not None: + try: + df = pd.read_csv(filename, sep=',', engine='python') # read everything else into a list of rows + header_list = df.columns.tolist() + data = df.values.tolist() + # print(data) + except: + sg.PopupError('Error reading file') + exit(69) + + sg.SetOptions(element_padding=(0, 0)) + + col_layout = [[sg.Table(values=data, headings=header_list, max_col_width=20, + auto_size_columns=True, justification='right', size=(None, len(data)))]] + + layout = [[sg.Column(col_layout, size=(1200, 600), scrollable=True)]] + + form = sg.FlexForm('Table', grab_anywhere=False) + b, v = form.LayoutAndRead(layout) + + exit(69) + + +table_example() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0c2156503..bb6899d22 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1541,7 +1541,7 @@ def __del__(self): # Table # # ---------------------------------------------------------------------- # class Table(Element): - def __init__(self, values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=10, select_mode=None, scrollable=None, font=None, justification='left', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=20, select_mode=None, display_row_numbers=False, scrollable=None, font=None, justification='right', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.Values = values self.ColumnHeadings = headings self.ColumnsToDisplay = visible_column_map @@ -1555,6 +1555,7 @@ def __init__(self, values, headings=None, visible_column_map=None, col_widths=No self.Scrollable = scrollable self.InitialState = None self.SelectMode = select_mode + self.DisplayRowNumbers = display_row_numbers self.TKTreeview = None super().__init__(ELEM_TYPE_TABLE, text_color=text_color, background_color=background_color, scale=scale, font=font, size=size, pad=pad, key=key) @@ -2683,7 +2684,6 @@ def CharWidthInPixels(): column_widths[i] = col_len except: column_widths[i] = col_len - if element.ColumnsToDisplay is None: displaycolumns = element.ColumnHeadings else: @@ -2691,14 +2691,16 @@ def CharWidthInPixels(): for i, should_display in enumerate(element.ColumnsToDisplay): if should_display: displaycolumns.append(element.ColumnHeadings[i]) - displaycolumns = ['Row',] + displaycolumns - column_headings = ['Row',] + element.ColumnHeadings - # scrollable_frame = TkScrollableFrame(tk_row_frame) + column_headings= element.ColumnHeadings + if element.DisplayRowNumbers: # if display row number, tack on the numbers to front of columns + displaycolumns = ['Row',] + displaycolumns + column_headings = ['Row',] + element.ColumnHeadings element.TKTreeview = ttk.Treeview(tk_row_frame, columns=column_headings, displaycolumns=displaycolumns, show='headings', height=height, selectmode=element.SelectMode) treeview = element.TKTreeview - treeview.heading('Row', text='Row') # make a dummy heading - treeview.column('Row', width=50, anchor=anchor) + if element.DisplayRowNumbers: + treeview.heading('Row', text='Row') # make a dummy heading + treeview.column('Row', width=50, anchor=anchor) for i, heading in enumerate(element.ColumnHeadings): treeview.heading(heading, text=heading) if element.AutoSizeColumns: @@ -2708,13 +2710,12 @@ def CharWidthInPixels(): width = element.ColumnWidths[i] except: width = element.DefaultColumnWidth + treeview.column(heading, width=width*CharWidthInPixels(), anchor=anchor) for i, value in enumerate(element.Values): - value = [i] + value + if element.DisplayRowNumbers: + value = [i] + value id = treeview.insert('', 'end', text=value, values=value) - # print(id) - # for i in range(5): - # treeview.insert(id, 'end', text=value, values=i) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKTreeview.configure(background=element.BackgroundColor) # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') diff --git a/docs/cookbook.md b/docs/cookbook.md index 47ae0e4da..13231b59f 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -327,15 +327,17 @@ This recipe implements a remote control interface for a robot. There are 4 dire --------- -## Easy Progress Meter +## OneLineProgressMeter + This recipe shows just how easy it is to add a progress meter to your code. -![progress meter 6](https://user-images.githubusercontent.com/13696193/43955982-73b33b38-9c70-11e8-8b07-cc1473a58a73.jpg) +![onelineprogressmeter](https://user-images.githubusercontent.com/13696193/45589254-bd285900-b8f0-11e8-9122-b43f06bf074d.jpg) + import PySimpleGUI as sg for i in range(1000): - sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) + sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') ----- diff --git a/docs/index.md b/docs/index.md index f30d52bbe..a8dac2e8c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.2.0) + (Ver 3.3.0) @@ -71,7 +71,7 @@ Perhaps you're looking for a way to interact with your **Raspberry Pi** in a mor In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: - EasyProgressMeter('My meter title', current_value, max value) + OneLineProgressMeter('My meter title', current_value, max value, 'key') ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) @@ -199,7 +199,12 @@ You will see a number of different styles of buttons, data entry fields, etc, in - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values - Linear programming instead of callbacks + #### Lofty Goals +> +> +> Change Python +The expectation is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe an easy to use GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. ----- @@ -413,13 +418,14 @@ The window created to get a folder name looks the same as the get a file name. ![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) -#### Progress Meter! +#### Progress Meters! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - EasyProgressMeter(title, + OneLineProgressMeter(title, current_value, max_value, + key, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, @@ -431,14 +437,14 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! for i in range(1,10000): - sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') That line of code resulted in this window popping up and updating. ![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -1526,46 +1532,19 @@ If there are more than 1 button on a form, the FIRST button that is of type Clos --- #### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. +The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen OneLineProgressMeter calls presented earlier in this readme. - sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') -The return value for `EasyProgressMeter` is: +The return value for `OneLineProgressMeter` is: `True` if meter updated correctly `False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +#### Progress Mater in Your Form +Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) @@ -2055,12 +2034,13 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices |**Demo_NonBlocking_Form.py** | a basic async form -|** Demo_OpenCV.py** | Integrated with OpenCV -|** Demo_Password_Login** | Password protection using SHA1 +|**Demo_OpenCV.py** | Integrated with OpenCV +|**Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_LEDs.py** | Control GPIO using buttons |**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons |**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +| **Demo_Progress_Meters.py** | Demonstrates using 2 progress meters simultaneously |**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook |**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts @@ -2143,9 +2123,9 @@ While not an "issue" this is a ***stern warning*** ## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. +**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. @@ -2207,6 +2187,8 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.2.0 Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. +3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall + ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index f30d52bbe..a8dac2e8c 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.2.0) + (Ver 3.3.0) @@ -71,7 +71,7 @@ Perhaps you're looking for a way to interact with your **Raspberry Pi** in a mor In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: - EasyProgressMeter('My meter title', current_value, max value) + OneLineProgressMeter('My meter title', current_value, max value, 'key') ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) @@ -199,7 +199,12 @@ You will see a number of different styles of buttons, data entry fields, etc, in - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values - Linear programming instead of callbacks + #### Lofty Goals +> +> +> Change Python +The expectation is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe an easy to use GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. ----- @@ -413,13 +418,14 @@ The window created to get a folder name looks the same as the get a file name. ![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) -#### Progress Meter! +#### Progress Meters! We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - EasyProgressMeter(title, + OneLineProgressMeter(title, current_value, max_value, + key, *args, orientation=None, bar_color=DEFAULT_PROGRESS_BAR_COLOR, @@ -431,14 +437,14 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! for i in range(1,10000): - sg.EasyProgressMeter('My Meter', i+1, 10000, 'Optional message') + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') That line of code resulted in this window popping up and updating. ![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `EasyProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -1526,46 +1532,19 @@ If there are more than 1 button on a form, the FIRST button that is of type Clos --- #### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use the functions that provide a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. -The **easiest** way to get progress meters into your code is to use the `EasyProgessMeter` API. This consists of a pair of functions, `EasyProgessMeter` and `EasyProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen EasyProgressMeter calls presented earlier in this readme. +The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen OneLineProgressMeter calls presented earlier in this readme. - sg.EasyProgressMeter('My Meter', i+1, 1000, 'Optional message') + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') -The return value for `EasyProgressMeter` is: +The return value for `OneLineProgressMeter` is: `True` if meter updated correctly `False` if user clicked the Cancel button, closed the form, or vale reached the max value. -**Customized Progress Bar** -If you want a bit more customization of your meter, then you can go up 1 level and use the calls to `ProgressMeter` and `ProgressMeterUpdate`. These APIs behave like an object we're all used to. First you create the `ProgressMeter` object, then you call the `Update` method to update it. - - -You setup the progress meter by calling - - my_meter = ProgressMeter(title, - max_value, - *args, - orientantion=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH) -Then to update the bar within your loop - - return_code = ProgressMeterUpdate(my_meter, - value, - *args): -Putting it all together you get this design pattern - - my_meter = sg.ProgressMeter('Meter Title', 100000, orentation='Vert') - - for i in range(0, 100000): - sg.ProgressMeterUpdate(my_meter, i+1, 'Some variable', 'Another variable') - - -The final way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +#### Progress Mater in Your Form +Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) @@ -2055,12 +2034,13 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices |**Demo_NonBlocking_Form.py** | a basic async form -|** Demo_OpenCV.py** | Integrated with OpenCV -|** Demo_Password_Login** | Password protection using SHA1 +|**Demo_OpenCV.py** | Integrated with OpenCV +|**Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_LEDs.py** | Control GPIO using buttons |**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons |**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +| **Demo_Progress_Meters.py** | Demonstrates using 2 progress meters simultaneously |**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook |**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts @@ -2143,9 +2123,9 @@ While not an "issue" this is a ***stern warning*** ## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads -**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. +**Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X -**Async Forms** - these include the 'easy' forms (EasyProgressMeter and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. +**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. @@ -2207,6 +2187,8 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.2.0 Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. +3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall + ### Upcoming Make suggestions people! Future release features From 30447c51730e9aab73c17aa9eea90d6fb67262db Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 15 Sep 2018 16:24:57 -0400 Subject: [PATCH 382/521] Readme, Cookbook for Version 3.3.0 --- docs/index.md | 12 +++++------- readme.md | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docs/index.md b/docs/index.md index a8dac2e8c..906f418f8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -25,11 +25,9 @@ [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -Super-simple GUI to grasp... Powerfully customizable. +Super-simple GUI to use... Powerfully customizable. -Create a custom GUI in 5 lines of code. - -Can create a custom GUI in 1 line of code if desired. +Home of the 1-line custom GUI and 1-line progress meter Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. @@ -69,7 +67,7 @@ Perhaps you're looking for a way to interact with your **Raspberry Pi** in a mor -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: OneLineProgressMeter('My meter title', current_value, max value, 'key') @@ -83,7 +81,7 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUIest of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. @@ -204,7 +202,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in > > Change Python -The expectation is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe an easy to use GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. +The hope is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux for all levels of developer. The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. ----- diff --git a/readme.md b/readme.md index a8dac2e8c..906f418f8 100644 --- a/readme.md +++ b/readme.md @@ -25,11 +25,9 @@ [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -Super-simple GUI to grasp... Powerfully customizable. +Super-simple GUI to use... Powerfully customizable. -Create a custom GUI in 5 lines of code. - -Can create a custom GUI in 1 line of code if desired. +Home of the 1-line custom GUI and 1-line progress meter Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. @@ -69,7 +67,7 @@ Perhaps you're looking for a way to interact with your **Raspberry Pi** in a mor -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this into any of your `for` loops and get a nice meter like this: +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: OneLineProgressMeter('My meter title', current_value, max value, 'key') @@ -83,7 +81,7 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they're **very** limiting. PySimpleGUI takes the best of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUIest of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. @@ -204,7 +202,7 @@ You will see a number of different styles of buttons, data entry fields, etc, in > > Change Python -The expectation is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe an easy to use GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. +The hope is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux for all levels of developer. The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. ----- From e491b756af3375076010b7d1b85007a2953360d4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 15 Sep 2018 16:32:46 -0400 Subject: [PATCH 383/521] RELEASE 3.3.0 --- PySimpleGUI.py | 8 ++++---- docs/index.md | 1 + readme.md | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bb6899d22..4223d6dbb 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2937,7 +2937,7 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): +def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None, grab_anywhere=True): ''' Create and show a form on tbe caller's behalf. :param title: @@ -2954,7 +2954,7 @@ def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,No local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) - form = FlexForm(title, auto_size_text=True, grab_anywhere=True) + form = FlexForm(title, auto_size_text=True, grab_anywhere=grab_anywhere) # Form using a horizontal bar if local_orientation[0].lower() == 'h': @@ -3128,7 +3128,7 @@ def EasyProgressMeterCancel(title, *args): _one_line_progress_meters = {} # ============================== OneLineProgressMeter =====# -def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): +def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None, grab_anywhere=True): global _one_line_progress_meters @@ -3142,7 +3142,7 @@ def OneLineProgressMeter(title, current_value, max_value, key, *args, orientatio _one_line_progress_meters[key] = meter_data meter_data.ComputeProgressStats() message = "\n".join([line for line in meter_data.StatMessages]) - meter_data.MeterID, meter_data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) + meter_data.MeterID, meter_data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width, grab_anywhere=grab_anywhere) meter_data.ParentForm = meter_data.MeterID.ParentForm return True diff --git a/docs/index.md b/docs/index.md index 906f418f8..053c45534 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2154,6 +2154,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). +| 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. ### Release Notes diff --git a/readme.md b/readme.md index 906f418f8..053c45534 100644 --- a/readme.md +++ b/readme.md @@ -2154,6 +2154,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). +| 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. ### Release Notes From 77d68f23841e6631233f6bbe34194479a11b61d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 15 Sep 2018 19:41:41 -0400 Subject: [PATCH 384/521] Wasn't computing individual amounts corectly. --- Demo_Desktop_Widget_CPU_Utilization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 12cde3432..cdf6b8504 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -74,7 +74,7 @@ def main(): top_sorted.pop(0) display_string = '' for proc, cpu in top_sorted: - display_string += '{} {}\n'.format(cpu, proc) + display_string += '{:2.2f} {}\n'.format(cpu/10, proc) # --------- Display timer in window -------- From 674d050ca1eb351a38517a1d708e48854b309d1a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 16 Sep 2018 14:32:37 -0400 Subject: [PATCH 385/521] New Demo - graph pings using canvas. Ping.py pure ping implementation --- Demo_Ping_Line_Graph.py | 78 ++++++ ping.py | 572 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 650 insertions(+) create mode 100644 Demo_Ping_Line_Graph.py create mode 100644 ping.py diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py new file mode 100644 index 000000000..209220112 --- /dev/null +++ b/Demo_Ping_Line_Graph.py @@ -0,0 +1,78 @@ +import ping +from threading import Thread +import time +import PySimpleGUI as sg + +# set coordinate system +canvas_right = 300 +canvas_left = 0 +canvas_top = 0 +canvas_bottom = 300 +# define the coordinates you'll use for your graph +x_right = 100 +x_left = 0 +y_bottom = 0 +y_top = 500 + +# globale used to communicate with thread.. yea yea... it's working fine +g_exit = False +g_response_time = None + +def ping_thread(args): + global g_exit, g_response_time + + while not g_exit: + g_response_time = ping.quiet_ping('google.com', timeout=1000) + + +def convert_xy_to_canvas_xy(x_in,y_in): + scale_x = (canvas_right - canvas_left) / (x_right - x_left) + scale_y = (canvas_top - canvas_bottom) / (y_top - y_bottom) + new_x = canvas_left + scale_x * (x_in - x_left) + new_y = canvas_bottom + scale_y * (y_in - y_bottom) + return new_x, new_y + + + +# start ping measurement thread +thread = Thread(target=ping_thread, args=(None,)) +thread.start() + +layout = [ [sg.T('Ping times to Google.com', font='Any 18')], + [sg.Canvas(size=(canvas_right, canvas_bottom), background_color='white', key='canvas')], + [sg.Quit()] + ] + +form = sg.FlexForm('Canvas test', grab_anywhere=True) +form.Layout(layout) +form.Finalize() + +canvas = form.FindElement('canvas').TKCanvas + +prev_response_time = None +i=0 +prev_x, prev_y = canvas_left, canvas_bottom +while True: + time.sleep(.2) + + button, values = form.ReadNonBlocking() + if button == 'Quit' or values is None: + break + + if g_response_time is None or prev_response_time == g_response_time: + continue + new_x, new_y = convert_xy_to_canvas_xy(i, g_response_time[0]) + prev_response_time = g_response_time + canvas.create_line(prev_x, prev_y, new_x, new_y, width=1, fill='black') + prev_x, prev_y = new_x, new_y + if i >= x_right: + i = 0 + prev_x = prev_y = last_x = last_y = 0 + else: i += 1 + +# tell thread we're done. wait for thread to exit +g_exit = True +thread.join() + + +exit(69) \ No newline at end of file diff --git a/ping.py b/ping.py new file mode 100644 index 000000000..3df8635dc --- /dev/null +++ b/ping.py @@ -0,0 +1,572 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" + A pure python ping implementation using raw sockets. + + (This is Python 3 port of https://github.com/jedie/python-ping) + (Tested and working with python 2.7, should work with 2.6+) + + Note that ICMP messages can only be sent from processes running as root + (in Windows, you must run this script as 'Administrator'). + + Derived from ping.c distributed in Linux's netkit. That code is + copyright (c) 1989 by The Regents of the University of California. + That code is in turn derived from code written by Mike Muuss of the + US Army Ballistic Research Laboratory in December, 1983 and + placed in the public domain. They have my thanks. + + Bugs are naturally mine. I'd be glad to hear about them. There are + certainly word - size dependencies here. + + Copyright (c) Matthew Dixon Cowles, . + Distributable under the terms of the GNU General Public License + version 2. Provided with no warranties of any sort. + + Original Version from Matthew Dixon Cowles: + -> ftp://ftp.visi.com/users/mdc/ping.py + + Rewrite by Jens Diemer: + -> http://www.python-forum.de/post-69122.html#69122 + + Rewrite by George Notaras: + -> http://www.g-loaded.eu/2009/10/30/python-ping/ + + Enhancements by Martin Falatic: + -> http://www.falatic.com/index.php/39/pinging-with-python + + Enhancements and fixes by Georgi Kolev: + -> http://github.com/jedie/python-ping/ + + Bug fix by Andrejs Rozitis: + -> http://github.com/rozitis/python-ping/ + + Revision history + ~~~~~~~~~~~~~~~~ + May 1, 2014 + ----------- + Little modifications by Mohammad Emami + - Added Python 3 support. For now this project will just support + python 3.x + - Tested with python 3.3 + - version was upped to 0.6 + + March 19, 2013 + -------------- + * Fixing bug to prevent divide by 0 during run-time. + + January 26, 2012 + ---------------- + * Fixing BUG #4 - competability with python 2.x [tested with 2.7] + - Packet data building is different for 2.x and 3.x. + 'cose of the string/bytes difference. + * Fixing BUG #10 - the multiple resolv issue. + - When pinging domain names insted of hosts (for exmaple google.com) + you can get different IP every time you try to resolv it, we should + resolv the host only once and stick to that IP. + * Fixing BUGs #3 #10 - Doing hostname resolv only once. + * Fixing BUG #14 - Removing all 'global' stuff. + - You should not use globul! Its bad for you...and its not thread safe! + * Fix - forcing the use of different times on linux/windows for + more accurate mesurments. (time.time - linux/ time.clock - windows) + * Adding quiet_ping function - This way we'll be able to use this script + as external lib. + * Changing default timeout to 3s. (1second is not enought) + * Switching data syze to packet size. It's easyer for the user to ignore the + fact that the packet headr is 8b and the datasize 64 will make packet with + size 72. + + October 12, 2011 + -------------- + Merged updates from the main project + -> https://github.com/jedie/python-ping + + September 12, 2011 + -------------- + Bugfixes + cleanup by Jens Diemer + Tested with Ubuntu + Windows 7 + + September 6, 2011 + -------------- + Cleanup by Martin Falatic. Restored lost comments and docs. Improved + functionality: constant time between pings, internal times consistently + use milliseconds. Clarified annotations (e.g., in the checksum routine). + Using unsigned data in IP & ICMP header pack/unpack unless otherwise + necessary. Signal handling. Ping-style output formatting and stats. + + August 3, 2011 + -------------- + Ported to py3k by Zach Ware. Mostly done by 2to3; also minor changes to + deal with bytes vs. string changes (no more ord() in checksum() because + >source_string< is actually bytes, added .encode() to data in + send_one_ping()). That's about it. + + March 11, 2010 + -------------- + changes by Samuel Stauffer: + - replaced time.clock with default_timer which is set to + time.clock on windows and time.time on other systems. + + November 8, 2009 + ---------------- + Improved compatibility with GNU/Linux systems. + + Fixes by: + * George Notaras -- http://www.g-loaded.eu + Reported by: + * Chris Hallman -- http://cdhallman.blogspot.com + + Changes in this release: + - Re-use time.time() instead of time.clock(). The 2007 implementation + worked only under Microsoft Windows. Failed on GNU/Linux. + time.clock() behaves differently under the two OSes[1]. + + [1] http://docs.python.org/library/time.html#time.clock + + May 30, 2007 + ------------ + little rewrite by Jens Diemer: + - change socket asterisk import to a normal import + - replace time.time() with time.clock() + - delete "return None" (or change to "return" only) + - in checksum() rename "str" to "source_string" + + December 4, 2000 + ---------------- + Changed the struct.pack() calls to pack the checksum and ID as + unsigned. My thanks to Jerome Poincheval for the fix. + + November 22, 1997 + ----------------- + Initial hack. Doesn't do much, but rather than try to guess + what features I (or others) will want in the future, I've only + put in what I need now. + + December 16, 1997 + ----------------- + For some reason, the checksum bytes are in the wrong order when + this is run under Solaris 2.X for SPARC but it works right under + Linux x86. Since I don't know just what's wrong, I'll swap the + bytes always and then do an htons(). + + =========================================================================== + IP header info from RFC791 + -> http://tools.ietf.org/html/rfc791) + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |Version| IHL |Type of Service| Total Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Identification |Flags| Fragment Offset | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time to Live | Protocol | Header Checksum | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Options | Padding | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + =========================================================================== + ICMP Echo / Echo Reply Message header info from RFC792 + -> http://tools.ietf.org/html/rfc792 + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type | Code | Checksum | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Identifier | Sequence Number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Data ... + +-+-+-+-+- + + =========================================================================== + ICMP parameter info: + -> http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml + + =========================================================================== + An example of ping's typical output: + + PING heise.de (193.99.144.80): 56 data bytes + 64 bytes from 193.99.144.80: icmp_seq=0 ttl=240 time=127 ms + 64 bytes from 193.99.144.80: icmp_seq=1 ttl=240 time=127 ms + 64 bytes from 193.99.144.80: icmp_seq=2 ttl=240 time=126 ms + 64 bytes from 193.99.144.80: icmp_seq=3 ttl=240 time=126 ms + 64 bytes from 193.99.144.80: icmp_seq=4 ttl=240 time=127 ms + + ----heise.de PING Statistics---- + 5 packets transmitted, 5 packets received, 0.0% packet loss + round-trip (ms) min/avg/max/med = 126/127/127/127 + + =========================================================================== +""" + +#=============================================================================# +import argparse +import os, sys, socket, struct, select, time, signal + +__description__ = 'A pure python ICMP ping implementation using raw sockets.' + +if sys.platform == "win32": + # On Windows, the best timer is time.clock() + default_timer = time.clock +else: + # On most other platforms the best timer is time.time() + default_timer = time.time + +NUM_PACKETS = 3 +PACKET_SIZE = 64 +WAIT_TIMEOUT = 3.0 + +#=============================================================================# +# ICMP parameters + +ICMP_ECHOREPLY = 0 # Echo reply (per RFC792) +ICMP_ECHO = 8 # Echo request (per RFC792) +ICMP_MAX_RECV = 2048 # Max size of incoming buffer + +MAX_SLEEP = 1000 + +class MyStats: + thisIP = "0.0.0.0" + pktsSent = 0 + pktsRcvd = 0 + minTime = 999999999 + maxTime = 0 + totTime = 0 + avrgTime = 0 + fracLoss = 1.0 + +myStats = MyStats # NOT Used globally anymore. + +#=============================================================================# +def checksum(source_string): + """ + A port of the functionality of in_cksum() from ping.c + Ideally this would act on the string as a series of 16-bit ints (host + packed), but this works. + Network data is big-endian, hosts are typically little-endian + """ + countTo = (int(len(source_string)/2))*2 + sum = 0 + count = 0 + + # Handle bytes in pairs (decoding as short ints) + loByte = 0 + hiByte = 0 + while count < countTo: + if (sys.byteorder == "little"): + loByte = source_string[count] + hiByte = source_string[count + 1] + else: + loByte = source_string[count + 1] + hiByte = source_string[count] + try: # For Python3 + sum = sum + (hiByte * 256 + loByte) + except: # For Python2 + sum = sum + (ord(hiByte) * 256 + ord(loByte)) + count += 2 + + # Handle last byte if applicable (odd-number of bytes) + # Endianness should be irrelevant in this case + if countTo < len(source_string): # Check for odd length + loByte = source_string[len(source_string)-1] + try: # For Python3 + sum += loByte + except: # For Python2 + sum += ord(loByte) + + sum &= 0xffffffff # Truncate sum to 32 bits (a variance from ping.c, which + # uses signed ints, but overflow is unlikely in ping) + + sum = (sum >> 16) + (sum & 0xffff) # Add high 16 bits to low 16 bits + sum += (sum >> 16) # Add carry from above (if any) + answer = ~sum & 0xffff # Invert and truncate to 16 bits + answer = socket.htons(answer) + + return answer + +#=============================================================================# +def do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size, quiet = False): + """ + Returns either the delay (in ms) or None on timeout. + """ + delay = None + + try: # One could use UDP here, but it's obscure + mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname("icmp")) + except socket.error as e: + print("failed. (socket error: '%s')" % e.args[1]) + raise # raise the original error + + my_ID = os.getpid() & 0xFFFF + + sentTime = send_one_ping(mySocket, destIP, my_ID, mySeqNumber, packet_size) + if sentTime == None: + mySocket.close() + return delay + + myStats.pktsSent += 1 + + recvTime, dataSize, iphSrcIP, icmpSeqNumber, iphTTL = receive_one_ping(mySocket, my_ID, timeout) + + mySocket.close() + + if recvTime: + delay = (recvTime-sentTime)*1000 + if not quiet: + print("%d bytes from %s: icmp_seq=%d ttl=%d time=%d ms" % ( + dataSize, socket.inet_ntoa(struct.pack("!I", iphSrcIP)), icmpSeqNumber, iphTTL, delay) + ) + myStats.pktsRcvd += 1 + myStats.totTime += delay + if myStats.minTime > delay: + myStats.minTime = delay + if myStats.maxTime < delay: + myStats.maxTime = delay + else: + delay = None + print("Request timed out.") + + return delay + +#=============================================================================# +def send_one_ping(mySocket, destIP, myID, mySeqNumber, packet_size): + """ + Send one ping to the given >destIP<. + """ + #destIP = socket.gethostbyname(destIP) + + # Header is type (8), code (8), checksum (16), id (16), sequence (16) + # (packet_size - 8) - Remove header size from packet size + myChecksum = 0 + + # Make a dummy heder with a 0 checksum. + header = struct.pack( + "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber + ) + + padBytes = [] + startVal = 0x42 + # 'cose of the string/byte changes in python 2/3 we have + # to build the data differnely for different version + # or it will make packets with unexpected size. + if sys.version[:1] == '2': + bytes = struct.calcsize("d") + data = ((packet_size - 8) - bytes) * "Q" + data = struct.pack("d", default_timer()) + data + else: + for i in range(startVal, startVal + (packet_size-8)): + padBytes += [(i & 0xff)] # Keep chars in the 0-255 range + #data = bytes(padBytes) + data = bytearray(padBytes) + + + # Calculate the checksum on the data and the dummy header. + myChecksum = checksum(header + data) # Checksum is in network order + + # Now that we have the right checksum, we put that in. It's just easier + # to make up a new header than to stuff it into the dummy. + header = struct.pack( + "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber + ) + + packet = header + data + + sendTime = default_timer() + + try: + mySocket.sendto(packet, (destIP, 1)) # Port number is irrelevant for ICMP + except socket.error as e: + print("General failure (%s)" % (e.args[1])) + return + + return sendTime + +#=============================================================================# +def receive_one_ping(mySocket, myID, timeout): + """ + Receive the ping from the socket. Timeout = in ms + """ + timeLeft = timeout/1000 + + while True: # Loop while waiting for packet or timeout + startedSelect = default_timer() + whatReady = select.select([mySocket], [], [], timeLeft) + howLongInSelect = (default_timer() - startedSelect) + if whatReady[0] == []: # Timeout + return None, 0, 0, 0, 0 + + timeReceived = default_timer() + + recPacket, addr = mySocket.recvfrom(ICMP_MAX_RECV) + + ipHeader = recPacket[:20] + iphVersion, iphTypeOfSvc, iphLength, \ + iphID, iphFlags, iphTTL, iphProtocol, \ + iphChecksum, iphSrcIP, iphDestIP = struct.unpack( + "!BBHHHBBHII", ipHeader + ) + + icmpHeader = recPacket[20:28] + icmpType, icmpCode, icmpChecksum, \ + icmpPacketID, icmpSeqNumber = struct.unpack( + "!BBHHH", icmpHeader + ) + + if icmpPacketID == myID: # Our packet + dataSize = len(recPacket) - 28 + #print (len(recPacket.encode())) + return timeReceived, (dataSize+8), iphSrcIP, icmpSeqNumber, iphTTL + + timeLeft = timeLeft - howLongInSelect + if timeLeft <= 0: + return None, 0, 0, 0, 0 + +#=============================================================================# +def dump_stats(myStats): + """ + Show stats when pings are done + """ + print("\n----%s PYTHON PING Statistics----" % (myStats.thisIP)) + + if myStats.pktsSent > 0: + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd)/myStats.pktsSent + + print("%d packets transmitted, %d packets received, %0.1f%% packet loss" % ( + myStats.pktsSent, myStats.pktsRcvd, 100.0 * myStats.fracLoss + )) + + if myStats.pktsRcvd > 0: + print("round-trip (ms) min/avg/max = %d/%0.1f/%d" % ( + myStats.minTime, myStats.totTime/myStats.pktsRcvd, myStats.maxTime + )) + + print("") + return + +#=============================================================================# +def signal_handler(signum, frame): + """ + Handle exit via signals + """ + dump_stats() + print("\n(Terminated with signal %d)\n" % (signum)) + sys.exit(0) + +#=============================================================================# +def verbose_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, + packet_size=PACKET_SIZE, path_finder=False): + """ + Send >count< ping to >destIP< with the given >timeout< and display + the result. + """ + signal.signal(signal.SIGINT, signal_handler) # Handle Ctrl-C + if hasattr(signal, "SIGBREAK"): + # Handle Ctrl-Break e.g. under Windows + signal.signal(signal.SIGBREAK, signal_handler) + + myStats = MyStats() # Reset the stats + + mySeqNumber = 0 # Starting value + + try: + destIP = socket.gethostbyname(hostname) + print("\nPYTHON PING %s (%s): %d data bytes" % (hostname, destIP, packet_size)) + except socket.gaierror as e: + print("\nPYTHON PING: Unknown host: %s (%s)" % (hostname, e.args[1])) + print() + return + + myStats.thisIP = destIP + + for i in range(count): + delay = do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size) + + if delay == None: + delay = 0 + + mySeqNumber += 1 + + # Pause for the remainder of the MAX_SLEEP period (if applicable) + if (MAX_SLEEP > delay): + time.sleep((MAX_SLEEP - delay)/1000) + + dump_stats(myStats) + +#=============================================================================# +def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, + packet_size=PACKET_SIZE, path_finder=False): + """ + Same as verbose_ping, but the results are returned as tuple + """ + myStats = MyStats() # Reset the stats + mySeqNumber = 0 # Starting value + + try: + destIP = socket.gethostbyname(hostname) + except socket.gaierror as e: + return False + + myStats.thisIP = destIP + + # This will send packet that we dont care about 0.5 seconds before it starts + # acrutally pinging. This is needed in big MAN/LAN networks where you sometimes + # loose the first packet. (while the switches find the way... :/ ) + if path_finder: + fakeStats = MyStats() + do_one(fakeStats, destIP, hostname, timeout, + mySeqNumber, packet_size, quiet=True) + time.sleep(0.5) + + for i in range(count): + delay = do_one(myStats, destIP, hostname, timeout, + mySeqNumber, packet_size, quiet=True) + + if delay == None: + delay = 0 + + mySeqNumber += 1 + + # Pause for the remainder of the MAX_SLEEP period (if applicable) + if (MAX_SLEEP > delay): + time.sleep((MAX_SLEEP - delay)/1000) + + if myStats.pktsSent > 0: + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd)/myStats.pktsSent + if myStats.pktsRcvd > 0: + myStats.avrgTime = myStats.totTime / myStats.pktsRcvd + + # return tuple(max_rtt, min_rtt, avrg_rtt, percent_lost) + return myStats.maxTime, myStats.minTime, myStats.avrgTime, myStats.fracLoss + +#=============================================================================# +def main(): + + parser = argparse.ArgumentParser(description=__description__) + parser.add_argument('-q', '--quiet', action='store_true', + help='quiet output') + parser.add_argument('-c', '--count', type=int, default=NUM_PACKETS, + help=('number of packets to be sent ' + '(default: %(default)s)')) + parser.add_argument('-W', '--timeout', type=float, default=WAIT_TIMEOUT, + help=('time to wait for a response in seoncds ' + '(default: %(default)s)')) + parser.add_argument('-s', '--packet-size', type=int, default=PACKET_SIZE, + help=('number of data bytes to be sent ' + '(default: %(default)s)')) + parser. add_argument('destination') + # args = parser.parse_args() + + ping = verbose_ping + # if args.quiet: + # ping = quiet_ping + ping('Google.com', timeout=1000) + # ping(args.destination, timeout=args.timeout*1000, count=args.count, + # packet_size=args.packet_size) + +if __name__ == '__main__': + main() From 25a5266dce9a31b048eabcdf0e4b095a961b9bee Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 16 Sep 2018 14:34:41 -0400 Subject: [PATCH 386/521] Clear canvas when at the end --- Demo_Ping_Line_Graph.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py index 209220112..36cd82672 100644 --- a/Demo_Ping_Line_Graph.py +++ b/Demo_Ping_Line_Graph.py @@ -68,6 +68,7 @@ def convert_xy_to_canvas_xy(x_in,y_in): if i >= x_right: i = 0 prev_x = prev_y = last_x = last_y = 0 + canvas.delete('all') else: i += 1 # tell thread we're done. wait for thread to exit From 4ad786c27cbc1619059d017eb46bac55506378da Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 16 Sep 2018 17:08:26 -0400 Subject: [PATCH 387/521] New Graph Element ! Graph on a canvas using your own coordinate system. Demo program for Graph Element, Exception handling for CPU widget. Sometimes as getting error from psutil --- Demo_Desktop_Widget_CPU_Utilization.py | 12 ++++-- Demo_Graph__Element.py | 57 ++++++++++++++++++++++++++ PySimpleGUI.py | 57 +++++++++++++++++++++++--- 3 files changed, 117 insertions(+), 9 deletions(-) create mode 100644 Demo_Graph__Element.py diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index cdf6b8504..691781019 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -27,8 +27,11 @@ def CPU_thread(args): global g_interval, g_cpu_percent, g_procs, g_exit while not g_exit: - g_cpu_percent = psutil.cpu_percent(interval=g_interval) - g_procs = psutil.process_iter() + try: + g_cpu_percent = psutil.cpu_percent(interval=g_interval) + g_procs = psutil.process_iter() + except: + pass def main(): @@ -67,7 +70,10 @@ def main(): display_string = '' if g_procs: # --------- Create list of top % CPU porocesses -------- - top = {proc.name() : proc.cpu_percent() for proc in g_procs} + try: + top = {proc.name() : proc.cpu_percent() for proc in g_procs} + except: pass + top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) if top_sorted: diff --git a/Demo_Graph__Element.py b/Demo_Graph__Element.py new file mode 100644 index 000000000..21f85b9ea --- /dev/null +++ b/Demo_Graph__Element.py @@ -0,0 +1,57 @@ +import ping +from threading import Thread +import time +import PySimpleGUI as sg + +# globale used to communicate with thread.. yea yea... it's working fine +g_exit = False +g_response_time = None +def ping_thread(args): + global g_exit, g_response_time + while not g_exit: + g_response_time = ping.quiet_ping('google.com', timeout=1000) + +def main(): + global g_exit, g_response_time + # start ping measurement thread + thread = Thread(target=ping_thread, args=(None,)) + thread.start() + + layout = [ [sg.T('Ping times to Google.com', font='Any 18')], + [sg.Graph((300,300), (0,0), (100,500),background_color='white', key='graph')], + [sg.Quit()]] + + form = sg.FlexForm('Canvas test', grab_anywhere=True) + form.Layout(layout) + + prev_response_time = None + i=0 + prev_x, prev_y = 0, 0 + while True: + time.sleep(.2) + + button, values = form.ReadNonBlocking() + if button == 'Quit' or values is None: + break + + if g_response_time is None or prev_response_time == g_response_time: + continue + new_x, new_y = i, g_response_time[0] + prev_response_time = g_response_time + form.FindElement('graph').DrawLine((prev_x, prev_y), (new_x, new_y), color='red') + # form.FindElement('graph').DrawPoint((new_x, new_y), color='red') + prev_x, prev_y = new_x, new_y + if i >= 100: + i = 0 + prev_x = prev_y = last_x = last_y = 0 + form.FindElement('graph').Erase() + else: i += 4 + + # tell thread we're done. wait for thread to exit + g_exit = True + thread.join() + + +if __name__ == '__main__': + main() + exit(69) \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4223d6dbb..e06fe1636 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1106,11 +1106,55 @@ def __del__(self): class Canvas(Element): def __init__(self, canvas=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR - self.TKCanvas = canvas + self._TKCanvas = canvas super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, scale=scale, size=size, pad=pad, key=key) return + @property + def TKCanvas(self): + return self._TKCanvas + + + def __del__(self): + super().__del__() + + + + +# ---------------------------------------------------------------------- # +# Graph # +# ---------------------------------------------------------------------- # +class Graph(Canvas): + def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + + self.CanvasSize = canvas_size + self.BottomLeft = graph_bottom_left + self.TopRight = graph_top_right + + super().__init__(background_color=background_color, scale=scale, size=canvas_size, pad=pad, key=key) + return + + def _convert_xy_to_canvas_xy(self, x_in, y_in): + scale_x = (self.CanvasSize[0] - 0) / (self.TopRight[0] - self.BottomLeft[0]) + scale_y = (0 - self.CanvasSize[1]) / (self.TopRight[1] - self.BottomLeft[1]) + new_x = 0 + scale_x * (x_in - self.BottomLeft[0]) + new_y = self.CanvasSize[1] + scale_y * (y_in - self.BottomLeft[1]) + return new_x, new_y + + def DrawLine(self, point_from, point_to, color='black', width=1): + converted_point_from = self._convert_xy_to_canvas_xy(*point_from) + converted_point_to = self._convert_xy_to_canvas_xy(*point_to) + self.TKCanvas.create_line(converted_point_from, converted_point_to, width=width, fill=color) + + def DrawPoint(self, point, size=2, color='black'): + converted_point = self._convert_xy_to_canvas_xy(*point) + self.TKCanvas.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) + + def Erase(self): + self.TKCanvas.delete('all') + + def __del__(self): super().__del__() @@ -2611,13 +2655,13 @@ def CharWidthInPixels(): # ------------------------- Canvas element ------------------------- # elif element_type == ELEM_TYPE_CANVAS: width, height = element_size - if element.TKCanvas is None: - element.TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + if element._TKCanvas is None: + element._TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) else: - element.TKCanvas.master = tk_row_frame + element._TKCanvas.master = tk_row_frame if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKCanvas.configure(background=element.BackgroundColor) - element.TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + element._TKCanvas.configure(background=element.BackgroundColor) + element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: menu_def = (('File', ('Open', 'Save')), @@ -3078,6 +3122,7 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, EasyProgressMeter.Data = getattr(EasyProgressMeter, 'Data', EasyProgressMeterDataClass()) # if no meter currently running if EasyProgressMeter.Data.MeterID is None: # Starting a new meter + print("Please change your call of EasyProgressMeter to use OneLineProgressMeter. EasyProgressMeter will be removed soon") if int(current_value) >= int(max_value): return False del(EasyProgressMeter.Data) From 7954634c751b2b77cf840cc5e9ea2e8875b09ef6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 17 Sep 2018 04:17:42 -0400 Subject: [PATCH 388/521] More Graph Element work. New parameter initial_folder for all file/folder browse buttons, no longer clears target if browse cancelled --- PySimpleGUI.py | 101 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 32 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index e06fe1636..1cfb8af1f 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -163,6 +163,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_IMAGE = 30 ELEM_TYPE_CANVAS = 40 ELEM_TYPE_FRAME = 41 +ELEM_TYPE_GRAPH = 42 ELEM_TYPE_INPUT_SLIDER = 10 ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 @@ -852,7 +853,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), initial_folder=None, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -885,6 +886,8 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.Focus = focus self.TKCal = None self.DefaultValue = None + self.InitialFolder = initial_folder + super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) return @@ -923,29 +926,33 @@ def ButtonCallBack(self): except: pass filetypes = [] if self.FileTypes is None else self.FileTypes if self.BType == BUTTON_TYPE_BROWSE_FOLDER: - folder_name = tk.filedialog.askdirectory() # show the 'get folder' dialog box - try: - strvar.set(folder_name) - self.TKStringVar.set(folder_name) - except: pass + folder_name = tk.filedialog.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) # show the 'get file' dialog box - strvar.set(file_name) - self.TKStringVar.set(file_name) + file_name = tk.filedialog.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 = 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) - file_name = ';'.join(file_name) - strvar.set(file_name) - self.TKStringVar.set(file_name) + file_name = tk.filedialog.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) # show the 'get file' dialog box - strvar.set(file_name) - self.TKStringVar.set(file_name) + file_name = tk.filedialog.asksaveasfilename(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_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window # first, get the results table built # modify the Results table in the parent FlexForm object @@ -1125,14 +1132,16 @@ def __del__(self): # ---------------------------------------------------------------------- # # Graph # # ---------------------------------------------------------------------- # -class Graph(Canvas): - def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): +class Graph(Element): + def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_color=None, scale=(None, None), pad=None, key=None): self.CanvasSize = canvas_size self.BottomLeft = graph_bottom_left self.TopRight = graph_top_right + self._TKCanvas = None + self._TKCanvas2 = None - super().__init__(background_color=background_color, scale=scale, size=canvas_size, pad=pad, key=key) + super().__init__(ELEM_TYPE_GRAPH, background_color=background_color, scale=scale, size=canvas_size, pad=pad, key=key) return def _convert_xy_to_canvas_xy(self, x_in, y_in): @@ -1145,15 +1154,29 @@ def _convert_xy_to_canvas_xy(self, x_in, y_in): def DrawLine(self, point_from, point_to, color='black', width=1): converted_point_from = self._convert_xy_to_canvas_xy(*point_from) converted_point_to = self._convert_xy_to_canvas_xy(*point_to) - self.TKCanvas.create_line(converted_point_from, converted_point_to, width=width, fill=color) + self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color) def DrawPoint(self, point, size=2, color='black'): converted_point = self._convert_xy_to_canvas_xy(*point) - self.TKCanvas.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) + self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) def Erase(self): - self.TKCanvas.delete('all') + self._TKCanvas2.delete('all') + + def Update(self, background_color): + self._TKCanvas2.configure(background=background_color) + + def Move(self, x_direction, y_direction): + zero_converted = self._convert_xy_to_canvas_xy(0,0) + shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) + shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) + print(shift_amount) + self._TKCanvas2.move('all', *shift_amount) + + @property + def TKCanvas(self): + return self._TKCanvas2 def __del__(self): super().__del__() @@ -1961,24 +1984,24 @@ def __del__(self): # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FolderBrowse(target=(ThisRow, -1), button_text='Browse', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types,initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- # -def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE AS Element lazy function ------------------------- # -def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): @@ -2662,6 +2685,20 @@ def CharWidthInPixels(): if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element._TKCanvas.configure(background=element.BackgroundColor) element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- Graph element ------------------------- # + elif element_type == ELEM_TYPE_GRAPH: + width, height = element_size + if element._TKCanvas is None: + element._TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + else: + element._TKCanvas.master = tk_row_frame + element._TKCanvas2 = tk.Canvas(element._TKCanvas, width=width, height=height, bd=border_depth) + element._TKCanvas2.pack(side=tk.LEFT) + element._TKCanvas2.addtag_all('mytag') + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element._TKCanvas2.configure(background=element.BackgroundColor) + element._TKCanvas.configure(background=element.BackgroundColor) + element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: menu_def = (('File', ('Open', 'Save')), From b4fb2ae839b030ea34ca7cf23dc777d4b4bfbe39 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 17 Sep 2018 12:46:37 -0400 Subject: [PATCH 389/521] Button clicks return key instead of button text if key is present --- PySimpleGUI.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1cfb8af1f..a045c2cc8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -901,7 +901,10 @@ def ButtonReleaseCallBack(self, parm): def ButtonPressCallBack(self, parm): r, c = self.Position self.ParentForm.LastButtonClickedWasRealtime = True - self.ParentForm.LastButtonClicked = self.ButtonText + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.ButtonText # ------- Button Callback ------- # def ButtonCallBack(self): @@ -957,7 +960,10 @@ def ButtonCallBack(self): # first, get the results table built # modify the Results table in the parent FlexForm object r,c = self.Position - self.ParentForm.LastButtonClicked = self.ButtonText + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = False # if the form is tabbed, must collect all form's results and destroy all forms if self.ParentForm.IsTabbedForm: @@ -971,7 +977,10 @@ def ButtonCallBack(self): elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE # first, get the results table built # modify the Results table in the parent FlexForm object - self.ParentForm.LastButtonClicked = self.ButtonText + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop elif self.BType == BUTTON_TYPE_CLOSES_WIN_ONLY: # this is a return type button so GET RESULTS and destroy window From 457591d8dd81024c8b0e1579468f25b2e266991a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 17 Sep 2018 13:48:14 -0400 Subject: [PATCH 390/521] Fix for border around Canvas & Graph Elements --- PySimpleGUI.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index a045c2cc8..53ec4323e 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2692,7 +2692,7 @@ def CharWidthInPixels(): else: element._TKCanvas.master = tk_row_frame if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element._TKCanvas.configure(background=element.BackgroundColor) + element._TKCanvas.configure(background=element.BackgroundColor, highlightthickness=0) element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- Graph element ------------------------- # elif element_type == ELEM_TYPE_GRAPH: @@ -2705,8 +2705,8 @@ def CharWidthInPixels(): element._TKCanvas2.pack(side=tk.LEFT) element._TKCanvas2.addtag_all('mytag') if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element._TKCanvas2.configure(background=element.BackgroundColor) - element._TKCanvas.configure(background=element.BackgroundColor) + element._TKCanvas2.configure(background=element.BackgroundColor, highlightthickness=0) + element._TKCanvas.configure(background=element.BackgroundColor, highlightthickness=0) element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: From 306abd0807f0ae73ab68033c5d4a9667faae6c9f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 17 Sep 2018 14:50:14 -0400 Subject: [PATCH 391/521] Reworked ALL Popups so they have same parameters. Added return values for YesNo, OkCancel --- PySimpleGUI.py | 280 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 247 insertions(+), 33 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 53ec4323e..107821f88 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3401,7 +3401,24 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au # (True if Submit was pressed, false otherwise) # # ---------------------------------------------------------------------- # -def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None, None)): + """ + Display popup with text entry field and browse button. Browse for folder + :param message: + :param default_path: + :param no_window: + :param size: + :param button_color: + :param background_color: + :param text_color: + :param icon: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: Contents of text field. None if closed using X + """ if no_window: root = tk.Tk() try: @@ -3413,7 +3430,7 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), return folder_name with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, - font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), FolderBrowse()], [Ok(), Cancel()]] @@ -3428,7 +3445,27 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), ##################################### # PopupGetFile # ##################################### -def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display popup with text entry field and browse button. Browse for file + + :param message: + :param default_path: + :param save_as: + :param file_types: + :param no_window: + :param size: + :param button_color: + :param background_color: + :param text_color: + :param icon: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ if no_window: root = tk.Tk() try: @@ -3445,7 +3482,7 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files browse_button = SaveAs(file_types=file_types) if save_as else FileBrowse(file_types=file_types) with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, - no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), browse_button], [Ok(), Cancel()]] @@ -3460,9 +3497,26 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files ##################################### # PopupGetText # ##################################### -def PopupGetText(message, default_text='', password_char='', size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def PopupGetText(message, default_text='', password_char='', size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display Popup with text entry field + :param message: + :param default_text: + :param password_char: + :param size: + :param button_color: + :param background_color: + :param text_color: + :param icon: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: Text entered or None if window was closed + """ with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, - background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], [InputText(default_text=default_text, size=size, password_char=password_char)], [Ok(), Cancel()]] @@ -3778,9 +3832,9 @@ def ObjToString(obj, extra=' '): # ----------------------------------- The mighty Popup! ------------------------------------------------------------ # -def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): """ - Popup = Display a message in a small window. Many options available + Popup - Display a popup box with as many parms as you wish to include :param args: :param button_color: :param background_color: @@ -3795,6 +3849,7 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt :param no_titlebar: :param grab_anywhere: :param keep_on_top: + :param location: :return: """ if not args: @@ -3806,7 +3861,7 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) as form: + with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) @@ -3837,7 +3892,7 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt elif button_type is POPUP_BUTTONS_CANCELLED: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) elif button_type is POPUP_BUTTONS_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('ERROR', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Error', size=(6, 1), button_color=button_color, focus=True, bind_return_key=True)) elif button_type is POPUP_BUTTONS_OK_CANCEL: form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), PopupButton('Cancel', size=(5, 1), button_color=button_color)) @@ -3865,27 +3920,82 @@ def MsgBox(*args): # --------------------------- PopupNoButtons --------------------------- -def PopupNoButtons(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def PopupNoButtons(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Show a Popup but without any buttons + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=POPUP_BUTTONS_NO_BUTTONS, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, - font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupNonBlocking --------------------------- -def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Show Popup box and immediately return (does not block) + :param args: + :param button_type: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, - font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) PopupNoWait = PopupNonBlocking # --------------------------- PopupNoTitlebar --------------------------- -def PopupNoTitlebar(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, grab_anywhere=True, keep_on_top=False): +def PopupNoTitlebar(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display a Popup without a titlebar. Enables grab anywhere so you can move it + :param args: + :param button_type: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, - font=font, no_titlebar=True, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) + font=font, no_titlebar=True, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) PopupNoFrame = PopupNoTitlebar PopupNoBorder = PopupNoTitlebar @@ -3893,38 +4003,142 @@ def PopupNoTitlebar(*args, button_type=POPUP_BUTTONS_OK, button_color=None, back # --------------------------- PopupAutoClose --------------------------- -def PopupAutoClose(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False): +def PopupAutoClose(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Popup that closes itself after some time period + :param args: + :param button_type: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ Popup(*args, button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, - font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) PopupTimed = PopupAutoClose # --------------------------- PopupError --------------------------- -def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, auto_close=False, auto_close_duration=None, - font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False): - Popup(*args, non_blocking=False, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Popup with colored button and 'Error' as button text + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(*args, button_type=POPUP_BUTTONS_ERROR, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupCancel --------------------------- -def PopupCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): - Popup(*args, button_type=POPUP_BUTTONS_CANCELLED, button_color=button_color, auto_close=auto_close, - auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +def PopupCancel(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display Popup with "cancelled" button text + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(*args, button_type=POPUP_BUTTONS_CANCELLED, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupOK --------------------------- -def PopupOK(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): - Popup(*args, button_type=POPUP_BUTTONS_OK, button_color=button_color, auto_close=auto_close, - auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +def PopupOK(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display Popup with OK button only + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(*args, button_type=POPUP_BUTTONS_OK, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupOKCancel --------------------------- -def PopupOKCancel(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): - Popup(*args, button_type=POPUP_BUTTONS_OK_CANCEL, button_color=button_color, auto_close=auto_close, - auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +def PopupOKCancel(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display popup with OK and Cancel buttons + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: OK, Cancel or None + """ + return Popup(*args, button_type=POPUP_BUTTONS_OK_CANCEL, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupYesNo --------------------------- -def PopupYesNo(*args, button_color=None, auto_close=False, auto_close_duration=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False): - Popup(*args, button_type=POPUP_BUTTONS_YES_NO, button_color=button_color, auto_close=auto_close, - auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top) +def PopupYesNo(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display Popup with Yes and No buttons + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: Yes, No or None + """ + return Popup(*args, button_type=POPUP_BUTTONS_YES_NO, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) def main(): From 2414e90e1eeda55633e18cc74510925e99489cea Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 17 Sep 2018 21:59:11 -0400 Subject: [PATCH 392/521] New element! Frame - A frame with a label, Demo program from Frame, Graph elements --- Demo_Graph_Noise.py | 69 +++++++++++++++++++++++ Demo_Graph__Element.py | 24 +++++--- Demo_Machine_Learning.py | 49 +++++++++------- PySimpleGUI.py | 117 ++++++++++++++++++++++++++++++++++----- 4 files changed, 215 insertions(+), 44 deletions(-) create mode 100644 Demo_Graph_Noise.py diff --git a/Demo_Graph_Noise.py b/Demo_Graph_Noise.py new file mode 100644 index 000000000..da52464d9 --- /dev/null +++ b/Demo_Graph_Noise.py @@ -0,0 +1,69 @@ +import time +import random +import PySimpleGUI as sg + + +STEP_SIZE=1 +SAMPLES = 300 +SAMPLE_MAX = 300 +CANVAS_SIZE = (300,300) + + +def main(): + global g_exit, g_response_time + + with sg.FlexForm('Enter graph size') as form: + layout = [[sg.T('Enter width, height of graph')], + [sg.In(size=(6, 1)), sg.In(size=(6, 1))], + [sg.Ok(), sg.Cancel()]] + + b,v = form.LayoutAndRead(layout) + if b is None or b == 'Cancel': + exit(69) + w, h = int(v[0]), int(v[1]) + CANVAS_SIZE = (w,h) + + # start ping measurement thread + + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0,0)) + + layout = [ [sg.Quit( button_color=('white','black'))], + [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,SAMPLE_MAX),background_color='black', key='graph')],] + + form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) + form.Layout(layout) + + form.Finalize() + graph = form.FindElement('graph') + + prev_response_time = None + i=0 + prev_x, prev_y = 0, 0 + graph_value = 250 + while True: + # time.sleep(.2) + button, values = form.ReadNonBlocking() + if button == 'Quit' or values is None: + break + graph_offset = random.randint(-10, 10) + graph_value = graph_value + graph_offset + if graph_value > SAMPLE_MAX: + graph_value = SAMPLE_MAX + if graph_value < 0: + graph_value = 0 + new_x, new_y = i, graph_value + prev_value = graph_value + if i >= SAMPLES: + graph.Move(-STEP_SIZE,0) + prev_x = prev_x - STEP_SIZE + graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white') + # form.FindElement('graph').DrawPoint((new_x, new_y), color='red') + prev_x, prev_y = new_x, new_y + i += STEP_SIZE if i < SAMPLES else 0 + + + +if __name__ == '__main__': + main() + exit(69) \ No newline at end of file diff --git a/Demo_Graph__Element.py b/Demo_Graph__Element.py index 21f85b9ea..e9547e552 100644 --- a/Demo_Graph__Element.py +++ b/Demo_Graph__Element.py @@ -3,6 +3,10 @@ import time import PySimpleGUI as sg + +STEP_SIZE=1 +SAMPLES = 6000 + # globale used to communicate with thread.. yea yea... it's working fine g_exit = False g_response_time = None @@ -17,11 +21,14 @@ def main(): thread = Thread(target=ping_thread, args=(None,)) thread.start() + # sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0,0)) + layout = [ [sg.T('Ping times to Google.com', font='Any 18')], - [sg.Graph((300,300), (0,0), (100,500),background_color='white', key='graph')], + [sg.Graph((6000,200), (0,0), (SAMPLES,500),background_color='black', key='graph')], [sg.Quit()]] - form = sg.FlexForm('Canvas test', grab_anywhere=True) + form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black') form.Layout(layout) prev_response_time = None @@ -33,19 +40,18 @@ def main(): button, values = form.ReadNonBlocking() if button == 'Quit' or values is None: break - + graph = form.FindElement('graph') if g_response_time is None or prev_response_time == g_response_time: continue new_x, new_y = i, g_response_time[0] prev_response_time = g_response_time - form.FindElement('graph').DrawLine((prev_x, prev_y), (new_x, new_y), color='red') + if i >= SAMPLES: + graph.Move(-STEP_SIZE,0) + prev_x = prev_x - STEP_SIZE + graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white') # form.FindElement('graph').DrawPoint((new_x, new_y), color='red') prev_x, prev_y = new_x, new_y - if i >= 100: - i = 0 - prev_x = prev_y = last_x = last_y = 0 - form.FindElement('graph').Erase() - else: i += 4 + i += STEP_SIZE if i < SAMPLES else 0 # tell thread we're done. wait for thread to exit g_exit = True diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index 118de02e5..2ade40d5f 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -2,26 +2,35 @@ def MachineLearningGUI(): sg.SetOptions(text_justification='right') - form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form - - layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), - sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 15), justification='left')], - [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], - [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], - [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], - [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], - [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], - [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], - [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + + flags = [[sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))],] + + loss_functions = [[sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))],] + + command_line_parms = [[sg.Text('Passes', size=(8, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(8, 1), pad=((7,3))), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(8, 1)), sg.In(default_text='6', size=(8, 1)), sg.Text('nn', size=(8, 1)), + sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(8, 1)), sg.In(default_text='ff', size=(8, 1)), sg.Text('ngram', size=(8, 1)), + sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(8, 1)), sg.In(default_text='0.4', size=(8, 1)), sg.Text('Layers', size=(8, 1)), + sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)],] + + layout = [[sg.Frame('Command Line Parameteres', command_line_parms, text_color='green', font='Any 12')], + [sg.Frame('Flags', flags, font='Any 12', text_color='blue')], + [sg.Frame('Loss Functions', loss_functions, font='Any 12', text_color='red')], [sg.Submit(), sg.Cancel()]] + + + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) button, values = form.LayoutAndRead(layout) del(form) sg.SetOptions(text_justification='left') @@ -53,5 +62,5 @@ def CustomMeter(): form.CloseNonBlockingForm() if __name__ == '__main__': - CustomMeter() + # CustomMeter() MachineLearningGUI() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 107821f88..f9d26aa83 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -12,6 +12,23 @@ import calendar +g_time_start = 0 +g_time_end = 0 +g_time_delta = 0 + +import time +def TimerStart(): + global g_time_start + + g_time_start = time.time() + +def TimerStop(): + global g_time_delta, g_time_end + + g_time_end = time.time() + g_time_delta = g_time_end - g_time_start + print(g_time_delta) + # ----====----====----==== Constants the user CAN safely change ====----====----====----# DEFAULT_WINDOW_ICON = 'default_icon.ico' DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS @@ -84,6 +101,7 @@ DEFAULT_SLIDER_ORIENTATION = 'vertical' DEFAULT_SLIDER_BORDER_WIDTH=1 DEFAULT_SLIDER_RELIEF = tk.FLAT +DEFAULT_FRAME_RELIEF = tk.GROOVE DEFAULT_LISTBOX_SELECT_MODE = tk.SINGLE SELECT_MODE_MULTIPLE = tk.MULTIPLE @@ -223,6 +241,11 @@ def FindReturnKeyBoundButton(self, form): rc = self.FindReturnKeyBoundButton(element) if rc is not None: return rc + if element.Type == ELEM_TYPE_FRAME: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + return None def ReturnKeyHandler(self, event): @@ -1180,7 +1203,6 @@ def Move(self, x_direction, y_direction): zero_converted = self._convert_xy_to_canvas_xy(0,0) shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) - print(shift_amount) self._TKCanvas2.move('all', *shift_amount) @property @@ -1195,13 +1217,50 @@ def __del__(self): # Frame # # ---------------------------------------------------------------------- # class Frame(Element): - def __init__(self, frame=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, title, layout, text_color=None, background_color=None, relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, key=None): + + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + self.ParentForm = None + self.TKFrame = None + self.Title = title + self.Relief = relief self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR - self.TKFrame = frame - super().__init__(ELEM_TYPE_FRAME, background_color=background_color, scale=scale, size=size, pad=pad, key=key) + self.Layout(layout) + + super().__init__(ELEM_TYPE_FRAME, background_color=background_color, text_color=text_color, size=size, font=font, pad=pad, key=key) return + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + + def __del__(self): super().__del__() @@ -1264,7 +1323,7 @@ def __del__(self): # ---------------------------------------------------------------------- # -# TkScrollableFrame (Used by Column (SOON) # +# TkScrollableFrame (Used by Column) # # ---------------------------------------------------------------------- # class TkScrollableFrame(tk.Frame): def __init__(self, master, **kwargs): @@ -2132,9 +2191,18 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): BuildResultsForSubform(element, initialize_only, top_level_form) for item in element.ReturnValuesList: AddToReturnList(top_level_form, item) - # for key in element.ReturnValuesDictionary: - # top_level_form.ReturnValuesDictionary[key] = element.ReturnValuesDictionary[key] - # top_level_form.DictionaryKeyCounter += element.DictionaryKeyCounter + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + + if element.Type == ELEM_TYPE_FRAME: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) if element.UseDictionary: top_level_form.UseDictionary = True if element.ReturnValues[0] is not None: # if a button was clicked @@ -2200,7 +2268,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): # if an input type element, update the results if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and \ - element.Type!= ELEM_TYPE_COLUMN: + element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME: AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER and element.Target == (None,None)) or \ @@ -2240,6 +2308,13 @@ def FillSubformWithValues(form, values_dict): value = values_dict[element.Key] except: continue + if element.Type == ELEM_TYPE_FRAME: + FillSubformWithValues(element, values_dict) + try: + value = values_dict[element.Key] + except: + continue + if element.Type == ELEM_TYPE_INPUT_TEXT: element.Update(value) elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: @@ -2268,6 +2343,10 @@ def _FindElementFromKeyInSubForm(form, key): matching_elem = _FindElementFromKeyInSubForm(element, key) if matching_elem is not None: return matching_elem + if element.Type == ELEM_TYPE_FRAME: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem if element.Key == key: return element @@ -2366,6 +2445,7 @@ def CharWidthInPixels(): col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) + # ------------------------- TEXT element ------------------------- # elif element_type == ELEM_TYPE_TEXT: # auto_size_text = element.AutoSizeText @@ -2728,12 +2808,16 @@ def CharWidthInPixels(): toplevel_form.TKroot.configure(menu=element.TKMenu) # ------------------------- Frame element ------------------------- # elif element_type == ELEM_TYPE_FRAME: - width, height = element_size - if element.TKFrame is None: - element.TKFrame = tk.Frame(tk_row_frame, width=width, height=height, bd=border_depth) - if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKFrame.configure(background=element.BackgroundColor) - element.TKFrame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + labeled_frame = tk.LabelFrame(tk_row_frame, text=element.Title, relief=element.Relief) + PackFormIntoFrame(element, labeled_frame, toplevel_form) + labeled_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + labeled_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + labeled_frame.configure(foreground=element.TextColor) + if element.Font != None: + labeled_frame.configure(font=element.Font) + # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() @@ -2856,7 +2940,9 @@ def ConvertFlexToTK(MyFlexForm): move_string = '+%i+%i'%(int(x),int(y)) master.geometry(move_string) + master.update_idletasks() # don't forget + return @@ -2961,6 +3047,7 @@ def StartupTK(my_flex_form): # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) # root.bind('', MyFlexForm.DestroyedCallback()) ConvertFlexToTK(my_flex_form) + my_flex_form.SetIcon(my_flex_form.WindowIcon) try: From 54049efa7c3a0967e2a471cf3b903476e4afa46b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 18 Sep 2018 01:01:13 -0400 Subject: [PATCH 393/521] Frame Element - parameter to set the location Title should be shown, Fixed keypad demo. It had been overwritten! --- Demo_Keypad.py | 99 ++++++++++++++++++++++---------------------------- PySimpleGUI.py | 22 +++++++++-- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/Demo_Keypad.py b/Demo_Keypad.py index fe0363636..501e9d4b3 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -1,56 +1,43 @@ -from tkinter import * -from random import randint -import PySimpleGUI as g -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg -from matplotlib.figure import Figure -import matplotlib.backends.tkagg as tkagg -import tkinter as Tk - - -def main(): - fig = Figure() - - ax = fig.add_subplot(111) - ax.set_xlabel("X axis") - ax.set_ylabel("Y axis") - ax.grid() - - layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [g.Canvas(size=(640, 480), key='canvas')], - [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - - # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.ReadNonBlocking() - - canvas_elem = form.FindElement('canvas') - - graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) - canvas = canvas_elem.TKCanvas - - dpts = [randint(0, 10) for x in range(10000)] - for i in range(len(dpts)): - button, values = form.ReadNonBlocking() - if button is 'Exit' or values is None: - exit(69) - - ax.cla() - ax.grid() - - ax.plot(range(20), dpts[i:i + 20], color='purple') - graph.draw() - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - canvas.create_image(640 / 2, 480 / 2, image=photo) - - figure_canvas_agg = FigureCanvasAgg(fig) - figure_canvas_agg.draw() - - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - # time.sleep(.1) - -if __name__ == '__main__': - main() \ No newline at end of file +import PySimpleGUI as sg + +# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons + +# Demonstrates a number of PySimpleGUI features including: +# Default element size +# auto_size_buttons +# ReadFormButton +# Dictionary return values +# Update of elements in form (Text, Input) +# do_not_clear of Input elements + + +# create the 2 Elements we want to control outside the form + +layout = [[sg.Text('Enter Your Passcode')], + [sg.Input(size=(10, 1), do_not_clear=True, key='input')], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')], + [sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')], + [sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')], + [sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')], + [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], + ] + +form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False) +form.Layout(layout) + +# Loop forever reading the form's values, updating the Input field +keys_entered = '' +while True: + button, values = form.Read() # read the form + if button is None: # if the X button clicked, just exit + break + if button is 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button is 'Submit': + keys_entered = values['input'] + form.FindElement('out').Update(keys_entered) # output the final string + + form.FindElement('input').Update(keys_entered) # change the form to reflect current key string \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index f9d26aa83..219601e83 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -118,6 +118,14 @@ def TimerStop(): TABLE_SELECT_MODE_EXTENDED = tk.EXTENDED DEFAULT_TABLE_SECECT_MODE = TABLE_SELECT_MODE_EXTENDED +TITLE_LOCATION_TOP = tk.N +TITLE_LOCATION_BOTTOM = tk.S +TITLE_LOCATION_LEFT = tk.W +TITLE_LOCATION_RIGHT = tk.E +TITLE_LOCATION_TOP_LEFT = tk.NW +TITLE_LOCATION_TOP_RIGHT = tk.NE +TITLE_LOCATION_BOTTOM_LEFT = tk.SW +TITLE_LOCATION_BOTTOM_RIGHT = tk.SE # DEFAULT_METER_ORIENTATION = 'Vertical' @@ -1217,7 +1225,7 @@ def __del__(self): # Frame # # ---------------------------------------------------------------------- # class Frame(Element): - def __init__(self, title, layout, text_color=None, background_color=None, relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, key=None): + def __init__(self, title, layout, title_color=None, background_color=None, title_location=None , relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, border_width=None, key=None): self.UseDictionary = False self.ReturnValues = None @@ -1230,11 +1238,13 @@ def __init__(self, title, layout, text_color=None, background_color=None, relief self.TKFrame = None self.Title = title self.Relief = relief + self.TitleLocation = title_location + self.BorderWidth = border_width self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.Layout(layout) - super().__init__(ELEM_TYPE_FRAME, background_color=background_color, text_color=text_color, size=size, font=font, pad=pad, key=key) + super().__init__(ELEM_TYPE_FRAME, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key) return def AddRow(self, *args): @@ -2815,8 +2825,12 @@ def CharWidthInPixels(): labeled_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: labeled_frame.configure(foreground=element.TextColor) - if element.Font != None: - labeled_frame.configure(font=element.Font) + if font is not None: + labeled_frame.configure(font=font) + if element.TitleLocation is not None: + labeled_frame.configure(labelanchor=element.TitleLocation) + if element.BorderWidth is not None: + labeled_frame.configure(borderwidth=element.BorderWidth) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: From 9db96fd10f3c6a5bb441cc355941d1fd7c080f4b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 18 Sep 2018 11:10:17 -0400 Subject: [PATCH 394/521] New Drawing methods for Graph Element. Demo program on drawing on Graph Elements --- Demo_Graph_Drawing.py | 30 ++++++++++++++++++++++++++++++ PySimpleGUI.py | 26 +++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 Demo_Graph_Drawing.py diff --git a/Demo_Graph_Drawing.py b/Demo_Graph_Drawing.py new file mode 100644 index 000000000..fc4ca3c82 --- /dev/null +++ b/Demo_Graph_Drawing.py @@ -0,0 +1,30 @@ +import PySimpleGUI as sg + +layout = [ + [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], + [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] + ] + +form = sg.FlexForm('Canvas test') +form.Layout(layout) +form.Finalize() + +graph = form.FindElement('graph') +circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') +point = graph.DrawPoint((75,75), 10, color='green') +oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) +rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) + +while True: + button, values = form.Read() + if button is None: + break + if button is 'Blue': + graph.TKCanvas.itemconfig(circle, fill = "Blue") + elif button is 'Red': + graph.TKCanvas.itemconfig(circle, fill = "Red") + elif button is 'Move': + graph.MoveFigure(point, 10,10) + graph.MoveFigure(circle, 10,10) + graph.MoveFigure(oval, 10,10) + graph.MoveFigure(rectangle, 10,10) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 219601e83..03852e30b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1194,16 +1194,30 @@ def _convert_xy_to_canvas_xy(self, x_in, y_in): def DrawLine(self, point_from, point_to, color='black', width=1): converted_point_from = self._convert_xy_to_canvas_xy(*point_from) converted_point_to = self._convert_xy_to_canvas_xy(*point_to) - self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color) + return self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color) def DrawPoint(self, point, size=2, color='black'): converted_point = self._convert_xy_to_canvas_xy(*point) - self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) + return self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) + + def DrawCircle(self, center_location, radius, fill_color=None, line_color='black'): + converted_point = self._convert_xy_to_canvas_xy(*center_location) + return self._TKCanvas2.create_oval(converted_point[0]-radius, converted_point[1]-radius, converted_point[0]+radius, converted_point[1]+radius, fill=fill_color, outline=line_color) + + def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None): + converted_top_left = self._convert_xy_to_canvas_xy(*top_left) + converted_bottom_right = self._convert_xy_to_canvas_xy(*bottom_right) + return self._TKCanvas2.create_oval(*converted_top_left, *converted_bottom_right, fill=fill_color, outline=line_color) + + + def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None): + converted_top_left = self._convert_xy_to_canvas_xy(*top_left) + converted_bottom_right = self._convert_xy_to_canvas_xy(*bottom_right) + return self._TKCanvas2.create_rectangle(*converted_top_left, *converted_bottom_right, fill=fill_color, outline=line_color) def Erase(self): self._TKCanvas2.delete('all') - def Update(self, background_color): self._TKCanvas2.configure(background=background_color) @@ -1213,6 +1227,12 @@ def Move(self, x_direction, y_direction): shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) self._TKCanvas2.move('all', *shift_amount) + def MoveFigure(self, figure, x_direction, y_direction): + zero_converted = self._convert_xy_to_canvas_xy(0,0) + shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) + shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) + self._TKCanvas2.move(figure, *shift_amount) + @property def TKCanvas(self): return self._TKCanvas2 From 92bafa24f072b0d8494076c1b61ba59fb37c436b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 18 Sep 2018 12:05:44 -0400 Subject: [PATCH 395/521] RELEASE 3.4.0 --- Demo_All_Widgets.py | 9 ++++++--- Demo_Button_Click.py | 2 +- Demo_Button_States.py | 37 ++++++++++++++++++------------------ Demo_Canvas.py | 9 +++++---- Demo_Color.py | 1 - Demo_Desktop_Widget_Timer.py | 12 ------------ Demo_DuplicateFileFinder.py | 10 +++++----- Demo_Graph__Element.py | 15 +++++++++------ Demo_Machine_Learning.py | 6 +++--- Demo_Menus.py | 3 ++- Demo_PDF_Viewer.py | 4 ++-- Demo_Ping_Line_Graph.py | 5 ++++- Demo_Popups.py | 15 +++++---------- Demo_Progress_Meters.py | 23 ++++++++++++++++++++-- Demo_Script_Launcher.py | 1 - Demo_Table_Element.py | 10 +++++++--- docs/index.md | 8 ++++++-- readme.md | 8 ++++++-- 18 files changed, 101 insertions(+), 77 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index d4cee3c31..ca10c88d8 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -14,18 +14,21 @@ [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], + + [sg.Frame([ [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',text_color='red', relief=sg.RELIEF_RAISED)], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame([[ sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')], + sg.Column(column1, background_color='#F7F3EC')]],'Labelled Group', text_color='purple')], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), @@ -35,6 +38,6 @@ button, values = form.LayoutAndRead(layout) -sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) +sg.PopupAutoClose('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values, auto_close_duration=1) diff --git a/Demo_Button_Click.py b/Demo_Button_Click.py index 2a6b89ec9..4a4ba3063 100644 --- a/Demo_Button_Click.py +++ b/Demo_Button_Click.py @@ -15,7 +15,7 @@ form = sg.FlexForm("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1)) form.Layout(layout) -form.Finalize() +form.Finalize() # only needed if want to diable elements prior to showing form form.FindElement('submit').Update(disabled=True) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index fa5d5d9f7..0974fdecf 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -11,10 +11,10 @@ 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='start'), - sg.ReadFormButton('Stop', button_color=('gray34', 'black'), key='stop'), - sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3'), key='reset'), - sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4'), key='submit')] + [sg.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), + sg.ReadFormButton('Stop', button_color=('white', 'black'), disabled=True, key='Stop'), + sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3'), key='Reset'), + sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4'), key='Submit')] ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, @@ -23,30 +23,31 @@ recording = have_data = False while True: button, values = form.Read() + print(button) if button is None: exit(69) if button is 'Start': - form.FindElement('start').Update(button_color=('gray34','black')) - form.FindElement('stop').Update(button_color=('white', 'black')) - form.FindElement('reset').Update(button_color=('white', 'firebrick3')) + form.FindElement('Start').Update(disabled=True) + form.FindElement('Stop').Update(disabled=False) + form.FindElement('Reset').Update(disabled=False) recording = True elif button is 'Stop' and recording: - form.FindElement('stop').Update(button_color=('gray34','black')) - form.FindElement('start').Update(button_color=('white', 'black')) - form.FindElement('submit').Update(button_color=('white', 'springgreen4')) + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Start').Update(disabled=False) + form.FindElement('Submit').Update(disabled=False) recording = False have_data = True elif button is 'Reset': - form.FindElement('stop').Update(button_color=('gray34','black')) - form.FindElement('start').Update(button_color=('white', 'black')) - form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) - form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) + form.FindElement('Stop').Update(button_color=('gray34','black')) + form.FindElement('Start').Update(button_color=('white', 'black')) + form.FindElement('Submit').Update(button_color=('gray34', 'springgreen4')) + form.FindElement('Reset').Update(button_color=('gray34', 'firebrick3')) recording = False have_data = False elif button is 'Submit' and have_data: - form.FindElement('stop').Update(button_color=('gray34','black')) - form.FindElement('start').Update(button_color=('white', 'black')) - form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) - form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) + form.FindElement('Stop').Update(button_color=('gray34','black')) + form.FindElement('Start').Update(button_color=('white', 'black')) + form.FindElement('Submit').Update(button_color=('gray34', 'springgreen4')) + form.FindElement('Reset').Update(button_color=('gray34', 'firebrick3')) recording = False diff --git a/Demo_Canvas.py b/Demo_Canvas.py index a717c4a9d..05156c7ed 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -1,11 +1,12 @@ -import PySimpleGUI as gui +import PySimpleGUI as sg + layout = [ - [gui.Canvas(size=(100,100), background_color='red', key='canvas')], - [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] + [sg.Canvas(size=(150, 150), background_color='red', key='canvas')], + [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue')] ] -form = gui.FlexForm('Canvas test') +form = sg.FlexForm('Canvas test') form.Layout(layout) form.Finalize() diff --git a/Demo_Color.py b/Demo_Color.py index cfc22bee9..ba481a39c 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1662,7 +1662,6 @@ def show_all_colors_on_buttons(): (sg.RGB(0, 210, 87), sg.RGB(0, 74, 60)), (sg.RGB(0, 164, 73), sg.RGB(0, 74, 60)), (sg.RGB(0, 74, 60), sg.RGB(0, 74, 60)), - ] diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index c02219997..367e83f06 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -1,18 +1,6 @@ import PySimpleGUI as sg import time -""" - Timer Desktop Widget - Creates a floating timer that is always on top of other windows - You move it by grabbing anywhere on the window - Good example of how to do a non-blocking, polling program using PySimpleGUI - Can be used to poll hardware when running on a Pi - - NOTE - you will get a warning message printed when you exit using exit button. - It will look something like: - invalid command name "1616802625480StopMove" -""" - # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') sg.SetOptions(element_padding=(0, 0)) diff --git a/Demo_DuplicateFileFinder.py b/Demo_DuplicateFileFinder.py index 958e5f8f4..1725fb4f9 100644 --- a/Demo_DuplicateFileFinder.py +++ b/Demo_DuplicateFileFinder.py @@ -12,12 +12,12 @@ def FindDuplicatesFilesInFolder(path): small_count, dup_count, error_count = 0,0,0 pngdir = path if not os.path.exists(path): - sg.MsgBox('Duplicate Finder', '** Folder doesn\'t exist***', path) + sg.Popup('Duplicate Finder', '** Folder doesn\'t exist***', path) return pngfiles = os.listdir(pngdir) total_files = len(pngfiles) for idx, f in enumerate(pngfiles): - if not sg.EasyProgressMeter('Counting Duplicates', idx + 1, total_files, 'Counting Duplicate Files'): + if not sg.OneLineProgressMeter('Counting Duplicates', idx + 1, total_files, 'Counting Duplicate Files'): break total += 1 fname = os.path.join(pngdir, f) @@ -37,7 +37,7 @@ def FindDuplicatesFilesInFolder(path): shatab.append(f_sha) msg = '{} Files processed\n {} Duplicates found'.format(total_files, dup_count) - sg.MsgBox('Duplicate Finder Ended', msg) + sg.Popup('Duplicate Finder Ended', msg) # ====____====____==== Pseudo-MAIN program ====____====____==== # # This is our main-alike piece of code # @@ -48,9 +48,9 @@ def FindDuplicatesFilesInFolder(path): if __name__ == '__main__': source_folder = None - rc, source_folder = sg.GetPathBox('Duplicate Finder - Count number of duplicate files', 'Enter path to folder you wish to find duplicates in') + rc, source_folder = sg.PopupGetFolder('Duplicate Finder - Count number of duplicate files', 'Enter path to folder you wish to find duplicates in') if rc is True and source_folder is not None: FindDuplicatesFilesInFolder(source_folder) else: - sg.MsgBoxCancel('Cancelling', '*** Cancelling ***') + sg.PopupCancel('Cancelling', '*** Cancelling ***') exit(0) diff --git a/Demo_Graph__Element.py b/Demo_Graph__Element.py index e9547e552..174ce1fb2 100644 --- a/Demo_Graph__Element.py +++ b/Demo_Graph__Element.py @@ -6,6 +6,7 @@ STEP_SIZE=1 SAMPLES = 6000 +CANVAS_SIZE = (6000,500) # globale used to communicate with thread.. yea yea... it's working fine g_exit = False @@ -17,20 +18,23 @@ def ping_thread(args): def main(): global g_exit, g_response_time + # start ping measurement thread thread = Thread(target=ping_thread, args=(None,)) thread.start() - # sg.ChangeLookAndFeel('Black') + sg.ChangeLookAndFeel('Black') sg.SetOptions(element_padding=(0,0)) - layout = [ [sg.T('Ping times to Google.com', font='Any 18')], - [sg.Graph((6000,200), (0,0), (SAMPLES,500),background_color='black', key='graph')], - [sg.Quit()]] + layout = [ [sg.T('Ping times to Google.com', font='Any 12'), sg.Quit(pad=((100,0), 0), button_color=('white', 'black'))], + [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,500),background_color='black', key='graph')],] - form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black') + form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) form.Layout(layout) + form.Finalize() + graph = form.FindElement('graph') + prev_response_time = None i=0 prev_x, prev_y = 0, 0 @@ -40,7 +44,6 @@ def main(): button, values = form.ReadNonBlocking() if button == 'Quit' or values is None: break - graph = form.FindElement('graph') if g_response_time is None or prev_response_time == g_response_time: continue new_x, new_y = i, g_response_time[0] diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index 2ade40d5f..cc26952ff 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -24,9 +24,9 @@ def MachineLearningGUI(): [sg.Text('l', size=(8, 1)), sg.In(default_text='0.4', size=(8, 1)), sg.Text('Layers', size=(8, 1)), sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)],] - layout = [[sg.Frame('Command Line Parameteres', command_line_parms, text_color='green', font='Any 12')], - [sg.Frame('Flags', flags, font='Any 12', text_color='blue')], - [sg.Frame('Loss Functions', loss_functions, font='Any 12', text_color='red')], + layout = [[sg.Frame('Command Line Parameteres', command_line_parms, title_color='green', font='Any 12')], + [sg.Frame('Flags', flags, font='Any 12', title_color='blue')], + [sg.Frame('Loss Functions', loss_functions, font='Any 12', title_color='red')], [sg.Submit(), sg.Cancel()]] diff --git a/Demo_Menus.py b/Demo_Menus.py index 7b3c884f2..7c0df18d7 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -29,7 +29,8 @@ def TestMenus(): # ------ GUI Defintion ------ # layout = [ [sg.Menu(menu_def)], - [sg.Output(size=(60,20))] + [sg.Output(size=(60,20))], + [sg.In('Test', key='input', do_not_clear=True)] ] form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py index 6fd5fb424..32889695a 100644 --- a/Demo_PDF_Viewer.py +++ b/Demo_PDF_Viewer.py @@ -40,9 +40,9 @@ sg.ChangeLookAndFeel('GreenTan') if len(sys.argv) == 1: - rc, fname = sg.GetFileBox('PDF Browser', 'PDF file to open', file_types=(("PDF Files", "*.pdf"),)) + rc, fname = sg.PopupGetFile('PDF Browser', 'PDF file to open', file_types=(("PDF Files", "*.pdf"),)) if rc is False: - sg.MsgBoxCancel('Cancelling') + sg.PopupCancel('Cancelling') exit(0) else: fname = sys.argv[1] diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py index 36cd82672..1faa97540 100644 --- a/Demo_Ping_Line_Graph.py +++ b/Demo_Ping_Line_Graph.py @@ -61,7 +61,10 @@ def convert_xy_to_canvas_xy(x_in,y_in): if g_response_time is None or prev_response_time == g_response_time: continue - new_x, new_y = convert_xy_to_canvas_xy(i, g_response_time[0]) + try: + new_x, new_y = convert_xy_to_canvas_xy(i, g_response_time[0]) + except: continue + prev_response_time = g_response_time canvas.create_line(prev_x, prev_y, new_x, new_y, width=1, fill='black') prev_x, prev_y = new_x, new_y diff --git a/Demo_Popups.py b/Demo_Popups.py index f5692b9f7..f90a41057 100644 --- a/Demo_Popups.py +++ b/Demo_Popups.py @@ -1,17 +1,15 @@ import PySimpleGUI as sg +print (sg.PopupYesNo('Yes No')) - -print(sg.PopupGetFolder('Get text', background_color='blue', text_color='white')) -print(sg.PopupGetFile('Get text', background_color='blue', text_color='white')) -print(sg.PopupGetFolder('Get text', background_color='blue', text_color='white')) +print(sg.PopupGetText('Get text', background_color='blue', text_color='white', location=(1000,200))) +print(sg.PopupGetFile('Get file', background_color='blue', text_color='white')) +print(sg.PopupGetFolder('Get folder', background_color='blue', text_color='white')) sg.Popup('Simple popup') -sg.PopupNonBlocking('Non Blocking') -sg.PopupError('Error') -sg.PopupYesNo('Yes No') +sg.PopupNonBlocking('Non Blocking', location=(500,500)) sg.PopupNoTitlebar('No titlebar') sg.PopupNoBorder('No border') sg.PopupNoFrame('No frame') @@ -19,6 +17,3 @@ sg.PopupCancel('Cancel') sg.PopupOKCancel('OK Cancel') sg.PopupAutoClose('Autoclose') -print(sg.PopupGetText('Get text')) -print(sg.PopupGetFile('Get File')) -print(sg.PopupGetFolder('Get folder')) diff --git a/Demo_Progress_Meters.py b/Demo_Progress_Meters.py index 9b013e455..2b902fb79 100644 --- a/Demo_Progress_Meters.py +++ b/Demo_Progress_Meters.py @@ -2,7 +2,7 @@ import PySimpleGUI as sg """ - Demonstration of multiple OneLineProgressMeter's + Demonstration of simple and multiple OneLineProgressMeter's Shows how 2 progress meters can be running at the same time. Note -- If the user wants to cancel a meter, it's important to use the "Cancel" button, not the X @@ -10,7 +10,26 @@ calling OneLineProgresMeterCancel(key) will cancel the meter with the matching key """ -sg.ChangeLookAndFeel('Dark') +# sg.ChangeLookAndFeel('Dark') + + +""" + The simple case is that you want to add a single meter to your code. The one-line solution +""" + +import PySimpleGUI as sg + +# Display a progress meter in work loop. User is not allowed to break out of the loop +for i in range(10000): + if i % 5 == 0: sg.OneLineProgressMeter('My 1-line progress meter', i+1, 10000, 'single') + +# Display a progress meter. Allow user to break out of loop using cancel button +for i in range(10000): + if not sg.OneLineProgressMeter('My 1-line progress meter', i+1, 10000, 'single'): + break + + + layout = [ [sg.T('One-Line Progress Meter Demo', font=('Any 18'))], diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 9260ff2cc..5c72c8c1d 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -41,7 +41,6 @@ def Launcher2(): namesonly.append(ntpath.basename(file)) layout = [ - [sg.Text('Script output....', size=(40, 1))], [sg.Listbox(values=namesonly, size=(30, 19), select_mode=sg.SELECT_MODE_EXTENDED, key='demolist'), sg.Output(size=(88, 20), font='Courier 10')], [sg.Checkbox('Wait for program to complete', default=False, key='wait')], [sg.ReadFormButton('Run'), sg.ReadFormButton('Shortcut 1'), sg.ReadFormButton('Fav Program'), sg.SimpleButton('EXIT')], diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py index 19d21639e..7a72088d7 100644 --- a/Demo_Table_Element.py +++ b/Demo_Table_Element.py @@ -1,7 +1,8 @@ import csv import PySimpleGUI as sg -filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) +# filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) +filename = 'C:/Python/PycharmProjects/GooeyGUI/CSV/Gruen Movement Catalog V5.3 for Lucid less data 2017-08-30.csv' # --- populate table with file contents --- # data = [] if filename is not None: @@ -19,8 +20,11 @@ auto_size_columns=True, display_row_numbers=True, justification='right', size=(None, len(data)))]] layout = [[sg.Column(col_layout, size=(1200,600), scrollable=True)],] - form = sg.FlexForm('Table', grab_anywhere=False) -b, v = form.LayoutAndRead(layout) +form.Layout(layout) + +form.Finalize() + +b, v = form.Read() exit(69) diff --git a/docs/index.md b/docs/index.md index 053c45534..637949aa3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.3.0) + (Ver 3.4.0) @@ -107,6 +107,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Radio Buttons Listbox Slider + Graph + Frame with title Icons Multi-line Text Input Scroll-able Output @@ -2155,6 +2157,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. +{ 03,04.00 | New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. ### Release Notes @@ -2188,6 +2191,7 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall +3.4.0 New Elements - Frame (a labelled frame for grouping elements. Similar to Column), Graph (like a Canvas element except uses the caller's coordinate system rather than tkinter's). Set an initial_folder for browsing type buttons (browse for file/folder). Buttons return key value rather than button text if a key is specified, OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's the way progress works sometimes), changed ALL of the Popup calls to provide many more customization settings - changed PopupGetFolder, PopupGetFile, PopupGetText, Popup, PopupNoButtons, PopupNonBlocking, PopupNoTitlebar, PopupAutoClose, PopupCancel, PopupOK, PopupOKCancel, PopupYesNo ### Upcoming Make suggestions people! Future release features @@ -2263,7 +2267,7 @@ Here are the steps to run that application The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) diff --git a/readme.md b/readme.md index 053c45534..637949aa3 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.3.0) + (Ver 3.4.0) @@ -107,6 +107,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Radio Buttons Listbox Slider + Graph + Frame with title Icons Multi-line Text Input Scroll-able Output @@ -2155,6 +2157,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. +{ 03,04.00 | New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. ### Release Notes @@ -2188,6 +2191,7 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall +3.4.0 New Elements - Frame (a labelled frame for grouping elements. Similar to Column), Graph (like a Canvas element except uses the caller's coordinate system rather than tkinter's). Set an initial_folder for browsing type buttons (browse for file/folder). Buttons return key value rather than button text if a key is specified, OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's the way progress works sometimes), changed ALL of the Popup calls to provide many more customization settings - changed PopupGetFolder, PopupGetFile, PopupGetText, Popup, PopupNoButtons, PopupNonBlocking, PopupNoTitlebar, PopupAutoClose, PopupCancel, PopupOK, PopupOKCancel, PopupYesNo ### Upcoming Make suggestions people! Future release features @@ -2263,7 +2267,7 @@ Here are the steps to run that application The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) From fd0690c3cec993860082a1c6c593ee708cd0f489 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 18 Sep 2018 15:38:26 -0400 Subject: [PATCH 396/521] New Button method - GetText - returns current button text --- PySimpleGUI.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 03852e30b..17ac598f7 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1052,7 +1052,8 @@ def Update(self, value=None, text=None, button_color=(None, None), disabled=None elif disabled == False: self.TKButton['state'] = 'normal' - + def GetText(self): + return self.ButtonText def __del__(self): try: @@ -2141,12 +2142,21 @@ def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_butt def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +# ------------------------- NO BUTTON Element lazy function ------------------------- # +def Help(button_text='Help', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +Btn = ReadFormButton +ReadButton = ReadFormButton +FormButton = ReadFormButton + # ------------------------- Realtime BUTTON Element lazy function ------------------------- # def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) From 57f35a494b54097c446e93dac7b6eed308041608 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 18 Sep 2018 19:34:26 -0400 Subject: [PATCH 397/521] Option to turn off Menu tearoff --- PySimpleGUI.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 17ac598f7..a9d2c227b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1684,10 +1684,11 @@ def selection(self): # Canvas # # ---------------------------------------------------------------------- # class Menu(Element): - def __init__(self, menu_definition, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, menu_definition, background_color=None, scale=(None, None), size=(None, None), tearoff=True, pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.MenuDefinition = menu_definition self.TKMenu = None + self.Tearoff = tearoff super().__init__(ELEM_TYPE_MENUBAR, background_color=background_color, scale=scale, size=size, pad=pad, key=key) return @@ -1935,7 +1936,10 @@ def Fill(self, values_dict): def FindElement(self, key): - return _FindElementFromKeyInSubForm(self, key) + element = _FindElementFromKeyInSubForm(self, key) + if element is None: + print('*** WARNING = FindElement did not find the key. Please check your key\'s spelling ***') + return element def SaveToDisk(self, filename): @@ -2836,11 +2840,11 @@ def CharWidthInPixels(): menu_def = element.MenuDefinition - element.TKMenu = tk.Menu(toplevel_form.TKroot, tearoff=0) # create the menubar + element.TKMenu = tk.Menu(toplevel_form.TKroot, tearoff=element.Tearoff) # create the menubar menubar = element.TKMenu for menu_entry in menu_def: # print(f'Adding a Menubar ENTRY') - baritem = tk.Menu(menubar) + baritem = tk.Menu(menubar, tearoff=element.Tearoff) menubar.add_cascade(label=menu_entry[0], menu=baritem) if len(menu_entry) > 1: AddMenuItem(baritem, menu_entry[1], element) From e02ca3ba14e67df8a0f4ee62b72918381a40bd60 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 18 Sep 2018 22:48:04 -0400 Subject: [PATCH 398/521] RELEASE 3.4.1 --- PySimpleGUI.py | 2 -- docs/index.md | 50 ++++++++++++++++++++++++++++++++++++++++++-------- readme.md | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 84 insertions(+), 18 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index a9d2c227b..564db5633 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2157,9 +2157,7 @@ def SimpleButton(button_text, image_filename=None, image_size=(None, None), imag def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) -Btn = ReadFormButton ReadButton = ReadFormButton -FormButton = ReadFormButton # ------------------------- Realtime BUTTON Element lazy function ------------------------- # def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): diff --git a/docs/index.md b/docs/index.md index 637949aa3..618241d80 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.4.0) + (Ver 3.4.1) @@ -2157,7 +2157,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. -{ 03,04.00 | New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. +| 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. +| 03.04.01 | Sept 18, 2018 - See release notes below ### Release Notes @@ -2187,11 +2188,44 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. -3.2.0 Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. +#### 3.2.0 + Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. + +#### 3.3.0 +OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall + +#### 3.4.0 + +* Frame - New Element - a labelled frame for grouping elements. Similar + to Column +* Graph (like a Canvas element except uses the caller's + coordinate system rather than tkinter's). +* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). +* Buttons return key value rather than button text **If** a `key` is specified, +* + OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's + the way progress works sometimes) + * Popup - changed ALL of the Popup calls to provide many more customization settings + * Popup + * PopupGetFolder + * PopupGetFile + * PopupGetText + * Popup + * PopupNoButtons + * PopupNonBlocking + * PopupNoTitlebar + * PopupAutoClose + * PopupCancel + * PopupOK + * PopupOKCancel + * PopupYesNo + +#### 3.4.1 +* Button.GetText - Button class method. Returns the current text being shown on a button. +* Menu - Tearoff option. Determines if menus should allow them to be torn off +* Help - Shorcut button. Like Submit, cancel, etc +* ReadButton - shortcut for ReadFormButton -3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall - -3.4.0 New Elements - Frame (a labelled frame for grouping elements. Similar to Column), Graph (like a Canvas element except uses the caller's coordinate system rather than tkinter's). Set an initial_folder for browsing type buttons (browse for file/folder). Buttons return key value rather than button text if a key is specified, OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's the way progress works sometimes), changed ALL of the Popup calls to provide many more customization settings - changed PopupGetFolder, PopupGetFile, PopupGetText, Popup, PopupNoButtons, PopupNonBlocking, PopupNoTitlebar, PopupAutoClose, PopupCancel, PopupOK, PopupOKCancel, PopupYesNo ### Upcoming Make suggestions people! Future release features @@ -2264,10 +2298,10 @@ Here are the steps to run that application python -m howdoi howdoi.py To run it: Python HowDoI.py - + The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) diff --git a/readme.md b/readme.md index 637949aa3..618241d80 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ # PySimpleGUI - (Ver 3.4.0) + (Ver 3.4.1) @@ -2157,7 +2157,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. -{ 03,04.00 | New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. +| 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. +| 03.04.01 | Sept 18, 2018 - See release notes below ### Release Notes @@ -2187,11 +2188,44 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t 3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. -3.2.0 Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. +#### 3.2.0 + Biggest change was the addition of the Table Element. Trying to make changes so that form resizing is a possibility but unknown if will work in the long run. Removed all MsgBox, Get* functions and replaced with Popup functions. Popups had multiple new parameters added to change the look and feel of a popup. + +#### 3.3.0 +OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall + +#### 3.4.0 + +* Frame - New Element - a labelled frame for grouping elements. Similar + to Column +* Graph (like a Canvas element except uses the caller's + coordinate system rather than tkinter's). +* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). +* Buttons return key value rather than button text **If** a `key` is specified, +* + OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's + the way progress works sometimes) + * Popup - changed ALL of the Popup calls to provide many more customization settings + * Popup + * PopupGetFolder + * PopupGetFile + * PopupGetText + * Popup + * PopupNoButtons + * PopupNonBlocking + * PopupNoTitlebar + * PopupAutoClose + * PopupCancel + * PopupOK + * PopupOKCancel + * PopupYesNo + +#### 3.4.1 +* Button.GetText - Button class method. Returns the current text being shown on a button. +* Menu - Tearoff option. Determines if menus should allow them to be torn off +* Help - Shorcut button. Like Submit, cancel, etc +* ReadButton - shortcut for ReadFormButton -3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall - -3.4.0 New Elements - Frame (a labelled frame for grouping elements. Similar to Column), Graph (like a Canvas element except uses the caller's coordinate system rather than tkinter's). Set an initial_folder for browsing type buttons (browse for file/folder). Buttons return key value rather than button text if a key is specified, OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's the way progress works sometimes), changed ALL of the Popup calls to provide many more customization settings - changed PopupGetFolder, PopupGetFile, PopupGetText, Popup, PopupNoButtons, PopupNonBlocking, PopupNoTitlebar, PopupAutoClose, PopupCancel, PopupOK, PopupOKCancel, PopupYesNo ### Upcoming Make suggestions people! Future release features @@ -2264,10 +2298,10 @@ Here are the steps to run that application python -m howdoi howdoi.py To run it: Python HowDoI.py - + The pip command is all there is to the setup. -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) From 9b33a4cf87ff7a5c0325d2cc2ca364d9cbc9e88c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 09:36:17 -0400 Subject: [PATCH 399/521] Fix for Menu Tearoff, fixed Demo All Widgets --- Demo_All_Widgets.py | 8 ++++---- PySimpleGUI.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index ca10c88d8..4432c206a 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -15,20 +15,20 @@ [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], - [sg.Frame([ + [sg.Frame(layout=[ [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',text_color='red', relief=sg.RELIEF_RAISED)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_RAISED)], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame([[ + sg.Frame('Labelled Group',[[ sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]],'Labelled Group', text_color='purple')], + sg.Column(column1, background_color='#F7F3EC')]])], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 564db5633..bb07d5234 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2404,7 +2404,7 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) item = sub_menu_info[i] if i != len(sub_menu_info) - 1: if type(sub_menu_info[i+1]) == list: - new_menu = tk.Menu(top_menu) + new_menu = tk.Menu(top_menu, tearoff=element.Tearoff) top_menu.add_cascade(label=sub_menu_info[i], menu=new_menu) AddMenuItem(new_menu, sub_menu_info[i+1], element, is_sub_menu=True) i += 1 # skip the next one @@ -2898,12 +2898,12 @@ def CharWidthInPixels(): column_widths = {} for row in element.Values: for i,col in enumerate(row): - col_len = min(len(str(col)), element.MaxColumnWidth) + col_width = min(len(str(col)), element.MaxColumnWidth) try: - if col_len > column_widths[i]: - column_widths[i] = col_len + if col_width > column_widths[i]: + column_widths[i] = col_width except: - column_widths[i] = col_len + column_widths[i] = col_width if element.ColumnsToDisplay is None: displaycolumns = element.ColumnHeadings else: From 0ea0453d13fc4dfc9ffeb42fbf4c682ff9cdc1b5 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 10:36:48 -0400 Subject: [PATCH 400/521] New option relief for Text Element --- PySimpleGUI.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bb07d5234..00037253a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -712,7 +712,7 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None): + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None): ''' Text Element - Displays text in your form. Can be updated in non-blocking forms :param text: The text to display @@ -727,6 +727,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N self.DisplayText = text self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR self.Justification = justification + self.Relief = relief if background_color is None: bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: @@ -2524,6 +2525,8 @@ def CharWidthInPixels(): wraplen = 0 # print("wraplen, width, height", wraplen, width, height) tktext_label.configure(anchor=anchor, wraplen=wraplen) # set wrap to width of widget + if element.Relief is not None: + tktext_label.configure(relief=element.Relief) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: From 842545a2d426707d8e321046cf31d781c009a745 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 10:39:46 -0400 Subject: [PATCH 401/521] Uses button disabling now --- Demo_Button_States.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index 0974fdecf..e0198d82f 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -12,14 +12,18 @@ [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('Notes:', pad=((3,0),0)), sg.In(size=(44,1), background_color='white', text_color='black')], [sg.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), - sg.ReadFormButton('Stop', button_color=('white', 'black'), disabled=True, key='Stop'), - sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3'), key='Reset'), - sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4'), key='Submit')] + sg.ReadFormButton('Stop', button_color=('white', 'black'), key='Stop'), + sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1)) form.Layout(layout) +form.Finalize() +form.FindElement('Stop').Update(disabled=True) +form.FindElement('Reset').Update(disabled=True) +form.FindElement('Submit').Update(disabled=True) recording = have_data = False while True: button, values = form.Read() @@ -30,6 +34,7 @@ form.FindElement('Start').Update(disabled=True) form.FindElement('Stop').Update(disabled=False) form.FindElement('Reset').Update(disabled=False) + form.FindElement('Submit').Update(disabled=True) recording = True elif button is 'Stop' and recording: form.FindElement('Stop').Update(disabled=True) @@ -38,16 +43,16 @@ recording = False have_data = True elif button is 'Reset': - form.FindElement('Stop').Update(button_color=('gray34','black')) - form.FindElement('Start').Update(button_color=('white', 'black')) - form.FindElement('Submit').Update(button_color=('gray34', 'springgreen4')) - form.FindElement('Reset').Update(button_color=('gray34', 'firebrick3')) + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Start').Update(disabled=False) + form.FindElement('Submit').Update(disabled=True) + form.FindElement('Reset').Update(disabled=False) recording = False have_data = False elif button is 'Submit' and have_data: - form.FindElement('Stop').Update(button_color=('gray34','black')) - form.FindElement('Start').Update(button_color=('white', 'black')) - form.FindElement('Submit').Update(button_color=('gray34', 'springgreen4')) - form.FindElement('Reset').Update(button_color=('gray34', 'firebrick3')) + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Start').Update(disabled=False) + form.FindElement('Submit').Update(disabled=True) + form.FindElement('Reset').Update(disabled=False) recording = False From c8b394c5be5f5c747cf0396393b9dbb95af81a60 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 10:43:30 -0400 Subject: [PATCH 402/521] Demo the Text Element relief setting --- Demo_All_Widgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 4432c206a..6560d09e4 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -11,13 +11,13 @@ [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Frame(layout=[ [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_RAISED)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), From 52a4f619c48049ff337fde6218bb9c7b6bca8a0a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 10:46:28 -0400 Subject: [PATCH 403/521] Lined up options elements --- Demo_All_Widgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 6560d09e4..be3c6c926 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -16,8 +16,8 @@ [sg.InputText('This is my text')], [sg.Frame(layout=[ - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)], + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), From aa2e3b84e859bbe07c88ae802df7add76eec81fe Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 11:28:55 -0400 Subject: [PATCH 404/521] Fixed justification for Tables, listbox bind_return_key option, listbox double-click --- PySimpleGUI.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 00037253a..2b07075e1 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -452,7 +452,7 @@ def __del__(self): # Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, default_values=None, select_mode=None, change_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_values=None, select_mode=None, change_submits=False, bind_return_key=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): ''' Listbox Element :param values: @@ -466,6 +466,7 @@ def __init__(self, values, default_values=None, select_mode=None, change_submits self.DefaultValues = default_values self.TKListbox = None self.ChangeSubmits = change_submits + self.BindReturnKey = bind_return_key if select_mode == LISTBOX_SELECT_MODE_BROWSE: self.SelectMode = SELECT_MODE_BROWSE elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: @@ -479,6 +480,7 @@ def __init__(self, values, default_values=None, select_mode=None, change_submits bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad) def Update(self, values=None, disabled=None): @@ -2696,7 +2698,9 @@ def CharWidthInPixels(): element.TKListbox.pack(side=tk.LEFT) vsb.pack(side=tk.LEFT, fill='y') listbox_frame.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) - element.TKListbox.bind('', element.ReturnKeyHandler) + if element.BindReturnKey: + element.TKListbox.bind('', element.ReturnKeyHandler) + element.TKListbox.bind('', element.ReturnKeyHandler) # ------------------------- INPUT MULTI LINE element ------------------------- # elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText @@ -2896,8 +2900,12 @@ def CharWidthInPixels(): # ------------------------- TABLE element ------------------------- # elif element_type == ELEM_TYPE_TABLE: width, height = element_size - anchor = tk.W if element.Justification == 'left' else tk.E - + if element.Justification == 'left': + anchor = tk.W + elif element.Justification == 'right': + anchor = tk.E + else: + anchor = tk.CENTER column_widths = {} for row in element.Values: for i,col in enumerate(row): From 117216a75262719ed30b87af1103fdfc35637257 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 11:48:55 -0400 Subject: [PATCH 405/521] Multiline Element - new option autoscroll, Update option append --- PySimpleGUI.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 2b07075e1..73147b7a9 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -671,7 +671,7 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): + def __init__(self, default_text='', enter_submits = False, autoscroll=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): ''' Input Multi-line Element :param default_text: @@ -687,17 +687,21 @@ def __init__(self, default_text='', enter_submits = False, scale=(None, None), s self.Focus = focus self.do_not_clear = do_not_clear fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + self.Autoscroll = autoscroll super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) return - def Update(self, value=None, disabled=None): + def Update(self, value=None, disabled=None, append=False): if value is not None: try: - self.TKText.delete('1.0', tk.END) + if not append: + self.TKText.delete('1.0', tk.END) self.TKText.insert(1.0, value) except: pass self.DefaultText = value + if self.Autoscroll: + self.TKText.see(tk.END) if disabled == True: self.TKText.configure(state='disabled') elif disabled == False: From 47807741a096c09976c4fc950b3438fbaa8ddc75 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 13:02:29 -0400 Subject: [PATCH 406/521] Button Targets can be keys along with (row,col). --- PySimpleGUI.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 73147b7a9..bb46d2d90 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -959,9 +959,12 @@ def ButtonCallBack(self): if target == (None, None): strvar = self.TKStringVar else: - if target[0] < 0: - target = [self.Position[0] + target[0], target[1]] - target_element = self.ParentForm._GetElementAtLocation(target) + if len(target) == 2: + if target[0] < 0: + target = [self.Position[0] + target[0], target[1]] + target_element = self.ParentForm._GetElementAtLocation(target) + else: + target_element = self.ParentForm.FindElement(target) try: strvar = target_element.TKStringVar except: pass From cce87eb6b281e6d1a17448dc33a1f764083cc578 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 13:08:01 -0400 Subject: [PATCH 407/521] Updates for part of 3.4.1, acknowledgements for fantastic contributors --- docs/index.md | 24 +++++++++++------------- readme.md | 24 +++++++++++------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/docs/index.md b/docs/index.md index 618241d80..2841f1072 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,22 +2,17 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 - -![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) - -[![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) # PySimpleGUI - (Ver 3.4.1) - +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.4.1-blue.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) -[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) +[ReadTheDocs](http://pysimplegui.readthedocs.io/) [COOKBOOK!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) @@ -103,6 +98,7 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Close form Realtime Calendar chooser + Color chooser Checkboxes Radio Buttons Listbox @@ -1328,7 +1324,7 @@ An up/down spinner control. The valid values are passed in as a list. #### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse @@ -1340,7 +1336,7 @@ The Types of buttons include: * Color Chooser - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. @@ -2270,7 +2266,8 @@ MikeTheWatchGuy ## Demo Code Contributors -JorjMcKie - PDF and image viewers (plus a number of code suggestions) + [JorjMcKie](https://github.com/JorjMcKie) - PDF and image viewers (plus a number of code suggestions) +[Otherion](https://github.com/Otherion) - Table Demos Panda & CSV. Loads of suggestions to the core APIs ## License @@ -2278,12 +2275,13 @@ GNU Lesser General Public License (LGPL 3) + ## Acknowledgments -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. +* [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help ## How Do I @@ -2298,7 +2296,7 @@ Here are the steps to run that application python -m howdoi howdoi.py To run it: Python HowDoI.py - + The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. diff --git a/readme.md b/readme.md index 618241d80..2841f1072 100644 --- a/readme.md +++ b/readme.md @@ -2,22 +2,17 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) since Jul 11, 2018 - -![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) - -[![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) # PySimpleGUI - (Ver 3.4.1) - +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.4.1-blue.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) -[Formatted ReadTheDocs Version of this Readme](http://pysimplegui.readthedocs.io/) +[ReadTheDocs](http://pysimplegui.readthedocs.io/) [COOKBOOK!](https://pysimplegui.readthedocs.io/en/latest/cookbook/) @@ -103,6 +98,7 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Close form Realtime Calendar chooser + Color chooser Checkboxes Radio Buttons Listbox @@ -1328,7 +1324,7 @@ An up/down spinner control. The valid values are passed in as a list. #### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it but Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse @@ -1340,7 +1336,7 @@ The Types of buttons include: * Color Chooser - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is closed, returning the values to the caller. + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. @@ -2270,7 +2266,8 @@ MikeTheWatchGuy ## Demo Code Contributors -JorjMcKie - PDF and image viewers (plus a number of code suggestions) + [JorjMcKie](https://github.com/JorjMcKie) - PDF and image viewers (plus a number of code suggestions) +[Otherion](https://github.com/Otherion) - Table Demos Panda & CSV. Loads of suggestions to the core APIs ## License @@ -2278,12 +2275,13 @@ GNU Lesser General Public License (LGPL 3) + ## Acknowledgments -* Jorj McKie was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence * [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. +* [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help ## How Do I @@ -2298,7 +2296,7 @@ Here are the steps to run that application python -m howdoi howdoi.py To run it: Python HowDoI.py - + The pip command is all there is to the setup. The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. From a16879069726f51d6cabf8f7945effac2c6a6863 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 16:07:51 -0400 Subject: [PATCH 408/521] Clickable Text - new parameter for Text Element - click_submits --- PySimpleGUI.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bb46d2d90..bc0fed3b8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -256,6 +256,15 @@ def FindReturnKeyBoundButton(self, form): return None + def TextClickedHandler(self, event): + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.DisplayText + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def ReturnKeyHandler(self, event): MyForm = self.ParentForm button_element = self.FindReturnKeyBoundButton(MyForm) @@ -718,7 +727,7 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None): + def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, click_submits=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None): ''' Text Element - Displays text in your form. Can be updated in non-blocking forms :param text: The text to display @@ -734,6 +743,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR self.Justification = justification self.Relief = relief + self.ClickSubmits = click_submits if background_color is None: bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: @@ -2542,6 +2552,9 @@ def CharWidthInPixels(): tktext_label.configure(fg=element.TextColor) tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill='both', expand=True) element.TKText = tktext_label + if element.ClickSubmits: + tktext_label.bind('', element.TextClickedHandler) + # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: stringvar = tk.StringVar() From 81ea42a2b7816f1a94b4171668c89127d09b8dd0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 16:13:16 -0400 Subject: [PATCH 409/521] LayoutAndRead returns the form now!! Even more compact / lazy code --- PySimpleGUI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bc0fed3b8..ad1c0a62e 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1828,6 +1828,7 @@ def AddRows(self,rows): def Layout(self,rows): self.AddRows(rows) + return self def LayoutAndRead(self,rows, non_blocking=False): self.AddRows(rows) From f850785532e3153907513170c086314dd45c2cb8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 17:05:09 -0400 Subject: [PATCH 410/521] This crashes tkinter --- Mike_Cashes_Tkinter.py | 93 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Mike_Cashes_Tkinter.py diff --git a/Mike_Cashes_Tkinter.py b/Mike_Cashes_Tkinter.py new file mode 100644 index 000000000..4dc7e357a --- /dev/null +++ b/Mike_Cashes_Tkinter.py @@ -0,0 +1,93 @@ +import PySimpleGUI as sg +import psutil +import time +from threading import Thread +import operator + +""" + Crashes with this information: + Tcl_AsyncDelete: async handler deleted by the wrong thread + + Process finished with exit code -2147483645 +""" + +# globale used to communicate with thread.. yea yea... it's working fine +g_interval = 1 +g_cpu_percent = 0 +g_procs = None +g_exit = False + +def CPU_thread(args): + global g_interval, g_cpu_percent, g_procs, g_exit + + while not g_exit: + try: + g_cpu_percent = psutil.cpu_percent(interval=g_interval) + g_procs = psutil.process_iter() + except: + pass + + +def main(): + global g_interval, g_procs, g_exit + + sg.PopupOKCancel('My popup') + + # ---------------- Create Form ---------------- + sg.ChangeLookAndFeel('Black') + form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], + [sg.Text('', size=(30, 8), font=('Courier New', 12),text_color='white', justification='left', key='processes')], + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')],] + + form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) + form.Layout(form_rows) + # start cpu measurement thread + thread = Thread(target=CPU_thread,args=(None,)) + thread.start() + # ---------------- main loop ---------------- + while (True): + # --------- Read and update window -------- + button, values = form.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + g_interval = int(values['spin']) + except: + g_interval = 1 + + # cpu_percent = psutil.cpu_percent(interval=interval) # if don't wan to use a task + cpu_percent = g_cpu_percent + + # let the GUI run ever 700ms regardless of CPU polling time. makes window be more responsive + time.sleep(.7) + + display_string = '' + if g_procs: + # --------- Create list of top % CPU porocesses -------- + try: + top = {proc.name() : proc.cpu_percent() for proc in g_procs} + except: pass + + + top_sorted = sorted(top.items(), key=operator.itemgetter(1), reverse=True) + if top_sorted: + top_sorted.pop(0) + display_string = '' + for proc, cpu in top_sorted: + display_string += '{:2.2f} {}\n'.format(cpu/10, proc) + + + # --------- Display timer in window -------- + form.FindElement('text').Update('CPU {}'.format(cpu_percent)) + form.FindElement('processes').Update(display_string) + + # Broke out of main loop. Close the window. + form.CloseNonBlockingForm() + g_exit = True + thread.join() + exit(69) + +if __name__ == "__main__": + main() \ No newline at end of file From 5fbfed05f742ebe1d9c8b188f2574be13a11fe51 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 21:11:45 -0400 Subject: [PATCH 411/521] Fix for autosized columns. NEW Table Demos - CSV & Panda --- Demo_Table_CSV.py | 46 ++++++++++++++++++++++++++++++++++++++++++++ Demo_Table_Pandas.py | 34 +++++++++++++++----------------- PySimpleGUI.py | 3 ++- 3 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 Demo_Table_CSV.py diff --git a/Demo_Table_CSV.py b/Demo_Table_CSV.py new file mode 100644 index 000000000..16205381c --- /dev/null +++ b/Demo_Table_CSV.py @@ -0,0 +1,46 @@ +import csv +import PySimpleGUI as sg + +def table_example(): + filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) + # --- populate table with file contents --- # + if filename == '': + exit(69) + data = [] + header_list = [] + button = sg.PopupYesNo('Does this file have column names already?') + if filename is not None: + with open(filename, "r") as infile: + reader = csv.reader(infile) + if button == 'Yes': + header_list = next(reader) + try: + data = list(reader) # read everything else into a list of rows + if button == 'No': + header_list = ['column' + str(x) for x in range(len(data[0]))] + except: + sg.PopupError('Error reading file') + exit(69) + sg.SetOptions(element_padding=(0, 0)) + + col_layout = [[sg.Table(values=data, headings=header_list, max_col_width=25, + auto_size_columns=True, justification='right', size=(None, len(data)))]] + + canvas_size = (13*10*len(header_list), 600) # estimate canvas size - 13 pixels per char * 10 char per column * num columns + layout = [[sg.Column(col_layout, size=canvas_size, scrollable=True)],] + + form = sg.FlexForm('Table', grab_anywhere=False) + b, v = form.LayoutAndRead(layout) + + exit(69) + +table_example() + + + + + + + + + diff --git a/Demo_Table_Pandas.py b/Demo_Table_Pandas.py index 0c00e773c..f5088d53c 100644 --- a/Demo_Table_Pandas.py +++ b/Demo_Table_Pandas.py @@ -1,40 +1,38 @@ import pandas as pd import PySimpleGUI as sg -""" - - Display a CSV file using Table Element and Pandas - Thank you to for writing this demo - -""" - - def table_example(): + sg.SetOptions(auto_size_buttons=True) filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files", "*.csv"),)) # --- populate table with file contents --- # + if filename == '': + exit(69) data = [] header_list = [] + button = sg.PopupYesNo('Does this file have column names already?') if filename is not None: try: - df = pd.read_csv(filename, sep=',', engine='python') # read everything else into a list of rows - header_list = df.columns.tolist() - data = df.values.tolist() - # print(data) + df = pd.read_csv(filename, sep=',', engine='python', header=None) # Header=None means you directly pass the columns names to the dataframe + data = df.values.tolist() # read everything else into a list of rows + if button == 'Yes': # Press if you named your columns in the csv + header_list = df.iloc[0].tolist() # Uses the first row (which should be column names) as columns names + data = df[1:].values.tolist() # Drops the first row in the table (otherwise the header names and the first row will be the same) + elif button == 'No': # Press if you didn't name the columns in the csv + header_list = ['column' + str(x) for x in range(len(data[0]))] # Creates columns names for each column ('column0', 'column1', etc) except: sg.PopupError('Error reading file') exit(69) + # sg.SetOptions(element_padding=(0, 0)) - sg.SetOptions(element_padding=(0, 0)) - - col_layout = [[sg.Table(values=data, headings=header_list, max_col_width=20, - auto_size_columns=True, justification='right', size=(None, len(data)))]] + col_layout = [[sg.Table(values=data, headings=header_list, display_row_numbers=True, + auto_size_columns=False, size=(None, len(data)))]] - layout = [[sg.Column(col_layout, size=(1200, 600), scrollable=True)]] + canvas_size = (13*10*len(header_list), 600) # estimate canvas size - 13 pixels per char * 10 per column * num columns + layout = [[sg.Column(col_layout, size=canvas_size, scrollable=True)]] form = sg.FlexForm('Table', grab_anywhere=False) b, v = form.LayoutAndRead(layout) exit(69) - table_example() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ad1c0a62e..d116fc44b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2180,6 +2180,7 @@ def ReadFormButton(button_text, image_filename=None, image_size=(None, None),ima ReadButton = ReadFormButton + # ------------------------- Realtime BUTTON Element lazy function ------------------------- # def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) @@ -2956,7 +2957,7 @@ def CharWidthInPixels(): for i, heading in enumerate(element.ColumnHeadings): treeview.heading(heading, text=heading) if element.AutoSizeColumns: - width = column_widths[i] + width = max(column_widths[i], len(heading)) else: try: width = element.ColumnWidths[i] From 91a3178c7bb436d2b671a5efee3149ee0ab8a6cd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 10:03:17 -0400 Subject: [PATCH 412/521] Changed MsgBox to Popup, fix for when button target is key --- Demo_Compare_Files.py | 14 ++++++++------ PySimpleGUI.py | 6 ++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index 73cdf604e..b00fc5fbd 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -5,16 +5,18 @@ def GetFilesToCompare(): with sg.FlexForm('File Compare') as form: form_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(15, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Text('File 2', size=(15, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 1', size=(15, 1)), sg.InputText(key='file1'), sg.FileBrowse()], + [sg.Text('File 2', size=(15, 1)), sg.InputText(key='file2'), sg.FileBrowse(target='file2')], [sg.Submit(), sg.Cancel()]] button, values = form.LayoutAndRead(form_rows) return button, values def main(): - button, (f1, f2) = GetFilesToCompare() + button, values = GetFilesToCompare() + f1 = values['file1'] + f2 = values['file2'] if any((button != 'Submit', f1 =='', f2 == '')): - sg.MsgBoxError('Operation cancelled') + sg.PopupError('Operation cancelled') exit(69) with open(f1, 'rb') as file1: @@ -24,11 +26,11 @@ def main(): for i, x in enumerate(a): if x != b[i]: - sg.MsgBox('Compare results for files', f1, f2, '**** Mismatch at offset {} ****'.format(i)) + sg.Popup('Compare results for files', f1, f2, '**** Mismatch at offset {} ****'.format(i)) break else: if len(a) == len(b): - sg.MsgBox('**** The files are IDENTICAL ****') + sg.Popup('**** The files are IDENTICAL ****') if __name__ == '__main__': diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d116fc44b..5d9d7cd64 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -969,7 +969,7 @@ def ButtonCallBack(self): if target == (None, None): strvar = self.TKStringVar else: - if len(target) == 2: + if not isinstance(target, str): if target[0] < 0: target = [self.Position[0] + target[0], target[1]] target_element = self.ParentForm._GetElementAtLocation(target) @@ -2179,6 +2179,8 @@ def ReadFormButton(button_text, image_filename=None, image_size=(None, None),ima return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ReadButton = ReadFormButton +RButton = ReadFormButton +RFButton = ReadFormButton # ------------------------- Realtime BUTTON Element lazy function ------------------------- # @@ -2552,7 +2554,7 @@ def CharWidthInPixels(): tktext_label.configure(background=element.BackgroundColor) if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: tktext_label.configure(fg=element.TextColor) - tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill='both', expand=True) + tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], expand=True) element.TKText = tktext_label if element.ClickSubmits: tktext_label.bind('', element.TextClickedHandler) From 53db1545d8a54a219fbbbf8a5d1d7a48992dbff4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 10:41:47 -0400 Subject: [PATCH 413/521] Shuffled around parms in calls to Button so that Button can be called by user. Changed all MsgBox calls to Popup --- Demo_Color.py | 1 - Demo_Desktop_Widget_CPU_Graph.py | 73 ++++++++++++++++++++++++++ Demo_Desktop_Widget_CPU_Utilization.py | 2 + Demo_Desktop_Widget_Timer.py | 12 ++++- Demo_Dictionary.py | 2 +- Demo_ElementBrowser.py | 24 --------- Demo_Func_Callback_Simulation.py | 2 +- Demo_Graph_Element.py | 66 +++++++++++++++++++++++ Demo_HowDoI.py | 5 +- Demo_Keyboard.py | 9 ++-- Demo_MIDI_Player.py | 8 +-- Demo_Menus.py | 2 +- Demo_NonBlocking_Form.py | 2 +- Demo_Pi_LEDs.py | 2 +- Demo_Popups.py | 11 ++-- Demo_Recipes.py | 12 ++--- Demo_Tabbed_Form.py | 4 +- Demo_Table_Element.py | 3 +- PySimpleGUI.py | 58 ++++++++++---------- 19 files changed, 212 insertions(+), 86 deletions(-) create mode 100644 Demo_Desktop_Widget_CPU_Graph.py delete mode 100644 Demo_ElementBrowser.py create mode 100644 Demo_Graph_Element.py diff --git a/Demo_Color.py b/Demo_Color.py index ba481a39c..e826ce88a 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1707,7 +1707,6 @@ def main(): complementary_hex = get_complementary_hex(color_hex) complementary_color = get_name_from_hex(complementary_hex) - # g.MsgBox('Colors', 'The RBG value is', rgb, 'color and comp are', color_string, compl) layout = [[sg.Text('That color and it\'s compliment are shown on these buttons. This form auto-closes')], [sg.Button(button_text=color_name, button_color=(color_hex, complementary_hex))], [sg.Button(button_text=complementary_hex + ' ' + complementary_color, button_color=(complementary_hex , color_hex), size=(30, 1))], diff --git a/Demo_Desktop_Widget_CPU_Graph.py b/Demo_Desktop_Widget_CPU_Graph.py new file mode 100644 index 000000000..ddc6663ad --- /dev/null +++ b/Demo_Desktop_Widget_CPU_Graph.py @@ -0,0 +1,73 @@ +import time +import random +import psutil +from threading import Thread +import PySimpleGUI as sg + + +STEP_SIZE=3 +SAMPLES = 300 +SAMPLE_MAX = 500 +CANVAS_SIZE = (300,200) + + +g_interval = .25 +g_cpu_percent = 0 +g_procs = None +g_exit = False + +def CPU_thread(args): + global g_interval, g_cpu_percent, g_procs, g_exit + + while not g_exit: + try: + g_cpu_percent = psutil.cpu_percent(interval=g_interval) + g_procs = psutil.process_iter() + except: + pass + +def main(): + global g_exit, g_response_time + # start ping measurement thread + + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0,0)) + + layout = [ [sg.Quit( button_color=('white','black')), sg.T('', pad=((100,0),0), font='Any 15', key='output')], + [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,SAMPLE_MAX),background_color='black', key='graph')],] + + form = sg.FlexForm('CPU Graph', grab_anywhere=True, keep_on_top=True, background_color='black', no_titlebar=True, use_default_focus=False) + form.Layout(layout) + + graph = form.FindElement('graph') + output = form.FindElement('output') + # start cpu measurement thread + thread = Thread(target=CPU_thread,args=(None,)) + thread.start() + + last_cpu = i = 0 + prev_x, prev_y = 0, 0 + while True: # the Event Loop + time.sleep(.5) + button, values = form.ReadNonBlocking() + if button == 'Quit' or values is None: # always give ths user a way out + break + # do CPU measurement and graph it + current_cpu = int(g_cpu_percent*10) + if current_cpu == last_cpu: + continue + output.Update(current_cpu/10) # show current cpu usage at top + if current_cpu > SAMPLE_MAX: + current_cpu = SAMPLE_MAX + new_x, new_y = i, current_cpu + if i >= SAMPLES: + graph.Move(-STEP_SIZE,0) # shift graph over if full of data + prev_x = prev_x - STEP_SIZE + graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white') + prev_x, prev_y = new_x, new_y + i += STEP_SIZE if i < SAMPLES else 0 + last_cpu = current_cpu + +if __name__ == '__main__': + main() + exit(69) diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 691781019..da675f6cd 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -37,6 +37,8 @@ def CPU_thread(args): def main(): global g_interval, g_procs, g_exit + yesno = sg.PopupYesNo('My popup') + # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 367e83f06..b8ce0ae94 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -1,6 +1,12 @@ import PySimpleGUI as sg import time +""" + Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. + It will look something like: invalid command name \"1616802625480StopMove\" +""" + + # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') sg.SetOptions(element_padding=(0, 0)) @@ -8,8 +14,8 @@ form_rows = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), - sg.ReadFormButton('Reset', button_color=('white', '#007339')), - sg.Exit(button_color=('white', 'firebrick4'))]] + sg.ReadFormButton('Reset', button_color=('white', '#007339'), key='Reset'), + sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) form.Layout(form_rows) @@ -25,6 +31,8 @@ current_time = int(round(time.time() * 100)) - start_time else: button, values = form.Read() + if button == 'button': + button = form.FindElement(button).GetText() # --------- Do Button Operations -------- if values is None or button == 'Exit': break diff --git a/Demo_Dictionary.py b/Demo_Dictionary.py index 1b918b7bf..06d8c6e77 100644 --- a/Demo_Dictionary.py +++ b/Demo_Dictionary.py @@ -14,5 +14,5 @@ button, values = form.LayoutAndRead(layout) -sg.MsgBox(button, values, values['name'], values['address'], values['phone']) +sg.Popup(button, values, values['name'], values['address'], values['phone']) diff --git a/Demo_ElementBrowser.py b/Demo_ElementBrowser.py deleted file mode 100644 index b75d59fe6..000000000 --- a/Demo_ElementBrowser.py +++ /dev/null @@ -1,24 +0,0 @@ -import PySimpleGUI as sg - -def ShowMainForm(): - - listbox_values = ('Text', 'InputText', 'Checkbox', 'Radio Button', 'Listbox', 'Slider' ) - - column2 = [ [sg.Output(size=(50, 20))], - [sg.ReadFormButton('Show Element'), sg.SimpleButton('Exit')]] - - column1 = [[sg.Listbox(values=listbox_values, size=(20, len(listbox_values)), key='listbox')], - [sg.Text('', size=(10, 15))]] - - layout = [[sg.Column(column1) , sg.Column(column2)]] - - form = sg.FlexForm('Element Browser') - form.Layout(layout) - while True: - button, values = form.Read() - if button is None or button == 'Exit': - break - sg.MsgBox(button, values['listbox'][0]) - - -ShowMainForm() diff --git a/Demo_Func_Callback_Simulation.py b/Demo_Func_Callback_Simulation.py index 618ff94ea..198337c3c 100644 --- a/Demo_Func_Callback_Simulation.py +++ b/Demo_Func_Callback_Simulation.py @@ -33,4 +33,4 @@ def button2(): break # All done! -sg.MsgBoxOK('Done') +sg.PopupOK('Done') diff --git a/Demo_Graph_Element.py b/Demo_Graph_Element.py new file mode 100644 index 000000000..174ce1fb2 --- /dev/null +++ b/Demo_Graph_Element.py @@ -0,0 +1,66 @@ +import ping +from threading import Thread +import time +import PySimpleGUI as sg + + +STEP_SIZE=1 +SAMPLES = 6000 +CANVAS_SIZE = (6000,500) + +# globale used to communicate with thread.. yea yea... it's working fine +g_exit = False +g_response_time = None +def ping_thread(args): + global g_exit, g_response_time + while not g_exit: + g_response_time = ping.quiet_ping('google.com', timeout=1000) + +def main(): + global g_exit, g_response_time + + # start ping measurement thread + thread = Thread(target=ping_thread, args=(None,)) + thread.start() + + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0,0)) + + layout = [ [sg.T('Ping times to Google.com', font='Any 12'), sg.Quit(pad=((100,0), 0), button_color=('white', 'black'))], + [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,500),background_color='black', key='graph')],] + + form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) + form.Layout(layout) + + form.Finalize() + graph = form.FindElement('graph') + + prev_response_time = None + i=0 + prev_x, prev_y = 0, 0 + while True: + time.sleep(.2) + + button, values = form.ReadNonBlocking() + if button == 'Quit' or values is None: + break + if g_response_time is None or prev_response_time == g_response_time: + continue + new_x, new_y = i, g_response_time[0] + prev_response_time = g_response_time + if i >= SAMPLES: + graph.Move(-STEP_SIZE,0) + prev_x = prev_x - STEP_SIZE + graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white') + # form.FindElement('graph').DrawPoint((new_x, new_y), color='red') + prev_x, prev_y = new_x, new_y + i += STEP_SIZE if i < SAMPLES else 0 + + # tell thread we're done. wait for thread to exit + g_exit = True + thread.join() + + +if __name__ == '__main__': + main() + exit(69) \ No newline at end of file diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index ae1b251ce..83c7c6608 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -33,8 +33,9 @@ def HowDoI(): layout = [ [sg.Text('Ask and your answer will appear here....', size=(40, 1))], [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.T('Command History'), sg.T('', size=(40,3), text_color=sg.BLUES[0], key='history')], + [ sg.Spin(values=(1, 2, 3, 4), initial_value=1, size=(2, 1), key='Num Answers', font='Helvetica 15'), + sg.Text('Num Answers',font='Helvetica 15'), sg.Checkbox('Display Full Text', key='full text', font='Helvetica 15'), + sg.T('Command History', font='Helvetica 15'), sg.T('', size=(40,3), text_color=sg.BLUES[0], key='history')], [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.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index bde67fdbe..9bbde27dd 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -4,17 +4,16 @@ # If want to use the space bar, then be sure and disable the "default focus" with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], - [text_elem], - [sg.SimpleButton("OK")]] + [sg.Text("", size=(18,1), key='text')], + [sg.SimpleButton("OK", key='OK')]] form.Layout(layout) # ---===--- Loop taking in user input --- # while True: button, value = form.Read() - - if button == "OK" or (button is None and value is None): + text_elem = form.FindElement('text') + if button in ("OK", None): print(button, "exiting") break if len(button) == 1: diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py index dbaabc0c1..3e4e50083 100644 --- a/Demo_MIDI_Player.py +++ b/Demo_MIDI_Player.py @@ -120,12 +120,12 @@ def GetCurrentTime(): button, values = pback.PlayerChooseSongGUI() if button != 'PLAY': - g.MsgBoxCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) + g.PopupCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) exit(69) if values['device']: midi_port = values['device'][0] else: - g.MsgBoxCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) + g.PopupCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) batch_folder = values['folder'] midi_filename = values['midifile'] @@ -138,7 +138,7 @@ def GetCurrentTime(): filelist = [midi_filename,] filetitles = [os.path.basename(midi_filename),] else: - g.MsgBoxError('*** Error - No MIDI files specified ***') + g.PopupError('*** Error - No MIDI files specified ***') exit(666) # ------ LOOP THROUGH MULTIPLE FILES --------------------------------------------------------- # @@ -162,7 +162,7 @@ def GetCurrentTime(): mid = mido.MidiFile(filename=midi_filename) except: print('****** Exception trying to play MidiFile filename = {}***************'.format(midi_filename)) - g.MsgBoxError('Exception trying to play MIDI file:', midi_filename, 'Skipping file') + g.PopupError('Exception trying to play MIDI file:', midi_filename, 'Skipping file') continue # Build list of data contained in MIDI File using only track 0 diff --git a/Demo_Menus.py b/Demo_Menus.py index 7c0df18d7..8462881f6 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -28,7 +28,7 @@ def TestMenus(): # ------ GUI Defintion ------ # layout = [ - [sg.Menu(menu_def)], + [sg.Menu(menu_def, tearoff=True)], [sg.Output(size=(60,20))], [sg.In('Test', key='input', do_not_clear=True)] ] diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 09071a6b9..b08b85c24 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -100,7 +100,7 @@ def main(): RemoteControlExample() StatusOutputExample() StatusOutputExample() - sg.MsgBox('End of non-blocking demonstration') + sg.Popup('End of non-blocking demonstration') # StatusOutputExample_context_manager() diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py index ec89ab118..6ec26c5e1 100644 --- a/Demo_Pi_LEDs.py +++ b/Demo_Pi_LEDs.py @@ -51,4 +51,4 @@ def FlashLED(): FlashLED() form.FindElement('output').Update('') -rg.MsgBox('Done... exiting') +rg.Popup('Done... exiting') diff --git a/Demo_Popups.py b/Demo_Popups.py index f90a41057..e5315ad11 100644 --- a/Demo_Popups.py +++ b/Demo_Popups.py @@ -1,10 +1,13 @@ import PySimpleGUI as sg +# Here, have some windows on me.... +[sg.PopupNoWait(location=(10*x,0)) for x in range(10)] + print (sg.PopupYesNo('Yes No')) -print(sg.PopupGetText('Get text', background_color='blue', text_color='white', location=(1000,200))) -print(sg.PopupGetFile('Get file', background_color='blue', text_color='white')) -print(sg.PopupGetFolder('Get folder', background_color='blue', text_color='white')) +print(sg.PopupGetText('Get text', location=(1000,200))) +print(sg.PopupGetFile('Get file')) +print(sg.PopupGetFolder('Get folder')) sg.Popup('Simple popup') @@ -13,7 +16,7 @@ sg.PopupNoTitlebar('No titlebar') sg.PopupNoBorder('No border') sg.PopupNoFrame('No frame') -sg.PopupNoButtons('No Buttons') +# sg.PopupNoButtons('No Buttons') # don't mix with non-blocking... disaster ahead... sg.PopupCancel('Cancel') sg.PopupOKCancel('OK Cancel') sg.PopupAutoClose('Autoclose') diff --git a/Demo_Recipes.py b/Demo_Recipes.py index 972a199ae..585fd1337 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -12,9 +12,9 @@ def SourceDestFolders(): button, values = form.LayoutAndRead(form_rows) if button is 'Submit': - sg.MsgBox('Submitted', values, 'The user entered source:', values['source'], 'Destination folder:', values['dest'], 'Using button', button) + sg.Popup('Submitted', values, 'The user entered source:', values['source'], 'Destination folder:', values['dest'], 'Using button', button) else: - sg.MsgBoxError('Cancelled', 'User Cancelled') + sg.PopupError('Cancelled', 'User Cancelled') def MachineLearningGUI(): @@ -75,7 +75,7 @@ def Everything(): button, values = form.LayoutAndRead(layout) - sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) # Should you decide not to use a context manager, then try this form as your starting point # Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if @@ -107,7 +107,7 @@ def Everything_NoContextManager(): button, values = form.LayoutAndRead(layout) del(form) - sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) + sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) def ProgressMeter(): @@ -209,7 +209,7 @@ def OneLineGUI(): def main(): # button, (filename,) = OneLineGUI() # DebugTe`st() - sg.MsgBox('Hello') + sg.Popup('Hello') ChatBot() Everything() SourceDestFolders() @@ -230,7 +230,7 @@ def main(): Everything_NoContextManager() NonBlockingPeriodicUpdateForm_ContextManager() - sg.MsgBox('Done with all recipes') + sg.Popup('Done with all recipes') if __name__ == '__main__': main() diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index 3cde91cad..d63d1205a 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -73,7 +73,7 @@ def eBaySuperSearcherGUI(): layout_tab_2.append([sg.Text('Typical US Search String')]) layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) - layout_tab_2.append([sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) + layout_tab_2.append([sg.ReadButton('Submit', button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) @@ -84,4 +84,4 @@ def eBaySuperSearcherGUI(): # sg.SetOptions(background_color='white') results = eBaySuperSearcherGUI() print(results) - sg.MsgBox('Results', results) \ No newline at end of file + sg.Popup('Results', results) \ No newline at end of file diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py index 7a72088d7..85ddef33d 100644 --- a/Demo_Table_Element.py +++ b/Demo_Table_Element.py @@ -1,8 +1,7 @@ import csv import PySimpleGUI as sg -# filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) -filename = 'C:/Python/PycharmProjects/GooeyGUI/CSV/Gruen Movement Catalog V5.3 for Lucid less data 2017-08-30.csv' +filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) # --- populate table with file contents --- # data = [] if filename is not None: diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 5d9d7cd64..70d72be7e 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -901,7 +901,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), button_text='', file_types=(("ALL Files", "*.*"),), initial_folder=None, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), file_types=(("ALL Files", "*.*"),), initial_folder=None, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -933,7 +933,7 @@ def __init__(self, button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), butt self.BindReturnKey = bind_return_key self.Focus = focus self.TKCal = None - self.DefaultValue = None + self.DefaultValue = default_value self.InitialFolder = initial_folder super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) @@ -2108,75 +2108,75 @@ def __del__(self): # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(target=(ThisRow, -1), button_text='Browse', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FolderBrowse(button_text='Browse', target=(ThisRow, -1), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FOLDER, target=target, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types,initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FileBrowse( button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILE, target=target, file_types=file_types,initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- # -def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FilesBrowse(button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILES, target=target, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FileSaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE AS Element lazy function ------------------------- # -def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def SaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),),initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button( button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- OPEN BUTTON Element lazy function ------------------------- # def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- OK BUTTON Element lazy function ------------------------- # def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- YES BUTTON Element lazy function ------------------------- # def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Exit BUTTON Element lazy function ------------------------- # def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- YES BUTTON Element lazy function ------------------------- # def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- NO BUTTON Element lazy function ------------------------- # def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- NO BUTTON Element lazy function ------------------------- # def Help(button_text='Help', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button( button_text=button_text, button_type=BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width,scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ReadButton = ReadFormButton RButton = ReadFormButton @@ -2185,17 +2185,17 @@ def ReadFormButton(button_text, image_filename=None, image_size=(None, None),ima # ------------------------- Realtime BUTTON Element lazy function ------------------------- # def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button( button_text=button_text,button_type=BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Dummy BUTTON Element lazy function ------------------------- # def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text, button_type= BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width,scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Calendar Chooser Button lazy function ------------------------- # def CalendarButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text, button_type=BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Calendar Chooser Button lazy function ------------------------- # def ColorChooserButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(BUTTON_TYPE_COLOR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, button_text=button_text, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + return Button(button_text=button_text,button_type=BUTTON_TYPE_COLOR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ##################################### ----- RESULTS ------ ################################################## def AddToReturnDictionary(form, element, value): From 983716e24270e4626cbfedbe2e9b651d687fae37 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 19:30:13 -0400 Subject: [PATCH 414/521] NEW Featrure - Tooltips! Go crazy and tip everything! but most importantly, tip me! --- PySimpleGUI.py | 313 +++++++++++++++++++++++++++++++------------------ 1 file changed, 197 insertions(+), 116 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 70d72be7e..908e38596 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -44,6 +44,7 @@ def TimerStop(): DEFAULT_DEBUG_WINDOW_SIZE = (80,20) DEFAULT_WINDOW_LOCATION = (None,None) MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 +DEFAULT_TOOLTIP_TIME = 400 #################### COLOR STUFF #################### BLUES = ("#082567","#0A37A3","#00345B") PURPLES = ("#480656","#4F2398","#380474") @@ -128,6 +129,9 @@ def TimerStop(): TITLE_LOCATION_BOTTOM_RIGHT = tk.SE + + + # DEFAULT_METER_ORIENTATION = 'Vertical' # ----====----====----==== Constants the user should NOT f-with ====----====----====----# ThisRow = 555666777 # magic number @@ -207,6 +211,63 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) POPUP_BUTTONS_OK = 0 POPUP_BUTTONS_NO_BUTTONS = 5 + +# ------------------------------------------------------------------------- # +# ToolTip used by the Elements # +# ------------------------------------------------------------------------- # + +class ToolTip: + """ Create a tooltip for a given widget + + (inspired by https://stackoverflow.com/a/36221216) + """ + + def __init__(self, widget, text, timeout=1000): + self.widget = widget + self.text = text + self.timeout = timeout + #self.wraplength = wraplength if wraplength else widget.winfo_screenwidth() // 2 + self.tipwindow = None + self.id = None + self.x = self.y = 0 + self.widget.bind("", self.enter) + self.widget.bind("", self.leave) + self.widget.bind("", self.leave) + + def enter(self, event=None): + self.schedule() + + def leave(self, event=None): + self.unschedule() + self.hidetip() + + def schedule(self): + self.unschedule() + self.id = self.widget.after(self.timeout, self.showtip) + + def unschedule(self): + if self.id: + self.widget.after_cancel(self.id) + self.id = None + + def showtip(self): + if self.tipwindow: + return + x = self.widget.winfo_rootx() + 20 + y = self.widget.winfo_rooty() + self.widget.winfo_height() + 1 + self.tipwindow = tk.Toplevel(self.widget) + self.tipwindow.wm_overrideredirect(True) + self.tipwindow.wm_geometry("+%d+%d" % (x, y)) + label = ttk.Label(self.tipwindow, text=self.text, justify=tk.LEFT, + background="#ffffe0", relief=tk.SOLID, borderwidth=1) + label.pack() + + def hidetip(self): + if self.tipwindow: + self.tipwindow.destroy() + self.tipwindow = None + + # ---------------------------------------------------------------------- # # Cascading structure.... Objects get larger # # Button # @@ -218,11 +279,10 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) # Element CLASS # # ------------------------------------------------------------------------- # class Element(): - def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, type, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): self.Size = size self.Type = type self.AutoSizeText = auto_size_text - self.Scale = scale self.Pad = DEFAULT_ELEMENT_PADDING if pad is None else pad self.Font = font @@ -238,6 +298,8 @@ def __init__(self, type, scale=(None, None), size=(None, None), auto_size_text=N self.BackgroundColor = background_color if background_color is not None else DEFAULT_ELEMENT_BACKGROUND_COLOR self.TextColor = text_color if text_color is not None else DEFAULT_ELEMENT_TEXT_COLOR self.Key = key # dictionary key for return values + self.Tooltip = tooltip + self.TooltipObject = None def FindReturnKeyBoundButton(self, form): for row in form.Rows: @@ -310,12 +372,11 @@ def __del__(self): # Input Class # # ---------------------------------------------------------------------- # class InputText(Element): - def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto_size_text=None, password_char='', - justification=None, background_color=None, text_color=None, font=None, do_not_clear=False, key=None, focus=False, pad=None): + def __init__(self, default_text ='', size=(None, None), auto_size_text=None, password_char='', + justification=None, background_color=None, text_color=None, font=None, tooltip=None, do_not_clear=False, key=None, focus=False, pad=None): ''' Input a line of text Element :param default_text: Default value to display - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param password_char: If non-blank, will display this character for every character typed @@ -328,7 +389,7 @@ def __init__(self, default_text ='', scale=(None, None), size=(None, None), auto self.Focus = focus self.do_not_clear = do_not_clear self.Justification = justification - super().__init__(ELEM_TYPE_INPUT_TEXT, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, font=font) + super().__init__(ELEM_TYPE_INPUT_TEXT, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, font=font, tooltip=tooltip) def Update(self, value=None, disabled=None): @@ -357,11 +418,10 @@ def __del__(self): # Combo # # ---------------------------------------------------------------------- # class InputCombo(Element): - def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, change_submits=False, disabled=False, key=None, pad=None): + def __init__(self, values, default_value=None, size=(None, None), auto_size_text=None, background_color=None, text_color=None, change_submits=False, disabled=False, key=None, pad=None, tooltip=None): ''' Input Combo Box Element (also called Dropdown box) :param values: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex @@ -374,7 +434,7 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_COMBO, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_COMBO, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) def Update(self, value=None, values=None, disabled=None): if values is not None: @@ -412,11 +472,10 @@ def __del__(self): # Option Menu # # ---------------------------------------------------------------------- # class InputOptionMenu(Element): - def __init__(self, values, default_value=None, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_value=None, size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): ''' Input Combo Box Element (also called Dropdown box) :param values: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex @@ -427,7 +486,7 @@ def __init__(self, values, default_value=None, scale=(None, None), size=(None, N bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) def Update(self, value=None, values=None, disabled=None): if values is not None: @@ -461,13 +520,12 @@ def __del__(self): # Listbox # # ---------------------------------------------------------------------- # class Listbox(Element): - def __init__(self, values, default_values=None, select_mode=None, change_submits=False, bind_return_key=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, default_values=None, select_mode=None, change_submits=False, bind_return_key=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): ''' Listbox Element :param values: :param select_mode: SELECT_MODE_BROWSE, SELECT_MODE_EXTENDED, SELECT_MODE_MULTIPLE, SELECT_MODE_SINGLE :param font: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex ''' @@ -490,7 +548,7 @@ def __init__(self, values, default_values=None, select_mode=None, change_submits fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_LISTBOX, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) def Update(self, values=None, disabled=None): if disabled == True: @@ -529,13 +587,12 @@ def __del__(self): # Radio # # ---------------------------------------------------------------------- # class Radio(Element): - def __init__(self, text, group_id, default=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None, key=None, pad=None): + def __init__(self, text, group_id, default=False, size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None, key=None, pad=None, tooltip=None): ''' Radio Button Element :param text: :param group_id: :param default: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex @@ -548,7 +605,7 @@ def __init__(self, text, group_id, default=False, scale=(None, None), size=(None self.Value = None self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_RADIO, scale=scale , size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_RADIO, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad, tooltip=tooltip) def Update(self, value=None, disabled=None): location = EncodeRadioRowCol(self.Position[0], self.Position[1]) @@ -573,12 +630,11 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, text, default=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, text, default=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): ''' Check Box Element :param text: :param default: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex @@ -590,7 +646,8 @@ def __init__(self, text, default=False, scale=(None, None), size=(None, None), a self.TKCheckbutton = None self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_CHECKBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_CHECKBOX, size=size, auto_size_text=auto_size_text, font=font, + background_color=background_color, text_color=self.TextColor, key=key, pad=pad, tooltip=tooltip) def Get(self): return self.TKIntVar.get() @@ -624,12 +681,11 @@ def __del__(self): class Spin(Element): # Values = None # TKSpinBox = None - def __init__(self, values, initial_value=None, change_submits=False, scale=(None, None), size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, values, initial_value=None, change_submits=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): ''' Spin Box Element :param values: :param initial_value: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex @@ -642,7 +698,7 @@ def __init__(self, values, initial_value=None, change_submits=False, scale=(None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_INPUT_SPIN, scale, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_SPIN, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) return def Update(self, value=None, values=None, disabled=None): @@ -680,12 +736,11 @@ def __del__(self): # Multiline # # ---------------------------------------------------------------------- # class Multiline(Element): - def __init__(self, default_text='', enter_submits = False, autoscroll=False, scale=(None, None), size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None): + def __init__(self, default_text='', enter_submits = False, autoscroll=False, size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None, tooltip=None): ''' Input Multi-line Element :param default_text: :param enter_submits: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param background_color: Color for Element. Text or RGB Hex @@ -698,7 +753,7 @@ def __init__(self, default_text='', enter_submits = False, autoscroll=False, sca fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR self.Autoscroll = autoscroll - super().__init__(ELEM_TYPE_INPUT_MULTILINE, scale=scale, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_MULTILINE, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) return def Update(self, value=None, disabled=None, append=False): @@ -727,11 +782,10 @@ def __del__(self): # Text # # ---------------------------------------------------------------------- # class Text(Element): - def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, click_submits=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None): + def __init__(self, text, size=(None, None), auto_size_text=None, click_submits=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None, tooltip=None): ''' Text Element - Displays text in your form. Can be updated in non-blocking forms :param text: The text to display - :param scale: Scaling factor (w,h) (2,2)= 2 * Size :param size: Size of Element in Characters :param auto_size_text: True if the field should shrink to fit the text :param font: Font name and size ("name", size) @@ -748,7 +802,7 @@ def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=N bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR else: bg = background_color - super().__init__(ELEM_TYPE_TEXT, scale, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad, key=key) + super().__init__(ELEM_TYPE_TEXT, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad, key=key, tooltip=tooltip) return def Update(self, value = None, background_color=None, text_color=None, font=None): @@ -877,10 +931,9 @@ def __del__(self): # Routes stdout, stderr to a scrolled window # # ---------------------------------------------------------------------- # class Output(Element): - def __init__(self, scale=(None, None), size=(None, None), background_color=None, text_color=None, pad=None, font=None): + def __init__(self, size=(None, None), background_color=None, text_color=None, pad=None, font=None, tooltip=None): ''' Output Element - reroutes stdout, stderr to this window - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param background_color: Color for Element. Text or RGB Hex ''' @@ -888,7 +941,7 @@ def __init__(self, scale=(None, None), size=(None, None), background_color=None, bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_OUTPUT, scale=scale, size=size, background_color=bg, text_color=fg, pad=pad, font=font) + super().__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font, tooltip=tooltip) def __del__(self): try: @@ -901,7 +954,7 @@ def __del__(self): # Button Class # # ---------------------------------------------------------------------- # class Button(Element): - def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), file_types=(("ALL Files", "*.*"),), initial_folder=None, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), tooltip=None, file_types=(("ALL Files", "*.*"),), initial_folder=None, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): ''' Button Element - Specifies all types of buttons :param button_type: @@ -912,7 +965,6 @@ def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(N :param image_size: :param image_subsample: :param border_width: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_button: :param button_color: @@ -936,7 +988,7 @@ def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(N self.DefaultValue = default_value self.InitialFolder = initial_folder - super().__init__(ELEM_TYPE_BUTTON, scale=scale, size=size, font=font, pad=pad, key=key) + super().__init__(ELEM_TYPE_BUTTON, size=size, font=font, pad=pad, key=key, tooltip=tooltip) return # Realtime button release callback @@ -1082,16 +1134,16 @@ def __del__(self): pass super().__del__() + # ---------------------------------------------------------------------- # # ProgreessBar # # ---------------------------------------------------------------------- # class ProgressBar(Element): - def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None, key=None, pad=None): + def __init__(self, max_value, orientation=None, size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None, key=None, pad=None): ''' Progress Bar Element :param max_value: :param orientation: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters :param auto_size_text: True if should shrink field to fit the default text :param bar_color: @@ -1109,7 +1161,7 @@ def __init__(self, max_value, orientation=None, scale=(None, None), size=(None, self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF self.BarExpired = False - super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text, key=key, pad=pad) + super().__init__(ELEM_TYPE_PROGRESS_BAR, size=size, auto_size_text=auto_size_text, key=key, pad=pad) return # returns False if update failed @@ -1135,11 +1187,10 @@ def __del__(self): # Image # # ---------------------------------------------------------------------- # class Image(Element): - def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, filename=None, data=None, size=(None, None), pad=None, key=None, tooltip=None): ''' Image Element :param filename: - :param scale: Adds multiplier to size (w,h) :param size: Size of field in characters ''' self.Filename = filename @@ -1147,7 +1198,7 @@ def __init__(self, filename=None, data=None,scale=(None, None), size=(None, None self.tktext_label = None if data is None and filename is None: print('* Warning... no image specified in Image Element! *') - super().__init__(ELEM_TYPE_IMAGE, scale=scale, size=size, pad=pad, key=key) + super().__init__(ELEM_TYPE_IMAGE, size=size, pad=pad, key=key, tooltip=tooltip) return def Update(self, filename=None, data=None): @@ -1172,11 +1223,11 @@ def __del__(self): # Canvas # # ---------------------------------------------------------------------- # class Canvas(Element): - def __init__(self, canvas=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, canvas=None, background_color=None, size=(None, None), pad=None, key=None, tooltip=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self._TKCanvas = canvas - super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, scale=scale, size=size, pad=pad, key=key) + super().__init__(ELEM_TYPE_CANVAS, background_color=background_color, size=size, pad=pad, key=key, tooltip=tooltip) return @property @@ -1194,7 +1245,7 @@ def __del__(self): # Graph # # ---------------------------------------------------------------------- # class Graph(Element): - def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_color=None, scale=(None, None), pad=None, key=None): + def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_color=None, pad=None, key=None, tooltip=None): self.CanvasSize = canvas_size self.BottomLeft = graph_bottom_left @@ -1202,7 +1253,7 @@ def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_c self._TKCanvas = None self._TKCanvas2 = None - super().__init__(ELEM_TYPE_GRAPH, background_color=background_color, scale=scale, size=canvas_size, pad=pad, key=key) + super().__init__(ELEM_TYPE_GRAPH, background_color=background_color, size=canvas_size, pad=pad, key=key, tooltip=tooltip) return def _convert_xy_to_canvas_xy(self, x_in, y_in): @@ -1266,7 +1317,7 @@ def __del__(self): # Frame # # ---------------------------------------------------------------------- # class Frame(Element): - def __init__(self, title, layout, title_color=None, background_color=None, title_location=None , relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, border_width=None, key=None): + def __init__(self, title, layout, title_color=None, background_color=None, title_location=None , relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): self.UseDictionary = False self.ReturnValues = None @@ -1285,7 +1336,7 @@ def __init__(self, title, layout, title_color=None, background_color=None, title self.Layout(layout) - super().__init__(ELEM_TYPE_FRAME, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key) + super().__init__(ELEM_TYPE_FRAME, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key, tooltip=tooltip) return def AddRow(self, *args): @@ -1319,7 +1370,7 @@ def __del__(self): # Slider # # ---------------------------------------------------------------------- # class Slider(Element): - def __init__(self, range=(None,None), default_value=None, resolution=None, orientation=None, border_width=None, relief=None, change_submits=False, scale=(None, None), size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None): + def __init__(self, range=(None,None), default_value=None, resolution=None, orientation=None, border_width=None, relief=None, change_submits=False, size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): ''' Slider :param range: @@ -1346,7 +1397,7 @@ def __init__(self, range=(None,None), default_value=None, resolution=None, orien self.Resolution = 1 if resolution is None else resolution self.ChangeSubmits = change_submits - super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad) + super().__init__(ELEM_TYPE_INPUT_SLIDER, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad, tooltip=tooltip) return def Update(self, value=None, range=(None, None), disabled=None): @@ -1704,13 +1755,13 @@ def selection(self): # Canvas # # ---------------------------------------------------------------------- # class Menu(Element): - def __init__(self, menu_definition, background_color=None, scale=(None, None), size=(None, None), tearoff=True, pad=None, key=None): + def __init__(self, menu_definition, background_color=None, size=(None, None), tearoff=True, pad=None, key=None): self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR self.MenuDefinition = menu_definition self.TKMenu = None self.Tearoff = tearoff - super().__init__(ELEM_TYPE_MENUBAR, background_color=background_color, scale=scale, size=size, pad=pad, key=key) + super().__init__(ELEM_TYPE_MENUBAR, background_color=background_color, size=size, pad=pad, key=key) return def MenuItemChosenCallback(self, item_chosen): @@ -1728,7 +1779,7 @@ def __del__(self): # Table # # ---------------------------------------------------------------------- # class Table(Element): - def __init__(self, values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=20, select_mode=None, display_row_numbers=False, scrollable=None, font=None, justification='right', text_color=None, background_color=None, scale=(None, None), size=(None, None), pad=None, key=None): + def __init__(self, values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=20, select_mode=None, display_row_numbers=False, scrollable=None, font=None, justification='right', text_color=None, background_color=None, size=(None, None), pad=None, key=None, tooltip=None): self.Values = values self.ColumnHeadings = headings self.ColumnsToDisplay = visible_column_map @@ -1745,7 +1796,7 @@ def __init__(self, values, headings=None, visible_column_map=None, col_widths=No self.DisplayRowNumbers = display_row_numbers self.TKTreeview = None - super().__init__(ELEM_TYPE_TABLE, text_color=text_color, background_color=background_color, scale=scale, font=font, size=size, pad=pad, key=key) + super().__init__(ELEM_TYPE_TABLE, text_color=text_color, background_color=background_color, font=font, size=size, pad=pad, key=key, tooltip=tooltip) return @@ -1763,14 +1814,13 @@ class FlexForm: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=None, keep_on_top=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=None, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title self.Rows = [] # a list of ELEMENTS for this row self.DefaultElementSize = default_element_size self.DefaultButtonElementSize = default_button_element_size if default_button_element_size != (None, None) else DEFAULT_BUTTON_ELEMENT_SIZE - self.Scale = scale self.Location = location self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR self.BackgroundColor = background_color if background_color else DEFAULT_BACKGROUND_COLOR @@ -2108,75 +2158,75 @@ def __del__(self): # ------------------------- FOLDER BROWSE Element lazy function ------------------------- # -def FolderBrowse(button_text='Browse', target=(ThisRow, -1), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FOLDER, target=target, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FolderBrowse(button_text='Browse', target=(ThisRow, -1), initial_folder=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FOLDER, target=target, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileBrowse( button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILE, target=target, file_types=file_types,initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FileBrowse( button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILE, target=target, file_types=file_types,initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- # -def FilesBrowse(button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILES, target=target, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FilesBrowse(button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILES, target=target, file_types=file_types, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- FILE BROWSE Element lazy function ------------------------- # -def FileSaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def FileSaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, tooltip=None,size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE AS Element lazy function ------------------------- # -def SaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),),initial_folder=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) +def SaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),),initial_folder=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) # ------------------------- SAVE BUTTON Element lazy function ------------------------- # -def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Save(button_text='Save', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # -def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): - return Button( button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Submit(button_text='Submit', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None, focus=False, pad=None, key=None): + return Button( button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- OPEN BUTTON Element lazy function ------------------------- # -def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Open(button_text='Open', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- OK BUTTON Element lazy function ------------------------- # -def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def OK(button_text='OK', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None,focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Ok(button_text='Ok', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None,focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- CANCEL BUTTON Element lazy function ------------------------- # -def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Cancel(button_text='Cancel', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- QUIT BUTTON Element lazy function ------------------------- # -def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Quit(button_text='Quit', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Exit BUTTON Element lazy function ------------------------- # -def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Exit(button_text='Exit', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- YES BUTTON Element lazy function ------------------------- # -def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Yes(button_text='Yes', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=True, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def No(button_text='No', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- NO BUTTON Element lazy function ------------------------- # -def Help(button_text='Help', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def Help(button_text='Help', size=(None, None), auto_size_button=None, button_color=None,font=None,tooltip=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button( button_text=button_text, button_type=BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width,scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button( button_text=button_text, button_type=BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ReadButton = ReadFormButton RButton = ReadFormButton @@ -2184,18 +2234,18 @@ def ReadFormButton(button_text, image_filename=None, image_size=(None, None),ima # ------------------------- Realtime BUTTON Element lazy function ------------------------- # -def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button( button_text=button_text,button_type=BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button( button_text=button_text,button_type=BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Dummy BUTTON Element lazy function ------------------------- # -def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text, button_type= BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width,scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type= BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Calendar Chooser Button lazy function ------------------------- # -def CalendarButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text, button_type=BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def CalendarButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None,tooltip=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): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- Calendar Chooser Button lazy function ------------------------- # -def ColorChooserButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): - return Button(button_text=button_text,button_type=BUTTON_TYPE_COLOR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +def ColorChooserButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None,tooltip=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): + return Button(button_text=button_text,button_type=BUTTON_TYPE_COLOR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) ##################################### ----- RESULTS ------ ################################################## def AddToReturnDictionary(form, element, value): @@ -2484,11 +2534,6 @@ def CharWidthInPixels(): elif (element_size == (None, None) and element_type == ELEM_TYPE_BUTTON): element_size = toplevel_form.DefaultButtonElementSize else: auto_size_text = False # if user has specified a size then it shouldn't autosize - # Apply scaling... Element scaling is higher priority than form level - if element.Scale != (None, None): - element_size = (int(element_size[0] * element.Scale[0]), int(element_size[1] * element.Scale[1])) - elif toplevel_form.Scale != (None, None): - element_size = (int(element_size[0] * toplevel_form.Scale[0]), int(element_size[1] * toplevel_form.Scale[1])) # ------------------------- COLUMN element ------------------------- # if element_type == ELEM_TYPE_COLUMN: if element.Scrollable: @@ -2558,7 +2603,8 @@ def CharWidthInPixels(): element.TKText = tktext_label if element.ClickSubmits: tktext_label.bind('', element.TextClickedHandler) - + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKText, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- BUTTON element ------------------------- # elif element_type == ELEM_TYPE_BUTTON: stringvar = tk.StringVar() @@ -2612,6 +2658,8 @@ def CharWidthInPixels(): element.TKButton.bind('', element.ReturnKeyHandler) element.TKButton.focus_set() toplevel_form.TKroot.focus_force() + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKButton, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- INPUT (Single Line) element ------------------------- # elif element_type == ELEM_TYPE_INPUT_TEXT: default_text = element.DefaultText @@ -2634,6 +2682,8 @@ def CharWidthInPixels(): if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): focus_set = True element.TKEntry.focus_set() + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKEntry, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- COMBO BOX (Drop Down) element ------------------------- # elif element_type == ELEM_TYPE_INPUT_COMBO: max_line_len = max([len(str(l)) for l in element.Values]) @@ -2683,6 +2733,8 @@ def CharWidthInPixels(): element.TKCombo.current(0) if element.ChangeSubmits: element.TKCombo.bind('<>', element.ComboboxSelectHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKCombo, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- OPTION MENU (Like ComboBox but different) element ------------------------- # elif element_type == ELEM_TYPE_INPUT_OPTION_MENU: max_line_len = max([len(str(l)) for l in element.Values]) @@ -2699,6 +2751,8 @@ def CharWidthInPixels(): if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: element.TKOptionMenu.configure(fg=element.TextColor) element.TKOptionMenu.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKOptionMenu, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- LISTBOX element ------------------------- # elif element_type == ELEM_TYPE_INPUT_LISTBOX: max_line_len = max([len(str(l)) for l in element.Values]) @@ -2725,6 +2779,8 @@ def CharWidthInPixels(): if element.BindReturnKey: element.TKListbox.bind('', element.ReturnKeyHandler) element.TKListbox.bind('', element.ReturnKeyHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKListbox, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- INPUT MULTI LINE element ------------------------- # elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText @@ -2742,6 +2798,8 @@ def CharWidthInPixels(): element.TKText.focus_set() if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKText.configure(fg=text_color) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKText, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- INPUT CHECKBOX element ------------------------- # elif element_type == ELEM_TYPE_INPUT_CHECKBOX: width = 0 if auto_size_text else element_size[0] @@ -2757,6 +2815,8 @@ def CharWidthInPixels(): if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKCheckbutton.configure(fg=text_color) element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKCheckbutton, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- PROGRESS BAR element ------------------------- # elif element_type == ELEM_TYPE_PROGRESS_BAR: # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar @@ -2795,6 +2855,8 @@ def CharWidthInPixels(): if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKRadio.configure(fg=text_color) element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKRadio, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- INPUT SPIN Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SPIN: width, height = element_size @@ -2810,11 +2872,15 @@ def CharWidthInPixels(): element.TKSpinBox.configure(fg=text_color) if element.ChangeSubmits: element.TKSpinBox.bind('', element.SpinChangedHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKSpinBox, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font, pad=element.Pad) element.TKOut.pack(side=tk.LEFT, expand=True, fill='both') + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKOut, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: if element.Filename is not None: @@ -2837,6 +2903,8 @@ def CharWidthInPixels(): element.tktext_label.image = photo # tktext_label.configure(anchor=tk.NW, image=photo) element.tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.tktext_label, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- Canvas element ------------------------- # elif element_type == ELEM_TYPE_CANVAS: width, height = element_size @@ -2847,6 +2915,8 @@ def CharWidthInPixels(): if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element._TKCanvas.configure(background=element.BackgroundColor, highlightthickness=0) element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element._TKCanvas, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- Graph element ------------------------- # elif element_type == ELEM_TYPE_GRAPH: width, height = element_size @@ -2861,6 +2931,8 @@ def CharWidthInPixels(): element._TKCanvas2.configure(background=element.BackgroundColor, highlightthickness=0) element._TKCanvas.configure(background=element.BackgroundColor, highlightthickness=0) element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element._TKCanvas, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: menu_def = (('File', ('Open', 'Save')), @@ -2894,7 +2966,8 @@ def CharWidthInPixels(): labeled_frame.configure(labelanchor=element.TitleLocation) if element.BorderWidth is not None: labeled_frame.configure(borderwidth=element.BorderWidth) - + if element.Tooltip is not None: + element.TooltipObject = ToolTip(labeled_frame, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() @@ -2921,6 +2994,8 @@ def CharWidthInPixels(): tkscale.configure(fg=text_color) tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) element.TKScale = tkscale + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKScale, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- TABLE element ------------------------- # elif element_type == ELEM_TYPE_TABLE: width, height = element_size @@ -2975,6 +3050,8 @@ def CharWidthInPixels(): element.TKTreeview.configure(background=element.BackgroundColor) # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') element.TKTreeview.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKTreeview, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) @@ -3195,7 +3272,7 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None, grab_anywhere=True): +def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True): ''' Create and show a form on tbe caller's behalf. :param title: @@ -3204,14 +3281,13 @@ def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,No :param orientation: :param bar_color: :param size: - :param scale: :param Style: :param StyleOffset: :return: ProgressBar object that is in the form ''' local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width - bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, scale=scale, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) + bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) form = FlexForm(title, auto_size_text=True, grab_anywhere=grab_anywhere) # Form using a horizontal bar @@ -3313,7 +3389,7 @@ def ComputeProgressStats(self): # ============================== EasyProgressMeter =====# -def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None): +def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None): ''' A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call before your loop. You've got enough code to write! @@ -3324,7 +3400,6 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, :param orientation: :param bar_color: :param size: - :param scale: :param Style: :param StyleOffset: :return: False if should stop the meter @@ -3343,7 +3418,7 @@ def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, EasyProgressMeter.Data = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) EasyProgressMeter.Data.ComputeProgressStats() message = "\n".join([line for line in EasyProgressMeter.Data.StatMessages]) - EasyProgressMeter.Data.MeterID, EasyProgressMeter.Data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width) + EasyProgressMeter.Data.MeterID, EasyProgressMeter.Data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, button_color=button_color, border_width=local_border_width) EasyProgressMeter.Data.ParentForm = EasyProgressMeter.Data.MeterID.ParentForm return True # if exactly the same values as before, then ignore. @@ -3387,7 +3462,7 @@ def EasyProgressMeterCancel(title, *args): _one_line_progress_meters = {} # ============================== OneLineProgressMeter =====# -def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, scale=(None, None), border_width=None, grab_anywhere=True): +def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True): global _one_line_progress_meters @@ -3401,7 +3476,7 @@ def OneLineProgressMeter(title, current_value, max_value, key, *args, orientatio _one_line_progress_meters[key] = meter_data meter_data.ComputeProgressStats() message = "\n".join([line for line in meter_data.StatMessages]) - meter_data.MeterID, meter_data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, scale=scale, button_color=button_color, border_width=local_border_width, grab_anywhere=grab_anywhere) + meter_data.MeterID, meter_data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, button_color=button_color, border_width=local_border_width, grab_anywhere=grab_anywhere) meter_data.ParentForm = meter_data.MeterID.ParentForm return True @@ -3722,7 +3797,8 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None, text_justification=None, background_color=None, element_background_color=None, text_element_background_color=None, input_elements_background_color=None, input_text_color=None, - scrollbar_color=None, text_color=None, element_text_color = None, debug_win_size=(None,None), window_location=(None,None)): + scrollbar_color=None, text_color=None, element_text_color = None, debug_win_size=(None,None), window_location=(None,None), + tooltip_time=None): global DEFAULT_ELEMENT_SIZE global DEFAULT_BUTTON_ELEMENT_SIZE @@ -3754,6 +3830,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el global DEFAULT_WINDOW_LOCATION global DEFAULT_ELEMENT_TEXT_COLOR global DEFAULT_INPUT_TEXT_COLOR + global DEFAULT_TOOLTIP_TIME global _my_windows if icon: @@ -3853,6 +3930,10 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el if input_text_color is not None: DEFAULT_INPUT_TEXT_COLOR = input_text_color + + if tooltip_time is not None: + DEFAULT_TOOLTIP_TIME = tooltip_time + return True From 0c1860b006470b201153b845a14f86e6c417170c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 20:42:40 -0400 Subject: [PATCH 415/521] Fixed erroneous popup, New demo - simple cpu meter --- Demo_Desktop_Widget_CPU_Utilization.py | 2 -- Demo_Desktop_Widget_CPU_Utilization_Simple.py | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Demo_Desktop_Widget_CPU_Utilization_Simple.py diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index da675f6cd..691781019 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -37,8 +37,6 @@ def CPU_thread(args): def main(): global g_interval, g_procs, g_exit - yesno = sg.PopupYesNo('My popup') - # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], diff --git a/Demo_Desktop_Widget_CPU_Utilization_Simple.py b/Demo_Desktop_Widget_CPU_Utilization_Simple.py new file mode 100644 index 000000000..17583aab7 --- /dev/null +++ b/Demo_Desktop_Widget_CPU_Utilization_Simple.py @@ -0,0 +1,34 @@ +import PySimpleGUI as sg +import psutil + +# ---------------- Create Form ---------------- +sg.ChangeLookAndFeel('Black') +form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15, 0), 0)), + sg.Spin([x + 1 for x in range(10)], 1, key='spin')]] +# Layout the rows of the form and perform a read. Indicate the form is non-blocking! +form = sg.FlexForm('CPU Meter', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) +form.Layout(form_rows) + +# ---------------- main loop ---------------- +while (True): + # --------- Read and update window -------- + button, values = form.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + interval = int(values['spin']) + except: + interval = 1 + + cpu_percent = psutil.cpu_percent(interval=interval) + + # --------- Display timer in window -------- + + form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + +# Broke out of main loop. Close the window. +form.CloseNonBlockingForm() \ No newline at end of file From 87aef6928f79860d16ceb11e24d0954d6ed7a823 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 23:16:26 -0400 Subject: [PATCH 416/521] Multiline - fix for appending lines. --- PySimpleGUI.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 908e38596..7883a948c 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -761,7 +761,7 @@ def Update(self, value=None, disabled=None, append=False): try: if not append: self.TKText.delete('1.0', tk.END) - self.TKText.insert(1.0, value) + self.TKText.insert(tk.END, value) except: pass self.DefaultText = value if self.Autoscroll: @@ -993,13 +993,11 @@ def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(N # Realtime button release callback def ButtonReleaseCallBack(self, parm): - r, c = self.Position self.LastButtonClickedWasRealtime = False self.ParentForm.LastButtonClicked = None # Realtime button callback def ButtonPressCallBack(self, parm): - r, c = self.Position self.ParentForm.LastButtonClickedWasRealtime = True if self.Key is not None: self.ParentForm.LastButtonClicked = self.Key @@ -1009,6 +1007,7 @@ def ButtonPressCallBack(self, parm): # ------- Button Callback ------- # def ButtonCallBack(self): global _my_windows + # print(f'Parent = {self.ParentForm} Position = {self.Position}') # Buttons modify targets or return from the form # If modifying target, get the element object at the target and modify its StrVar target = self.Target @@ -1062,7 +1061,6 @@ def ButtonCallBack(self): elif self.BType == BUTTON_TYPE_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window # first, get the results table built # modify the Results table in the parent FlexForm object - r,c = self.Position if self.Key is not None: self.ParentForm.LastButtonClicked = self.Key else: From 2d5a3a8ff959fdf8317560bc8e2d4d06358f5f36 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 23:43:53 -0400 Subject: [PATCH 417/521] RELEASE 3.5.0 --- docs/index.md | 18 ++++++++++++++++-- readme.md | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2841f1072..af243158b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,7 +7,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.4.1-blue.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.0-red.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) @@ -2154,7 +2154,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. -| 03.04.01 | Sept 18, 2018 - See release notes below +| 03.04.01 | Sept 18, 2018 - See release notes +| 03.05.00 | Sept 20, 2018 - See release notes ### Release Notes @@ -2222,6 +2223,19 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Help - Shorcut button. Like Submit, cancel, etc * ReadButton - shortcut for ReadFormButton +#### 3.5.0 +* Tool Tips for all elements +* Clickable text +* Text Element relief setting +* Keys as targets for buttons +* New names for buttons: + * Button = SimpleButton + * RButton = ReadButton = ReadFormButton +* Double clickable list entries +* Auto sizing table widths works now +* Feature DELETED - Scaling. Removed from all elements + + ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index 2841f1072..af243158b 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.4.1-blue.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.0-red.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) @@ -2154,7 +2154,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. -| 03.04.01 | Sept 18, 2018 - See release notes below +| 03.04.01 | Sept 18, 2018 - See release notes +| 03.05.00 | Sept 20, 2018 - See release notes ### Release Notes @@ -2222,6 +2223,19 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Help - Shorcut button. Like Submit, cancel, etc * ReadButton - shortcut for ReadFormButton +#### 3.5.0 +* Tool Tips for all elements +* Clickable text +* Text Element relief setting +* Keys as targets for buttons +* New names for buttons: + * Button = SimpleButton + * RButton = ReadButton = ReadFormButton +* Double clickable list entries +* Auto sizing table widths works now +* Feature DELETED - Scaling. Removed from all elements + + ### Upcoming Make suggestions people! Future release features From af8fe3f9be6f1c99b0063fecd2e7e463e754f162 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 20 Sep 2018 23:44:47 -0400 Subject: [PATCH 418/521] Removed autoclose --- Demo_All_Widgets.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index be3c6c926..873a96ce0 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -3,18 +3,24 @@ sg.ChangeLookAndFeel('GreenTan') -form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) +# ------ Menu Definition ------ # +menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + +# ------ Column Definition ------ # column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] layout = [ + [sg.Menu(menu_def, tearoff=True)], [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], - [sg.Frame(layout=[ [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)], @@ -36,8 +42,14 @@ [sg.Submit(), sg.Cancel()] ] -button, values = form.LayoutAndRead(layout) -sg.PopupAutoClose('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values, auto_close_duration=1) +form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + +button, values = form.Read() + +sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) From 560dc0b8ca6306989eed02c4403647914ea25c7c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 00:18:28 -0400 Subject: [PATCH 419/521] Pong gif --- docs/index.md | 2 ++ readme.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/index.md b/docs/index.md index af243158b..e718ab5cd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -73,6 +73,8 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? diff --git a/readme.md b/readme.md index af243158b..e718ab5cd 100644 --- a/readme.md +++ b/readme.md @@ -73,6 +73,8 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? From 864e1ce08f9f92e39c0ba31131bcb411fbaaa85f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 00:43:16 -0400 Subject: [PATCH 420/521] Fixed up new function names, added new Sine Wave Recipe --- docs/cookbook.md | 220 ++++++++++++++++++++++++++--------------------- 1 file changed, 123 insertions(+), 97 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 13231b59f..d00e73b2c 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -80,7 +80,7 @@ Quickly add a GUI allowing the user to browse for a filename if a filename is no import sys if len(sys.argv) == 1: - button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], + button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.Text('Document to open')], [sg.In(), sg.FileBrowse()], [sg.Open(), sg.Cancel()]]) else: @@ -223,7 +223,7 @@ An async form that has a button read loop. A Text Element is updated periodical # create a text element that will be updated periodically form_rows = [[sg.Text('Stopwatch', size=(20, 2), justification='center')], [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], - [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] + [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] form.LayoutAndRead(form_rows, non_blocking=True) @@ -269,7 +269,7 @@ The architecture of some programs works better with button callbacks instead of form = sg.FlexForm('Button callback example') # Layout the design of the GUI layout = [[sg.Text('Please click a button')], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] + [sg.ReadButton('1'), sg.ReadButton('2'), sg.Quit()]] # Show the form to the user form.Layout(layout) @@ -282,7 +282,7 @@ The architecture of some programs works better with button callbacks instead of button1() elif button == '2': button2() - elif button =='Quit' or button is None: + elif button =='Quit' or button == None: break # All done! @@ -387,13 +387,13 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 # define layout of the rows layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], - [sg.ReadFormButton('Restart Song', button_color=(background, background), + [sg.ReadButton('Restart Song', button_color=(background, background), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=(background, background), + sg.ReadButton('Pause', button_color=(background, background), image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=(background, background), + sg.ReadButton('Next', button_color=(background, background), image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), @@ -429,7 +429,7 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 form.FindElement('output).Update(button) ---- ## Script Launcher - Persistent Form -This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadFormButton` instead of `sg.SimpleButton`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. +This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.SimpleButton`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. ![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) @@ -443,8 +443,8 @@ This form doesn't close after button clicks. To achieve this the buttons are sp layout = [ [sg.Text('Script output....', size=(40, 1))], [sg.Output(size=(88, 20))], - [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], - [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] + [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.SimpleButton('EXIT')], + [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] ] form.Layout(layout) @@ -622,7 +622,7 @@ This simple program keep a form open, taking input values until the user termina [sg.Txt('_' * 10)], [sg.In(size=(8,1), key='denominator')], [sg.Txt('', size=(8,1), key='output') ], - [sg.ReadFormButton('Calculate', bind_return_key=True)]] + [sg.ReadButton('Calculate', bind_return_key=True)]] form.Layout(layout) @@ -659,7 +659,7 @@ The Canvas Element is one of the few tkinter objects that are directly accessibl layout = [ [sg.Canvas(size=(100, 100), background_color='red', key= 'canvas')], - [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue')] + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] ] form = sg.FlexForm('Canvas test') @@ -673,9 +673,9 @@ The Canvas Element is one of the few tkinter objects that are directly accessibl button, values = form.Read() if button is None: break - if button is 'Blue': + if button == 'Blue': canvas.TKCanvas.itemconfig(cir, fill="Blue") - elif button is 'Red': + elif button == 'Red': canvas.TKCanvas.itemconfig(cir, fill="Red") @@ -685,7 +685,7 @@ This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the di There are a number of features used in this Recipe including: * Default Element Size * auto_size_buttons -* ReadFormButton +* ReadButton * Dictionary Return values * Update of Elements in form (Input, Text) * do_not_clear of Input Elements @@ -700,17 +700,17 @@ There are a number of features used in this Recipe including: # Demonstrates a number of PySimpleGUI features including: # Default element size # auto_size_buttons - # ReadFormButton + # ReadButton # Dictionary return values # Update of elements in form (Text, Input) # do_not_clear of Input elements layout = [[sg.Text('Enter Your Passcode')], [sg.Input(size=(10, 1), do_not_clear=True, justification='right', key='input')], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')], - [sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')], - [sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')], - [sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')], + [sg.ReadButton('1'), sg.ReadButton('2'), sg.ReadButton('3')], + [sg.ReadButton('4'), sg.ReadButton('5'), sg.ReadButton('6')], + [sg.ReadButton('7'), sg.ReadButton('8'), sg.ReadButton('9')], + [sg.ReadButton('Submit'), sg.ReadButton('0'), sg.ReadButton('Clear')], [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], ] @@ -723,12 +723,12 @@ There are a number of features used in this Recipe including: button, values = form.Read() # read the form if button is None: # if the X button clicked, just exit break - if button is 'Clear': # clear keys if clear button + if button == 'Clear': # clear keys if clear button keys_entered = '' elif button in '1234567890': keys_entered = values['input'] # get what's been entered so far keys_entered += button # add the new digit - elif button is 'Submit': + elif button == 'Submit': keys_entered = values['input'] form.FindElement('out').Update(keys_entered) # output the final string @@ -760,7 +760,7 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], [g.Canvas(size=(640, 480), key='canvas')], - [g.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') @@ -775,7 +775,7 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to dpts = [randint(0, 10) for x in range(10000)] for i in range(len(dpts)): button, values = form.ReadNonBlocking() - if button is 'Exit' or values is None: + if button == 'Exit' or values is None: exit(69) ax.cla() @@ -894,10 +894,10 @@ In other GUI frameworks this program would be most likely "event driven" with ca 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='start'), - sg.ReadFormButton('Stop', button_color=('gray34', 'black'), key='stop'), - sg.ReadFormButton('Reset', button_color=('gray', 'firebrick3'), key='reset'), - sg.ReadFormButton('Submit', button_color=('gray34', 'springgreen4'), key='submit')] + [sg.ReadButton('Start', button_color=('white', 'black'), key='start'), + sg.ReadButton('Stop', button_color=('gray34', 'black'), key='stop'), + sg.ReadButton('Reset', button_color=('gray', 'firebrick3'), key='reset'), + sg.ReadButton('Submit', button_color=('gray34', 'springgreen4'), key='submit')] ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, @@ -908,25 +908,25 @@ In other GUI frameworks this program would be most likely "event driven" with ca button, values = form.Read() if button is None: exit(69) - if button is 'Start': + if button == 'Start': form.FindElement('start').Update(button_color=('gray34','black')) form.FindElement('stop').Update(button_color=('white', 'black')) form.FindElement('reset').Update(button_color=('white', 'firebrick3')) recording = True - elif button is 'Stop' and recording: + elif button == 'Stop' and recording: form.FindElement('stop').Update(button_color=('gray34','black')) form.FindElement('start').Update(button_color=('white', 'black')) form.FindElement('submit').Update(button_color=('white', 'springgreen4')) recording = False have_data = True - elif button is 'Reset': + elif button == 'Reset': form.FindElement('stop').Update(button_color=('gray34','black')) form.FindElement('start').Update(button_color=('white', 'black')) form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) recording = False have_data = False - elif button is 'Submit' and have_data: + elif button == 'Submit' and have_data: form.FindElement('stop').Update(button_color=('gray34','black')) form.FindElement('start').Update(button_color=('white', 'black')) form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) @@ -1052,10 +1052,10 @@ You can easily change colors to match your background by changing a couple of pa sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), - sg.ReadFormButton('Run', button_color=('white', '#00168B')), - sg.ReadFormButton('Program 1'), - sg.ReadFormButton('Program 2'), - sg.ReadFormButton('Program 3', button_color=('white', '#35008B')), + sg.ReadButton('Run', button_color=('white', '#00168B')), + sg.ReadButton('Program 1'), + sg.ReadButton('Program 2'), + sg.ReadButton('Program 3', button_color=('white', '#35008B')), sg.SimpleButton('EXIT', button_color=('white','firebrick3'))], [sg.T('', text_color='white', size=(50,1), key='output')]] @@ -1066,13 +1066,13 @@ You can easily change colors to match your background by changing a couple of pa # ---===--- Loop taking in user input (buttons) --- # while True: (button, value) = form.Read() - if button is 'EXIT' or button is None: + if button == 'EXIT' or button is None: break # exit button clicked - if button is 'Program 1': + if button == 'Program 1': print('Run your program 1 here!') - elif button is 'Program 2': + elif button == 'Program 2': print('Run your program 2 here!') - elif button is 'Run': + elif button == 'Run': file = value['demofile'] print('Launching %s'%file) ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) @@ -1113,71 +1113,73 @@ Much of the code is handling the button states in a fancy way. It could be much ![timer](https://user-images.githubusercontent.com/13696193/45336349-26a31300-b551-11e8-8b06-d1232ff8ca10.jpg) - import PySimpleGUI as sg - import time - - """ - Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. - It will look something like: invalid command name "1616802625480StopMove"""" - - # ---------------- Create Form ---------------- - sg.ChangeLookAndFeel('Black') - sg.SetOptions(element_padding=(0,0)) - # Make a form, but don't use context manager - # Create the form layout - form_rows = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), sg.ReadFormButton('Reset', button_color=('white', '#007339')), sg.Exit(button_color=('white','firebrick4'))]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - form.Layout(form_rows) - # - # ---------------- main loop ---------------- - current_time = 0 - paused = False - start_time = int(round(time.time()*100)) - while (True): - # --------- Read and update window -------- - if not paused: - button, values = form.ReadNonBlocking() - current_time = int(round(time.time()*100)) - start_time - else: - button, values = form.Read() - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - if button is 'Reset': - start_time = int(round(time.time()*100)) - current_time = 0 - paused_time = start_time - elif button == 'Pause': - paused = True - paused_time = int(round(time.time()*100)) - element = form.FindElement('button') - element.Update(new_text='Run') - elif button == 'Run': - paused = False - start_time = start_time + int(round(time.time()*100)) - paused_time - element = form.FindElement('button') - element.Update(new_text='Pause') - - # --------- Display timer in window -------- - form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, - (current_time // 100) % 60, - current_time % 100)) - time.sleep(.01) + import PySimpleGUI as sg + import time + + """ + Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. It will look something like: invalid command name \"1616802625480StopMove\" + """ + + + # ---------------- Create Form ---------------- + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0, 0)) + + form_rows = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), + sg.ReadFormButton('Reset', button_color=('white', '#007339'), key='Reset'), + sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] + + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) + form.Layout(form_rows) + + # ---------------- main loop ---------------- + current_time = 0 + paused = False + start_time = int(round(time.time() * 100)) + while (True): + # --------- Read and update window -------- + if not paused: + button, values = form.ReadNonBlocking() + current_time = int(round(time.time() * 100)) - start_time + else: + button, values = form.Read() + if button == 'button': + button = form.FindElement(button).GetText() + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + if button is 'Reset': + start_time = int(round(time.time() * 100)) + current_time = 0 + paused_time = start_time + elif button == 'Pause': + paused = True + paused_time = int(round(time.time() * 100)) + element = form.FindElement('button') + element.Update(text='Run') + elif button == 'Run': + paused = False + start_time = start_time + int(round(time.time() * 100)) - paused_time + element = form.FindElement('button') + element.Update(text='Pause') + # --------- Display timer in window -------- + form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + (current_time // 100) % 60, + current_time % 100)) + time.sleep(.01) # --------- After loop -------- # Broke out of main loop. Close the window. form.CloseNonBlockingForm() - ## Desktop Floating Widget - CPU Utilization Like the Timer widget above, this script can be kept running. You will need the package psutil installed in order to run this Recipe. -The spinner changes the number of seconds between reads. +The spinner changes the number of seconds between reads. Note that you will get an error message printed when exiting because the window does not have have a titlebar. It's a known problem. ![cpu widget 2](https://user-images.githubusercontent.com/13696193/45456096-77348080-b6b7-11e8-8906-6663c31ad0eb.jpg) @@ -1222,7 +1224,7 @@ The spinner changes the number of seconds between reads. Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. -Menu's are defined separately from the GUI form. To add one to your form, simply insert sg.Menu(menu_layout). The meny definition is a list of menu choices and submenus. They are a list of lists. Copy the Recipe and play with it. You'll eventualy get when you're looking for. +Menu's are defined separately from the GUI form. To add one to your form, simply insert sg.Menu(menu_layout). The menu definition is a list of menu choices and submenus. They are a list of lists. Copy the Recipe and play with it. You'll eventually get when you're looking for. If you double click the dashed line at the top of the list of choices, that menu will tear off and become a floating toolbar. How cool! @@ -1253,7 +1255,7 @@ If you double click the dashed line at the top of the list of choices, that menu # ------ Loop & Process button menu choices ------ # while True: button, values = form.Read() - if button is None or button == 'Exit': + if button == None or button == 'Exit': return print('Button = ', button) # ------ Process menu choices ------ # @@ -1262,3 +1264,27 @@ If you double click the dashed line at the top of the list of choices, that menu elif button == 'Open': filename = sg.PopupGetFile('file to open', no_window=True) print(filename) + +## Graphing with Graph Element + +Use the Graph Element to draw points, lines, circles, rectangles using ***your*** coordinate systems rather than the underlying graphics coordinates. + +In this example we're defining our graph to be from -100, -100 to +100,+100. That means that zero is in the middle of the drawing. You define this graph description in your call to Graph. + +![graph element](https://user-images.githubusercontent.com/13696193/45860701-a8a3f080-bd36-11e8-9649-ada5890cdc14.jpg) + + + import math + import PySimpleGUI as sg + + layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] + + form = sg.FlexForm('Graph of Sine Function').Layout(layout) + form.Finalize() + graph = form.FindElement('graph') + + for x in range(-100,100): + y = math.sin(x/20)*50 + graph.DrawPoint((x,y)) + + button, values = form.Read() From d83d8b882648f5e0e72968717b2d80a2ed031f4d Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 00:45:21 -0400 Subject: [PATCH 421/521] New 10-line graph demo --- Demo_Graph_Element_Sine_Wave.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Demo_Graph_Element_Sine_Wave.py diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py new file mode 100644 index 000000000..112ee6a2b --- /dev/null +++ b/Demo_Graph_Element_Sine_Wave.py @@ -0,0 +1,14 @@ +import math +import PySimpleGUI as sg + +layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] + +form = sg.FlexForm('Graph of Sine Function').Layout(layout) +form.Finalize() +graph = form.FindElement('graph') + +for x in range(-100,100): + y = math.sin(x/20)*50 + graph.DrawPoint((x,y)) + +button, values = form.Read() From 6cfce5ee484a523f0b4c47ccbe55fdb29071a16f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 01:09:48 -0400 Subject: [PATCH 422/521] Draw Axis --- Demo_Graph_Element_Sine_Wave.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py index 112ee6a2b..0d4510672 100644 --- a/Demo_Graph_Element_Sine_Wave.py +++ b/Demo_Graph_Element_Sine_Wave.py @@ -7,8 +7,11 @@ form.Finalize() graph = form.FindElement('graph') +graph.DrawLine((-100,0), (100,0)) +graph.DrawLine((0,-100), (0,100)) + for x in range(-100,100): y = math.sin(x/20)*50 - graph.DrawPoint((x,y)) + graph.DrawPoint((x,y), color='red') button, values = form.Read() From e458235d5023848948db04401dbea951d2340a28 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 08:43:39 -0400 Subject: [PATCH 423/521] New button names - SimpleButton -> Button, ReadFormButton -> ReadButton --- docs/cookbook.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index d00e73b2c..4e7989c67 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -396,7 +396,7 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 sg.ReadButton('Next', button_color=(background, background), image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), + sg.Text(' ' * 2), sg.Button('Exit', button_color=(background, background), image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], [sg.Text('_' * 30)], @@ -429,7 +429,7 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 form.FindElement('output).Update(button) ---- ## Script Launcher - Persistent Form -This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.SimpleButton`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. +This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.Button`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. ![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) @@ -443,7 +443,7 @@ This form doesn't close after button clicks. To achieve this the buttons are sp layout = [ [sg.Text('Script output....', size=(40, 1))], [sg.Output(size=(88, 20))], - [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.SimpleButton('EXIT')], + [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] ] @@ -1056,7 +1056,7 @@ You can easily change colors to match your background by changing a couple of pa sg.ReadButton('Program 1'), sg.ReadButton('Program 2'), sg.ReadButton('Program 3', button_color=('white', '#35008B')), - sg.SimpleButton('EXIT', button_color=('white','firebrick3'))], + sg.Button('EXIT', button_color=('white','firebrick3'))], [sg.T('', text_color='white', size=(50,1), key='output')]] form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True) @@ -1127,8 +1127,8 @@ Much of the code is handling the button states in a fancy way. It could be much form_rows = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), - sg.ReadFormButton('Reset', button_color=('white', '#007339'), key='Reset'), + [sg.ReadButton('Pause', key='button', button_color=('white', '#001480')), + sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) @@ -1271,7 +1271,8 @@ Use the Graph Element to draw points, lines, circles, rectangles using ***your** In this example we're defining our graph to be from -100, -100 to +100,+100. That means that zero is in the middle of the drawing. You define this graph description in your call to Graph. -![graph element](https://user-images.githubusercontent.com/13696193/45860701-a8a3f080-bd36-11e8-9649-ada5890cdc14.jpg) +![snap0354](https://user-images.githubusercontent.com/13696193/45861485-cd9a6280-bd3a-11e8-83ea-32ca42dc9f3a.jpg) + import math @@ -1283,8 +1284,11 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th form.Finalize() graph = form.FindElement('graph') + graph.DrawLine((-100,0), (100,0)) + graph.DrawLine((0,-100), (0,100)) + for x in range(-100,100): y = math.sin(x/20)*50 - graph.DrawPoint((x,y)) + graph.DrawPoint((x,y), color='red') button, values = form.Read() From 84f229a4660014550eb52c54ec5fdedcf2a334de Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 14:02:16 -0400 Subject: [PATCH 424/521] Readme - New Elements and parameter.. much more to go --- docs/index.md | 271 +++++++++++++++++++++++++++++++++++++++++--------- readme.md | 271 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 448 insertions(+), 94 deletions(-) diff --git a/docs/index.md b/docs/index.md index e718ab5cd..9df7de2f4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -137,6 +137,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Borderless (no titlebar) windows Always on top windows Menus + Tooltips + Clickable links No async programming required (no callbacks to worry about) @@ -156,7 +158,7 @@ Here is the code that produced the above screenshot. [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], + ))], [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), @@ -429,7 +431,6 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): Here's the one-line Progress Meter in action! @@ -825,7 +826,7 @@ This code utilizes as many of the elements in one form as possible. [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], + )], [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), @@ -882,7 +883,6 @@ This is the definition of the FlexForm object: default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, - scale=(None, None), location=(None, None), font=None, button_color=None,Font=None, @@ -907,7 +907,6 @@ Parameter Descriptions. You will find these same parameters specified for each default_button_element_size - Size of buttons on this form auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label - scale - Set size of element to be a multiple of the Element size location - (x,y) Location to place window in pixels font - Font name and size for elements of the form button_color - Default color for buttons (foreground, background). Can be text or hex @@ -936,8 +935,6 @@ The default Element size for PySimpleGUI is `(45,1)`. Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. #### No Titlebar @@ -983,12 +980,27 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Multi-line Text Input Scroll-able Output Progress Bar + Menu + Frame + Graph + Table Async/Non-Blocking Windows Tabbed forms Persistent Windows Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) +#### Common Parameters +Some parameters that you will see on almost all Elements are: +key +tooltip + +#### Tooltip +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. + +Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. + + ### Output Elements Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: @@ -1004,23 +1016,35 @@ The code is a crude representation of the GUI, laid out in text. ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. + + Text(text + size=(None, None) + auto_size_text=None + click_submits=None + relief=None + font=None + text_color=None + background_color=None + justification=None + pad=None + key=None + tooltip=None) - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None, - justification=None) . Text - The text that's displayed size - Element's size + click_submits - if clicked will cause a read call to return they key value as the button + relief - relief to use around the text auto_size_text - Bool. Change width to match size of text font - Font name and size to use text_color - text color + background_color - background color justification - Justification for the text. String - 'left', 'right', 'center' + pad - (x,y) amount of padding in pixels to use around element when packing + key - used to identify element. This value will return as button if click_submits True + tooltip - string representing tooltip Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. @@ -1059,14 +1083,12 @@ This Element doubles as both an input and output Element. The `DefaultText` opt Multiline(default_text='', enter_submits = False, - scale=(None, None), size=(None, None), auto_size_text=None) . default_text - Text to display in the text box enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale size - Element's size auto_size_text - Bool. Change width to match size of text @@ -1077,11 +1099,9 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. ![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) - Output(scale=(None, None), - size=(None, None)) + Output(size=(None, None)) . - scale - How much to scale size of element size - Size of element (width, height) in characters ### Input Elements @@ -1095,7 +1115,6 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. def InputText(default_text = '', - scale=(None, None), size=(None, None), auto_size_text=None, password_char='', @@ -1108,7 +1127,6 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. . default_text - Text initially shown in the input box - scale - Amount size is scaled by size - (width, height) of element in characters auto_size_text- Bool. True is element should be sized to fit text password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field @@ -1134,8 +1152,7 @@ Also known as a drop-down list. Only required parameter is the list of choices. ![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) - InputCombo(values, - scale=(None, None), + InputCombo(values, , size=(None, None), auto_size_text=None, background_color = None, @@ -1144,7 +1161,6 @@ Also known as a drop-down list. Only required parameter is the list of choices. . values - Choices to be displayed. List of strings - scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background @@ -1159,15 +1175,20 @@ The standard listbox like you'll find in most GUIs. Note that the return values ![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) - Listbox(values, - select_mode=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - background_color = None, - text_color = None, - key = None) + Listbox(values + default_values=None + select_mode=None + change_submits=False + bind_return_key=False + size=(None, None) + auto_size_text=None + font=None + background_color=None + text_color=None + key=None + pad=None + tooltip=None): + . values - Choices to be displayed. List of strings @@ -1183,12 +1204,16 @@ The standard listbox like you'll find in most GUIs. Note that the return values 'extended' 'multiple' 'single' - scale - Amount to scale size by + change_submits - if True, the form read will return with a button value of '' + bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background + font - font to use for items in list text_color - color to use for the typed text - key = Dictionary key to use for return values + key - Dictionary key to use for return values and to find element + pad - amount of padding to use when packing + tooltip - tooltip text The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. @@ -1205,7 +1230,6 @@ Sliders have a couple of slider-specific settings as well as appearance settings orientation=None, border_width=None, relief=None, - scale=(None, None), size=(None, None), font=None, background_color = None, @@ -1224,7 +1248,6 @@ Sliders have a couple of slider-specific settings as well as appearance settings RELIEF_RIDGE= 'ridge' RELIEF_GROOVE= 'groove' RELIEF_SOLID = 'solid' - scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background @@ -1242,7 +1265,6 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o Radio(text, group_id, default=False, - scale=(None, None), size=(None, None), auto_size_text=None, font=None, @@ -1255,7 +1277,6 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o text - Text to display next to button group_id - Groups together multiple Radio Buttons. Can be any value default - Bool. Initial state - scale - Amount to scale size of element size- (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display @@ -1275,7 +1296,6 @@ Checkbox elements are like Radio Button elements. They return a bool indicating Checkbox(text, default=False, - scale=(None, None), size=(None, None), auto_size_text=None, font=None, @@ -1286,7 +1306,6 @@ Checkbox elements are like Radio Button elements. They return a bool indicating text - Text to display next to checkbox default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) - scale - Amount to scale size of element size - (width, height) size of element in characters auto_size_text- Bool. True if should size width to fit text font- Font type and size for text display @@ -1305,7 +1324,6 @@ An up/down spinner control. The valid values are passed in as a list. Spin(values, intiial_value=None, - scale=(None, None), size=(None, None), auto_size_text=None, font=None, @@ -1316,7 +1334,6 @@ An up/down spinner control. The valid values are passed in as a list. values - List of valid values initial_value - String with initial value - scale - Amount to scale size of element size - (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display @@ -1360,7 +1377,6 @@ While it's possible to build forms using the Button Element directly, you should image_subsample=None, border_width=None, bind_return_key=False, - scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, @@ -1572,8 +1588,7 @@ Another way of using a Progress Meter with PySimpleGUI is to build a custom form #### Output The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - Output(scale=(None, None), - size=(None, None)) + Output(size=(None, None)) Here's a complete solution for a chat-window using an Async form with an Output Element @@ -1600,6 +1615,13 @@ Starting in version 2.9 you'll be able to do more complex layouts by using the C Columns are specified in exactly the same way as a form is, as a list of lists. + def Column(layout - the list of rows that define the layout + background_color - color of background + size - size of visible portion of column + pad - element padding to use when packing + scrollable - bool. True if should add scrollbars + + Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1644,6 +1666,157 @@ The Column Element has 1 required parameter and 1 optional (the layout and the b The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. + + +---- +## Frames (Labelled Frames, Frames with a title) + +Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. + + def Frame(title - the label / title to put on frame + layout - list of rows of elements the frame contains + title_color - color of the title text + background_color - color of background + title_location - locations to put the title + relief - type of relief to use + size - size of Frame in characters. Do not use if you want frame to autosize + font - font to use for title + pad - element padding to use when packing + border_width - how thick the line going around frame should be + key - key used to location the element + tooltip - tooltip text + + + +This code creates a form with a Frame and 2 buttons. + + frame_layout = [ + [sg.T('Text inside of a frame')], + [sg.CB('Check 1'), sg.CB('Check 2')], + ] + layout = [ + [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], + [sg.Submit(), sg.Cancel()] + ] + + form = sg.FlexForm('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + + +![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) + + + +Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. + +*These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. + +## Canvas Element + +In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. + +### Matplotlib, Pyplot Integration + +One such integration is with Matploplib and Pyplot. There is a Demo program written that you can use as a design pattern to get an understanding of how to use the Canvas Widget once you get it. + + def Canvas(canvas - a tkinter canvasf if you created one. Normally not set + background_color - canvas color + size - size in pixels + pad - element padding for packing + key - key used to lookup element + tooltip - tooltip text + +The order of operations to obtain a tkinter Canvas Widget is: + + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # define the form layout + layout = [[sg.Text('Plot test')], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], + [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] + + # create the form and show it without the plot + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) + form.Finalize() + + # add the plot to the window + fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) + + # show it all again and get buttons + button, values = form.Read() + +To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: +* Add Canvas Element to your form +* Layout your form +* Call `form.Finalize()` - this is a critical step you must not forget +* Find the Canvas Element by looking up using key +* Your Canvas Widget Object will be the found_element.TKCanvas +* Draw on your canvas to your heart's content +* Call `form.Read()` - Nothing will appear on your canvas until you call Read + +See `Demo_Matplotlib.py` for a Recipe you can copy. + + +## Graph Element + +All you math fans will enjoy this Element... and all you non-math fans will enjoy it too. + +I've found nothing to be less fun than dealing with a graphic's coordinate system from a GUI Framework. It's always upside down from what I want. (0,0) is in the upper left hand corner. In short, it's a **pain in the ass**. + +Graph Element to the rescue. A Graph Element creates a pixel addressable canvas using YOUR coordinate system. *You* get to define the units on the X and Y axis. + +There are 3 values you'll need to supply the Graph Element. They are: +* Size of the canvas in pixels +* The lower left (x,y) coordinate of your coordinate system +* The upper right (x,y) coordinate of your coordinate system + +After you supply those values you can scribble all of over your graph by creating Graph Figures. Graph Figures are created, and a Figure ID is obtained by calling: +* DrawCircle +* DrawLine +* DrawPoint +* DrawRectangle +* DrawOval + +You can move your figures around on the canvas by supplying the Figure ID the x,y amount to move. + + graph.MoveFigure(my_circle, 10, 10) + +This Element is relatively new and may have some parameter additions or deletions. It shouldn't break your code however. + + def Graph( canvas_size - size of canvas in pixels + graph_bottom_left - the x,y location of your coordinate system's bottom left point + graph_top_right - the x,y location of your coordinate system's top right point + background_color - color to use for background + pad - element padding for pack + key - key used to lookup element + tooltip - tooltip text + + + +## Table Element + +Let me say up front that the Table Element has Beta status. The reason is that some of the parameters are not quite right and will change. Be warned one or two parameters may change. The `size` parameter in particular is gong to change. Currently the number of rows to allocate for the table is set by the height parameter of size. The problem is that the width is not used. The plan is to instead have a parameter named `number_of_rows` or something like it. + + def Table(values - Your table's array + headings - list of strings representing your headings, if you have any + visible_column_map - list of bools. If True, column in that position is shown. Defaults to all columns + col_widths - list of column widths + def_col_width - default column width. defaults to 10 + auto_size_columns - bool. If True column widths are determined by table contents + max_col_width - maximum width of a column. defaults to 25 + select_mode - table rows can be selected, but doesn't currently do anything + display_row_numbers - bool. If True shows numbers next to rows + scrollable - if True table will be scrolled + font - font for table entries + justification - left, right, center + text_color - color of text + background_color - cell background color + size - (None, number of rows). + pad - element padding for packing + key - key used to lookup element + tooltip - tooltip text + + + + ## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format @@ -1726,6 +1899,7 @@ Let's have some fun customizing! Make PySimpleGUI look the way you want it to l scrollbar_color=None, text_color=None debug_win_size=(None,None) window_location=(None,None) + tooltip_time = None Explanation of parameters @@ -1759,6 +1933,7 @@ Explanation of parameters text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' debug_win_size - size of the Print output window window_location - location on the screen (x,y) of window's top left cornder + tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: @@ -2328,3 +2503,5 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + + diff --git a/readme.md b/readme.md index e718ab5cd..9df7de2f4 100644 --- a/readme.md +++ b/readme.md @@ -137,6 +137,8 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU Borderless (no titlebar) windows Always on top windows Menus + Tooltips + Clickable links No async programming required (no callbacks to worry about) @@ -156,7 +158,7 @@ Here is the code that produced the above screenshot. [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], + ))], [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), @@ -429,7 +431,6 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr bar_color=DEFAULT_PROGRESS_BAR_COLOR, button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, - scale=(None, None), border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): Here's the one-line Progress Meter in action! @@ -825,7 +826,7 @@ This code utilizes as many of the elements in one form as possible. [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - scale=(2, 10))], + )], [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), @@ -882,7 +883,6 @@ This is the definition of the FlexForm object: default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, - scale=(None, None), location=(None, None), font=None, button_color=None,Font=None, @@ -907,7 +907,6 @@ Parameter Descriptions. You will find these same parameters specified for each default_button_element_size - Size of buttons on this form auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label - scale - Set size of element to be a multiple of the Element size location - (x,y) Location to place window in pixels font - Font name and size for elements of the form button_color - Default color for buttons (foreground, background). Can be text or hex @@ -936,8 +935,6 @@ The default Element size for PySimpleGUI is `(45,1)`. Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. -In addition to `size` there is a `scale` option. `scale` will take the Element's size and scale it up or down depending on the scale value. `scale=(1,1)` doesn't change the Element's size. `scale=(2,1)` will set the Element's size to be twice as wide as the size setting. - There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. #### No Titlebar @@ -983,12 +980,27 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Multi-line Text Input Scroll-able Output Progress Bar + Menu + Frame + Graph + Table Async/Non-Blocking Windows Tabbed forms Persistent Windows Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) +#### Common Parameters +Some parameters that you will see on almost all Elements are: +key +tooltip + +#### Tooltip +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. + +Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. + + ### Output Elements Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: @@ -1004,23 +1016,35 @@ The code is a crude representation of the GUI, laid out in text. ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. Size, Scale are a couple that you will see in every element. +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. + + Text(text + size=(None, None) + auto_size_text=None + click_submits=None + relief=None + font=None + text_color=None + background_color=None + justification=None + pad=None + key=None + tooltip=None) - Text(Text, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - text_color=None, - justification=None) . Text - The text that's displayed size - Element's size + click_submits - if clicked will cause a read call to return they key value as the button + relief - relief to use around the text auto_size_text - Bool. Change width to match size of text font - Font name and size to use text_color - text color + background_color - background color justification - Justification for the text. String - 'left', 'right', 'center' + pad - (x,y) amount of padding in pixels to use around element when packing + key - used to identify element. This value will return as button if click_submits True + tooltip - string representing tooltip Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. @@ -1059,14 +1083,12 @@ This Element doubles as both an input and output Element. The `DefaultText` opt Multiline(default_text='', enter_submits = False, - scale=(None, None), size=(None, None), auto_size_text=None) . default_text - Text to display in the text box enter_submits - Bool. If True, pressing Enter key submits form - scale - Element's scale size - Element's size auto_size_text - Bool. Change width to match size of text @@ -1077,11 +1099,9 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. ![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) - Output(scale=(None, None), - size=(None, None)) + Output(size=(None, None)) . - scale - How much to scale size of element size - Size of element (width, height) in characters ### Input Elements @@ -1095,7 +1115,6 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. def InputText(default_text = '', - scale=(None, None), size=(None, None), auto_size_text=None, password_char='', @@ -1108,7 +1127,6 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. . default_text - Text initially shown in the input box - scale - Amount size is scaled by size - (width, height) of element in characters auto_size_text- Bool. True is element should be sized to fit text password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field @@ -1134,8 +1152,7 @@ Also known as a drop-down list. Only required parameter is the list of choices. ![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) - InputCombo(values, - scale=(None, None), + InputCombo(values, , size=(None, None), auto_size_text=None, background_color = None, @@ -1144,7 +1161,6 @@ Also known as a drop-down list. Only required parameter is the list of choices. . values - Choices to be displayed. List of strings - scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background @@ -1159,15 +1175,20 @@ The standard listbox like you'll find in most GUIs. Note that the return values ![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) - Listbox(values, - select_mode=None, - scale=(None, None), - size=(None, None), - auto_size_text=None, - font=None, - background_color = None, - text_color = None, - key = None) + Listbox(values + default_values=None + select_mode=None + change_submits=False + bind_return_key=False + size=(None, None) + auto_size_text=None + font=None + background_color=None + text_color=None + key=None + pad=None + tooltip=None): + . values - Choices to be displayed. List of strings @@ -1183,12 +1204,16 @@ The standard listbox like you'll find in most GUIs. Note that the return values 'extended' 'multiple' 'single' - scale - Amount to scale size by + change_submits - if True, the form read will return with a button value of '' + bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background + font - font to use for items in list text_color - color to use for the typed text - key = Dictionary key to use for return values + key - Dictionary key to use for return values and to find element + pad - amount of padding to use when packing + tooltip - tooltip text The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. @@ -1205,7 +1230,6 @@ Sliders have a couple of slider-specific settings as well as appearance settings orientation=None, border_width=None, relief=None, - scale=(None, None), size=(None, None), font=None, background_color = None, @@ -1224,7 +1248,6 @@ Sliders have a couple of slider-specific settings as well as appearance settings RELIEF_RIDGE= 'ridge' RELIEF_GROOVE= 'groove' RELIEF_SOLID = 'solid' - scale - Amount to scale size by size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background @@ -1242,7 +1265,6 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o Radio(text, group_id, default=False, - scale=(None, None), size=(None, None), auto_size_text=None, font=None, @@ -1255,7 +1277,6 @@ Creates one radio button that is assigned to a group of radio buttons. Only 1 o text - Text to display next to button group_id - Groups together multiple Radio Buttons. Can be any value default - Bool. Initial state - scale - Amount to scale size of element size- (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display @@ -1275,7 +1296,6 @@ Checkbox elements are like Radio Button elements. They return a bool indicating Checkbox(text, default=False, - scale=(None, None), size=(None, None), auto_size_text=None, font=None, @@ -1286,7 +1306,6 @@ Checkbox elements are like Radio Button elements. They return a bool indicating text - Text to display next to checkbox default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) - scale - Amount to scale size of element size - (width, height) size of element in characters auto_size_text- Bool. True if should size width to fit text font- Font type and size for text display @@ -1305,7 +1324,6 @@ An up/down spinner control. The valid values are passed in as a list. Spin(values, intiial_value=None, - scale=(None, None), size=(None, None), auto_size_text=None, font=None, @@ -1316,7 +1334,6 @@ An up/down spinner control. The valid values are passed in as a list. values - List of valid values initial_value - String with initial value - scale - Amount to scale size of element size - (width, height) size of element in characters auto_size_text - Bool. True if should size width to fit text font - Font type and size for text display @@ -1360,7 +1377,6 @@ While it's possible to build forms using the Button Element directly, you should image_subsample=None, border_width=None, bind_return_key=False, - scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, @@ -1572,8 +1588,7 @@ Another way of using a Progress Meter with PySimpleGUI is to build a custom form #### Output The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - Output(scale=(None, None), - size=(None, None)) + Output(size=(None, None)) Here's a complete solution for a chat-window using an Async form with an Output Element @@ -1600,6 +1615,13 @@ Starting in version 2.9 you'll be able to do more complex layouts by using the C Columns are specified in exactly the same way as a form is, as a list of lists. + def Column(layout - the list of rows that define the layout + background_color - color of background + size - size of visible portion of column + pad - element padding to use when packing + scrollable - bool. True if should add scrollbars + + Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1644,6 +1666,157 @@ The Column Element has 1 required parameter and 1 optional (the layout and the b The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. + + +---- +## Frames (Labelled Frames, Frames with a title) + +Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. + + def Frame(title - the label / title to put on frame + layout - list of rows of elements the frame contains + title_color - color of the title text + background_color - color of background + title_location - locations to put the title + relief - type of relief to use + size - size of Frame in characters. Do not use if you want frame to autosize + font - font to use for title + pad - element padding to use when packing + border_width - how thick the line going around frame should be + key - key used to location the element + tooltip - tooltip text + + + +This code creates a form with a Frame and 2 buttons. + + frame_layout = [ + [sg.T('Text inside of a frame')], + [sg.CB('Check 1'), sg.CB('Check 2')], + ] + layout = [ + [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], + [sg.Submit(), sg.Cancel()] + ] + + form = sg.FlexForm('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + + +![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) + + + +Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. + +*These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. + +## Canvas Element + +In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. + +### Matplotlib, Pyplot Integration + +One such integration is with Matploplib and Pyplot. There is a Demo program written that you can use as a design pattern to get an understanding of how to use the Canvas Widget once you get it. + + def Canvas(canvas - a tkinter canvasf if you created one. Normally not set + background_color - canvas color + size - size in pixels + pad - element padding for packing + key - key used to lookup element + tooltip - tooltip text + +The order of operations to obtain a tkinter Canvas Widget is: + + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # define the form layout + layout = [[sg.Text('Plot test')], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], + [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] + + # create the form and show it without the plot + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) + form.Finalize() + + # add the plot to the window + fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) + + # show it all again and get buttons + button, values = form.Read() + +To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: +* Add Canvas Element to your form +* Layout your form +* Call `form.Finalize()` - this is a critical step you must not forget +* Find the Canvas Element by looking up using key +* Your Canvas Widget Object will be the found_element.TKCanvas +* Draw on your canvas to your heart's content +* Call `form.Read()` - Nothing will appear on your canvas until you call Read + +See `Demo_Matplotlib.py` for a Recipe you can copy. + + +## Graph Element + +All you math fans will enjoy this Element... and all you non-math fans will enjoy it too. + +I've found nothing to be less fun than dealing with a graphic's coordinate system from a GUI Framework. It's always upside down from what I want. (0,0) is in the upper left hand corner. In short, it's a **pain in the ass**. + +Graph Element to the rescue. A Graph Element creates a pixel addressable canvas using YOUR coordinate system. *You* get to define the units on the X and Y axis. + +There are 3 values you'll need to supply the Graph Element. They are: +* Size of the canvas in pixels +* The lower left (x,y) coordinate of your coordinate system +* The upper right (x,y) coordinate of your coordinate system + +After you supply those values you can scribble all of over your graph by creating Graph Figures. Graph Figures are created, and a Figure ID is obtained by calling: +* DrawCircle +* DrawLine +* DrawPoint +* DrawRectangle +* DrawOval + +You can move your figures around on the canvas by supplying the Figure ID the x,y amount to move. + + graph.MoveFigure(my_circle, 10, 10) + +This Element is relatively new and may have some parameter additions or deletions. It shouldn't break your code however. + + def Graph( canvas_size - size of canvas in pixels + graph_bottom_left - the x,y location of your coordinate system's bottom left point + graph_top_right - the x,y location of your coordinate system's top right point + background_color - color to use for background + pad - element padding for pack + key - key used to lookup element + tooltip - tooltip text + + + +## Table Element + +Let me say up front that the Table Element has Beta status. The reason is that some of the parameters are not quite right and will change. Be warned one or two parameters may change. The `size` parameter in particular is gong to change. Currently the number of rows to allocate for the table is set by the height parameter of size. The problem is that the width is not used. The plan is to instead have a parameter named `number_of_rows` or something like it. + + def Table(values - Your table's array + headings - list of strings representing your headings, if you have any + visible_column_map - list of bools. If True, column in that position is shown. Defaults to all columns + col_widths - list of column widths + def_col_width - default column width. defaults to 10 + auto_size_columns - bool. If True column widths are determined by table contents + max_col_width - maximum width of a column. defaults to 25 + select_mode - table rows can be selected, but doesn't currently do anything + display_row_numbers - bool. If True shows numbers next to rows + scrollable - if True table will be scrolled + font - font for table entries + justification - left, right, center + text_color - color of text + background_color - cell background color + size - (None, number of rows). + pad - element padding for packing + key - key used to lookup element + tooltip - tooltip text + + + + ## Tabbed Forms Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format @@ -1726,6 +1899,7 @@ Let's have some fun customizing! Make PySimpleGUI look the way you want it to l scrollbar_color=None, text_color=None debug_win_size=(None,None) window_location=(None,None) + tooltip_time = None Explanation of parameters @@ -1759,6 +1933,7 @@ Explanation of parameters text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' debug_win_size - size of the Print output window window_location - location on the screen (x,y) of window's top left cornder + tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: @@ -2328,3 +2503,5 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + + From 83ef56302586ffe3b433cb05dac782fd3cf78861 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 14:05:08 -0400 Subject: [PATCH 425/521] Added keys to Output, Column Elements --- PySimpleGUI.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7883a948c..36a934f66 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -931,7 +931,7 @@ def __del__(self): # Routes stdout, stderr to a scrolled window # # ---------------------------------------------------------------------- # class Output(Element): - def __init__(self, size=(None, None), background_color=None, text_color=None, pad=None, font=None, tooltip=None): + def __init__(self, size=(None, None), background_color=None, text_color=None, pad=None, font=None, tooltip=None, key=None): ''' Output Element - reroutes stdout, stderr to this window :param size: Size of field in characters @@ -941,7 +941,7 @@ def __init__(self, size=(None, None), background_color=None, text_color=None, pa bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR - super().__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font, tooltip=tooltip) + super().__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font, tooltip=tooltip, key=key) def __del__(self): try: @@ -1490,7 +1490,7 @@ def set_scrollregion(self, event=None): # Column # # ---------------------------------------------------------------------- # class Column(Element): - def __init__(self, layout, background_color = None, size=(None, None), pad=None, scrollable=False): + def __init__(self, layout, background_color = None, size=(None, None), pad=None, scrollable=False, key=None): self.UseDictionary = False self.ReturnValues = None self.ReturnValuesList = [] @@ -1505,7 +1505,7 @@ def __init__(self, layout, background_color = None, size=(None, None), pad=None, self.Layout(layout) - super().__init__(ELEM_TYPE_COLUMN, background_color=background_color, size=size, pad=pad) + super().__init__(ELEM_TYPE_COLUMN, background_color=background_color, size=size, pad=pad, key=key) return def AddRow(self, *args): From 5646ff87867189063dce6601659eed05983da8bd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 15:18:46 -0400 Subject: [PATCH 426/521] Fixed user submitted bug in setting icon in FlexForm init --- PySimpleGUI.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 36a934f66..3cf4c8422 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1827,9 +1827,7 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.Font = font if font else DEFAULT_FONT self.RadioDict = {} self.BorderDepth = border_depth - # self.WindowIcon = icon - # self.WindowIcon = icon if icon else icon_tempfile - self.WindowIcon = icon if not None else _my_windows.user_defined_icon + self.WindowIcon = icon if icon is not None else _my_windows.user_defined_icon self.AutoClose = auto_close self.NonBlocking = False self.TKroot = None From f6d93fbde9e98a5a116bb30c6c68ec86c7d02c8a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 15:48:04 -0400 Subject: [PATCH 427/521] Turned of Grab Anywhere because want to copy and paste text from window --- Demo_Matplotlib_Browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Matplotlib_Browser.py b/Demo_Matplotlib_Browser.py index 17ecb0e56..5ab902a44 100644 --- a/Demo_Matplotlib_Browser.py +++ b/Demo_Matplotlib_Browser.py @@ -876,7 +876,7 @@ def draw_figure(canvas, figure, loc=(0, 0)): ] # create the form and show it without the plot -form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') +form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', grab_anywhere=False) form.Layout(layout) while True: From 5f296978879b32b4af1c827a4f2798f44247c3a4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 20:00:47 -0400 Subject: [PATCH 428/521] Fix for Buttons not finding Target if within a Calumn or other container like Frame --- PySimpleGUI.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3cf4c8422..5d106b0de 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -293,6 +293,7 @@ def __init__(self, type, size=(None, None), auto_size_text=None, font=None, bac self.TKImage = None self.ParentForm=None + self.ParentContainer=None # will be a Form, Column, or Frame element self.TextInputDefault = None self.Position = (0,0) # Default position Row 0, Col 0 self.BackgroundColor = background_color if background_color is not None else DEFAULT_ELEMENT_BACKGROUND_COLOR @@ -1023,7 +1024,7 @@ def ButtonCallBack(self): if not isinstance(target, str): if target[0] < 0: target = [self.Position[0] + target[0], target[1]] - target_element = self.ParentForm._GetElementAtLocation(target) + target_element = self.ParentContainer._GetElementAtLocation(target) else: target_element = self.ParentForm.FindElement(target) try: @@ -1324,7 +1325,7 @@ def __init__(self, title, layout, title_color=None, background_color=None, title self.DictionaryKeyCounter = 0 self.ParentWindow = None self.Rows = [] - self.ParentForm = None + # self.ParentForm = None self.TKFrame = None self.Title = title self.Relief = relief @@ -1345,6 +1346,7 @@ def AddRow(self, *args): # ------------------------- Add the elements to a row ------------------------- # for i, element in enumerate(args): # Loop through list of elements and add them to the row element.Position = (CurrentRowNumber, i) + element.ParentContainer = self CurrentRow.append(element) if element.Key is not None: self.UseDictionary = True @@ -1355,15 +1357,20 @@ def Layout(self, rows): for row in rows: self.AddRow(*row) + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + def __del__(self): for row in self.Rows: for element in row: element.__del__() - - - def __del__(self): super().__del__() + # ---------------------------------------------------------------------- # # Slider # # ---------------------------------------------------------------------- # @@ -1498,7 +1505,7 @@ def __init__(self, layout, background_color = None, size=(None, None), pad=None, self.DictionaryKeyCounter = 0 self.ParentWindow = None self.Rows = [] - self.ParentForm = None + # self.ParentForm = None self.TKFrame = None self.Scrollable = scrollable bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR @@ -1516,6 +1523,7 @@ def AddRow(self, *args): # ------------------------- Add the elements to a row ------------------------- # for i, element in enumerate(args): # Loop through list of elements and add them to the row element.Position = (CurrentRowNumber, i) + element.ParentContainer = self CurrentRow.append(element) if element.Key is not None: self.UseDictionary = True @@ -1526,6 +1534,13 @@ def Layout(self, rows): for row in rows: self.AddRow(*row) + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + def __del__(self): for row in self.Rows: for element in row: @@ -1863,6 +1878,7 @@ def AddRow(self, *args): # ------------------------- Add the elements to a row ------------------------- # for i, element in enumerate(args): # Loop through list of elements and add them to the row element.Position = (CurrentRowNumber, i) + element.ParentContainer = self CurrentRow.append(element) # ------------------------- Append the row to list of Rows ------------------------- # self.Rows.append(CurrentRow) From 8eadf8e21d0fc8265992af0f47c17dfa756fe172 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 21:10:28 -0400 Subject: [PATCH 429/521] Fix for Tabbed Forms - ReadButton was returing None values. Also fixed problem with blank popups after tabbed form. --- Demo_All_Widgets.py | 4 ++-- PySimpleGUI.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 873a96ce0..6a83153ea 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -23,7 +23,7 @@ [sg.InputText('This is my text')], [sg.Frame(layout=[ [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), @@ -39,7 +39,7 @@ [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] ] diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 5d106b0de..10b2cbb19 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1084,6 +1084,8 @@ def ButtonCallBack(self): else: self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = True + if self.ParentForm.IsTabbedForm: + self.ParentForm.UberParent.FormStayedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop elif self.BType == BUTTON_TYPE_CLOSES_WIN_ONLY: # this is a return type button so GET RESULTS and destroy window # if the form is tabbed, must collect all form's results and destroy all forms @@ -2147,6 +2149,7 @@ def __init__(self): self.FormReturnValues = [] self.TKroot = None self.TKrootDestroyed = False + self.FormStayedOpen = False def AddForm(self, form): self.FormList.append(form) @@ -3131,6 +3134,8 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A except: pass + _my_windows.Increment() + if not len(args): print('******************* SHOW TABBED FORMS ERROR .... no arguments') return @@ -3184,6 +3189,14 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A pass root.mainloop() + if uber.FormStayedOpen: + FormReturnValues = [] + for form in uber.FormList: + BuildResults(form, False, form) + FormReturnValues.append(form.ReturnValues) + uber.FormReturnValues = FormReturnValues + # if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + # return BuildResults(self, False, self) if id: root.after_cancel(id) uber.TKrootDestroyed = True return uber.FormReturnValues From eb309b5895322aa69332d9bd67229982279458e3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 22:45:05 -0400 Subject: [PATCH 430/521] Turned off no_titlebar, changed target to use new key-style targe --- Demo_Calendar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Demo_Calendar.py b/Demo_Calendar.py index 12b48d467..612757d6f 100644 --- a/Demo_Calendar.py +++ b/Demo_Calendar.py @@ -1,10 +1,10 @@ import PySimpleGUI as sg layout = [[sg.T('Calendar Test')], - [sg.In('', size=(20,1))], - [sg.CalendarButton('Choose Date', target=(1,0), key='date')], + [sg.In('', size=(20,1), key='input')], + [sg.CalendarButton('Choose Date', target='input', key='date')], [sg.Ok(key=1)]] -form = sg.FlexForm('Calendar', no_titlebar=True) +form = sg.FlexForm('Calendar', grab_anywhere=False) b,v = form.LayoutAndRead(layout) sg.Popup(v['date']) From 91fef55aed6864916d4de9b8356803c7f304deae Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Sep 2018 23:29:50 -0400 Subject: [PATCH 431/521] Key error --- Demo_Calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo_Calendar.py b/Demo_Calendar.py index 612757d6f..2ecc18f6d 100644 --- a/Demo_Calendar.py +++ b/Demo_Calendar.py @@ -7,4 +7,4 @@ form = sg.FlexForm('Calendar', grab_anywhere=False) b,v = form.LayoutAndRead(layout) -sg.Popup(v['date']) +sg.Popup(v['input']) From 37be7d8d5055e83e5eb45efab93249f3526135ab Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 22 Sep 2018 13:16:49 -0400 Subject: [PATCH 432/521] Fixed compatibility problems in graph drawing functions --- PySimpleGUI.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 10b2cbb19..98472d7eb 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1265,28 +1265,28 @@ def _convert_xy_to_canvas_xy(self, x_in, y_in): return new_x, new_y def DrawLine(self, point_from, point_to, color='black', width=1): - converted_point_from = self._convert_xy_to_canvas_xy(*point_from) - converted_point_to = self._convert_xy_to_canvas_xy(*point_to) + converted_point_from = self._convert_xy_to_canvas_xy(point_from[0], point_from[1]) + converted_point_to = self._convert_xy_to_canvas_xy(point_to[0], point_to[1]) return self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color) def DrawPoint(self, point, size=2, color='black'): - converted_point = self._convert_xy_to_canvas_xy(*point) + converted_point = self._convert_xy_to_canvas_xy(point[0], point[1]) return self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) def DrawCircle(self, center_location, radius, fill_color=None, line_color='black'): - converted_point = self._convert_xy_to_canvas_xy(*center_location) + converted_point = self._convert_xy_to_canvas_xy(center_location[0], center_location[1]) return self._TKCanvas2.create_oval(converted_point[0]-radius, converted_point[1]-radius, converted_point[0]+radius, converted_point[1]+radius, fill=fill_color, outline=line_color) def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None): - converted_top_left = self._convert_xy_to_canvas_xy(*top_left) - converted_bottom_right = self._convert_xy_to_canvas_xy(*bottom_right) - return self._TKCanvas2.create_oval(*converted_top_left, *converted_bottom_right, fill=fill_color, outline=line_color) + converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1]) + converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0],bottom_right[1]) + return self._TKCanvas2.create_oval(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None): - converted_top_left = self._convert_xy_to_canvas_xy(*top_left) - converted_bottom_right = self._convert_xy_to_canvas_xy(*bottom_right) - return self._TKCanvas2.create_rectangle(*converted_top_left, *converted_bottom_right, fill=fill_color, outline=line_color) + converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1] ) + converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1]) + return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) def Erase(self): self._TKCanvas2.delete('all') @@ -1298,13 +1298,13 @@ def Move(self, x_direction, y_direction): zero_converted = self._convert_xy_to_canvas_xy(0,0) shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) - self._TKCanvas2.move('all', *shift_amount) + self._TKCanvas2.move('all', shift_amount[0], shift_amount[1]) def MoveFigure(self, figure, x_direction, y_direction): zero_converted = self._convert_xy_to_canvas_xy(0,0) shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) - self._TKCanvas2.move(figure, *shift_amount) + self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1]) @property def TKCanvas(self): From 39dfe7b462aabeff13af814245487fcf147a3c65 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 22 Sep 2018 13:52:08 -0400 Subject: [PATCH 433/521] 3.5.1 Relase Readme --- docs/index.md | 554 +++++++++++++++++++++++++++++++++----------------- readme.md | 554 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 744 insertions(+), 364 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9df7de2f4..c15f91ad4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -171,7 +171,7 @@ Here is the code that produced the above screenshot. sg.FolderBrowse()], [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))] ] button, values = form.LayoutAndRead(layout) @@ -328,12 +328,14 @@ There are a number of Popup output calls, each with a slightly different look (e The list of Popup output functions are - Popup,PopupOk + Popup + PopupOk PopupYesNo PopupCancel PopupOkCancel PopupError PopupTimed, PopupAutoClose + PopupNoWait, PopupNonBlocking The trailing portion of the function name after Popup indicates what buttons are shown. `PopupYesNo` shows a pair of button with Yes and No on them. `PopupCancel` has a Cancel button, etc. @@ -385,6 +387,16 @@ sg.PopupScrolled(my_text, size=(80, None)) Note that the default max number of lines before scrolling happens is set to 50. At 50 lines the scrolling will begin. +### PopupNoWait + +The Popup call PopupNoWait or PopupNonBlocking will create a popup window and then immediately return control back to you. All other popup functions will block, waiting for the user to close the popup window. + +This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement + +A word of ***caution***... Windows that are created after the NoWait Popup are "slaves" to the NoWait'd popup. If you close the Popup, it will also lose the window the you created after the Popup. A good rule of thumb is to leave the popup open while you're interacting with the rest of your program until you understand what happens when you close the NoWaitPopup. + + + ### Popup Input There are Popup calls for single-item inputs. These follow the pattern of `Popup` followed by `Get` and then the type of item to get. @@ -570,55 +582,75 @@ Read on for detailed instructions on the calls that show the form and return you # Copy these design patterns! -## Pattern 1 - With Context Manager +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. - with sg.FlexForm('SHA-1 & 256 Hash') as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) -## Pattern 2 - No Context Manager +## Pattern 1 - Single read forms +This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program - form = sg.FlexForm('SHA-1 & 256 Hash') form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] + + form = sg.FlexForm('SHA-1 & 256 Hash') + button, (source_filename,) = form.LayoutAndRead(form_rows) ---- -## Pattern 3 - Short Form +## Pattern 2 - Single-read form "chained" +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling FlexForm and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) +## Pattern 3 - Persistent form (multiple reads) -These 3 design patterns both produce this custom form: +Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. -![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling FlexForm which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. -When you're code leaves forms open or you show many forms, then it's important to use the "with" context manager so that resources are freed as quickly as possible. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + import PySimpleGUI as sg + + layout = [[sg.Text('Persistent form')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] -The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + form = sg.FlexForm('Raspberry Pi GUI').Layout(layout) -The third is the 'compact form'. It compacts down into 2 lines of code. One line is your form definition. The next is the call that shows the form and returns the values. You can use this pattern for simple, short programs where resource allocation isn't an issue. + while True: + button, values = form.Read() + if button is None: + break -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. ### How GUI Programming in Python Should Look? At least for beginners Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. +The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. + + Let's dissect this little program + + import PySimpleGUI as sg + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + form = sg.FlexForm('Rename Files or Folders') + + button, (folder_path, file_path) = form.LayoutAndRead(layout) -Let's look at this one. ![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) @@ -640,7 +672,7 @@ See how the source code mirrors the layout? You simply make lists for each row, And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. -The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. +For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. @@ -648,65 +680,7 @@ In our example form, there are 2 fields, so the return values from this form wil In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - -### The Auto-Packer - -Once you've laid out your elements into, it's the job of the Auto-Packer to place your elements into a window frame. - -The layout of custom GUIs is made trivial by the use of the Auto-Packer. GUI frameworks often use a grid system and sometimes have a "pack" function that's used to place widgets into a window. It's almost always a confusing exercise to use them. - -PySimpleGUI uses a "row by row" approach to building GUIs. When you were to sketch your GUI out on a sheet of paper and then draw horizontal lines across the page under each widget then you would have a several "rows" of widgets. - -For each row in your GUI, you will have a list of elements. In Python this list is a simple Python list. An entire GUI window is a list of rows, one after another. - -This is how your GUI is created, one row at a time, with one row stacked on top of another. This visual form of coding makes GUI creation go so much quicker. - - layout = [ [ Row 1 Elements], - [ Row 2 Elements] ] - - -### Laying out your form - -Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. - - layout = [ [row 1], - [row 2], - [row 3] ] - -Simple enough... a list of lists. -A row is a list of Elements. For example this could be a row with a couple of elements on it. - - [ Input, Button] - -Turning back to our example. This GUI roughly looks like this: - - layout = [ [Text], - [InputText, FileBrowse] - [Submit, Cancel] ] - - Now let's put it all together into an entire program. - - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [sg.InputText(), sg.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [sg.Submit(), sg.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - button, (source_filename, ) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. ## Return values @@ -744,19 +718,30 @@ If you have a SINGLE value being returned, it is written this way: ### Return values as a dictionary -If you wish to receive the return values as a dictionary rather than a simple list, then you'll have to one thing... +For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. + +The most common form read statement you'll encounter looks something like this: + + button, values = form.LayoutAndRead(layout) + +or + + button, values = form.Read() + +All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. + + To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -This sample program demonstrates these 2 steps as well as how to address the return values (e.g. `values['name']`) - +Let's take a look at your first dictionary-based form. import PySimpleGUI as sg form = sg.FlexForm('Simple data entry form') layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] @@ -764,14 +749,39 @@ This sample program demonstrates these 2 steps as well as how to address the ret button, values = form.LayoutAndRead(layout) - sg.Popup(button, values, values[0], values['address'], values['phone']) + sg.Popup(button, values, values['name'], values['address'], values['phone']) + +To get the value of an input field, you use whatever value used as the `key` value as the index value. Thus to get the value of the name field, it is written as + values['name'] + +You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. + +### Button Return Values + +The button value from a Read call will be one of 3 values: +1. The Button's text +2. The Button's key +3. None + +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. + +None is returned when the user clicks the X to close a window. + +If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: + + while True: + button, values= form.Read() + if button is None or button == 'Quit': + break ## The Event Loop / Callback Functions -All GUIs have a few things in common, one of them being an "event loop" of some sort. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. This simple scenarios are front-end GUIs where you call sg.GetFile for example and then call your program that does something with the file. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. -Event Loops are used in programs where the window stays open after button presses. The program processes button clicks a loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. +Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. + +Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. This little program has a typical Event Loop @@ -781,12 +791,11 @@ This little program has a typical Event Loop import PySimpleGUI as sg layout = [[sg.T('Raspberry Pi LEDs')], - [sg.ReadFormButton('Turn LED On')], - [sg.ReadFormButton('Turn LED Off')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], [sg.Exit()]] - form = sg.FlexForm('Raspberry Pi GUI', grab_anywhere=False) - form.Layout(layout) + form = sg.FlexForm('Raspberry Pi).Layout(layout) # ---- Event Loop ---- # while True: @@ -807,48 +816,78 @@ This little program has a typical Event Loop In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) -The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions. A function you define would be called when a button is clicked. This requires you to write code where data is shared between these callback functions. There is a lot more communications that have to happen between parts of your program. +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. + +There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. -One of the larger hurdles for beginners to GUI programming are these callback functions. PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simple read your button click and take appropriate action. +PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . -Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible tradeoff to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. +Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible trade-off to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. --- ## All Widgets / Elements + This code utilizes as many of the elements in one form as possible. - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - )], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] + import PySimpleGUI as sg - button, values = form.LayoutAndRead(layout) + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] + ] + + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = form.Read() + + sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. -![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + +![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. @@ -1217,6 +1256,9 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. +ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. + #### Slider Element Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. @@ -1341,14 +1383,17 @@ An up/down spinner control. The valid values are passed in as a list. text_color - color to use for the typed text key = Dictionary key to use for return values -#### Button Element +### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse * File Browse -* Close Form +* Files Browse +* File SaveAs +* File Save +* Close Form (normal button) * Read Form * Realtime * Calendar Chooser @@ -1365,25 +1410,68 @@ Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. +Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - image_filename=None, - image_size=(None, None), - image_subsample=None, - border_width=None, - bind_return_key=False, - size=(None, None), - auto_size_button=None, - button_color=None, - font=None, - focus=False) - -These Pre-made buttons are some of the most important elements of all because they are used so much. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. (hmmm Save already comes to mind). They include: +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. + +Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. + +The 3 primary forms of PySimpleGUI buttons and their names are: + + 1. `Button` = `SimpleButton` + 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` + 3. `RealtimeButton` + +You will find the long-form in the older programs. + +The most basic Button element call to use is `Button` + + Button(button_text='' + button_type=BUTTON_TYPE_CLOSES_WIN + target=(None, None) + tooltip=None + file_types=(("ALL Files", "*.*"),) + initial_folder=None + image_filename=None + image_size=(None, None) + image_subsample=None + border_width=None + size=(None, None) + auto_size_button=None + button_color=None + default_value = None + font=None + bind_return_key=False + focus=False + pad=None + key=None): + +Parameters + + button_text - Text to be displayed on the button + button_type - You should NOT be setting this directly + target - key or (row,col) target for the button + tooltip - tooltip text for the button + file_types - the filetypes that will be used to match files + initial_folder - starting path for folders and files + image_filename - image filename if there is a button image + image_size - size of button image in pixels + image_subsample - amount to reduce the size of the image + border_width - width of border around button in pixels + size - size in characters + auto_size_button - True if button size is determined by button text + button_color - (text color, backound color) + default_value - initial value for buttons that hold information + font - font to use for button text + bind_return_key - If True the return key will cause this button to fire + focus - if focus should be set to this button + pad - (x,y) padding in pixels for packing the button + key - key used for finding the element + +#### Pre-defined Buttons +These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: OK Ok @@ -1393,9 +1481,11 @@ These Pre-made buttons are some of the most important elements of all because th No Exit Quit + Help Save SaveAs FileBrowse + FilesBrowse FileSaveAs FolderBrowse . @@ -1405,11 +1495,21 @@ These Pre-made buttons are some of the most important elements of all because th #### Button targets -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. + +The Target comes in two forms. +1. Key +2. (row, column) + +Targets that are specified using a key will find its target element by using the target's key value. This is the "preferred" method. + +If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The (row, col) targeting can only target elements that are in the same "container". Containers are the FlexForm, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. -The default value for `targe` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. +The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. (ThisRow, -1) means the Element to the left of the button, on the same row. -If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value. +If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. Let's examine this form as an example: @@ -1428,9 +1528,17 @@ The code for the entire form could be: [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] +or if using keys, then the code would be: + + layout = [[sg.T('Source Folder')], + [sg.In(key='input')], + [sg.FolderBrowse(target='input'), sg.OK()]] + +See how much easier the key method is? + **Save & Open Buttons** -There are 3 different types of File/Folder open dialog box available. If you are looking for a file to open, the `FileBrowse` is what you want. If you want to save a file, `SaveAs` is the button. If you want to get a folder name, then `FolderBrowse` is the button to use. +There are 3 different types of File/Folder open dialog box available. If you are looking for a file to open, the `FileBrowse` is what you want. If you want to save a file, `SaveAs` is the button. If you want to get a folder name, then `FolderBrowse` is the button to use. To open several files at once, use the `FilesBrowse` button. It will create a list of files that are separated by ';' ![open](https://user-images.githubusercontent.com/13696193/45243804-2b529780-b2c3-11e8-90dc-6c9061db2a1e.jpg) @@ -1457,23 +1565,23 @@ These buttons pop up a standard color chooser window. The result is returned as **Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. -layout = [[sg.SimpleButton('My Button')]] +layout = [[sg.Button('My Button')]] ![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. - sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) Three parameters are used for button images. @@ -1488,7 +1596,7 @@ Here's an example form made with button images. You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. @@ -1562,17 +1670,16 @@ Another way of using a Progress Meter with PySimpleGUI is to build a custom form ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) - # create the progress bar element - progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + import PySimpleGUI as sg + # layout the form layout = [[sg.Text('A custom progress meter')], - [progress_bar], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], [sg.Cancel()]] # create the form` - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) + form = sg.FlexForm('Custom Progress Meter').Layout(layout) + progress_bar = form.FindElement('progressbar') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked @@ -1580,9 +1687,9 @@ Another way of using a Progress Meter with PySimpleGUI is to build a custom form if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i+1) + progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() + form.CloseNonBlockingForm()) #### Output @@ -1593,22 +1700,27 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Here's a complete solution for a chat-window using an Async form with an Output Element import PySimpleGUI as sg - # Blocking form that doesn't close + + # Blocking form that doesn't close def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + form = sg.FlexForm('Chat Window', default_element_size=(30, 2)).Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + ChatBot() + ------------------- ## Columns Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. @@ -1946,9 +2058,9 @@ Each lower level overrides the settings of the higher level. Once settings have ## Persistent Forms (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The SimpleButton Element also closes the form. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. -The `ReadFormButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. @@ -1979,13 +2091,6 @@ One example is you have an input field that changes as you press buttons on an o ![keypad 3](https://user-images.githubusercontent.com/13696193/45260275-a2198e80-b3b0-11e8-85fe-a4ce6484510f.jpg) -Another example, a slider or a spinner move changes the size of the text somewhere on the form. - - -![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) - -A final example... changing a text field as a user types into another field. - ### Periodically Calling`ReadNonBlocking` @@ -1999,6 +2104,9 @@ There are 2 methods of interacting with non-blocking forms. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. #### Exiting a Non-Blocking Form + +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. + Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. The proper code to check if the user has exited the form will be a polling-loop that looks something like this: @@ -2045,7 +2153,7 @@ See the sample code on the GitHub named Demo Media Player for another example of # Create the layout form_rows = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], - [sg.SimpleButton('Quit')]] + [sg.Button('Quit')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form.LayoutAndRead(form_rows, non_blocking=True) @@ -2071,6 +2179,71 @@ The new thing in this example is the call use of the Update method for the Text Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. +## Updating Elements (changing elements in active form) + +Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). + +The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. + +![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) + + +In some programs these updates happen in response to another Element. This program takes a Spinner and a Slider's input values and uses them to resize a Text Element. The Spinner and Slider are on the left, the Text element being changed is on the right. + + + + + + # Testing async form, see if can have a slider + # that adjusts the size of text displayed + + import PySimpleGUI as sg + fontSize = 12 + layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), + change_submits=True, key='slider', font=('Helvetica 20')), + sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] + + sz = fontSize + form = sg.FlexForm("Font size selector", grab_anywhere=False).Layout(layout) + # Event Loop + while True: + button, values= form.Read() + if button is None: + break + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + + print("Done.") + + +Inside the event loop we read the value of the Spinner and the Slider using those Elements' keys. +For example, `values['slider']` is the value of the Slider Element. + +This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: + + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + +Remember this design pattern because you will use it OFTEN if you use persistent forms. + +It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: + + text_element = form.FindElement('text') + text_element.Update(font=font) + +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. + + + ## Keyboard & Mouse Capture Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. @@ -2093,7 +2266,7 @@ Key Sym is a string such as 'Control_L'. The Key Code is a numeric representati text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], - [sg.SimpleButton("OK")]] + [sg.Button("OK")]] form.Layout(layout) # ---===--- Loop taking in user input --- # @@ -2115,7 +2288,7 @@ Use realtime keyboard capture by calling with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: layout = [[sg.Text("Hold down a key")], - [sg.SimpleButton("OK")]] + [sg.Button("OK")]] form.Layout(layout) @@ -2162,7 +2335,7 @@ We have an InputText field that we want to update. When the Element was created sg.Input(key='input') -To update or change the value for that Input Element, we use this contruct: +To update or change the value for that Input Element, we use this construct: form.FindElement('input').Update('new text') @@ -2170,6 +2343,17 @@ Using the '.' makes the code shorter. The FindElement call returns an Element. See the Font Sizer demo for example source code. +You can use Update to do things like: +* Have one Element (appear to) make a change to another Element +* Disable a button, slider, input field, etc +* Change a button's text +* Change an Element's text or background color +* Add text to a scrolling output window +* Change the choices in a list +* etc + + + ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: @@ -2505,3 +2689,9 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + + + + + + diff --git a/readme.md b/readme.md index 9df7de2f4..c15f91ad4 100644 --- a/readme.md +++ b/readme.md @@ -171,7 +171,7 @@ Here is the code that produced the above screenshot. sg.FolderBrowse()], [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))] ] button, values = form.LayoutAndRead(layout) @@ -328,12 +328,14 @@ There are a number of Popup output calls, each with a slightly different look (e The list of Popup output functions are - Popup,PopupOk + Popup + PopupOk PopupYesNo PopupCancel PopupOkCancel PopupError PopupTimed, PopupAutoClose + PopupNoWait, PopupNonBlocking The trailing portion of the function name after Popup indicates what buttons are shown. `PopupYesNo` shows a pair of button with Yes and No on them. `PopupCancel` has a Cancel button, etc. @@ -385,6 +387,16 @@ sg.PopupScrolled(my_text, size=(80, None)) Note that the default max number of lines before scrolling happens is set to 50. At 50 lines the scrolling will begin. +### PopupNoWait + +The Popup call PopupNoWait or PopupNonBlocking will create a popup window and then immediately return control back to you. All other popup functions will block, waiting for the user to close the popup window. + +This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement + +A word of ***caution***... Windows that are created after the NoWait Popup are "slaves" to the NoWait'd popup. If you close the Popup, it will also lose the window the you created after the Popup. A good rule of thumb is to leave the popup open while you're interacting with the rest of your program until you understand what happens when you close the NoWaitPopup. + + + ### Popup Input There are Popup calls for single-item inputs. These follow the pattern of `Popup` followed by `Get` and then the type of item to get. @@ -570,55 +582,75 @@ Read on for detailed instructions on the calls that show the form and return you # Copy these design patterns! -## Pattern 1 - With Context Manager +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. - with sg.FlexForm('SHA-1 & 256 Hash') as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = form.LayoutAndRead(form_rows) -## Pattern 2 - No Context Manager +## Pattern 1 - Single read forms +This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program - form = sg.FlexForm('SHA-1 & 256 Hash') form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] + + form = sg.FlexForm('SHA-1 & 256 Hash') + button, (source_filename,) = form.LayoutAndRead(form_rows) ---- -## Pattern 3 - Short Form +## Pattern 2 - Single-read form "chained" +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling FlexForm and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] + button, (source_filename,) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) +## Pattern 3 - Persistent form (multiple reads) -These 3 design patterns both produce this custom form: +Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. -![snap0134](https://user-images.githubusercontent.com/13696193/43162410-e7775466-8f58-11e8-8d6a-da4772c00dd8.jpg) +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling FlexForm which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. -When you're code leaves forms open or you show many forms, then it's important to use the "with" context manager so that resources are freed as quickly as possible. PySimpleGUI uses `tkinter`. `tkinter` is very picky about who releases objects and when. The `with` takes care of disposing of everything properly for you. + import PySimpleGUI as sg + + layout = [[sg.Text('Persistent form')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] -The second design pattern is not context manager based. If you are struggling with an unknown error, try modifying the code to run without a context manager. To do so, you simple remove the with, stick the form on the front of that statement, and un-indent the with-block code. + form = sg.FlexForm('Raspberry Pi GUI').Layout(layout) -The third is the 'compact form'. It compacts down into 2 lines of code. One line is your form definition. The next is the call that shows the form and returns the values. You can use this pattern for simple, short programs where resource allocation isn't an issue. + while True: + button, values = form.Read() + if button is None: + break -You will use these design patterns or code templates for all of your "normal" (blocking) types of input forms. Copy it and modify it to suit your needs. This is the quickest way to get your code up and running with PySimpleGUI. This is the most basic / normal of the design patterns. ### How GUI Programming in Python Should Look? At least for beginners Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom forms in PySimpleGUI is to view forms as ROWS of Widgets (Elements). Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. +The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. + + Let's dissect this little program + + import PySimpleGUI as sg + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + form = sg.FlexForm('Rename Files or Folders') + + button, (folder_path, file_path) = form.LayoutAndRead(layout) -Let's look at this one. ![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) @@ -640,7 +672,7 @@ See how the source code mirrors the layout? You simply make lists for each row, And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. -The same "row" concept applies to return values. The form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. +For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. @@ -648,65 +680,7 @@ In our example form, there are 2 fields, so the return values from this form wil In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of tkinter code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - -### The Auto-Packer - -Once you've laid out your elements into, it's the job of the Auto-Packer to place your elements into a window frame. - -The layout of custom GUIs is made trivial by the use of the Auto-Packer. GUI frameworks often use a grid system and sometimes have a "pack" function that's used to place widgets into a window. It's almost always a confusing exercise to use them. - -PySimpleGUI uses a "row by row" approach to building GUIs. When you were to sketch your GUI out on a sheet of paper and then draw horizontal lines across the page under each widget then you would have a several "rows" of widgets. - -For each row in your GUI, you will have a list of elements. In Python this list is a simple Python list. An entire GUI window is a list of rows, one after another. - -This is how your GUI is created, one row at a time, with one row stacked on top of another. This visual form of coding makes GUI creation go so much quicker. - - layout = [ [ Row 1 Elements], - [ Row 2 Elements] ] - - -### Laying out your form - -Your form is a 2 dimensional list in Python. The first dimension are rows, the second is a list of Elements for each row. The first thing you want to do is layout your form on paper. - - layout = [ [row 1], - [row 2], - [row 3] ] - -Simple enough... a list of lists. -A row is a list of Elements. For example this could be a row with a couple of elements on it. - - [ Input, Button] - -Turning back to our example. This GUI roughly looks like this: - - layout = [ [Text], - [InputText, FileBrowse] - [Submit, Cancel] ] - - Now let's put it all together into an entire program. - - -### Line by line explanation - -Going through each line of code in the above form will help explain how to use this design patter. Copy, modify and run it! - - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: -This creates a new form, storing it in the variable `form`. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], -The next few rows of code lay out the rows of elements in the window to be displayed. The variable `form_rows` holds our entire GUI window. The first row of this form has a Text element. These simply display text on the form. - - [sg.InputText(), sg.FileBrowse()], -Now we're on the second row of the form. On this row there are 2 elements. The first is an `Input` field. It's a place the user can enter `strings`. The second element is a `File Browse Button`. A file or folder browse button will always fill in the text field to it's left unless otherwise specified. In this example, the File Browse Button will interact with the `InputText` field to its left. - - [sg.Submit(), sg.Cancel()]] - -The last line of the `form_rows` variable assignment contains a Submit and a Cancel Button. These are buttons that will cause a form to return its value to the caller. - - button, (source_filename, ) = form.LayoutAndRead(form_rows) -This is the code that **displays** the form, collects the information and returns the data collected. In this example we have a button return code and only 1 input field. The result of the form is stored directly into the variable we wish to work with. +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. ## Return values @@ -744,19 +718,30 @@ If you have a SINGLE value being returned, it is written this way: ### Return values as a dictionary -If you wish to receive the return values as a dictionary rather than a simple list, then you'll have to one thing... +For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. + +The most common form read statement you'll encounter looks something like this: + + button, values = form.LayoutAndRead(layout) + +or + + button, values = form.Read() + +All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. + + To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -This sample program demonstrates these 2 steps as well as how to address the return values (e.g. `values['name']`) - +Let's take a look at your first dictionary-based form. import PySimpleGUI as sg form = sg.FlexForm('Simple data entry form') layout = [ [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] @@ -764,14 +749,39 @@ This sample program demonstrates these 2 steps as well as how to address the ret button, values = form.LayoutAndRead(layout) - sg.Popup(button, values, values[0], values['address'], values['phone']) + sg.Popup(button, values, values['name'], values['address'], values['phone']) + +To get the value of an input field, you use whatever value used as the `key` value as the index value. Thus to get the value of the name field, it is written as + values['name'] + +You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. + +### Button Return Values + +The button value from a Read call will be one of 3 values: +1. The Button's text +2. The Button's key +3. None + +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. + +None is returned when the user clicks the X to close a window. + +If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: + + while True: + button, values= form.Read() + if button is None or button == 'Quit': + break ## The Event Loop / Callback Functions -All GUIs have a few things in common, one of them being an "event loop" of some sort. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. This simple scenarios are front-end GUIs where you call sg.GetFile for example and then call your program that does something with the file. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. -Event Loops are used in programs where the window stays open after button presses. The program processes button clicks a loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. +Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. + +Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. This little program has a typical Event Loop @@ -781,12 +791,11 @@ This little program has a typical Event Loop import PySimpleGUI as sg layout = [[sg.T('Raspberry Pi LEDs')], - [sg.ReadFormButton('Turn LED On')], - [sg.ReadFormButton('Turn LED Off')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], [sg.Exit()]] - form = sg.FlexForm('Raspberry Pi GUI', grab_anywhere=False) - form.Layout(layout) + form = sg.FlexForm('Raspberry Pi).Layout(layout) # ---- Event Loop ---- # while True: @@ -807,48 +816,78 @@ This little program has a typical Event Loop In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) -The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions. A function you define would be called when a button is clicked. This requires you to write code where data is shared between these callback functions. There is a lot more communications that have to happen between parts of your program. +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. + +There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. -One of the larger hurdles for beginners to GUI programming are these callback functions. PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simple read your button click and take appropriate action. +PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . -Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible tradeoff to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. +Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible trade-off to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. --- ## All Widgets / Elements + This code utilizes as many of the elements in one form as possible. - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - )], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', 'green'))] - ] + import PySimpleGUI as sg - button, values = form.LayoutAndRead(layout) + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] + ] + + + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = form.Read() + + sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. -![results 2](https://user-images.githubusercontent.com/13696193/43097502-44e3ed32-8e8a-11e8-9a51-2b8af0b1a682.jpg) + +![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) **`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. @@ -1217,6 +1256,9 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. +ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. + #### Slider Element Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. @@ -1341,14 +1383,17 @@ An up/down spinner control. The valid values are passed in as a list. text_color - color to use for the typed text key = Dictionary key to use for return values -#### Button Element +### Button Element Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse * File Browse -* Close Form +* Files Browse +* File SaveAs +* File Save +* Close Form (normal button) * Read Form * Realtime * Calendar Chooser @@ -1365,25 +1410,68 @@ Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog -Read Form - This is an async form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. +Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -While it's possible to build forms using the Button Element directly, you should never need to do that. There are pre-made buttons and shortcuts that will make life much easier. The most basic Button element call to use is `SimpleButton` - - SimpleButton(text, - image_filename=None, - image_size=(None, None), - image_subsample=None, - border_width=None, - bind_return_key=False, - size=(None, None), - auto_size_button=None, - button_color=None, - font=None, - focus=False) - -These Pre-made buttons are some of the most important elements of all because they are used so much. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. (hmmm Save already comes to mind). They include: +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. + +Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. + +The 3 primary forms of PySimpleGUI buttons and their names are: + + 1. `Button` = `SimpleButton` + 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` + 3. `RealtimeButton` + +You will find the long-form in the older programs. + +The most basic Button element call to use is `Button` + + Button(button_text='' + button_type=BUTTON_TYPE_CLOSES_WIN + target=(None, None) + tooltip=None + file_types=(("ALL Files", "*.*"),) + initial_folder=None + image_filename=None + image_size=(None, None) + image_subsample=None + border_width=None + size=(None, None) + auto_size_button=None + button_color=None + default_value = None + font=None + bind_return_key=False + focus=False + pad=None + key=None): + +Parameters + + button_text - Text to be displayed on the button + button_type - You should NOT be setting this directly + target - key or (row,col) target for the button + tooltip - tooltip text for the button + file_types - the filetypes that will be used to match files + initial_folder - starting path for folders and files + image_filename - image filename if there is a button image + image_size - size of button image in pixels + image_subsample - amount to reduce the size of the image + border_width - width of border around button in pixels + size - size in characters + auto_size_button - True if button size is determined by button text + button_color - (text color, backound color) + default_value - initial value for buttons that hold information + font - font to use for button text + bind_return_key - If True the return key will cause this button to fire + focus - if focus should be set to this button + pad - (x,y) padding in pixels for packing the button + key - key used for finding the element + +#### Pre-defined Buttons +These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: OK Ok @@ -1393,9 +1481,11 @@ These Pre-made buttons are some of the most important elements of all because th No Exit Quit + Help Save SaveAs FileBrowse + FilesBrowse FileSaveAs FolderBrowse . @@ -1405,11 +1495,21 @@ These Pre-made buttons are some of the most important elements of all because th #### Button targets -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target is specified using a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. + +The Target comes in two forms. +1. Key +2. (row, column) + +Targets that are specified using a key will find its target element by using the target's key value. This is the "preferred" method. + +If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. + +The (row, col) targeting can only target elements that are in the same "container". Containers are the FlexForm, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. -The default value for `targe` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. +The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. (ThisRow, -1) means the Element to the left of the button, on the same row. -If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value. +If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. Let's examine this form as an example: @@ -1428,9 +1528,17 @@ The code for the entire form could be: [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] +or if using keys, then the code would be: + + layout = [[sg.T('Source Folder')], + [sg.In(key='input')], + [sg.FolderBrowse(target='input'), sg.OK()]] + +See how much easier the key method is? + **Save & Open Buttons** -There are 3 different types of File/Folder open dialog box available. If you are looking for a file to open, the `FileBrowse` is what you want. If you want to save a file, `SaveAs` is the button. If you want to get a folder name, then `FolderBrowse` is the button to use. +There are 3 different types of File/Folder open dialog box available. If you are looking for a file to open, the `FileBrowse` is what you want. If you want to save a file, `SaveAs` is the button. If you want to get a folder name, then `FolderBrowse` is the button to use. To open several files at once, use the `FilesBrowse` button. It will create a list of files that are separated by ';' ![open](https://user-images.githubusercontent.com/13696193/45243804-2b529780-b2c3-11e8-90dc-6c9061db2a1e.jpg) @@ -1457,23 +1565,23 @@ These buttons pop up a standard color chooser window. The result is returned as **Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `SimpleButton`, which closes the form when clicked. +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. -layout = [[sg.SimpleButton('My Button')]] +layout = [[sg.Button('My Button')]] ![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all SimpleButtons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `ReadFormButton`. You also put images on blocking buttons by using `SimpleButton`. +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. - sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) Three parameters are used for button images. @@ -1488,7 +1596,7 @@ Here's an example form made with button images. You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. @@ -1562,17 +1670,16 @@ Another way of using a Progress Meter with PySimpleGUI is to build a custom form ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) - # create the progress bar element - progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + import PySimpleGUI as sg + # layout the form layout = [[sg.Text('A custom progress meter')], - [progress_bar], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], [sg.Cancel()]] # create the form` - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) + form = sg.FlexForm('Custom Progress Meter').Layout(layout) + progress_bar = form.FindElement('progressbar') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked @@ -1580,9 +1687,9 @@ Another way of using a Progress Meter with PySimpleGUI is to build a custom form if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i+1) + progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() + form.CloseNonBlockingForm()) #### Output @@ -1593,22 +1700,27 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Here's a complete solution for a chat-window using an Async form with an Output Element import PySimpleGUI as sg - # Blocking form that doesn't close + + # Blocking form that doesn't close def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + form = sg.FlexForm('Chat Window', default_element_size=(30, 2)).Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + + ChatBot() + ------------------- ## Columns Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. @@ -1946,9 +2058,9 @@ Each lower level overrides the settings of the higher level. Once settings have ## Persistent Forms (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The SimpleButton Element also closes the form. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. -The `ReadFormButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. @@ -1979,13 +2091,6 @@ One example is you have an input field that changes as you press buttons on an o ![keypad 3](https://user-images.githubusercontent.com/13696193/45260275-a2198e80-b3b0-11e8-85fe-a4ce6484510f.jpg) -Another example, a slider or a spinner move changes the size of the text somewhere on the form. - - -![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) - -A final example... changing a text field as a user types into another field. - ### Periodically Calling`ReadNonBlocking` @@ -1999,6 +2104,9 @@ There are 2 methods of interacting with non-blocking forms. With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. #### Exiting a Non-Blocking Form + +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. + Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. The proper code to check if the user has exited the form will be a polling-loop that looks something like this: @@ -2045,7 +2153,7 @@ See the sample code on the GitHub named Demo Media Player for another example of # Create the layout form_rows = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], - [sg.SimpleButton('Quit')]] + [sg.Button('Quit')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! form.LayoutAndRead(form_rows, non_blocking=True) @@ -2071,6 +2179,71 @@ The new thing in this example is the call use of the Update method for the Text Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. +## Updating Elements (changing elements in active form) + +Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). + +The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. + +![snap0272](https://user-images.githubusercontent.com/13696193/45260249-ec4e4000-b3af-11e8-853b-9b29d0bf7797.jpg) + + +In some programs these updates happen in response to another Element. This program takes a Spinner and a Slider's input values and uses them to resize a Text Element. The Spinner and Slider are on the left, the Text element being changed is on the right. + + + + + + # Testing async form, see if can have a slider + # that adjusts the size of text displayed + + import PySimpleGUI as sg + fontSize = 12 + layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), + change_submits=True, key='slider', font=('Helvetica 20')), + sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] + + sz = fontSize + form = sg.FlexForm("Font size selector", grab_anywhere=False).Layout(layout) + # Event Loop + while True: + button, values= form.Read() + if button is None: + break + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + + print("Done.") + + +Inside the event loop we read the value of the Spinner and the Slider using those Elements' keys. +For example, `values['slider']` is the value of the Slider Element. + +This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: + + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + +Remember this design pattern because you will use it OFTEN if you use persistent forms. + +It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: + + text_element = form.FindElement('text') + text_element.Update(font=font) + +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. + + + ## Keyboard & Mouse Capture Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. @@ -2093,7 +2266,7 @@ Key Sym is a string such as 'Control_L'. The Key Code is a numeric representati text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], - [sg.SimpleButton("OK")]] + [sg.Button("OK")]] form.Layout(layout) # ---===--- Loop taking in user input --- # @@ -2115,7 +2288,7 @@ Use realtime keyboard capture by calling with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: layout = [[sg.Text("Hold down a key")], - [sg.SimpleButton("OK")]] + [sg.Button("OK")]] form.Layout(layout) @@ -2162,7 +2335,7 @@ We have an InputText field that we want to update. When the Element was created sg.Input(key='input') -To update or change the value for that Input Element, we use this contruct: +To update or change the value for that Input Element, we use this construct: form.FindElement('input').Update('new text') @@ -2170,6 +2343,17 @@ Using the '.' makes the code shorter. The FindElement call returns an Element. See the Font Sizer demo for example source code. +You can use Update to do things like: +* Have one Element (appear to) make a change to another Element +* Disable a button, slider, input field, etc +* Change a button's text +* Change an Element's text or background color +* Add text to a scrolling output window +* Change the choices in a list +* etc + + + ## Sample Applications Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: @@ -2505,3 +2689,9 @@ The PySimpleGUI window that the results are shown in is an 'input' field which m + + + + + + From a2c6cc3b9f7dc09022162ef6e54f95fb73dd09f7 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 22 Sep 2018 14:00:23 -0400 Subject: [PATCH 434/521] 3.5.1 version info added --- docs/index.md | 17 +++++------------ readme.md | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/docs/index.md b/docs/index.md index c15f91ad4..578ced224 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,7 +7,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.0-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.1-red.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) @@ -2517,7 +2517,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. | 03.04.01 | Sept 18, 2018 - See release notes | 03.05.00 | Sept 20, 2018 - See release notes - +| 03.05.01 | Sept 22, 2018 - See release notes ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -2596,7 +2596,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Auto sizing table widths works now * Feature DELETED - Scaling. Removed from all elements - +#### 3.5.1 +* Bug fix for broken PySimpleGUI if Python version < 3.6 (sorry!) +* LOTS of Readme changes ### Upcoming Make suggestions people! Future release features @@ -2686,12 +2688,3 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. - - - - - - - - - diff --git a/readme.md b/readme.md index c15f91ad4..578ced224 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.0-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.1-red.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) @@ -2517,7 +2517,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. | 03.04.01 | Sept 18, 2018 - See release notes | 03.05.00 | Sept 20, 2018 - See release notes - +| 03.05.01 | Sept 22, 2018 - See release notes ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -2596,7 +2596,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Auto sizing table widths works now * Feature DELETED - Scaling. Removed from all elements - +#### 3.5.1 +* Bug fix for broken PySimpleGUI if Python version < 3.6 (sorry!) +* LOTS of Readme changes ### Upcoming Make suggestions people! Future release features @@ -2686,12 +2688,3 @@ In the hands of a competent programmer, this tool is **amazing**. It's a must- The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. - - - - - - - - - From ee58a41fcc771e8f520123797ce0b785d4e127d6 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 22 Sep 2018 14:34:20 -0400 Subject: [PATCH 435/521] 1/2 way through the Cookbook overhaul --- docs/cookbook.md | 288 ++++++++++++++++++++--------------------------- 1 file changed, 125 insertions(+), 163 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 4e7989c67..5b101c1c2 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -28,7 +28,7 @@ Same GUI screen except the return values are in a list instead of a dictionary a print(button, values[0], values[1], values[2]) ## Simple data entry - Return Values As Dictionary -A simple form with default values. Results returned in a dictionary. Does not use a context manager +A simple form with default values. Results returned in a dictionary. ![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) @@ -61,11 +61,12 @@ Browse for a filename that is populated into the input field. import PySimpleGUI as sg - with sg.FlexForm('SHA-1 & 256 Hash') as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - (button, (source_filename,)) = form.LayoutAndShow(form_rows) + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + (button, (source_filename,)) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) print(button, source_filename) @@ -81,15 +82,15 @@ Quickly add a GUI allowing the user to browse for a filename if a filename is no if len(sys.argv) == 1: button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.Text('Document to open')], - [sg.In(), sg.FileBrowse()], - [sg.Open(), sg.Cancel()]]) + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) else: fname = sys.argv[1] if not fname: sg.Popup("Cancel", "No filename supplied") raise SystemExit("Cancelling: no filename supplied") - + print(button, fname) @@ -97,153 +98,119 @@ Quickly add a GUI allowing the user to browse for a filename if a filename is no ## Compare 2 Files -Browse to get 2 file names that can be then compared. Uses a context manager +Browse to get 2 file names that can be then compared. ![compare 2 files](https://user-images.githubusercontent.com/13696193/43934659-60dc5fbe-9c1e-11e8-8d2b-07c0e3b61892.jpg) import PySimpleGUI as sg - with sg.FlexForm('File Compare') as form: - form_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, values = form.LayoutAndShow(form_rows) - - print(button, values) - ---------------- -## Nearly All Widgets with Green Color Theme with Context Manager -Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, ***the preferred method***. - -![cookbook all elements](https://user-images.githubusercontent.com/13696193/45308495-9bddfc00-b4ef-11e8-9c6a-32edf6b1d925.jpg) - - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] - with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: - - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) -------------- -### All Widgets No Context Manager + form = sg.FlexForm('File Compare') -Same form as above with no Context Manager. Use this pattern when you are in a hurry, don't have time to do things right, or it's throw-away code.... the legit use of this design is when you have non-blocking forms that update the form far away in the code from the form creation. Perhaps you show your form, get some input, then down in your event loop you want to execute another read or have an event loop where form.ReadNonBlocking is called. + button, values = form.LayoutAndRead(form_rows) -Turning your form into forms that use a Contact Manage is quite easy. Change your FlexForm call from + print(button, values) - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) +--------------- +## Nearly All Widgets with Green Color Theme +Example of nearly all of the widgets in a single form. Uses a customized color scheme. -to +![latest everything bagel](https://user-images.githubusercontent.com/13696193/45920376-22d89000-be71-11e8-8ac4-640f011f84d0.jpg) - with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: -Be sure and place the with statement at the top of your GUI code and indent you code under it. + #!/usr/bin/env Python3 import PySimpleGUI as sg sg.ChangeLookAndFeel('GreenTan') - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + # ------ Column Definition ------ # column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3))], [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')], + sg.Column(column1, background_color='#F7F3EC')]])], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] ] - button, values = form.LayoutAndRead(layout) ------------ + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = form.Read() + + sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) + +------------- + ## Non-Blocking Form With Periodic Update -An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. +An async form that has a button read loop. A Text Element is updated periodically with a running timer. Note that `value` is checked for None which indicates the window was closed using X. ![non-blocking](https://user-images.githubusercontent.com/13696193/43955295-70f6ac48-9c6d-11e8-8ea2-e6729ba9330c.jpg) + import PySimpleGUI as sg import time - form = sg.FlexForm('Running Timer') - # create a text element that will be updated periodically form_rows = [[sg.Text('Stopwatch', size=(20, 2), justification='center')], [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] - form.LayoutAndRead(form_rows, non_blocking=True) + form = sg.FlexForm('Running Timer').Layout(form_rows) timer_running = True i = 0 - # loop to process user clicks + # Event Loop while True: i += 1 * (timer_running is True) button, values = form.ReadNonBlocking() if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - elif button == 'Start/Stop': + break + elif button == 'Start/Stop': timer_running = not timer_running form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) time.sleep(.01) - - -------- ## Callback Function Simulation @@ -265,13 +232,13 @@ The architecture of some programs works better with button callbacks instead of def button2(): print('Button 2 callback') - # Create a standard form - form = sg.FlexForm('Button callback example') + # Layout the design of the GUI - layout = [[sg.Text('Please click a button')], - [sg.ReadButton('1'), sg.ReadButton('2'), sg.Quit()]] + layout = [[sg.Text('Please click a button', auto_size_text=True)], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] + # Show the form to the user - form.Layout(layout) + form = sg.FlexForm('Button callback example').Layout(layout) # Event loop. Read buttons, make callbacks while True: @@ -280,13 +247,13 @@ The architecture of some programs works better with button callbacks instead of # Take appropriate action based on button if button == '1': button1() - elif button == '2': + elif button == '2': button2() - elif button =='Quit' or button == None: + elif button =='Quit' or button is None: break # All done! - sg.PopupOk('Done') + sg.PopupOK('Done') ----- ## Realtime Buttons (Good For Raspberry Pi) @@ -296,8 +263,6 @@ This recipe implements a remote control interface for a robot. There are 4 dire import PySimpleGUI as sg - # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) form_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' ' * 10), sg.RealtimeButton('Forward')], @@ -307,7 +272,7 @@ This recipe implements a remote control interface for a robot. There are 4 dire [sg.Quit(button_color=('black', 'orange'))] ] - form.LayoutAndRead(form_rows, non_blocking=True) + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True).Layout(form_rows) # # Some place later in your code... @@ -317,13 +282,13 @@ This recipe implements a remote control interface for a robot. There are 4 dire # your program's main loop while (True): # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() + button, values = form.ReadNonBlocking() if button is not None: print(button) if button == 'Quit' or values is None: break - form.CloseNonBlockingForm() + form.CloseNonBlockingForm() # Don't forget to close your window! --------- @@ -349,21 +314,21 @@ Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your l import PySimpleGUI as sg - with sg.FlexForm('', auto_size_text=True) as form: - with sg.FlexForm('', auto_size_text=True) as form2: + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + form = sg.FlexForm('') + form2 = sg.FlexForm('') - results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), - (form2, layout_tab_2,'Second Tab')) + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2, 'Second Tab')) sg.Popup(results) + ----- ## Button Graphics (Media Player) Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. @@ -381,9 +346,6 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 image_next = './ButtonGraphics/Next.png' image_exit = './ButtonGraphics/Exit.png' - # 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), - font=("Helvetica", 25)) # define layout of the rows layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], @@ -413,20 +375,20 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] - ] - # Call the same LayoutAndRead but indicate the form is non-blocking - form.LayoutAndRead(layout, non_blocking=True) + form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)).Layout(layout) # Our event loop while (True): - # Read the form (this call will not block) + # Read the form (this call will not block) button, values = form.ReadNonBlocking() - if button == 'Exit' or values is None: - break + if button == 'Exit' or values is None: + break # If a button was pressed, display it on the GUI by updating the text element if button: - form.FindElement('output).Update(button) + form.FindElement('output').Update(button) + ---- ## Script Launcher - Persistent Form This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.Button`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. @@ -436,45 +398,42 @@ This form doesn't close after button clicks. To achieve this the buttons are sp import PySimpleGUI as sg import subprocess - def Launcher(): - - form = sg.FlexForm('Script launcher') - - layout = [ - [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20))], - [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], - [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] - ] - - form.Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI --- # - while True: - (button, value) = form.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': - ExecuteCommandSubprocess('pip','list') - elif button == 'script2': - ExecuteCommandSubprocess('python', '--version') - elif button == 'Run': - ExecuteCommandSubprocess(value[0]) - - + # Please check Demo programs for better examples of launchers def ExecuteCommandSubprocess(command, *args): try: - sp = subprocess.Popen([command,*args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + sp = subprocess.Popen([command, *args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() if out: print(out.decode("utf-8")) if err: print(err.decode("utf-8")) - except: pass + except: + pass - if __name__ == '__main__': - Launcher() + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], + [sg.Text('Manual command', size=(15, 1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] + ] + + + form = sg.FlexForm('Script launcher').Layout(layout) + + # ---===--- Loop taking in user input and using it to call scripts --- # + + while True: + (button, value) = form.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip', 'list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) + ---- ## Machine Learning GUI A standard non-blocking GUI with lots of inputs. @@ -488,14 +447,15 @@ A standard non-blocking GUI with lots of inputs. sg.SetOptions(text_justification='right') - form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form - layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), + sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), + sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), + sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)], [sg.Text('_' * 100, size=(65, 1))], [sg.Text('Flags', font=('Helvetica', 15), justification='left')], [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], @@ -509,7 +469,9 @@ A standard non-blocking GUI with lots of inputs. [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], [sg.Submit(), sg.Cancel()]] - button, values = form.LayoutAndRead(layout) + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) + + button, values = form.Read() ------- ## Custom Progress Meter / Progress Bar @@ -526,9 +488,7 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an [sg.Cancel()]] # create the form - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) + form = sg.FlexForm('Custom Progress Meter').Layout(layout) # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked @@ -557,7 +517,7 @@ Instead of layout = [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] + [sg.OK(), sg.Cancel()]] button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) @@ -565,10 +525,12 @@ you can write this line of code for the exact same result (OK, two lines with th import PySimpleGUI as sg - button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + button, (filename,) = sg.FlexForm('Get filename example').LayoutAndRead( + [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) + -------------------- ## Multiple Columns -Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. +Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. @@ -597,8 +559,7 @@ To make it easier to see the Column in the window, the Column background has bee [sg.OK()]] # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. + button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) sg.Popup(button, values, line_width=200) @@ -1292,3 +1253,4 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th graph.DrawPoint((x,y), color='red') button, values = form.Read() + From 0deb89c213074a58798d4bdffc35c902767054e8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 22 Sep 2018 14:52:39 -0400 Subject: [PATCH 436/521] Cookbook - updated to new best-practices --- docs/cookbook.md | 307 +++++++++++++++++++++-------------------------- 1 file changed, 138 insertions(+), 169 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 5b101c1c2..b2533994f 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -575,9 +575,6 @@ This simple program keep a form open, taking input values until the user termina import PySimpleGUI as sg - form = sg.FlexForm('Math') - - layout = [ [sg.Txt('Enter values to calculate')], [sg.In(size=(8,1), key='numerator')], [sg.Txt('_' * 10)], @@ -585,7 +582,7 @@ This simple program keep a form open, taking input values until the user termina [sg.Txt('', size=(8,1), key='output') ], [sg.ReadButton('Calculate', bind_return_key=True)]] - form.Layout(layout) + form = sg.FlexForm('Math').Layout(layout) while True: button, values = form.Read() @@ -612,6 +609,8 @@ The Canvas Element is one of the few tkinter objects that are directly accessibl tkcanvas = can.TKCanvas tkcanvas.create_oval(50, 50, 100, 100) +While it's fun to scribble on a Canvas Widget, try Graph Element makes it a downright pleasant experience. You do not have to worry about the tkinter coordinate system and can instead work in your own coordinate system. + ![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) @@ -634,11 +633,50 @@ The Canvas Element is one of the few tkinter objects that are directly accessibl button, values = form.Read() if button is None: break - if button == 'Blue': + if button == 'Blue': canvas.TKCanvas.itemconfig(cir, fill="Blue") elif button == 'Red': canvas.TKCanvas.itemconfig(cir, fill="Red") +## Graph Element - drawing circle, rectangle, etc, objects + +Just like you can draw on a tkinter widget, you can also draw on a Graph Element. Graph Elements are easier on the programmer as you get to work in your own coordinate system. + +![graph recipe](https://user-images.githubusercontent.com/13696193/45920640-751bb000-be75-11e8-9530-45b71cbae07d.jpg) + + + import PySimpleGUI as sg + + layout = [ + [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], + [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] + ] + + form = sg.FlexForm('Graph test') + form.Layout(layout) + form.Finalize() + + graph = form.FindElement('graph') + circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') + point = graph.DrawPoint((75,75), 10, color='green') + oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) + rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) + line = graph.DrawLine((0,0), (100,100)) + + while True: + button, values = form.Read() + if button is None: + break + if button is 'Blue': + graph.TKCanvas.itemconfig(circle, fill = "Blue") + elif button is 'Red': + graph.TKCanvas.itemconfig(circle, fill = "Red") + elif button is 'Move': + graph.MoveFigure(point, 10,10) + graph.MoveFigure(circle, 10,10) + graph.MoveFigure(oval, 10,10) + graph.MoveFigure(rectangle, 10,10) + ## Keypad Touchscreen Entry - Input Element Update @@ -675,25 +713,24 @@ There are a number of features used in this Recipe including: [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], ] - form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False) - form.Layout(layout) + form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) # Loop forever reading the form's values, updating the Input field keys_entered = '' while True: button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit - break - if button == 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button == 'Submit': - keys_entered = values['input'] - form.FindElement('out').Update(keys_entered) # output the final string - - form.FindElement('input').Update(keys_entered) # change the form to reflect current key string + if button is None: # if the X button clicked, just exit + break + if button == 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button == 'Submit': + keys_entered = values['input'] + form.FindElement('out').Update(keys_entered) # output the final string + + form.FindElement('input').Update(keys_entered) # change the form to reflect current key string ## Animated Matplotlib Graph @@ -711,124 +748,51 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to import tkinter as Tk - def main(): - fig = Figure() + fig = Figure() - ax = fig.add_subplot(111) - ax.set_xlabel("X axis") - ax.set_ylabel("Y axis") - ax.grid() - - layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [g.Canvas(size=(640, 480), key='canvas')], - [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - - # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.ReadNonBlocking() - - canvas_elem = form.FindElement('canvas') + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() - graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) - canvas = canvas_elem.TKCanvas + layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + [g.Canvas(size=(640, 480), key='canvas')], + [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - dpts = [randint(0, 10) for x in range(10000)] - for i in range(len(dpts)): - button, values = form.ReadNonBlocking() - if button == 'Exit' or values is None: - exit(69) - - ax.cla() - ax.grid() + # create the form and show it without the plot - ax.plot(range(20), dpts[i:i + 20], color='purple') - graph.draw() - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - canvas.create_image(640 / 2, 480 / 2, image=photo) + form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) + form.Finalize() # needed to access the canvas element prior to reading the form - figure_canvas_agg = FigureCanvasAgg(fig) - figure_canvas_agg.draw() + canvas_elem = form.FindElement('canvas') - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - # time.sleep(.1) - - if __name__ == '__main__': - main() + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas -## Tables - -While there is no official support for "Tables" (e.g. there is no Table Element), it is possible to display information in a tabular way. This only works for smaller tables because there is no way to scroll a window or a column element. Until scrollable columns are implemented there is little use in creating a Table Element. - -This Recipe contains a number of concepts beyond just tables. It has menus, and 'realtime' keyboard input. Working with large numbers of elements takes time to layout. Once laid out it should be OK. - - -![table 2](https://user-images.githubusercontent.com/13696193/45310830-5de3d680-b4f5-11e8-925a-7c2a7b8b1922.jpg) + dpts = [randint(0, 10) for x in range(10000)] + # Our event loop + for i in range(len(dpts)): + button, values = form.ReadNonBlocking() + if button == 'Exit' or values is None: + exit(69) + ax.cla() + ax.grid() + ax.plot(range(20), dpts[i:i + 20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - import PySimpleGUI as sg + canvas.create_image(640 / 2, 480 / 2, image=photo) - menu_def = [['File', ['Open', 'Save', 'Exit']], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], - ['Help', 'About...'],] + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() - sg.SetOptions(element_padding=(0,0)) - layout = [ [sg.Menu(menu_def)], - [sg.T('Table Using Combos and Input Elements', font='Any 18')], - [sg.T('Row, Cal to change'), - sg.In(key='inputrow', justification='right', size=(8,1), pad=(1,1), do_not_clear=True), - sg.In(key='inputcol', size=(8,1), pad=(1,1), justification='right', do_not_clear=True), - sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)]] - - for i in range(20): - inputs = [sg.In(size=(18, 1), pad=(1, 1), justification='right', key=(i,j), do_not_clear=True) for j in range(10)] - line = [sg.Combo(('Customer ID', 'Customer Name', 'Customer Info'))] - line.append(inputs) - layout.append(inputs) - - form = sg.FlexForm('Table', return_keyboard_events=True, grab_anywhere=False) - form.Layout(layout) + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - while True: - button, values = form.Read() - if button is None: - break - if button == 'Open': - filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) - if filename is not None: - with open(filename, "r") as infile: - reader = csv.reader(infile) - # first_row = next(reader, None) # skip the headers - data = list(reader) # read everything else into a list of rows - sg.Print(data) - for i, row in enumerate(data): - for j, item in enumerate(row): - print(i,j, item) - # form.FindElement(key=(i,j)).Update(item) - location = (i,j) - try: - # location = (int(values['inputrow']), int(values['inputcol'])) - target_element = form.FindElement(location) - new_value = item - # new_value = values['value'] - if target_element is not None and new_value != '': - target_element.Update(new_value) - except: - pass - if button == 'Exit': - break - try: - location = (int(values['inputrow']), int(values['inputcol'])) - target_element = form.FindElement(location) - new_value = values['value'] - if target_element is not None and new_value != '': - target_element.Update(new_value) - except: - pass ## Tight Layout with Button States @@ -855,43 +819,49 @@ In other GUI frameworks this program would be most likely "event driven" with ca 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadButton('Start', button_color=('white', 'black'), key='start'), - sg.ReadButton('Stop', button_color=('gray34', 'black'), key='stop'), - sg.ReadButton('Reset', button_color=('gray', 'firebrick3'), key='reset'), - sg.ReadButton('Submit', button_color=('gray34', 'springgreen4'), key='submit')] + [sg.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), + sg.ReadFormButton('Stop', button_color=('white', 'black'), key='Stop'), + sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] ] form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1)) form.Layout(layout) + form.Finalize() + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Reset').Update(disabled=True) + form.FindElement('Submit').Update(disabled=True) recording = have_data = False while True: button, values = form.Read() + print(button) if button is None: exit(69) - if button == 'Start': - form.FindElement('start').Update(button_color=('gray34','black')) - form.FindElement('stop').Update(button_color=('white', 'black')) - form.FindElement('reset').Update(button_color=('white', 'firebrick3')) + if button is 'Start': + form.FindElement('Start').Update(disabled=True) + form.FindElement('Stop').Update(disabled=False) + form.FindElement('Reset').Update(disabled=False) + form.FindElement('Submit').Update(disabled=True) recording = True - elif button == 'Stop' and recording: - form.FindElement('stop').Update(button_color=('gray34','black')) - form.FindElement('start').Update(button_color=('white', 'black')) - form.FindElement('submit').Update(button_color=('white', 'springgreen4')) + elif button is 'Stop' and recording: + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Start').Update(disabled=False) + form.FindElement('Submit').Update(disabled=False) recording = False - have_data = True - elif button == 'Reset': - form.FindElement('stop').Update(button_color=('gray34','black')) - form.FindElement('start').Update(button_color=('white', 'black')) - form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) - form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) + have_data = True + elif button is 'Reset': + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Start').Update(disabled=False) + form.FindElement('Submit').Update(disabled=True) + form.FindElement('Reset').Update(disabled=False) recording = False - have_data = False - elif button == 'Submit' and have_data: - form.FindElement('stop').Update(button_color=('gray34','black')) - form.FindElement('start').Update(button_color=('white', 'black')) - form.FindElement('submit').Update(button_color=('gray34', 'springgreen4')) - form.FindElement('reset').Update(button_color=('gray34', 'firebrick3')) + have_data = False + elif button is 'Submit' and have_data: + form.FindElement('Stop').Update(disabled=True) + form.FindElement('Start').Update(disabled=False) + form.FindElement('Submit').Update(disabled=True) + form.FindElement('Reset').Update(disabled=False) recording = False ## Password Protection For Scripts @@ -924,8 +894,8 @@ Use the upper half to generate your hash code. Then paste it into the code in t ] form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), - text_justification='r', return_keyboard_events=True, grab_anywhere=False) - form.Layout(layout) + text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) + while True: button, values = form.Read() @@ -1020,9 +990,7 @@ You can easily change colors to match your background by changing a couple of pa sg.Button('EXIT', button_color=('white','firebrick3'))], [sg.T('', text_color='white', size=(50,1), key='output')]] - form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True) - - form.Layout(layout) + form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) # ---===--- Loop taking in user input (buttons) --- # while True: @@ -1092,8 +1060,8 @@ Much of the code is handling the button states in a fancy way. It could be much sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - form.Layout(form_rows) + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) + # ---------------- main loop ---------------- current_time = 0 @@ -1156,8 +1124,8 @@ The spinner changes the number of seconds between reads. Note that you will get [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - form.Layout(form_rows) + form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(form_rows) + # ---------------- main loop ---------------- while (True): @@ -1169,7 +1137,7 @@ The spinner changes the number of seconds between reads. Note that you will get break try: interval = int(values['spin']) - except: + except: interval = 1 cpu_percent = psutil.cpu_percent(interval=interval) @@ -1193,35 +1161,35 @@ If you double click the dashed line at the top of the list of choices, that menu ![tear off](https://user-images.githubusercontent.com/13696193/45307668-9aabcf80-b4ed-11e8-9b2b-8564d4bf82a8.jpg) + import PySimpleGUI as sg sg.ChangeLookAndFeel('LightGreen') sg.SetOptions(element_padding=(0, 0)) # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save',]], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], - ['Help', 'About...'],] + menu_def = [['File', ['Open', 'Save', 'Exit' ]], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] # ------ GUI Defintion ------ # layout = [ - [sg.Menu(menu_def)], - [sg.Output(size=(60,20))] - ] + [sg.Menu(menu_def)], + [sg.Output(size=(60, 20))] + ] form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12, 1)) - form.Layout(layout) + default_button_element_size=(12, 1)).Layout(layout) # ------ Loop & Process button menu choices ------ # while True: button, values = form.Read() if button == None or button == 'Exit': - return - print('Button = ', button) + break + print('Button = ', button) # ------ Process menu choices ------ # - if button == 'About...': - sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...') + if button == 'About...': + sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') elif button == 'Open': filename = sg.PopupGetFile('file to open', no_window=True) print(filename) @@ -1254,3 +1222,4 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th button, values = form.Read() + From eec0283461a558e6c282c157586432a6d6cf60b9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 22 Sep 2018 22:45:21 -0400 Subject: [PATCH 437/521] Fix for not properly filling form elements inside of Frame Element --- PySimpleGUI.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 98472d7eb..d1f7b02c6 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2435,17 +2435,12 @@ def FillSubformWithValues(form, values_dict): value = None if element.Type == ELEM_TYPE_COLUMN: FillSubformWithValues(element, values_dict) - try: - value = values_dict[element.Key] - except: - continue if element.Type == ELEM_TYPE_FRAME: FillSubformWithValues(element, values_dict) try: value = values_dict[element.Key] except: continue - if element.Type == ELEM_TYPE_INPUT_TEXT: element.Update(value) elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: From ae661d27f26db773bb4397f1ddd221fd9c832c24 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 11:37:37 -0400 Subject: [PATCH 438/521] Added Recipe to create EXE file using PyInstaller --- docs/cookbook.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index b2533994f..008ec67aa 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -547,7 +547,7 @@ To make it easier to see the Column in the window, the Column background has bee # Prior to the Column element, this layout was not possible # Columns layouts look identical to form layouts, they are a list of lists of elements. - # sg.ChangeLookAndFeel('BlueMono') + sg.ChangeLookAndFeel('BlueMono') # Column layout col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], @@ -624,7 +624,7 @@ While it's fun to scribble on a Canvas Widget, try Graph Element makes it a down form = sg.FlexForm('Canvas test') form.Layout(layout) - form.ReadNonBlocking() + form.Finalize() canvas = form.FindElement('canvas') cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) @@ -1223,3 +1223,25 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th button, values = form.Read() +## Creating a Windows .EXE File + +It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. + +Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) + + pip install PySimpleGUI + pip install PyInstaller + +To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: + + pyinstaller -wF my_program.py + +You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. + +That's all... Run your `my_program.exe` file on the Windows machine of your choosing. + +> "It's just that easy." +> +(famous last words that screw up just about anything being referenced) + +Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. From 50261625a45c08693b7ce3a2130c79faa8254de0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 12:10:25 -0400 Subject: [PATCH 439/521] Addec chaining capability to Finalize method... more compacting the user's code! --- PySimpleGUI.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d1f7b02c6..4d9fab538 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2001,9 +2001,23 @@ def ReadNonBlocking(self, Message=''): # return None, None return BuildResults(self, False, self) + + def Finalize(self): + if self.TKrootDestroyed: + return self + if not self.Shown: + self.Show(non_blocking=True) + try: + rc = self.TKroot.update() + except: + self.TKrootDestroyed = True + _my_windows.Decrement() + # return None, None + return self + # Another name for ReadNonBlocking. PrepareForUpdate = ReadNonBlocking - Finalize = ReadNonBlocking + # Finalize = ReadNonBlocking PreRead = ReadNonBlocking From 7e00dd16fe069de15729d063a810a01195289140 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 12:16:50 -0400 Subject: [PATCH 440/521] RELEASE 3.5.2 --- Demo_All_Widgets.py | 2 - Demo_Button_Click.py | 5 +- Demo_Button_States.py | 77 ++-- Demo_Canvas.py | 4 +- Demo_Chatterbot.py | 35 +- Demo_Desktop_Widget_CPU_Graph.py | 3 +- Demo_Disable_Elements.py | 8 +- Demo_Font_Sizer.py | 2 +- Demo_Func_Callback_Simulation.py | 36 +- Demo_Graph_Drawing.py | 5 +- Demo_Graph_Element_Sine_Wave.py | 5 +- Demo_Graph_Noise.py | 5 +- Demo_Matplotlib.py | 9 +- Demo_Ping_Line_Graph.py | 587 ++++++++++++++++++++++++++++++- Demo_Pong.py | 7 +- Demo_Super_Simple_Form.py | 18 +- Demo_Tabbed_Form.py | 142 ++++---- docs/index.md | 12 +- readme.md | 12 +- 19 files changed, 744 insertions(+), 230 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 6a83153ea..bf81163db 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -3,13 +3,11 @@ sg.ChangeLookAndFeel('GreenTan') - # ------ Menu Definition ------ # menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], ['Help', 'About...'], ] - # ------ Column Definition ------ # column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], diff --git a/Demo_Button_Click.py b/Demo_Button_Click.py index 4a4ba3063..2dfa029c6 100644 --- a/Demo_Button_Click.py +++ b/Demo_Button_Click.py @@ -12,10 +12,7 @@ sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='submit')] ] -form = sg.FlexForm("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1)) -form.Layout(layout) -form.Finalize() # only needed if want to diable elements prior to showing form +form = sg.FlexForm("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1)).Layout(layout).Finalize() form.FindElement('submit').Update(disabled=True) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index e0198d82f..e3a9cfb77 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -1,58 +1,31 @@ import PySimpleGUI as sg -""" -Demonstrates using a "tight" layout with a Dark theme. -Shows how button states can be controlled by a user application. The program manages the disabled/enabled -states for buttons and changes the text color to show greyed-out (disabled) buttons -""" -sg.ChangeLookAndFeel('Dark') -sg.SetOptions(element_padding=(0,0)) +sg.ChangeLookAndFeel('LightGreen') +sg.SetOptions(element_padding=(0, 0)) -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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), - sg.ReadFormButton('Stop', button_color=('white', 'black'), key='Stop'), - sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] - ] +# ------ Menu Definition ------ # +menu_def = [['File', ['Open', 'Save', 'Exit' ]], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] -form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1)) -form.Layout(layout) -form.Finalize() -form.FindElement('Stop').Update(disabled=True) -form.FindElement('Reset').Update(disabled=True) -form.FindElement('Submit').Update(disabled=True) -recording = have_data = False +# ------ GUI Defintion ------ # +layout = [ + [sg.Menu(menu_def)], + [sg.Output(size=(60, 20))] +] + +form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12, 1)).Layout(layout) + +# ------ Loop & Process button menu choices ------ # while True: button, values = form.Read() - print(button) - if button is None: - exit(69) - if button is 'Start': - form.FindElement('Start').Update(disabled=True) - form.FindElement('Stop').Update(disabled=False) - form.FindElement('Reset').Update(disabled=False) - form.FindElement('Submit').Update(disabled=True) - recording = True - elif button is 'Stop' and recording: - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Start').Update(disabled=False) - form.FindElement('Submit').Update(disabled=False) - recording = False - have_data = True - elif button is 'Reset': - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Start').Update(disabled=False) - form.FindElement('Submit').Update(disabled=True) - form.FindElement('Reset').Update(disabled=False) - recording = False - have_data = False - elif button is 'Submit' and have_data: - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Start').Update(disabled=False) - form.FindElement('Submit').Update(disabled=True) - form.FindElement('Reset').Update(disabled=False) - recording = False - + if button == None or button == 'Exit': + break + print('Button = ', button) + # ------ Process menu choices ------ # + if button == 'About...': + sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') + elif button == 'Open': + filename = sg.PopupGetFile('file to open', no_window=True) + print(filename) \ No newline at end of file diff --git a/Demo_Canvas.py b/Demo_Canvas.py index 05156c7ed..cbe01caa2 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -6,9 +6,7 @@ [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue')] ] -form = sg.FlexForm('Canvas test') -form.Layout(layout) -form.Finalize() +form = sg.FlexForm('Canvas test').Layout(layout).Finalize() cir = form.FindElement('canvas').TKCanvas.create_oval(50, 50, 100, 100) diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index f7936482d..12832a46a 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -12,6 +12,7 @@ # Create the 'Trainer GUI' # The Trainer GUI consists of a lot of progress bars stacked on top of each other sg.ChangeLookAndFeel('GreenTan') +sg.DebugWin() MAX_PROG_BARS = 20 # number of training sessions bars = [] texts = [] @@ -21,8 +22,7 @@ texts.append(sg.T(' ' * 20, size=(20, 1), justification='right')) training_layout += [[texts[i], bars[i]],] # add a single row -training_form = sg.FlexForm('Training') -training_form.Layout(training_layout) +training_form = sg.FlexForm('Training').Layout(training_layout) current_bar = 0 # callback function for training runs @@ -50,19 +50,20 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar chatbot.train("chatterbot.corpus.english") ################# GUI ################# -with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: - layout = [[sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), - sg.ReadFormButton('SEND', bind_return_key=True), sg.ReadFormButton('EXIT')]] - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, (value,) = form.Read() - if button is not 'SEND': - break - string = value.rstrip() - print(' '+string) - # send the user input to chatbot to get a response - response = chatbot.get_response(value.rstrip()) - print(response) \ No newline at end of file +layout = [[sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.ReadFormButton('SEND', bind_return_key=True), sg.ReadFormButton('EXIT')]] + +form = sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)).Layout(layout) + +# ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # +while True: + button, (value,) = form.Read() + if button is not 'SEND': + break + string = value.rstrip() + print(' '+string) + # send the user input to chatbot to get a response + response = chatbot.get_response(value.rstrip()) + print(response) \ No newline at end of file diff --git a/Demo_Desktop_Widget_CPU_Graph.py b/Demo_Desktop_Widget_CPU_Graph.py index ddc6663ad..3456ce3ef 100644 --- a/Demo_Desktop_Widget_CPU_Graph.py +++ b/Demo_Desktop_Widget_CPU_Graph.py @@ -36,8 +36,7 @@ def main(): layout = [ [sg.Quit( button_color=('white','black')), sg.T('', pad=((100,0),0), font='Any 15', key='output')], [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,SAMPLE_MAX),background_color='black', key='graph')],] - form = sg.FlexForm('CPU Graph', grab_anywhere=True, keep_on_top=True, background_color='black', no_titlebar=True, use_default_focus=False) - form.Layout(layout) + form = sg.FlexForm('CPU Graph', grab_anywhere=True, keep_on_top=True, background_color='black', no_titlebar=True, use_default_focus=False).Layout(layout) graph = form.FindElement('graph') output = form.FindElement('output') diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index cf351a8f8..aed848078 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -20,13 +20,9 @@ sg.ReadFormButton('Values', button_color=('white', 'springgreen4')), 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("Disable Elements Demo", default_element_size=(12, 1), text_justification='r', auto_size_text=False, auto_size_buttons=False, keep_on_top=True, grab_anywhere=False, - default_button_element_size=(12, 1)) - -form.Layout(layout) - -form.Finalize() + default_button_element_size=(12, 1)).Layout(layout).Finalize() form.FindElement('cbox').Update(disabled=True) form.FindElement('listbox').Update(disabled=True) diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index e79e686e4..d030af938 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -11,7 +11,7 @@ form.Layout(layout) while True: button, values= form.Read() - if button is None: + if button is None or button == 'Quit': break sz_spin = int(values['spin']) sz_slider = int(values['slider']) diff --git a/Demo_Func_Callback_Simulation.py b/Demo_Func_Callback_Simulation.py index 198337c3c..a3f5df846 100644 --- a/Demo_Func_Callback_Simulation.py +++ b/Demo_Func_Callback_Simulation.py @@ -1,36 +1,14 @@ import PySimpleGUI as sg -# This design pattern simulates button callbacks -# Note that callbacks are NOT a part of the package's interface to the -# caller intentionally. The underlying implementation actually does use -# tkinter callbacks. They are simply hidden from the user. +layout = [[sg.Text('Filename', )], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()]] -# The callback functions -def button1(): - print('Button 1 callback') +button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) -def button2(): - print('Button 2 callback') -# Create a standard form -form = sg.FlexForm('Button callback example') -# Layout the design of the GUI -layout = [[sg.Text('Please click a button', auto_size_text=True)], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] -# Show the form to the user -form.Layout(layout) -# Event loop. Read buttons, make callbacks -while True: - # Read the form - button, value = form.Read() - # Take appropriate action based on button - if button == '1': - button1() - elif button == '2': - button2() - elif button =='Quit' or button is None: - break +import PySimpleGUI as sg -# All done! -sg.PopupOK('Done') +button, (filename,) = sg.FlexForm('Get filename example').LayoutAndRead( + [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) \ No newline at end of file diff --git a/Demo_Graph_Drawing.py b/Demo_Graph_Drawing.py index fc4ca3c82..de8a82f70 100644 --- a/Demo_Graph_Drawing.py +++ b/Demo_Graph_Drawing.py @@ -5,15 +5,14 @@ [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] ] -form = sg.FlexForm('Canvas test') -form.Layout(layout) -form.Finalize() +form = sg.FlexForm('Graph test').Layout(layout).Finalize() graph = form.FindElement('graph') circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') point = graph.DrawPoint((75,75), 10, color='green') oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) +line = graph.DrawLine((0,0), (100,100)) while True: button, values = form.Read() diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py index 0d4510672..5d922fde5 100644 --- a/Demo_Graph_Element_Sine_Wave.py +++ b/Demo_Graph_Element_Sine_Wave.py @@ -1,10 +1,9 @@ import math import PySimpleGUI as sg -layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] +layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph', tooltip='This is a cool graph!')],] -form = sg.FlexForm('Graph of Sine Function').Layout(layout) -form.Finalize() +form = sg.FlexForm('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize() graph = form.FindElement('graph') graph.DrawLine((-100,0), (100,0)) diff --git a/Demo_Graph_Noise.py b/Demo_Graph_Noise.py index da52464d9..fbef4bc41 100644 --- a/Demo_Graph_Noise.py +++ b/Demo_Graph_Noise.py @@ -31,10 +31,7 @@ def main(): layout = [ [sg.Quit( button_color=('white','black'))], [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,SAMPLE_MAX),background_color='black', key='graph')],] - form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) - form.Layout(layout) - - form.Finalize() + form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False).Layout(layout).Finalize() graph = form.FindElement('graph') prev_response_time = None diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 8b5d334dc..7b2553f76 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -107,19 +107,16 @@ def draw_figure(canvas, figure, loc=(0, 0)): # information to display. # # --------------------------------------------------------------------------------# figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds -canvas_elem = sg.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on # define the form layout layout = [[sg.Text('Plot test')], - [canvas_elem], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] # create the form and show it without the plot -form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') -form.Layout(layout) -form.ReadNonBlocking() +form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() # add the plot to the window -fig_photo = draw_figure(canvas_elem.TKCanvas, fig) +fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) # show it all again and get buttons button, values = form.Read() diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py index 1faa97540..ef6e2f4db 100644 --- a/Demo_Ping_Line_Graph.py +++ b/Demo_Ping_Line_Graph.py @@ -1,8 +1,587 @@ -import ping from threading import Thread import time import PySimpleGUI as sg +# !/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" + A pure python ping implementation using raw sockets. + + (This is Python 3 port of https://github.com/jedie/python-ping) + (Tested and working with python 2.7, should work with 2.6+) + + Note that ICMP messages can only be sent from processes running as root + (in Windows, you must run this script as 'Administrator'). + + Derived from ping.c distributed in Linux's netkit. That code is + copyright (c) 1989 by The Regents of the University of California. + That code is in turn derived from code written by Mike Muuss of the + US Army Ballistic Research Laboratory in December, 1983 and + placed in the public domain. They have my thanks. + + Bugs are naturally mine. I'd be glad to hear about them. There are + certainly word - size dependencies here. + + Copyright (c) Matthew Dixon Cowles, . + Distributable under the terms of the GNU General Public License + version 2. Provided with no warranties of any sort. + + Original Version from Matthew Dixon Cowles: + -> ftp://ftp.visi.com/users/mdc/ping.py + + Rewrite by Jens Diemer: + -> http://www.python-forum.de/post-69122.html#69122 + + Rewrite by George Notaras: + -> http://www.g-loaded.eu/2009/10/30/python-ping/ + + Enhancements by Martin Falatic: + -> http://www.falatic.com/index.php/39/pinging-with-python + + Enhancements and fixes by Georgi Kolev: + -> http://github.com/jedie/python-ping/ + + Bug fix by Andrejs Rozitis: + -> http://github.com/rozitis/python-ping/ + + Revision history + ~~~~~~~~~~~~~~~~ + May 1, 2014 + ----------- + Little modifications by Mohammad Emami + - Added Python 3 support. For now this project will just support + python 3.x + - Tested with python 3.3 + - version was upped to 0.6 + + March 19, 2013 + -------------- + * Fixing bug to prevent divide by 0 during run-time. + + January 26, 2012 + ---------------- + * Fixing BUG #4 - competability with python 2.x [tested with 2.7] + - Packet data building is different for 2.x and 3.x. + 'cose of the string/bytes difference. + * Fixing BUG #10 - the multiple resolv issue. + - When pinging domain names insted of hosts (for exmaple google.com) + you can get different IP every time you try to resolv it, we should + resolv the host only once and stick to that IP. + * Fixing BUGs #3 #10 - Doing hostname resolv only once. + * Fixing BUG #14 - Removing all 'global' stuff. + - You should not use globul! Its bad for you...and its not thread safe! + * Fix - forcing the use of different times on linux/windows for + more accurate mesurments. (time.time - linux/ time.clock - windows) + * Adding quiet_ping function - This way we'll be able to use this script + as external lib. + * Changing default timeout to 3s. (1second is not enought) + * Switching data syze to packet size. It's easyer for the user to ignore the + fact that the packet headr is 8b and the datasize 64 will make packet with + size 72. + + October 12, 2011 + -------------- + Merged updates from the main project + -> https://github.com/jedie/python-ping + + September 12, 2011 + -------------- + Bugfixes + cleanup by Jens Diemer + Tested with Ubuntu + Windows 7 + + September 6, 2011 + -------------- + Cleanup by Martin Falatic. Restored lost comments and docs. Improved + functionality: constant time between pings, internal times consistently + use milliseconds. Clarified annotations (e.g., in the checksum routine). + Using unsigned data in IP & ICMP header pack/unpack unless otherwise + necessary. Signal handling. Ping-style output formatting and stats. + + August 3, 2011 + -------------- + Ported to py3k by Zach Ware. Mostly done by 2to3; also minor changes to + deal with bytes vs. string changes (no more ord() in checksum() because + >source_string< is actually bytes, added .encode() to data in + send_one_ping()). That's about it. + + March 11, 2010 + -------------- + changes by Samuel Stauffer: + - replaced time.clock with default_timer which is set to + time.clock on windows and time.time on other systems. + + November 8, 2009 + ---------------- + Improved compatibility with GNU/Linux systems. + + Fixes by: + * George Notaras -- http://www.g-loaded.eu + Reported by: + * Chris Hallman -- http://cdhallman.blogspot.com + + Changes in this release: + - Re-use time.time() instead of time.clock(). The 2007 implementation + worked only under Microsoft Windows. Failed on GNU/Linux. + time.clock() behaves differently under the two OSes[1]. + + [1] http://docs.python.org/library/time.html#time.clock + + May 30, 2007 + ------------ + little rewrite by Jens Diemer: + - change socket asterisk import to a normal import + - replace time.time() with time.clock() + - delete "return None" (or change to "return" only) + - in checksum() rename "str" to "source_string" + + December 4, 2000 + ---------------- + Changed the struct.pack() calls to pack the checksum and ID as + unsigned. My thanks to Jerome Poincheval for the fix. + + November 22, 1997 + ----------------- + Initial hack. Doesn't do much, but rather than try to guess + what features I (or others) will want in the future, I've only + put in what I need now. + + December 16, 1997 + ----------------- + For some reason, the checksum bytes are in the wrong order when + this is run under Solaris 2.X for SPARC but it works right under + Linux x86. Since I don't know just what's wrong, I'll swap the + bytes always and then do an htons(). + + =========================================================================== + IP header info from RFC791 + -> http://tools.ietf.org/html/rfc791) + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |Version| IHL |Type of Service| Total Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Identification |Flags| Fragment Offset | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time to Live | Protocol | Header Checksum | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Options | Padding | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + =========================================================================== + ICMP Echo / Echo Reply Message header info from RFC792 + -> http://tools.ietf.org/html/rfc792 + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type | Code | Checksum | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Identifier | Sequence Number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Data ... + +-+-+-+-+- + + =========================================================================== + ICMP parameter info: + -> http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml + + =========================================================================== + An example of ping's typical output: + + PING heise.de (193.99.144.80): 56 data bytes + 64 bytes from 193.99.144.80: icmp_seq=0 ttl=240 time=127 ms + 64 bytes from 193.99.144.80: icmp_seq=1 ttl=240 time=127 ms + 64 bytes from 193.99.144.80: icmp_seq=2 ttl=240 time=126 ms + 64 bytes from 193.99.144.80: icmp_seq=3 ttl=240 time=126 ms + 64 bytes from 193.99.144.80: icmp_seq=4 ttl=240 time=127 ms + + ----heise.de PING Statistics---- + 5 packets transmitted, 5 packets received, 0.0% packet loss + round-trip (ms) min/avg/max/med = 126/127/127/127 + + =========================================================================== +""" + +# =============================================================================# +import argparse +import os, sys, socket, struct, select, time, signal + +__description__ = 'A pure python ICMP ping implementation using raw sockets.' + +if sys.platform == "win32": + # On Windows, the best timer is time.clock() + default_timer = time.clock +else: + # On most other platforms the best timer is time.time() + default_timer = time.time + +NUM_PACKETS = 3 +PACKET_SIZE = 64 +WAIT_TIMEOUT = 3.0 + +# =============================================================================# +# ICMP parameters + +ICMP_ECHOREPLY = 0 # Echo reply (per RFC792) +ICMP_ECHO = 8 # Echo request (per RFC792) +ICMP_MAX_RECV = 2048 # Max size of incoming buffer + +MAX_SLEEP = 1000 + + +class MyStats: + thisIP = "0.0.0.0" + pktsSent = 0 + pktsRcvd = 0 + minTime = 999999999 + maxTime = 0 + totTime = 0 + avrgTime = 0 + fracLoss = 1.0 + + +myStats = MyStats # NOT Used globally anymore. + + +# =============================================================================# +def checksum(source_string): + """ + A port of the functionality of in_cksum() from ping.c + Ideally this would act on the string as a series of 16-bit ints (host + packed), but this works. + Network data is big-endian, hosts are typically little-endian + """ + countTo = (int(len(source_string) / 2)) * 2 + sum = 0 + count = 0 + + # Handle bytes in pairs (decoding as short ints) + loByte = 0 + hiByte = 0 + while count < countTo: + if (sys.byteorder == "little"): + loByte = source_string[count] + hiByte = source_string[count + 1] + else: + loByte = source_string[count + 1] + hiByte = source_string[count] + try: # For Python3 + sum = sum + (hiByte * 256 + loByte) + except: # For Python2 + sum = sum + (ord(hiByte) * 256 + ord(loByte)) + count += 2 + + # Handle last byte if applicable (odd-number of bytes) + # Endianness should be irrelevant in this case + if countTo < len(source_string): # Check for odd length + loByte = source_string[len(source_string) - 1] + try: # For Python3 + sum += loByte + except: # For Python2 + sum += ord(loByte) + + sum &= 0xffffffff # Truncate sum to 32 bits (a variance from ping.c, which + # uses signed ints, but overflow is unlikely in ping) + + sum = (sum >> 16) + (sum & 0xffff) # Add high 16 bits to low 16 bits + sum += (sum >> 16) # Add carry from above (if any) + answer = ~sum & 0xffff # Invert and truncate to 16 bits + answer = socket.htons(answer) + + return answer + + +# =============================================================================# +def do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size, quiet=False): + """ + Returns either the delay (in ms) or None on timeout. + """ + delay = None + + try: # One could use UDP here, but it's obscure + mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname("icmp")) + except socket.error as e: + print("failed. (socket error: '%s')" % e.args[1]) + raise # raise the original error + + my_ID = os.getpid() & 0xFFFF + + sentTime = send_one_ping(mySocket, destIP, my_ID, mySeqNumber, packet_size) + if sentTime == None: + mySocket.close() + return delay + + myStats.pktsSent += 1 + + recvTime, dataSize, iphSrcIP, icmpSeqNumber, iphTTL = receive_one_ping(mySocket, my_ID, timeout) + + mySocket.close() + + if recvTime: + delay = (recvTime - sentTime) * 1000 + if not quiet: + print("%d bytes from %s: icmp_seq=%d ttl=%d time=%d ms" % ( + dataSize, socket.inet_ntoa(struct.pack("!I", iphSrcIP)), icmpSeqNumber, iphTTL, delay) + ) + myStats.pktsRcvd += 1 + myStats.totTime += delay + if myStats.minTime > delay: + myStats.minTime = delay + if myStats.maxTime < delay: + myStats.maxTime = delay + else: + delay = None + print("Request timed out.") + + return delay + + +# =============================================================================# +def send_one_ping(mySocket, destIP, myID, mySeqNumber, packet_size): + """ + Send one ping to the given >destIP<. + """ + # destIP = socket.gethostbyname(destIP) + + # Header is type (8), code (8), checksum (16), id (16), sequence (16) + # (packet_size - 8) - Remove header size from packet size + myChecksum = 0 + + # Make a dummy heder with a 0 checksum. + header = struct.pack( + "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber + ) + + padBytes = [] + startVal = 0x42 + # 'cose of the string/byte changes in python 2/3 we have + # to build the data differnely for different version + # or it will make packets with unexpected size. + if sys.version[:1] == '2': + bytes = struct.calcsize("d") + data = ((packet_size - 8) - bytes) * "Q" + data = struct.pack("d", default_timer()) + data + else: + for i in range(startVal, startVal + (packet_size - 8)): + padBytes += [(i & 0xff)] # Keep chars in the 0-255 range + # data = bytes(padBytes) + data = bytearray(padBytes) + + # Calculate the checksum on the data and the dummy header. + myChecksum = checksum(header + data) # Checksum is in network order + + # Now that we have the right checksum, we put that in. It's just easier + # to make up a new header than to stuff it into the dummy. + header = struct.pack( + "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber + ) + + packet = header + data + + sendTime = default_timer() + + try: + mySocket.sendto(packet, (destIP, 1)) # Port number is irrelevant for ICMP + except socket.error as e: + print("General failure (%s)" % (e.args[1])) + return + + return sendTime + + +# =============================================================================# +def receive_one_ping(mySocket, myID, timeout): + """ + Receive the ping from the socket. Timeout = in ms + """ + timeLeft = timeout / 1000 + + while True: # Loop while waiting for packet or timeout + startedSelect = default_timer() + whatReady = select.select([mySocket], [], [], timeLeft) + howLongInSelect = (default_timer() - startedSelect) + if whatReady[0] == []: # Timeout + return None, 0, 0, 0, 0 + + timeReceived = default_timer() + + recPacket, addr = mySocket.recvfrom(ICMP_MAX_RECV) + + ipHeader = recPacket[:20] + iphVersion, iphTypeOfSvc, iphLength, \ + iphID, iphFlags, iphTTL, iphProtocol, \ + iphChecksum, iphSrcIP, iphDestIP = struct.unpack( + "!BBHHHBBHII", ipHeader + ) + + icmpHeader = recPacket[20:28] + icmpType, icmpCode, icmpChecksum, \ + icmpPacketID, icmpSeqNumber = struct.unpack( + "!BBHHH", icmpHeader + ) + + if icmpPacketID == myID: # Our packet + dataSize = len(recPacket) - 28 + # print (len(recPacket.encode())) + return timeReceived, (dataSize + 8), iphSrcIP, icmpSeqNumber, iphTTL + + timeLeft = timeLeft - howLongInSelect + if timeLeft <= 0: + return None, 0, 0, 0, 0 + + +# =============================================================================# +def dump_stats(myStats): + """ + Show stats when pings are done + """ + print("\n----%s PYTHON PING Statistics----" % (myStats.thisIP)) + + if myStats.pktsSent > 0: + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd) / myStats.pktsSent + + print("%d packets transmitted, %d packets received, %0.1f%% packet loss" % ( + myStats.pktsSent, myStats.pktsRcvd, 100.0 * myStats.fracLoss + )) + + if myStats.pktsRcvd > 0: + print("round-trip (ms) min/avg/max = %d/%0.1f/%d" % ( + myStats.minTime, myStats.totTime / myStats.pktsRcvd, myStats.maxTime + )) + + print("") + return + + +# =============================================================================# +def signal_handler(signum, frame): + """ + Handle exit via signals + """ + dump_stats() + print("\n(Terminated with signal %d)\n" % (signum)) + sys.exit(0) + + +# =============================================================================# +def verbose_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, + packet_size=PACKET_SIZE, path_finder=False): + """ + Send >count< ping to >destIP< with the given >timeout< and display + the result. + """ + signal.signal(signal.SIGINT, signal_handler) # Handle Ctrl-C + if hasattr(signal, "SIGBREAK"): + # Handle Ctrl-Break e.g. under Windows + signal.signal(signal.SIGBREAK, signal_handler) + + myStats = MyStats() # Reset the stats + + mySeqNumber = 0 # Starting value + + try: + destIP = socket.gethostbyname(hostname) + print("\nPYTHON PING %s (%s): %d data bytes" % (hostname, destIP, packet_size)) + except socket.gaierror as e: + print("\nPYTHON PING: Unknown host: %s (%s)" % (hostname, e.args[1])) + print() + return + + myStats.thisIP = destIP + + for i in range(count): + delay = do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size) + + if delay == None: + delay = 0 + + mySeqNumber += 1 + + # Pause for the remainder of the MAX_SLEEP period (if applicable) + if (MAX_SLEEP > delay): + time.sleep((MAX_SLEEP - delay) / 1000) + + dump_stats(myStats) + + +# =============================================================================# +def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, + packet_size=PACKET_SIZE, path_finder=False): + """ + Same as verbose_ping, but the results are returned as tuple + """ + myStats = MyStats() # Reset the stats + mySeqNumber = 0 # Starting value + + try: + destIP = socket.gethostbyname(hostname) + except socket.gaierror as e: + return False + + myStats.thisIP = destIP + + # This will send packet that we dont care about 0.5 seconds before it starts + # acrutally pinging. This is needed in big MAN/LAN networks where you sometimes + # loose the first packet. (while the switches find the way... :/ ) + if path_finder: + fakeStats = MyStats() + do_one(fakeStats, destIP, hostname, timeout, + mySeqNumber, packet_size, quiet=True) + time.sleep(0.5) + + for i in range(count): + delay = do_one(myStats, destIP, hostname, timeout, + mySeqNumber, packet_size, quiet=True) + + if delay == None: + delay = 0 + + mySeqNumber += 1 + + # Pause for the remainder of the MAX_SLEEP period (if applicable) + if (MAX_SLEEP > delay): + time.sleep((MAX_SLEEP - delay) / 1000) + + if myStats.pktsSent > 0: + myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd) / myStats.pktsSent + if myStats.pktsRcvd > 0: + myStats.avrgTime = myStats.totTime / myStats.pktsRcvd + + # return tuple(max_rtt, min_rtt, avrg_rtt, percent_lost) + return myStats.maxTime, myStats.minTime, myStats.avrgTime, myStats.fracLoss + + +# =============================================================================# +def main(): + parser = argparse.ArgumentParser(description=__description__) + parser.add_argument('-q', '--quiet', action='store_true', + help='quiet output') + parser.add_argument('-c', '--count', type=int, default=NUM_PACKETS, + help=('number of packets to be sent ' + '(default: %(default)s)')) + parser.add_argument('-W', '--timeout', type=float, default=WAIT_TIMEOUT, + help=('time to wait for a response in seoncds ' + '(default: %(default)s)')) + parser.add_argument('-s', '--packet-size', type=int, default=PACKET_SIZE, + help=('number of data bytes to be sent ' + '(default: %(default)s)')) + parser.add_argument('destination') + # args = parser.parse_args() + + ping = verbose_ping + # if args.quiet: + # ping = quiet_ping + ping('Google.com', timeout=1000) + # ping(args.destination, timeout=args.timeout*1000, count=args.count, + # packet_size=args.packet_size) + + # set coordinate system canvas_right = 300 canvas_left = 0 @@ -22,7 +601,7 @@ def ping_thread(args): global g_exit, g_response_time while not g_exit: - g_response_time = ping.quiet_ping('google.com', timeout=1000) + g_response_time = quiet_ping('google.com', timeout=1000) def convert_xy_to_canvas_xy(x_in,y_in): @@ -43,9 +622,7 @@ def convert_xy_to_canvas_xy(x_in,y_in): [sg.Quit()] ] -form = sg.FlexForm('Canvas test', grab_anywhere=True) -form.Layout(layout) -form.Finalize() +form = sg.FlexForm('Ping Times To Google.com', grab_anywhere=True).Layout(layout).Finalize() canvas = form.FindElement('canvas').TKCanvas diff --git a/Demo_Pong.py b/Demo_Pong.py index 0e883804a..3aef52c7b 100644 --- a/Demo_Pong.py +++ b/Demo_Pong.py @@ -128,9 +128,8 @@ def pong(): layout = [[sg.Canvas(size=(700, 400), background_color='black', key='canvas')], [sg.T(''), sg.ReadFormButton('Quit')]] # ------------- Create window ------------- - form = sg.FlexForm('Canvas test', return_keyboard_events=True) - form.Layout(layout) - form.Finalize() # TODO Replace with call to form.Finalize once code released + form = sg.FlexForm('The Classic Game of Pong', return_keyboard_events=True).Layout(layout).Finalize() + # form.Finalize() # TODO Replace with call to form.Finalize once code released # ------------- Get the tkinter Canvas we're drawing on ------------- canvas = form.FindElement('canvas').TKCanvas @@ -150,7 +149,6 @@ def pong(): # ------------- Read the form, get keypresses ------------- button, values = form.ReadNonBlocking() - # ------------- If quit ------------- if button is None and values is None or button == 'Quit': exit(69) @@ -167,6 +165,7 @@ def pong(): if ball1.checkwin(): sg.Popup('Game Over', ball1.checkwin() + ' won!!') + break # ------------- Bottom of loop, delay between animations ------------- diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index a1039249d..80c229a41 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -1,16 +1,14 @@ import PySimpleGUI as sg -# Very basic form. Return values as a dictionary -form = sg.FlexForm('Simple data entry form') # begin with a blank form - +form = sg.FlexForm('Simple data entry form') layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Ok(), sg.Cancel()] - ] + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] +] button, values = form.LayoutAndRead(layout) -sg.Popup(button, values, values['name'], values['address'], values['phone']) +sg.Popup(button, values, values['name'], values['address'], values['phone']) \ No newline at end of file diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index d63d1205a..21b640e1d 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -1,87 +1,83 @@ import PySimpleGUI as sg -def eBaySuperSearcherGUI(): - # Drop Down list of options - configs = ('0 - Gruen - Started 2 days ago in Watches', - '1 - Gruen - Currently Active in Watches', - '2 - Alpina - Currently Active in Jewelry', - '3 - Gruen - Ends in 1 day in Watches', - '4 - Gruen - Completed in Watches', - '5 - Gruen - Advertising', - '6 - Gruen - Currently Active in Jewelry', - '7 - Gruen - Price Test', - '8 - Gruen - No brand name specified') +# Drop Down list of options +configs = ('0 - Gruen - Started 2 days ago in Watches', + '1 - Gruen - Currently Active in Watches', + '2 - Alpina - Currently Active in Jewelry', + '3 - Gruen - Ends in 1 day in Watches', + '4 - Gruen - Completed in Watches', + '5 - Gruen - Advertising', + '6 - Gruen - Currently Active in Jewelry', + '7 - Gruen - Price Test', + '8 - Gruen - No brand name specified') - us_categories = ('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 34', - ' Watch Ads - 165254' - ) +us_categories = ('Use Default with no change', + 'All - 1', + 'Jewelry - 281', + ' Watches - 14324', + ' Wristwatches - 31387', + ' Pocket Watches - 3937', + 'Advertising - 34', + ' Watch Ads - 165254' + ) - german_categories =('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 1', - ' Watch Ads - 19823' - ) +german_categories =('Use Default with no change', + 'All - 1', + 'Jewelry - 281', + ' Watches - 14324', + ' Wristwatches - 31387', + ' Pocket Watches - 3937', + 'Advertising - 1', + ' Watch Ads - 19823' + ) - # the form layout - with sg.FlexForm('EBay Super Searcher', auto_size_text=True) as form: - with sg.FlexForm('EBay Super Searcher', auto_size_text=False) as form2: - layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], - [sg.Text('Choose base configuration to run')], - [sg.InputCombo(configs)], - [sg.Text('_'*100, size=(80,1))], - [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], - [sg.InputText(),sg.Text('Custom text to add to folder name')], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], - [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Time Filters')], - [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] +# the form layout +form = sg.FlexForm('EBay Super Searcher', auto_size_text=True) +form2 = sg.FlexForm('EBay Super Searcher', auto_size_text=False) - # First category is default (need to special case this) - layout_tab_2 = [[sg.Text('Choose Category')], - [sg.Text('US Categories'),sg.Text('German Categories')], - [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] +layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], + [sg.Text('Choose base configuration to run')], + [sg.InputCombo(configs)], + [sg.Text('_'*100, size=(80,1))], + [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], + [sg.InputText(),sg.Text('Custom text to add to folder name')], + [sg.Text('_'*100, size=(80,1))], + [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], + [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Text('Time Filters')], + [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], + [sg.Text('_'*100, size=(80,1))], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - for i,cat in enumerate(us_categories): - if i == 0: continue # skip first one - layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) - layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) - layout_tab_2.append([sg.Text('US Search String Override')]) - layout_tab_2.append([sg.InputText(size=(100,1))]) - layout_tab_2.append([sg.Text('German Search String Override')]) - layout_tab_2.append([sg.InputText(size=(100,1))]) - layout_tab_2.append([sg.Text('Typical US Search String')]) - layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) - layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) - layout_tab_2.append([sg.ReadButton('Submit', button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) +# First category is default (need to special case this) +layout_tab_2 = [[sg.Text('Choose Category')], + [sg.Text('US Categories'),sg.Text('German Categories')], + [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] - results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) +for i,cat in enumerate(us_categories): + if i == 0: continue # skip first one + layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) - return results +layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) +layout_tab_2.append([sg.Text('US Search String Override')]) +layout_tab_2.append([sg.InputText(size=(100,1))]) +layout_tab_2.append([sg.Text('German Search String Override')]) +layout_tab_2.append([sg.InputText(size=(100,1))]) +layout_tab_2.append([sg.Text('Typical US Search String')]) +layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) +layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) +layout_tab_2.append([sg.ReadButton('Submit', button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) +results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) -if __name__ == '__main__': - # sg.SetOptions(background_color='white') - results = eBaySuperSearcherGUI() - print(results) - sg.Popup('Results', results) \ No newline at end of file + + +sg.Popup('Results', results) \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 578ced224..0a835cd56 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,7 +7,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.2-red.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) @@ -1846,8 +1846,8 @@ The order of operations to obtain a tkinter Canvas Widget is: [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) - form.Finalize() + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + # add the plot to the window fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) @@ -2518,6 +2518,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.04.01 | Sept 18, 2018 - See release notes | 03.05.00 | Sept 20, 2018 - See release notes | 03.05.01 | Sept 22, 2018 - See release notes +| 03.05.02 | Sept 23, 2018 - See release notes ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -2600,6 +2601,11 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Bug fix for broken PySimpleGUI if Python version < 3.6 (sorry!) * LOTS of Readme changes +#### 3.5.2 +* Made `Finalize()` in a way that it can be chained +* Fixed bug in return values from Frame Element contents + + ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index 578ced224..0a835cd56 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.2-red.svg?longCache=true&style=for-the-badge) [Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) @@ -1846,8 +1846,8 @@ The order of operations to obtain a tkinter Canvas Widget is: [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) - form.Finalize() + form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + # add the plot to the window fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) @@ -2518,6 +2518,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.04.01 | Sept 18, 2018 - See release notes | 03.05.00 | Sept 20, 2018 - See release notes | 03.05.01 | Sept 22, 2018 - See release notes +| 03.05.02 | Sept 23, 2018 - See release notes ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -2600,6 +2601,11 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Bug fix for broken PySimpleGUI if Python version < 3.6 (sorry!) * LOTS of Readme changes +#### 3.5.2 +* Made `Finalize()` in a way that it can be chained +* Fixed bug in return values from Frame Element contents + + ### Upcoming Make suggestions people! Future release features From 4228c1eb353156a5b92529e7144549aa8d8e58c3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 12:40:31 -0400 Subject: [PATCH 441/521] Removed LookAndFeel capability for Mac platform. The function does nothing if sys.platform == 'darwin'. Added warning messages trying to help user when Finalize is not called when it should be. Removed candidate function names PrepareForUpdate and PreRead. Ended up using Finalize as final function name --- PySimpleGUI.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4d9fab538..3f21b0652 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1233,6 +1233,9 @@ def __init__(self, canvas=None, background_color=None, size=(None, None), pad=No @property def TKCanvas(self): + if self._TKCanvas is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') return self._TKCanvas @@ -1308,6 +1311,9 @@ def MoveFigure(self, figure, x_direction, y_direction): @property def TKCanvas(self): + if self._TKCanvas2 is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') return self._TKCanvas2 def __del__(self): @@ -2015,10 +2021,6 @@ def Finalize(self): # return None, None return self - # Another name for ReadNonBlocking. - PrepareForUpdate = ReadNonBlocking - # Finalize = ReadNonBlocking - PreRead = ReadNonBlocking def Refresh(self): @@ -3976,6 +3978,10 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), button_el # of the elements. # ############################################################## def ChangeLookAndFeel(index): + if sys.platform == 'darwin': + print('*** Changing look and feel is not supported on Mac platform ***') + return + # look and feel table look_and_feel = {'SystemDefault': {'BACKGROUND' : COLOR_SYSTEM_DEFAULT, 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT': COLOR_SYSTEM_DEFAULT,'TEXT_INPUT' : COLOR_SYSTEM_DEFAULT, 'SCROLL': COLOR_SYSTEM_DEFAULT, 'BUTTON': OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, 'PROGRESS': COLOR_SYSTEM_DEFAULT, 'BORDER': 1,'SLIDER_DEPTH':1, 'PROGRESS_DEPTH':0}, From 9623ba8b99785342fa2ef70dfe9ba40eb7542beb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 13:48:37 -0400 Subject: [PATCH 442/521] More readme changes... reworked parts of intro. Included info on using PyInstaller to make an EXE file --- docs/index.md | 154 ++++++++++++++++++++++++++++++++++---------------- readme.md | 154 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 212 insertions(+), 96 deletions(-) diff --git a/docs/index.md b/docs/index.md index 0a835cd56..d5aec6619 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,7 +26,7 @@ Home of the 1-line custom GUI and 1-line progress meter Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? Look no further, **you've found your GUI package**. +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. import PySimpleGUI as sg @@ -73,21 +73,36 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) +How about embedding a game inside of a GUI? This game of Pong is written in tkinter and then dropped into the PySimpleGUI window creating a game that has an accompanying GUI. + ![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) + +Combining PySimpleGUI with PyInstaller creates something truly remarkable and special, a Python program that looks like a Windows WinForms application. This application with working menu was created in 20 lines of Python code. It is a single .EXE file that launches straight into the screen you see. And more good news, the only icon you see on the taskbar is the window itself... there is no pesky shell window. + +![menu demo](https://user-images.githubusercontent.com/13696193/45923097-8fbc4c00-beaa-11e8-87d2-01a5331811c8.gif) + + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUIest of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. - -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. -The `PySimpleGUI` package is focused on the ***developer***. Create a custom GUI with as little and as simple code as possible. This was the primary mantra used to create PySimpleGUI. "Do it in a Python-like way" was the second desired outcome. +The `PySimpleGUI` package is focused on the ***developer***. +> Create a custom GUI with as little and as simple code as possible. + +This was the primary focus used to create PySimpleGUI. + +> "Do it in a Python-like way" + +was the second. ## Features +While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. + Features of PySimpleGUI include: Text Single Line Input @@ -142,42 +157,39 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU No async programming required (no callbacks to worry about) -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... +An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : + +>Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... +> ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) -Here is the code that produced the above screenshot. + import PySimpleGUI as sg - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - ))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), - sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - **A note on screen shots** -You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] + + button, values = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) + --- @@ -185,11 +197,11 @@ You will see a number of different styles of buttons, data entry fields, etc, in > Copy, Paste, Run. -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. > Be Pythonic - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - Forms are represented as Python lists. - A form is a list of rows @@ -200,11 +212,18 @@ You will see a number of different styles of buttons, data entry fields, etc, in - Linear programming instead of callbacks #### Lofty Goals -> -> + > Change Python -The hope is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux for all levels of developer. The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. +The hope is not that ***this*** package will become part of the Python Standard Library. + +The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. + +The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. + +There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. + +Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. This is my attempt to find out. ----- @@ -222,10 +241,9 @@ On a Raspberry Pi, this is should work: sudo pip3 install --upgrade pysimplegui -Some users have found that upgrading required using an extra flag on the pip `--no-cache-dir` and you can force the version number too by adding `==version` onto the end - - pip install --upgrade --no-cache-dir PySimpleGUI==3.0.3 +Some users have found that upgrading required using an extra flag on the pip `--no-cache-dir`. + pip install --upgrade --no-cache-dir If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. @@ -238,16 +256,19 @@ then you need to install `tkinter`. Be sure and get the Python 3 version. sudo apt-get install python3-tk ``` - - ### Prerequisites Python 3 tkinter -Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. -### Using +### EXE file creation + +If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe + + +## Using To use in your code, simply import.... `import PySimpleGUI as sg` @@ -274,6 +295,7 @@ PySimpleGUI can be broken down into 2 types of API's: There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... * Variable number of arguments to a function call * Optional parameters to a function call + * Dictionaries #### Variable Number of Arguments @@ -310,6 +332,12 @@ If the caller wanted to change the button color to be black on yellow, the call ![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) +#### Dictionaries + +Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: +1. To identify values when a form is read +2. To identify Elements so that they can be "updated" + --- ### High Level API Calls - Popup's @@ -318,7 +346,7 @@ If the caller wanted to change the button color to be black on yellow, the call ### Popup Output -Think of the `Popup` call as the GUI equivelent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. +Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. `Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. @@ -2414,6 +2442,36 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify * [Matplotlib](https://matplotlib.org/) * [PyMuPDF](https://github.com/rk700/PyMuPDF) + +## Creating a Windows .EXE File + +It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. + +Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) + +``` +pip install PySimpleGUI +pip install PyInstaller + +``` + +To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: + +``` +pyinstaller -wF my_program.py + +``` + +You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. + +That's all... Run your `my_program.exe` file on the Windows machine of your choosing. + +> "It's just that easy." + +(famous last words that screw up just about anything being referenced) + +Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. + ## Fun Stuff Here are some things to try if you're bored or want to further customize diff --git a/readme.md b/readme.md index 0a835cd56..d5aec6619 100644 --- a/readme.md +++ b/readme.md @@ -26,7 +26,7 @@ Home of the 1-line custom GUI and 1-line progress meter Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? Look no further, **you've found your GUI package**. +Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. import PySimpleGUI as sg @@ -73,21 +73,36 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) +How about embedding a game inside of a GUI? This game of Pong is written in tkinter and then dropped into the PySimpleGUI window creating a game that has an accompanying GUI. + ![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) + +Combining PySimpleGUI with PyInstaller creates something truly remarkable and special, a Python program that looks like a Windows WinForms application. This application with working menu was created in 20 lines of Python code. It is a single .EXE file that launches straight into the screen you see. And more good news, the only icon you see on the taskbar is the window itself... there is no pesky shell window. + +![menu demo](https://user-images.githubusercontent.com/13696193/45923097-8fbc4c00-beaa-11e8-87d2-01a5331811c8.gif) + + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUIest of packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms is the primary difference between these and `PySimpleGUI`. - -Every call has optional parameters so that you can change the look and feel. Don't like the button color? It's easy to change by adding a button_color parameter to your widget. The configure is done in-place. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. -The `PySimpleGUI` package is focused on the ***developer***. Create a custom GUI with as little and as simple code as possible. This was the primary mantra used to create PySimpleGUI. "Do it in a Python-like way" was the second desired outcome. +The `PySimpleGUI` package is focused on the ***developer***. +> Create a custom GUI with as little and as simple code as possible. + +This was the primary focus used to create PySimpleGUI. + +> "Do it in a Python-like way" + +was the second. ## Features +While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. + Features of PySimpleGUI include: Text Single Line Input @@ -142,42 +157,39 @@ The `PySimpleGUI` package is focused on the ***developer***. Create a custom GU No async programming required (no callbacks to worry about) -An example of many widgets used on a single form. A little further down you'll find the TWENTY lines of code required to create this complex form. Try it if you don't believe it. Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... +An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : + +>Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... +> ![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) -Here is the code that produced the above screenshot. + import PySimpleGUI as sg - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything', - ))], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), - sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))] - ] - - button, values = form.LayoutAndRead(layout) - - **A note on screen shots** -You will see a number of different styles of buttons, data entry fields, etc, in this readme. They were all made with the same SDK, the only difference is in the settings that are specified on a per-element, row, form, or global basis. One setting in particular, border_width, can make a big difference on the look of the form. Some of the screenshots had a border_width of 6, others a value of 1. + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] + + button, values = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) + --- @@ -185,11 +197,11 @@ You will see a number of different styles of buttons, data entry fields, etc, in > Copy, Paste, Run. -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. > Be Pythonic - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work. + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - Forms are represented as Python lists. - A form is a list of rows @@ -200,11 +212,18 @@ You will see a number of different styles of buttons, data entry fields, etc, in - Linear programming instead of callbacks #### Lofty Goals -> -> + > Change Python -The hope is not that ***this*** package will become part of the Python Standard Library. The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux for all levels of developer. The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. There is a gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". Or maybe simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. I want to find out. +The hope is not that ***this*** package will become part of the Python Standard Library. + +The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. + +The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. + +There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. + +Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. This is my attempt to find out. ----- @@ -222,10 +241,9 @@ On a Raspberry Pi, this is should work: sudo pip3 install --upgrade pysimplegui -Some users have found that upgrading required using an extra flag on the pip `--no-cache-dir` and you can force the version number too by adding `==version` onto the end - - pip install --upgrade --no-cache-dir PySimpleGUI==3.0.3 +Some users have found that upgrading required using an extra flag on the pip `--no-cache-dir`. + pip install --upgrade --no-cache-dir If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. @@ -238,16 +256,19 @@ then you need to install `tkinter`. Be sure and get the Python 3 version. sudo apt-get install python3-tk ``` - - ### Prerequisites Python 3 tkinter -Runs on all Python platforms that have tkinter running on them. Thoroughly tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. -### Using +### EXE file creation + +If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe + + +## Using To use in your code, simply import.... `import PySimpleGUI as sg` @@ -274,6 +295,7 @@ PySimpleGUI can be broken down into 2 types of API's: There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... * Variable number of arguments to a function call * Optional parameters to a function call + * Dictionaries #### Variable Number of Arguments @@ -310,6 +332,12 @@ If the caller wanted to change the button color to be black on yellow, the call ![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) +#### Dictionaries + +Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: +1. To identify values when a form is read +2. To identify Elements so that they can be "updated" + --- ### High Level API Calls - Popup's @@ -318,7 +346,7 @@ If the caller wanted to change the button color to be black on yellow, the call ### Popup Output -Think of the `Popup` call as the GUI equivelent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. +Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. `Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. @@ -2414,6 +2442,36 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify * [Matplotlib](https://matplotlib.org/) * [PyMuPDF](https://github.com/rk700/PyMuPDF) + +## Creating a Windows .EXE File + +It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. + +Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) + +``` +pip install PySimpleGUI +pip install PyInstaller + +``` + +To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: + +``` +pyinstaller -wF my_program.py + +``` + +You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. + +That's all... Run your `my_program.exe` file on the Windows machine of your choosing. + +> "It's just that easy." + +(famous last words that screw up just about anything being referenced) + +Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. + ## Fun Stuff Here are some things to try if you're bored or want to further customize From 61253d9723ecb9e5ccf21800873de97c6e4c0884 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 15:25:50 -0400 Subject: [PATCH 443/521] Somewhat significant overhaul to include more features, better outlook on life in general... --- docs/tutorial.md | 114 ++++++++++++++++++++++++++++++----------------- 1 file changed, 73 insertions(+), 41 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 6f790fa0c..cc3c2a676 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,5 +1,7 @@ # Add GUIs to your programs and scripts easily with PySimpleGUI +NOTE -- PySimpleGUI requires Python3. If you're running Python2, don't waste your time reading. + ## Introduction Few people run Python programs by double clicking the .py file as if it were a .exe file. When a typical user (non-programmer types) double clicks an exe file, they expect it to pop open with a window they can interact with. While GUIs, using tkinter, are possible using standard Python installations, it's unlikely many programs do this. @@ -8,24 +10,26 @@ What if it were easy so to open a Python program into a GUI that complete beginn There seems to be a gap in the ability to add a GUI onto a Python program/script. Complete beginners are left using only the command line and many advanced programmers don't want to take the time required to code up a tkinter GUI. + + ## GUI Frameworks There is no shortage of GUI frameworks for Python. tkinter, WxPython, Qt, Kivy are a few of the major packages. In addition, there are a good number of dumbed down GUI packages that wrap one of the major packages. These include EasyGUI, PyGUI, Pyforms, ... -The problem is that beginners (those with experience of less than 6 weeks) are not capable of learning even the simplest of the major packages. That leaves the wrapper-packages. Users will likely find it difficult or impossible to build a custom GUI layout. Or, if it's possible, pages of code are required. +The problem is that beginners (those with experience of less than 6 weeks) are not capable of learning even the simplest of the major packages. That leaves the wrapper-packages. Users will likely find it difficult or impossible to build a custom GUI layout using the smaller packages. -PySimpleGUI attempts to address these GUI challenges by providing a super-simple, easy to understand interface to GUIs that can be easily customized. Even the most complex of GUIs are often less than 20 lines of code when PySimpleGUI is used. +PySimpleGUI attempts to address these GUI challenges by providing a super-simple, easy to understand interface to GUIs that can be easily customized. Complex GUIs are often less than 20 lines of code when PySimpleGUI is used. ## The Secret What makes PySimpleGUI superior for newcomers is that the package contains the majority of the code that the user is normally expected to write. Button callbacks are handled by PySimpleGUI, not the user's code. Beginners struggle to grasp the concept of a function, expecting them to understand a call-back function in the first few weeks is a stretch. -With most GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. +With some GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a form layout, it is configured in-place, not several lines of code away. Results are returned as a simple list or a dictionary. ## What is a GUI? -Most GUIs do one thing.... they collect information from the user and return it. From a programmer's viewpoint this could be summed up as a function call that looks like this: +Most GUIs do one thing.... they collect information from the user and return it. From a programmer's viewpoint a GUI that collects information, like a form, could be summed up as a function call that looks like this: button, values = GUI_Display(gui_layout) @@ -33,13 +37,14 @@ What's expected from most GUIs is the button that was clicked (OK, cancel, save, This is exactly how PySimpleGUI works (for these simple kinds of GUIs). When the call is made to display the GUI, execution does no return until a button is clicked that closes the form. -There are more complex GUIs such as those that don't close after a button is clicked. These complex forms can also be created with PySimpleGUI. A remote control interface for a robot and a chat window are a couple of examples. +There are more complex GUIs such as those that don't close after a button is clicked. These resemble a windows program and also be created with PySimpleGUI. A remote control interface for a robot and a chat window are a couple of examples where you want to keep the window open after a button is clicked. ## The 5-Minute GUI -When is PySimpleGUI useful? Immediately, anytime you've got a GUI need. It will take under 5 minutes for you to create and try your GUI. With those kinds of times, what do you have to lose trying it? +When is PySimpleGUI useful? ***Immediately***, anytime you've got a GUI need. It will take under 5 minutes for you to create and try your GUI. With those kinds of times, what do you have to lose trying it? The best way to go about making your GUI in under 5 minutes is to copy one of the GUIs from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/). Follow these steps: +* Install PySimpleGUI * Find a GUI that looks similar to what you want to create * Copy code from Cookbook * Paste into your IDE and run @@ -91,80 +96,99 @@ Not all GUIs take 5 minutes. Some take 5 lines of code. This is a GUI with a c ## Making Your Custom GUI -That 5-minute estimate wasn't the time it takes to copy and paste the code from the Cookbook. You should be able to modify the code within 5 minutes in order to get to your layout, assuming you've got a straightforward layout. +If you find a Recipe similar to your project. You may be able to modify the code within 5 minutes in order to get to *your layout*, assuming you've got a straightforward layout. Widgets are called Elements in PySimpleGUI. This list of Elements are spelled exactly as you would type it into your Python code. ### Core Element list ``` - Text - InputText - Multiline - InputCombo - Listbox - Radio + Buttons including these types: + File Browse + Folder Browse + Color chooser + Date picker + Read Form + Close form + Realtime Checkbox - Spin - Output - SimpleButton - RealtimeButton - ReadFormButton - ProgressBar - Image + Radio Button + Listbox Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Option Menu + Image + Menu + Frame Column + Graph + Table + Tabbed forms + Redirected Python Output/Errors to scrolling Window ``` You can also have short-cut Elements. There are 2 types of shortcuts. One is simply other names for the exact same element (e.g. T instead of Text). The second type configures an Element with particular setting, sparing the programmer from specifying all of the parameters (e.g. Submit is a button with the text "Submit" on it). + ### Shortcut list T = Text Txt = Text In = InputText Input = IntputText - Combo = InputCombo + Combo = DropDown = Drop = InputCombo DropDown = InputCombo Drop = InputCombo + OptionMenu = InputOptionMenu + CB - CBox = Check = Checkbox + RButton = ReadButton = ReadFormButton + Button = SimpleButton A number of common buttons have been implemented as shortcuts. These include: ### Button Shortcuts FolderBrowse FileBrowse + FilesBrowse FileSaveAs Save + Open Submit OK Ok Cancel Quit + Help Exit Yes No The more generic button functions, that are also shortcuts ### Generic Buttons - SimpleButton - ReadFormButton + Button + RButton (ReadButton) RealtimeButton -These are all of the GUI Widgets you have to choose from. If it's not in this list, it doesn't go in your form layout. +These are all of the GUI Widgets you have to choose from. If it's not in this list, it doesn't go in your form layout. (Maybe... unless there's been an update with more features and this tutorial wasn't updated) ### GUI Design Pattern The stuff that tends not to change in GUIs are the calls that setup and show the Window. It's the layout of the Elements that changes from one program to another. This is the code from above with the layout removed: import PySimpleGUI as sg - - form = sg.FlexForm('Simple data entry form') # Define your form here (it's a list of lists) + layout = [[ your layout ]] + form = sg.FlexForm('Simple data entry form') button, values = form.LayoutAndRead(layout) + The flow for most GUIs is: * Create the Form object * Define GUI as a list of lists * Show the GUI and get results -These are line for line what you see in design pattern. +Some forms act more like Windows programs. These forms have an "Event Loop". Please see the readme for more info on these kinds of forms (Persistent Forms) + +These are line for line what you see in design pattern above. ### GUI Layout @@ -184,11 +208,14 @@ The layout produced this window: Once you have your layout complete and you've copied over the lines of code that setup and show the form, it's time to look at how to display the form and get the values from the user. -This is the line of code that displays the form and provides the results: +First get a form. +``` form = sg.FlexForm('Simple data entry form') ``` + +Then display the form and get the results.: button, values = form.LayoutAndRead(layout) - Forms return 2 values, the text of the button that was clicked and a ***list of values*** the user entered into the form. + Forms return 2 values, the text of the button that was clicked and a ***list of values*** the user entered into the form. More advanced forms return the values as a **dictionary of values**, If the example form was displayed and the user did nothing other than click the OK button, then the results would have been: @@ -201,11 +228,11 @@ Checkbox Elements return a value of True/False. Because these checkboxes defaul Once you have the values from the GUI it would be nice to check what values are in the variables. Rather than print them out using a `print` statement, let's stick with the GUI idea and output to a window. -PySimpleGUI has a number of Message Boxes to choose from. The data passed to the message box will be displayed in a window. The function takes any number of arguments. Simply indicate all the variables you would like to see in the call. +PySimpleGUI has a number of Popup Windows to choose from. The data passed to the Popup will be displayed in a window. The function takes any number of arguments, just like a print call would. Simply pass in all the variables you would like to see in the call. -The most-commonly used Message Box in PySimpleGUI is MsgBox. To display the results of the previous example, one would write: +The most-commonly used display window is the `Popup`. To display the results of the previous example, one would write: - MsgBox('The GUI returned:', button, values) + Popup('The GUI returned:', button, values) ## Putting It All Together @@ -215,9 +242,7 @@ Now that you know the basics, let's put together a form that contains as many Py sg.ChangeLookAndFeel('GreenTan') - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) - - column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10,1))], + column1 = [[sg.Text('Column 1', background_color='#d3dfda', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] @@ -241,12 +266,13 @@ Now that you know the basics, let's put together a form that contains as many Py [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()] - ] + ] + form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) button, values = form.LayoutAndRead(layout) - sg.MsgBox(button, values) + sg.Popup(button, values) -That may seem like a lot of code, but try coding this same GUI layout directly in tkinter and you'll quickly realize that the length is tiny. +That may seem like a lot of code, but try coding this same GUI layout using any other GUI framework and it will be lengthier and what you see here.... by a WIDE margin. 10's of times longer. ![everything for tutorial](https://user-images.githubusercontent.com/13696193/44302997-38531b00-a303-11e8-8c45-698ea62590a8.jpg) @@ -269,17 +295,23 @@ This kind of logic is all that's needed: else: # collect arguements from sys.argv -The easiest way to get a GUI up and running quickly is to copy and modify one of the Recipes from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +Copy one of the Recipes from the Cookbook and run it. See if it resembles something you would like to build: +[PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) Have some fun! Spice up the scripts you're tired of running by hand. Spend 5 or 10 minutes playing with the demo scripts. You may find one already exists that does exactly what you need. If not, you will find it's 'simple' to create your own. If you really get lost, you've only invested 10 minutes. ## Resources ### Installation + Requires Python 3 pip install PySimpleGUI +If on a Raspberry Pi or Linux, may need to do this instead: + + sudo pip3 install --upgrade pysimplegui + Works on all systems that run tkinter, including the Raspberry Pi ### Documentation @@ -287,6 +319,6 @@ Works on all systems that run tkinter, including the Raspberry Pi [Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) -### Home Page +### Home Page (GitHub) -[www.PySimpleGUI.com](www.PySimpleGUI.com) \ No newline at end of file +[www.PySimpleGUI.com](www.PySimpleGUI.com) From 294f11a6061f25fae707ab1b38dfc8d461c30214 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 16:51:13 -0400 Subject: [PATCH 444/521] Goodbye FlexForm.... Hello Window --- docs/cookbook.md | 62 +- docs/index.md | 3251 +++++++++++++++++++++++----------------------- readme.md | 3251 +++++++++++++++++++++++----------------------- 3 files changed, 3299 insertions(+), 3265 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 008ec67aa..38857130a 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -13,7 +13,7 @@ Same GUI screen except the return values are in a list instead of a dictionary a import PySimpleGUI as sg # Very basic form. Return values as a list - form = sg.FlexForm('Simple data entry form') # begin with a blank form + form = sg.Window('Simple data entry form') # begin with a blank form layout = [ [sg.Text('Please enter your Name, Address, Phone')], @@ -35,7 +35,7 @@ A simple form with default values. Results returned in a dictionary. import PySimpleGUI as sg # Very basic form. Return values as a dictionary - form = sg.FlexForm('Simple data entry form') # begin with a blank form + form = sg.Window('Simple data entry form') # begin with a blank form layout = [ [sg.Text('Please enter your Name, Address, Phone')], @@ -66,7 +66,7 @@ Browse for a filename that is populated into the input field. [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - (button, (source_filename,)) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) + (button, (source_filename,)) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) print(button, source_filename) @@ -81,7 +81,7 @@ Quickly add a GUI allowing the user to browse for a filename if a filename is no import sys if len(sys.argv) == 1: - button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.Text('Document to open')], + button, (fname,) = sg.Window('My Script').LayoutAndRead([[sg.Text('Document to open')], [sg.In(), sg.FileBrowse()], [sg.Open(), sg.Cancel()]]) else: @@ -110,7 +110,7 @@ Browse to get 2 file names that can be then compared. [sg.Submit(), sg.Cancel()]] - form = sg.FlexForm('File Compare') + form = sg.Window('File Compare') button, values = form.LayoutAndRead(form_rows) @@ -167,7 +167,7 @@ Example of nearly all of the widgets in a single form. Uses a customized color ] - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) button, values = form.Read() @@ -194,7 +194,7 @@ An async form that has a button read loop. A Text Element is updated periodical [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] - form = sg.FlexForm('Running Timer').Layout(form_rows) + form = sg.Window('Running Timer').Layout(form_rows) timer_running = True i = 0 @@ -238,7 +238,7 @@ The architecture of some programs works better with button callbacks instead of [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] # Show the form to the user - form = sg.FlexForm('Button callback example').Layout(layout) + form = sg.Window('Button callback example').Layout(layout) # Event loop. Read buttons, make callbacks while True: @@ -272,7 +272,7 @@ This recipe implements a remote control interface for a robot. There are 4 dire [sg.Quit(button_color=('black', 'orange'))] ] - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True).Layout(form_rows) + form = sg.Window('Robotics Remote Control', auto_size_text=True).Layout(form_rows) # # Some place later in your code... @@ -321,8 +321,8 @@ Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your l [sg.InputText(), sg.Text('Enter some info')], [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - form = sg.FlexForm('') - form2 = sg.FlexForm('') + form = sg.Window('') + form2 = sg.Window('') results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), (form2, layout_tab_2, 'Second Tab')) @@ -377,7 +377,7 @@ Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] ] - form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1), + form = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1), font=("Helvetica", 25)).Layout(layout) # Our event loop while (True): @@ -419,7 +419,7 @@ This form doesn't close after button clicks. To achieve this the buttons are sp ] - form = sg.FlexForm('Script launcher').Layout(layout) + form = sg.Window('Script launcher').Layout(layout) # ---===--- Loop taking in user input and using it to call scripts --- # @@ -469,7 +469,7 @@ A standard non-blocking GUI with lots of inputs. [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], [sg.Submit(), sg.Cancel()]] - form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) + form = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) button, values = form.Read() @@ -488,7 +488,7 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an [sg.Cancel()]] # create the form - form = sg.FlexForm('Custom Progress Meter').Layout(layout) + form = sg.Window('Custom Progress Meter').Layout(layout) # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked @@ -505,7 +505,7 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an ## The One-Line GUI -For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `FlexForm` and the call to `LayoutAndRead`. `FlexForm` returns a `FlexForm` object which has the `LayoutAndRead` method. +For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `Window` and the call to `LayoutAndRead`. `Window` returns a `Window` object which has the `LayoutAndRead` method. ![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) @@ -519,13 +519,13 @@ Instead of [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]] - button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) you can write this line of code for the exact same result (OK, two lines with the import): import PySimpleGUI as sg - button, (filename,) = sg.FlexForm('Get filename example').LayoutAndRead( + button, (filename,) = sg.Window('Get filename example').LayoutAndRead( [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) -------------------- @@ -560,7 +560,7 @@ To make it easier to see the Column in the window, the Column background has bee # Display the form and get values - button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) + button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) sg.Popup(button, values, line_width=200) @@ -582,7 +582,7 @@ This simple program keep a form open, taking input values until the user termina [sg.Txt('', size=(8,1), key='output') ], [sg.ReadButton('Calculate', bind_return_key=True)]] - form = sg.FlexForm('Math').Layout(layout) + form = sg.Window('Math').Layout(layout) while True: button, values = form.Read() @@ -622,7 +622,7 @@ While it's fun to scribble on a Canvas Widget, try Graph Element makes it a down [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] ] - form = sg.FlexForm('Canvas test') + form = sg.Window('Canvas test') form.Layout(layout) form.Finalize() @@ -652,7 +652,7 @@ Just like you can draw on a tkinter widget, you can also draw on a Graph Element [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] ] - form = sg.FlexForm('Graph test') + form = sg.Window('Graph test') form.Layout(layout) form.Finalize() @@ -713,7 +713,7 @@ There are a number of features used in this Recipe including: [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], ] - form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) + form = sg.Window('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) # Loop forever reading the form's values, updating the Input field keys_entered = '' @@ -762,7 +762,7 @@ Use the Canvas Element to create an animated graph. The code is a bit tricky to # create the form and show it without the plot - form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) + form = g.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) form.Finalize() # needed to access the canvas element prior to reading the form canvas_elem = form.FindElement('canvas') @@ -825,7 +825,7 @@ In other GUI frameworks this program would be most likely "event driven" with ca sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] ] - form = sg.FlexForm("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + form = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1)) form.Layout(layout) form.Finalize() @@ -893,7 +893,7 @@ Use the upper half to generate your hash code. Then paste it into the code in t [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], ] - form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), + form = sg.Window('SHA Generator', auto_size_text=False, default_element_size=(10,1), text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) @@ -990,7 +990,7 @@ You can easily change colors to match your background by changing a couple of pa sg.Button('EXIT', button_color=('white','firebrick3'))], [sg.T('', text_color='white', size=(50,1), key='output')]] - form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) + form = sg.Window('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) # ---===--- Loop taking in user input (buttons) --- # while True: @@ -1060,7 +1060,7 @@ Much of the code is handling the button states in a fancy way. It could be much sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) + form = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) # ---------------- main loop ---------------- @@ -1124,7 +1124,7 @@ The spinner changes the number of seconds between reads. Note that you will get [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(form_rows) + form = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(form_rows) # ---------------- main loop ---------------- @@ -1178,7 +1178,7 @@ If you double click the dashed line at the top of the list of choices, that menu [sg.Output(size=(60, 20))] ] - form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + form = sg.Window("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12, 1)).Layout(layout) # ------ Loop & Process button menu choices ------ # @@ -1209,7 +1209,7 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] - form = sg.FlexForm('Graph of Sine Function').Layout(layout) + form = sg.Window('Graph of Sine Function').Layout(layout) form.Finalize() graph = form.FindElement('graph') diff --git a/docs/index.md b/docs/index.md index d5aec6619..e4d30b63c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,16 +1,16 @@ - -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) # PySimpleGUI - -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.2-red.svg?longCache=true&style=for-the-badge) + +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.0-red.svg?longCache=true&style=for-the-badge) -[Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) +[Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) [ReadTheDocs](http://pysimplegui.readthedocs.io/) @@ -18,64 +18,72 @@ [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) +[OpenSource Article](https://opensource.com/article/18/8/pysimplegui) + [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -Super-simple GUI to use... Powerfully customizable. +Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter - -Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. - - import PySimpleGUI as sg - - sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - + +Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking for a GUI package to help with +* Taking your Python code from the world of command lines and into the convenience of a GUI? * +* Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? +* Into Machine Learning and are sick of the command line? +* How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? + +Look no further, **you've found your GUI package**. + + import PySimpleGUI as sg + + sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + ![hello world](https://user-images.githubusercontent.com/13696193/44960047-1f7f6380-aec6-11e8-9d5e-12ef935bcade.jpg) Or how about a ***custom GUI*** in 1 line of code? import PySimpleGUI as sg - - button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) - + + button, (filename,) = sg.Window('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. - - + + ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a more friendly way. It does the layout and boilerplate code for you and presents you with a simple, efficient interface. - -![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) - + +![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) + Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The same for shown as on Pi (roughly the same) - + ![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) - - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: - - OneLineProgressMeter('My meter title', current_value, max value, 'key') - - ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - + + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: + + OneLineProgressMeter('My meter title', current_value, max value, 'key') + + ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) - + How about embedding a game inside of a GUI? This game of Pong is written in tkinter and then dropped into the PySimpleGUI window creating a game that has an accompanying GUI. -![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) Combining PySimpleGUI with PyInstaller creates something truly remarkable and special, a Python program that looks like a Windows WinForms application. This application with working menu was created in 20 lines of Python code. It is a single .EXE file that launches straight into the screen you see. And more good news, the only icon you see on the taskbar is the window itself... there is no pesky shell window. @@ -84,59 +92,58 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. -> Create a custom GUI with as little and as simple code as possible. +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. +> Create a custom GUI with as little and as simple code as possible. -This was the primary focus used to create PySimpleGUI. +This was the primary focus used to create PySimpleGUI. > "Do it in a Python-like way" -was the second. +was the second. ## Features While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Files Browse - Folder Browse - SaveAs - Non-closing return - Close form - Realtime + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Files Browse + Folder Browse + SaveAs + Non-closing return + Close form + Realtime Calendar chooser Color chooser - Checkboxes - Radio Buttons - Listbox - Slider + Checkboxes + Radio Buttons + Listbox + Option Menu + Slider Graph - Frame with title - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Calendar chooser - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Code Proress Bar & Debug Print - Complete control of colors, look and feel + Frame with title + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Code Proress Bar & Debug Print + Complete control of colors, look and feel Selection of pre-defined palettes - Button images + Button images Return values as dictionary Set focus Bind return key to buttons @@ -155,86 +162,86 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Tooltips Clickable links No async programming required (no callbacks to worry about) - - + + An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : ->Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... +>Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - - - - import PySimpleGUI as sg - - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), - sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] - - button, values = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) - - - ---- -### Design Goals - -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + + + + import PySimpleGUI as sg + + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] + + button, values = sg.Window('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) + + + +--- +### Design Goals + +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. + + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. - Return values can also be represented as a dictionary - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values - Linear programming instead of callbacks - + #### Lofty Goals > Change Python -The hope is not that ***this*** package will become part of the Python Standard Library. +The hope is not that ***this*** package will become part of the Python Standard Library. -The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. +The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. -The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. +The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. -There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. +There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. This is my attempt to find out. - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install --upgrade PySimpleGUI - + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install --upgrade PySimpleGUI + On some systems you need to run pip3. - + pip3 install --upgrade PySimpleGUI On a Raspberry Pi, this is should work: @@ -249,110 +256,110 @@ If for some reason you are unable to install using `pip`, don't worry, you can s `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: ``` -ImportError: No module named tkinter +ImportError: No module named tkinter ``` then you need to install `tkinter`. Be sure and get the Python 3 version. ``` sudo apt-get install python3-tk ``` - -### Prerequisites - -Python 3 -tkinter - -PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Prerequisites + +Python 3 +tkinter + +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### EXE file creation If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe - -## Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.Popup('This is my first Popup') - -![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: + +## Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.Popup('This is my first Popup') + +![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom form functions - - -### Python Language Features - - There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... - * Variable number of arguments to a function call - * Optional parameters to a function call + * Custom form functions + + +### Python Language Features + + There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... + * Variable number of arguments to a function call + * Optional parameters to a function call * Dictionaries - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.Popup('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Popup - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def Popup(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.Popup('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Popup + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def Popup(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: 1. To identify values when a form is read 2. To identify Elements so that they can be "updated" - ---- - -### High Level API Calls - Popup's + +--- + +### High Level API Calls - Popup's "High level calls" are those that start with "Popup". They are the most basic form of communications with the user. They are named after the type of window they create, a pop-up window. These windows are meant to be short lived while, either delivering information or collecting it, and then quickly disappearing. ### Popup Output -Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. +Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. `Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. -There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). +There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). The list of Popup output functions are @@ -360,7 +367,7 @@ The list of Popup output functions are PopupOk PopupYesNo PopupCancel - PopupOkCancel + PopupOkCancel PopupError PopupTimed, PopupAutoClose PopupNoWait, PopupNonBlocking @@ -374,16 +381,16 @@ The function `PopupTimed` or `PopupAutoClose` are popup windows that will automa Here is a quick-reference showing how the Popup calls look. - sg.Popup('Popup') - sg.PopupOk('PopupOk') - sg.PopupYesNo('PopupYesNo') - sg.PopupCancel('PopupCancel') - sg.PopupOkCancel('PopupOkCancel') - sg.PopupError('PopupError') - sg.PopupTimed('PopupTimed') + sg.Popup('Popup') + sg.PopupOk('PopupOk') + sg.PopupYesNo('PopupYesNo') + sg.PopupCancel('PopupCancel') + sg.PopupOkCancel('PopupOkCancel') + sg.PopupError('PopupError') + sg.PopupTimed('PopupTimed') sg.PopupAutoClose('PopupAutoClose') - - + + ![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) @@ -402,14 +409,14 @@ Here is a quick-reference showing how the Popup calls look. #### Scrolled Output There is a scrolled version of Popups should you have a lot of information to display. - sg.PopupScrolled(my_text) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - + sg.PopupScrolled(my_text) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + The `PopupScrolled` will auto-fit the window size to the size of the text. Specify `None` in the height field of a `size` parameter to get auto-sized height. -This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. +This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. sg.PopupScrolled(my_text, size=(80, None)) @@ -419,7 +426,7 @@ Note that the default max number of lines before scrolling happens is set to 50. The Popup call PopupNoWait or PopupNonBlocking will create a popup window and then immediately return control back to you. All other popup functions will block, waiting for the user to close the popup window. -This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement +This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement A word of ***caution***... Windows that are created after the NoWait Popup are "slaves" to the NoWait'd popup. If you close the Popup, it will also lose the window the you created after the Popup. A good rule of thumb is to leave the popup open while you're interacting with the rest of your program until you understand what happens when you close the NoWaitPopup. @@ -434,99 +441,99 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFolder` - get a folder name Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. - - - import PySimpleGUI as sg - - text = sg.PopupGetText('Title', 'Please input something') - sg.Popup('Results', 'The value returned from PopupGetText', text) - + + + import PySimpleGUI as sg + + text = sg.PopupGetText('Title', 'Please input something') + sg.Popup('Results', 'The value returned from PopupGetText', text) + ![popupgettext](https://user-images.githubusercontent.com/13696193/44957281-8721b880-ae9e-11e8-98cd-d06369f4187e.jpg) ![popup gettext response](https://user-images.githubusercontent.com/13696193/44957282-8721b880-ae9e-11e8-84ae-dc8bb30504a0.jpg) - text = sg.PopupGetFile('Please enter a file name') + text = sg.PopupGetFile('Please enter a file name') sg.Popup('Results', 'The value returned from PopupGetFile', text) - + ![popupgetfile](https://user-images.githubusercontent.com/13696193/44957857-2fd31680-aea5-11e8-8eb7-f6b91c202cc8.jpg) The window created to get a folder name looks the same as the get a file name. The difference is in what the browse button does. `PopupGetFile` shows an Open File dialog box while `PopupGetFolder` shows an Open Folder dialog box. - text = sg.PopupGetFolder('Please enter a folder name') + text = sg.PopupGetFolder('Please enter a folder name') sg.Popup('Results', 'The value returned from PopupGetFolder', text) ![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) -#### Progress Meters! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - OneLineProgressMeter(title, - current_value, - max_value, +#### Progress Meters! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + OneLineProgressMeter(title, + current_value, + max_value, key, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. ## The Form Designer The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. @@ -539,7 +546,7 @@ It's a manual process, but if you follow the instructions, it will take only a m 3. Label each Element with the Element name 4. Write your Python code using the labels as pseudo-code -Let's take a couple of examples. +Let's take a couple of examples. **Enter a number**.... Popular beginner programs are often based on a game or logic puzzle that requires the user to enter something, like a number. The "high-low" answer game comes to mind where you try to guess the number based on high or low tips. @@ -570,20 +577,20 @@ Row 3 has an OK button Now that we've got the 3 rows defined, they are put into a list that represents the entire window. - layout = [ [sg.Text('Enter a Number')], - [sg.Input()], + layout = [ [sg.Text('Enter a Number')], + [sg.Input()], [sg.OK()] ] Finally we can put it all together into a program that will display our window. - import PySimpleGUI as sg - - layout = [[sg.Text('Enter a Number')], - [sg.Input()], - [sg.OK()] ] - - button, (number,) = sg.FlexForm('Enter a number example').LayoutAndRead(layout) - + import PySimpleGUI as sg + + layout = [[sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + + button, (number,) = sg.Window('Enter a number example').LayoutAndRead(layout) + sg.Popup(button, number) ### Example 2 - Get a filename @@ -594,14 +601,14 @@ Let's say you've got a utility you've written that operates on some input file a Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] - - button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) - + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) + sg.Popup(button, number) @@ -609,140 +616,140 @@ Read on for detailed instructions on the calls that show the form and return you -# Copy these design patterns! +# Copy these design patterns! All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. - + ## Pattern 1 - Single read forms This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - form = sg.FlexForm('SHA-1 & 256 Hash') + form = sg.Window('SHA-1 & 256 Hash') - button, (source_filename,) = form.LayoutAndRead(form_rows) - - ---- + button, (source_filename,) = form.LayoutAndRead(form_rows) + + ---- ## Pattern 2 - Single-read form "chained" -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling FlexForm and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, (source_filename,) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) ## Pattern 3 - Persistent form (multiple reads) Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling FlexForm which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. - - import PySimpleGUI as sg - - layout = [[sg.Text('Persistent form')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.FlexForm('Raspberry Pi GUI').Layout(layout) - - while True: - button, values = form.Read() - if button is None: +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. + + import PySimpleGUI as sg + + layout = [[sg.Text('Persistent form')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + form = sg.Window('Raspberry Pi GUI').Layout(layout) + + while True: + button, values = form.Read() + if button is None: break ### How GUI Programming in Python Should Look? At least for beginners - + Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. - + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. + Let's dissect this little program - import PySimpleGUI as sg - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - - form = sg.FlexForm('Rename Files or Folders') - + import PySimpleGUI as sg + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + form = sg.Window('Rename Files or Folders') + button, (folder_path, file_path) = form.LayoutAndRead(layout) - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -## Return values - + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +## Return values + As of version 2.8 there are 2 forms of return values, list and dictionary. - + ### Return values as a list By default return values are a list of values, one entry for each input field. - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - + + Return information from Window, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... ### Return values as a dictionary @@ -766,17 +773,17 @@ If **any** element in the form has a `key`, then **all** of the return values ar Let's take a look at your first dictionary-based form. import PySimpleGUI as sg - form = sg.FlexForm('Simple data entry form') - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - + form = sg.Window('Simple data entry form') + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + sg.Popup(button, values, values['name'], values['address'], values['phone']) To get the value of an input field, you use whatever value used as the `key` value as the index value. Thus to get the value of the name field, it is written as @@ -794,20 +801,20 @@ The button value from a Read call will be one of 3 values: If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. -None is returned when the user clicks the X to close a window. +None is returned when the user clicks the X to close a window. If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: - while True: - button, values= form.Read() - if button is None or button == 'Quit': + while True: + button, values= form.Read() + if button is None or button == 'Quit': break ## The Event Loop / Callback Functions All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. -Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. +Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. @@ -818,195 +825,195 @@ This little program has a typical Event Loop import PySimpleGUI as sg - layout = [[sg.T('Raspberry Pi LEDs')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.FlexForm('Raspberry Pi).Layout(layout) - - # ---- Event Loop ---- # - while True: - button, values = form.Read() - - # ---- Process Button Clicks ---- # - if button is None or button == 'Exit': - break - if button == 'Turn LED Off': - turn_LED_off() - elif button == 'Turn LED On': - turn_LED_on() - - # ---- After Event Loop ---- # + layout = [[sg.T('Raspberry Pi LEDs')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + form = sg.Window('Raspberry Pi).Layout(layout) + + # ---- Event Loop ---- # + while True: + button, values = form.Read() + + # ---- Process Button Clicks ---- # + if button is None or button == 'Exit': + break + if button == 'Turn LED Off': + turn_LED_off() + elif button == 'Turn LED On': + turn_LED_on() + + # ---- After Event Loop ---- # sg.Popup('Done... exiting') In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) -The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. -There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. +There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. -PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . +PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible trade-off to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. - ---- - -## All Widgets / Elements - -This code utilizes as many of the elements in one form as possible. - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ Column Definition ------ # - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Frame(layout=[ - [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame('Labelled Group',[[ - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]])], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] - ] - - - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - - button, values = form.Read() - - sg.Popup('Title', - 'The results of the form.', - 'The button clicked was "{}"'.format(button), + +--- + +## All Widgets / Elements + +This code utilizes as many of the elements in one form as possible. + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] + ] + + + form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = form.Read() + + sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), 'The values are', values) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) - -Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. + +Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms - -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms + +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the Window object: + + def Window(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), default_button_element_size = (None, None), - auto_size_text=None, - auto_size_buttons=None, - location=(None, None), + auto_size_text=None, + auto_size_buttons=None, + location=(None, None), font=None, - button_color=None,Font=None, - progress_bar_color=(None,None), + button_color=None,Font=None, + progress_bar_color=(None,None), background_color=None - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True - keep_on_top=False): - + keep_on_top=False): + -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) default_button_element_size - Size of buttons on this form - auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - location - (x,y) Location to place window in pixels - font - Font name and size for elements of the form - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - background_color - Color of the window background - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar + auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + location - (x,y) Location to place window in pixels + font - Font name and size for elements of the form + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + background_color - Color of the window background + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. - + #### Window Location PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. #### No Titlebar -Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. +Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. Be sure an provide your user an "exit" button or they will not be able to close the window! When no titlebar is enabled, there will be no icon on your taskbar for the window. Without an exit button you will need to kill via taskmanager... not fun. @@ -1020,7 +1027,7 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. @@ -1028,35 +1035,40 @@ It is turned off for non-blocking because there is a warning message printed out To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar + Calendar picker + Date Chooser + Read form + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Option Menu Menu Frame + Column Graph + Image Table - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + #### Common Parameters Some parameters that you will see on almost all Elements are: key @@ -1068,23 +1080,23 @@ Tooltips are text boxes that popup next to an element if you hold your mouse ove Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. - -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. - + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. + +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. + Text(text size=(None, None) auto_size_text=None @@ -1098,150 +1110,150 @@ The most basic element is the Text element. It simply displays text. Many of t key=None tooltip=None) -. - - Text - The text that's displayed - size - Element's size +. + + Text - The text that's displayed + size - Element's size click_submits - if clicked will cause a read call to return they key value as the button relief - relief to use around the text - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color background_color - background color - justification - Justification for the text. String - 'left', 'right', 'center' + justification - Justification for the text. String - 'left', 'right', 'center' pad - (x,y) amount of padding in pixels to use around element when packing key - used to identify element. This value will return as button if click_submits True tooltip - string representing tooltip - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. - - (foreground, background) - + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. + + (foreground, background) + Individual colors are specified using either the color names as defined in tkinter or an RGB string of this format: - - "#RRGGBB" - -**auto_size_text** + + "#RRGGBB" + +**auto_size_text** A `True` value for `auto_size_text`, when placed on Text Elements, indicates that the width of the Element should be shrunk do the width of the text. The default setting is True. - [ ] List item - -**Shortcut functions** -The shorthand functions for `Text` are `Txt` and `T` - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] + +**Shortcut functions** +The shorthand functions for `Text` are `Txt` and `T` + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] ![multiline](https://user-images.githubusercontent.com/13696193/44959853-b139a180-aec3-11e8-972f-f52188510c88.jpg) - -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) - - Output(size=(None, None)) -. - - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] + +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) + + Output(size=(None, None)) +. + + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] ![inputtext 2](https://user-images.githubusercontent.com/13696193/44959861-b5fe5580-aec3-11e8-8040-53ec241b5079.jpg) - - - def InputText(default_text = '', - size=(None, None), - auto_size_text=None, + + + def InputText(default_text = '', + size=(None, None), + auto_size_text=None, password_char='', - background_color=None, - text_color=None, + background_color=None, + text_color=None, do_not_clear=False, key=None, focus=False - ) -. - - default_text - Text initially shown in the input box - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + ) +. + + default_text - Text initially shown in the input box + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) - + There are two methods that can be called: InputText.Update(new_Value) - sets the input value - Input.Text(Get() - returns the current value of the field. - - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) + Input.Text(Get() - returns the current value of the field. - InputCombo(values, , - size=(None, None), + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) + + InputCombo(values, , + size=(None, None), auto_size_text=None, background_color = None, text_color = None, - key = None) -. - - values - Choices to be displayed. List of strings - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + key = None) +. + + values - Choices to be displayed. List of strings + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) - - + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) + + Listbox(values default_values=None select_mode=None @@ -1255,207 +1267,207 @@ The standard listbox like you'll find in most GUIs. Note that the return values key=None pad=None tooltip=None): - -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' + +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' change_submits - if True, the form read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background font - font to use for items in list text_color - color to use for the typed text key - Dictionary key to use for return values and to find element pad - amount of padding to use when packing tooltip - tooltip text - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. - -#### Slider Element - -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - size=(None, None), + +#### Slider Element + +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + size=(None, None), font=None, background_color = None, text_color = None, - key = None) ): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text + key = None) ): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Radio Button Element - -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) - - Radio(text, - group_id, - default=False, - size=(None, None), - auto_size_text=None, + +#### Radio Button Element + +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) + + Radio(text, + group_id, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display + key = None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the text - key = Dictionary key to use for return values - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] - - + key = Dictionary key to use for return values + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + + ![checkbox](https://user-images.githubusercontent.com/13696193/44959906-6f5d2b00-aec4-11e8-9c8a-962c787f0286.jpg) - Checkbox(text, - default=False, - size=(None, None), - auto_size_text=None, + Checkbox(text, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None): -. - - text - Text to display next to checkbox + key = None): +. + + text - Text to display next to checkbox default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - - -#### Spin Element - -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) - - Spin(values, - intiial_value=None, - size=(None, None), - auto_size_text=None, + key = Dictionary key to use for return values + + +#### Spin Element + +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) + + Spin(values, + intiial_value=None, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, key = None): -. - - values - List of valid values - initial_value - String with initial value - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display +. + + values - List of valid values + initial_value - String with initial value + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - -### Button Element - -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse + key = Dictionary key to use for return values + +### Button Element + +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse * Files Browse * File SaveAs * File Save -* Close Form (normal button) -* Read Form -* Realtime +* Close Form (normal button) +* Read Form +* Realtime * Calendar Chooser * Color Chooser - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog - -Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - + +Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. -Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. +Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. The 3 primary forms of PySimpleGUI buttons and their names are: - 1. `Button` = `SimpleButton` + 1. `Button` = `SimpleButton` 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` 3. `RealtimeButton` -You will find the long-form in the older programs. - -The most basic Button element call to use is `Button` +You will find the long-form in the older programs. +The most basic Button element call to use is `Button` + Button(button_text='' button_type=BUTTON_TYPE_CLOSES_WIN target=(None, None) @@ -1475,7 +1487,7 @@ The most basic Button element call to use is `Button` focus=False pad=None key=None): - + Parameters button_text - Text to be displayed on the button @@ -1499,69 +1511,69 @@ Parameters key - key used for finding the element #### Pre-defined Buttons -These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: - - OK - Ok - Submit - Cancel - Yes - No +These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: + + OK + Ok + Submit + Cancel + Yes + No Exit Quit Help Save SaveAs - FileBrowse + FileBrowse FilesBrowse - FileSaveAs - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - + FileSaveAs + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + ![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) - + #### Button targets + +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. - -The Target comes in two forms. +The Target comes in two forms. 1. Key 2. (row, column) Targets that are specified using a key will find its target element by using the target's key value. This is the "preferred" method. -If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The (row, col) targeting can only target elements that are in the same "container". Containers are the FlexForm, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. +If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The (row, col) targeting can only target elements that are in the same "container". Containers are the Window, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. + The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. (ThisRow, -1) means the Element to the left of the button, on the same row. If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. + +Let's examine this form as an example: -Let's examine this form as an example: - - + ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) - - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) - -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], + + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) + +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] or if using keys, then the code would be: - layout = [[sg.T('Source Folder')], - [sg.In(key='input')], + layout = [[sg.T('Source Folder')], + [sg.In(key='input')], [sg.FolderBrowse(target='input'), sg.OK()]] - + See how much easier the key method is? **Save & Open Buttons** @@ -1591,162 +1603,162 @@ These buttons pop up a standard color chooser window. The result is returned as ![color](https://user-images.githubusercontent.com/13696193/45243375-99965a80-b2c1-11e8-9779-b71bed85fab6.jpg) - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. - -layout = [[sg.Button('My Button')]] - -![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. - - - sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. + +layout = [[sg.Button('My Button')]] + +![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. + + + sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) - - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. - -**File Types** -The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. + + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.Window('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. + +**File Types** +The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen OneLineProgressMeter calls presented earlier in this readme. - - sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') - -The return value for `OneLineProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. - -#### Progress Mater in Your Form -Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen OneLineProgressMeter calls presented earlier in this readme. + + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') + +The return value for `OneLineProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. + +#### Progress Mater in Your Form +Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) - import PySimpleGUI as sg - - # layout the form - layout = [[sg.Text('A custom progress meter')], - [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], - [sg.Cancel()]] - - # create the form` - form = sg.FlexForm('Custom Progress Meter').Layout(layout) - progress_bar = form.FindElement('progressbar') - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i + 1) - # done with loop... need to destroy the window as it's still open + import PySimpleGUI as sg + + # layout the form + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], + [sg.Cancel()]] + + # create the form` + form = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = form.FindElement('progressbar') + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open form.CloseNonBlockingForm()) - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - - # Blocking form that doesn't close - def ChatBot(): - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), - sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), - sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - - form = sg.FlexForm('Chat Window', default_element_size=(30, 2)).Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + + # Blocking form that doesn't close + def ChatBot(): + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + ChatBot() ------------------- @@ -1760,8 +1772,8 @@ Columns are specified in exactly the same way as a form is, as a list of lists. size - size of visible portion of column pad - element padding to use when packing scrollable - bool. True if should add scrollbars - - + + Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1771,47 +1783,47 @@ Columns are needed when you have an element that has a height > 1 line on the le This code produced the above window. - import PySimpleGUI as sg - - # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. - - form = sg.FlexForm('Columns') # blank form - - # Column layout - col = [[sg.Text('col Row 1')], - [sg.Text('col Row 2'), sg.Input('col input 1')], - [sg.Text('col Row 3'), sg.Input('col input 2')], - [sg.Text('col Row 4'), sg.Input('col input 3')], - [sg.Text('col Row 5'), sg.Input('col input 4')], - [sg.Text('col Row 6'), sg.Input('col input 5')], - [sg.Text('col Row 7'), sg.Input('col input 6')]] - - layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], - [sg.In('Last input')], - [sg.OK()]] - - # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + form = sg.Window('Columns') # blank form + + # Column layout + col = [[sg.Text('col Row 1')], + [sg.Text('col Row 2'), sg.Input('col input 1')], + [sg.Text('col Row 3'), sg.Input('col input 2')], + [sg.Text('col Row 4'), sg.Input('col input 3')], + [sg.Text('col Row 5'), sg.Input('col input 4')], + [sg.Text('col Row 6'), sg.Input('col input 5')], + [sg.Text('col Row 7'), sg.Input('col input 6')]] + + layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], + [sg.In('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. Column(layout, background_color=None) The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. - + ---- ## Frames (Labelled Frames, Frames with a title) -Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. +Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. def Frame(title - the label / title to put on frame layout - list of rows of elements the frame contains @@ -1830,29 +1842,29 @@ Frames work exactly the same way as Columns. You create layout that is then use This code creates a form with a Frame and 2 buttons. - frame_layout = [ - [sg.T('Text inside of a frame')], - [sg.CB('Check 1'), sg.CB('Check 2')], - ] - layout = [ - [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], - [sg.Submit(), sg.Cancel()] - ] - - form = sg.FlexForm('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + frame_layout = [ + [sg.T('Text inside of a frame')], + [sg.CB('Check 1'), sg.CB('Check 2')], + ] + layout = [ + [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], + [sg.Submit(), sg.Cancel()] + ] + + form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. ## Canvas Element -In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. +In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. ### Matplotlib, Pyplot Integration @@ -1867,25 +1879,25 @@ One such integration is with Matploplib and Pyplot. There is a Demo program wri The order of operations to obtain a tkinter Canvas Widget is: - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the form layout - layout = [[sg.Text('Plot test')], - [sg.Canvas(size=(figure_w, figure_h), key='canvas')], - [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - - # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() - - - # add the plot to the window - fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) - - # show it all again and get buttons + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # define the form layout + layout = [[sg.Text('Plot test')], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], + [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] + + # create the form and show it without the plot + form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + + + # add the plot to the window + fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) + + # show it all again and get buttons button, values = form.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: * Add Canvas Element to your form -* Layout your form +* Layout your form * Call `form.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas @@ -1927,7 +1939,7 @@ This Element is relatively new and may have some parameter additions or deletion background_color - color to use for background pad - element padding for pack key - key used to lookup element - tooltip - tooltip text + tooltip - tooltip text @@ -1957,133 +1969,133 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: - -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... - - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: + +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None text_color=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None element_text_color=None input_text_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) tooltip_time = None - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color element_text_color - Text color of elements that have text, like Radio Buttons input_text_color - Color of the text that you type in - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + ## Persistent Forms (Window stays open after button click) There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. @@ -2092,16 +2104,16 @@ The `RButton` Element creates a button that when clicked will return control to -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. -When to use a non-blocking form: -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. +When to use a non-blocking form: +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. @@ -2125,88 +2137,88 @@ One example is you have an input field that changes as you press buttons on an o Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking forms. +There are 2 methods of interacting with non-blocking forms. 1. Read the form just as you would a normal form 2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values - With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - + With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + #### Exiting a Non-Blocking Form It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - - -Periodic refresh - +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + form = Window() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + form.ReadNonBlocking() or form.Refresh() - -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - - # Create the layout - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], - [sg.Button('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - + +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.Window('Running Timer', auto_size_text=True) + + # Create the layout + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], + [sg.Button('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + ## Updating Elements (changing elements in active form) Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). @@ -2220,35 +2232,35 @@ In some programs these updates happen in response to another Element. This prog + - - # Testing async form, see if can have a slider - # that adjusts the size of text displayed - - import PySimpleGUI as sg - fontSize = 12 - layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), - sg.Slider(range=(6,172), orientation='h', size=(10,20), - change_submits=True, key='slider', font=('Helvetica 20')), - sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] - - sz = fontSize - form = sg.FlexForm("Font size selector", grab_anywhere=False).Layout(layout) + # Testing async form, see if can have a slider + # that adjusts the size of text displayed + + import PySimpleGUI as sg + fontSize = 12 + layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), + change_submits=True, key='slider', font=('Helvetica 20')), + sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] + + sz = fontSize + form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop - while True: - button, values= form.Read() - if button is None: - break - sz_spin = int(values['spin']) - sz_slider = int(values['slider']) - sz = sz_spin if sz_spin != fontSize else sz_slider - if sz != fontSize: - fontSize = sz - font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - + while True: + button, values= form.Read() + if button is None: + break + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + print("Done.") @@ -2257,25 +2269,25 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + Remember this design pattern because you will use it OFTEN if you use persistent forms. It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: text_element = form.FindElement('text') - text_element.Update(font=font) + text_element.Update(font=font) The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. ## Keyboard & Mouse Capture -Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. +Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the Window call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. -Keys and scroll-wheel events are returned in exactly the same way as buttons. +Keys and scroll-wheel events are returned in exactly the same way as buttons. For scroll-wheel events, if the mouse is scrolled up, then the `button` text will be `MouseWheel:Up`. For downward scrolling, the text returned is `MouseWheel:Down` @@ -2285,50 +2297,50 @@ Keyboard keys return 2 types of key events. For "normal" keys (a,b,c, etc), a si Key Sym is a string such as 'Control_L'. The Key Code is a numeric representation of that key. The left control key, when pressed will return the value 'Control_L:17' - import PySimpleGUI as sg - - # Recipe for getting keys, one at a time as they are released - # If want to use the space bar, then be sure and disable the "default focus" - - with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - text_elem = sg.Text("", size=(18,1)) - layout = [[sg.Text("Press a key or scroll mouse")], - [text_elem], - [sg.Button("OK")]] - - form.Layout(layout) - # ---===--- Loop taking in user input --- # - while True: - button, value = form.ReadNonBlocking() - - if button == "OK" or (button is None and value is None): - print(button, "exiting") - break - if button is not None: + import PySimpleGUI as sg + + # Recipe for getting keys, one at a time as they are released + # If want to use the space bar, then be sure and disable the "default focus" + + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], + [text_elem], + [sg.Button("OK")]] + + form.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = form.ReadNonBlocking() + + if button == "OK" or (button is None and value is None): + print(button, "exiting") + break + if button is not None: text_elem.Update(button) -You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. +You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. ### Realtime Keyboard Capture -Use realtime keyboard capture by calling - - import PySimpleGUI as sg - - with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text("Hold down a key")], - [sg.Button("OK")]] - - form.Layout(layout) - - while True: - button, value = form.ReadNonBlocking() - - if button == "OK": - print(button, value, "exiting") - break - if button is not None: - print(button) - elif value is None: +Use realtime keyboard capture by calling + + import PySimpleGUI as sg + + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + layout = [[sg.Text("Hold down a key")], + [sg.Button("OK")]] + + form.Layout(layout) + + while True: + button, value = form.ReadNonBlocking() + + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + print(button) + elif value is None: break ## Menus @@ -2337,8 +2349,8 @@ Beginning in version 3.01 you can add a menubar to your form/window. You specif This definition: - menu_def = [['File', ['Open', 'Save', 'Exit',]], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + menu_def = [['File', ['Open', 'Save', 'Exit',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] Note the placement of ',' and of []. It's tricky to get the nested menus correct that implement cascading menus. See how paste has Special and Normal as a list after it. This means that Paste has a cascading menu with items Special and Normal. @@ -2354,7 +2366,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2381,68 +2393,68 @@ You can use Update to do things like: * etc + +## Sample Applications + +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -## Sample Applications - -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - - | Source File| Description | -|--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form + | Source File| Description | +|--|--| +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form -|**Demo_Chat.py** | A chat window with scrollable history -|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project -|**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex forms -|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form +|**Demo_Chat.py** | A chat window with scrollable history +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors +|**Demo_Columns.py** | Using the Column Element to create more complex forms +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook -|**Demo_Dictionary.py** | Specifying and using return values in dictionary format +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format **Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility -|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter |**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements -|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them -|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors -|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code -|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files -|**Demo_Keyboard.py** | Using blocking keyboard events -|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events -|**Demo_Machine_Learning.py** | A sample Machine Learning front end -|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph -|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph -|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files +|**Demo_Keyboard.py** | Using blocking keyboard events +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events +|**Demo_Machine_Learning.py** | A sample Machine Learning front end +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method -|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +|**Demo_NonBlocking_Form.py** | a basic async form |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 -|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_LEDs.py** | Control GPIO using buttons -|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons -|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | **Demo_Progress_Meters.py** | Demonstrates using 2 progress meters simultaneously -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook -|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts -|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts -|**Demo_Tabbed_Form.py** | Using the Tab feature +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts +|**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables |**Demo_Timer.py** | Simple non-blocking form - + ## Packages Used In Demos - - + + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: * [Chatterbot](https://github.com/gunthercox/ChatterBot) * [Mido](https://github.com/olemb/mido) * [Matplotlib](https://matplotlib.org/) * [PyMuPDF](https://github.com/rk700/PyMuPDF) - - + + ## Creating a Windows .EXE File It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. @@ -2472,22 +2484,22 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. -Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. +Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. sg.ChangeLookAndFeel('GreenTan') @@ -2510,57 +2522,57 @@ To see the latest list of color choices, take a look at the bottom of the `PySim You can also combine the `ChangeLookAndFeel` function with the `SetOptions` function to quickly modify one of the canned color schemes. Maybe you like the colors but was more depth to your bezels. You can dial in exactly what you want. -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X - -**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + +**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others @@ -2569,7 +2581,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) -| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) +| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. @@ -2577,19 +2589,20 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.00 | Sept 20, 2018 - See release notes | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code +| 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) @@ -2599,9 +2612,9 @@ Listboxes are still without scrollwheels. The mouse can drag to see more items. 3.0 We've come a long way baby! Time for a major revision bump. One reason is that the numbers started to confuse people the latest release was 2.30, but some people read it as 2.3 and thought it went backwards. I kinda messed up the 2.x series of numbers, so why not start with a clean slate. A lot has happened anyway so it's well earned. -One change that will set PySimpleGUI apart is the parlor trick of being able to move the window by clicking on it anywhere. This is turned on by default. It's not a common way to interact with windows. Normally you have to move using the titlebar. Not so with PySimpleGUI. Now you can drag using any part of the window. You will want to turn this off for windows with sliders. This feature is enabled in the FlexForm call. +One change that will set PySimpleGUI apart is the parlor trick of being able to move the window by clicking on it anywhere. This is turned on by default. It's not a common way to interact with windows. Normally you have to move using the titlebar. Not so with PySimpleGUI. Now you can drag using any part of the window. You will want to turn this off for windows with sliders. This feature is enabled in the Window call. -Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to FlexForm. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. +Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to Window. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. 3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. @@ -2610,18 +2623,18 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t #### 3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall - -#### 3.4.0 + +#### 3.4.0 * Frame - New Element - a labelled frame for grouping elements. Similar - to Column + to Column * Graph (like a Canvas element except uses the caller's - coordinate system rather than tkinter's). -* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). -* Buttons return key value rather than button text **If** a `key` is specified, -* + coordinate system rather than tkinter's). +* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). +* Buttons return key value rather than button text **If** a `key` is specified, +* OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's - the way progress works sometimes) + the way progress works sometimes) * Popup - changed ALL of the Popup calls to provide many more customization settings * Popup * PopupGetFolder @@ -2637,7 +2650,7 @@ OneLineProgressMeter function added which gives you not only a one-line solution * PopupOKCancel * PopupYesNo -#### 3.4.1 +#### 3.4.1 * Button.GetText - Button class method. Returns the current text being shown on a button. * Menu - Tearoff option. Determines if menus should allow them to be torn off * Help - Shorcut button. Like Submit, cancel, etc @@ -2663,92 +2676,96 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Made `Finalize()` in a way that it can be chained * Fixed bug in return values from Frame Element contents +#### 3.6.0 +* Renamed FlexForm to Window +* Removed LookAndFeel capability from Mac platform. -### Upcoming -Make suggestions people! Future release features +### Upcoming +Make suggestions people! Future release features + Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. WxPython is higher priority. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. **Dictionaries** Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. You can also look up elements using their keys. This is an excellent way to update elements in reaction to another element. Call `form.FindElement(key)` to get the Element. - - + + ## Author -MikeTheWatchGuy - +MikeTheWatchGuy + ## Demo Code Contributors [JorjMcKie](https://github.com/JorjMcKie) - PDF and image viewers (plus a number of code suggestions) [Otherion](https://github.com/Otherion) - Table Demos Panda & CSV. Loads of suggestions to the core APIs -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) - - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - + + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. diff --git a/readme.md b/readme.md index d5aec6619..e4d30b63c 100644 --- a/readme.md +++ b/readme.md @@ -1,16 +1,16 @@ - -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) # PySimpleGUI - -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.5.2-red.svg?longCache=true&style=for-the-badge) + +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.0-red.svg?longCache=true&style=for-the-badge) -[Wiki for the latest news](https://github.com/MikeTheWatchGuy/PySimpleGUI/wiki) +[Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) [ReadTheDocs](http://pysimplegui.readthedocs.io/) @@ -18,64 +18,72 @@ [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) +[OpenSource Article](https://opensource.com/article/18/8/pysimplegui) + [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -Super-simple GUI to use... Powerfully customizable. +Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter - -Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - -Looking to take your Python code from the world of command lines and into the convenience of a GUI? Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? Into Machine Learning and are sick of the command line? How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. - - import PySimpleGUI as sg - - sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - + +Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + +Looking for a GUI package to help with +* Taking your Python code from the world of command lines and into the convenience of a GUI? * +* Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? +* Into Machine Learning and are sick of the command line? +* How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? + +Look no further, **you've found your GUI package**. + + import PySimpleGUI as sg + + sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + ![hello world](https://user-images.githubusercontent.com/13696193/44960047-1f7f6380-aec6-11e8-9d5e-12ef935bcade.jpg) Or how about a ***custom GUI*** in 1 line of code? import PySimpleGUI as sg - - button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) - + + button, (filename,) = sg.Window('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. - - + + ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a more friendly way. It does the layout and boilerplate code for you and presents you with a simple, efficient interface. - -![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) - + +![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) + Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The same for shown as on Pi (roughly the same) - + ![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) - - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: - - OneLineProgressMeter('My meter title', current_value, max value, 'key') - - ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - + + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: + + OneLineProgressMeter('My meter title', current_value, max value, 'key') + + ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) - + How about embedding a game inside of a GUI? This game of Pong is written in tkinter and then dropped into the PySimpleGUI window creating a game that has an accompanying GUI. -![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) Combining PySimpleGUI with PyInstaller creates something truly remarkable and special, a Python program that looks like a Windows WinForms application. This application with working menu was created in 20 lines of Python code. It is a single .EXE file that launches straight into the screen you see. And more good news, the only icon you see on the taskbar is the window itself... there is no pesky shell window. @@ -84,59 +92,58 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. -> Create a custom GUI with as little and as simple code as possible. +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? + +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. +> Create a custom GUI with as little and as simple code as possible. -This was the primary focus used to create PySimpleGUI. +This was the primary focus used to create PySimpleGUI. > "Do it in a Python-like way" -was the second. +was the second. ## Features While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Files Browse - Folder Browse - SaveAs - Non-closing return - Close form - Realtime + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Files Browse + Folder Browse + SaveAs + Non-closing return + Close form + Realtime Calendar chooser Color chooser - Checkboxes - Radio Buttons - Listbox - Slider + Checkboxes + Radio Buttons + Listbox + Option Menu + Slider Graph - Frame with title - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar - Calendar chooser - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Code Proress Bar & Debug Print - Complete control of colors, look and feel + Frame with title + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Code Proress Bar & Debug Print + Complete control of colors, look and feel Selection of pre-defined palettes - Button images + Button images Return values as dictionary Set focus Bind return key to buttons @@ -155,86 +162,86 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Tooltips Clickable links No async programming required (no callbacks to worry about) - - + + An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : ->Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... +>Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - - - - import PySimpleGUI as sg - - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), - sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] - - button, values = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) - - - ---- -### Design Goals - -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. + +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + + + + import PySimpleGUI as sg + + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] + + button, values = sg.Window('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) + + + +--- +### Design Goals + +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. + + - Forms are represented as Python lists. + - A form is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. - Return values can also be represented as a dictionary - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values - Linear programming instead of callbacks - + #### Lofty Goals > Change Python -The hope is not that ***this*** package will become part of the Python Standard Library. +The hope is not that ***this*** package will become part of the Python Standard Library. -The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. +The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. -The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. +The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. -There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. +There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. This is my attempt to find out. - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install --upgrade PySimpleGUI - + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install --upgrade PySimpleGUI + On some systems you need to run pip3. - + pip3 install --upgrade PySimpleGUI On a Raspberry Pi, this is should work: @@ -249,110 +256,110 @@ If for some reason you are unable to install using `pip`, don't worry, you can s `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: ``` -ImportError: No module named tkinter +ImportError: No module named tkinter ``` then you need to install `tkinter`. Be sure and get the Python 3 version. ``` sudo apt-get install python3-tk ``` - -### Prerequisites - -Python 3 -tkinter - -PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Prerequisites + +Python 3 +tkinter + +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### EXE file creation If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe - -## Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.Popup('This is my first Popup') - -![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: + +## Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own forms. + + sg.Popup('This is my first Popup') + +![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom form functions - - -### Python Language Features - - There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... - * Variable number of arguments to a function call - * Optional parameters to a function call + * Custom form functions + + +### Python Language Features + + There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... + * Variable number of arguments to a function call + * Optional parameters to a function call * Dictionaries - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.Popup('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Popup - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def Popup(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.Popup('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Popup + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def Popup(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: 1. To identify values when a form is read 2. To identify Elements so that they can be "updated" - ---- - -### High Level API Calls - Popup's + +--- + +### High Level API Calls - Popup's "High level calls" are those that start with "Popup". They are the most basic form of communications with the user. They are named after the type of window they create, a pop-up window. These windows are meant to be short lived while, either delivering information or collecting it, and then quickly disappearing. ### Popup Output -Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. +Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. `Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. -There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). +There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). The list of Popup output functions are @@ -360,7 +367,7 @@ The list of Popup output functions are PopupOk PopupYesNo PopupCancel - PopupOkCancel + PopupOkCancel PopupError PopupTimed, PopupAutoClose PopupNoWait, PopupNonBlocking @@ -374,16 +381,16 @@ The function `PopupTimed` or `PopupAutoClose` are popup windows that will automa Here is a quick-reference showing how the Popup calls look. - sg.Popup('Popup') - sg.PopupOk('PopupOk') - sg.PopupYesNo('PopupYesNo') - sg.PopupCancel('PopupCancel') - sg.PopupOkCancel('PopupOkCancel') - sg.PopupError('PopupError') - sg.PopupTimed('PopupTimed') + sg.Popup('Popup') + sg.PopupOk('PopupOk') + sg.PopupYesNo('PopupYesNo') + sg.PopupCancel('PopupCancel') + sg.PopupOkCancel('PopupOkCancel') + sg.PopupError('PopupError') + sg.PopupTimed('PopupTimed') sg.PopupAutoClose('PopupAutoClose') - - + + ![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) @@ -402,14 +409,14 @@ Here is a quick-reference showing how the Popup calls look. #### Scrolled Output There is a scrolled version of Popups should you have a lot of information to display. - sg.PopupScrolled(my_text) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - + sg.PopupScrolled(my_text) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + The `PopupScrolled` will auto-fit the window size to the size of the text. Specify `None` in the height field of a `size` parameter to get auto-sized height. -This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. +This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. sg.PopupScrolled(my_text, size=(80, None)) @@ -419,7 +426,7 @@ Note that the default max number of lines before scrolling happens is set to 50. The Popup call PopupNoWait or PopupNonBlocking will create a popup window and then immediately return control back to you. All other popup functions will block, waiting for the user to close the popup window. -This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement +This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement A word of ***caution***... Windows that are created after the NoWait Popup are "slaves" to the NoWait'd popup. If you close the Popup, it will also lose the window the you created after the Popup. A good rule of thumb is to leave the popup open while you're interacting with the rest of your program until you understand what happens when you close the NoWaitPopup. @@ -434,99 +441,99 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFolder` - get a folder name Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. - - - import PySimpleGUI as sg - - text = sg.PopupGetText('Title', 'Please input something') - sg.Popup('Results', 'The value returned from PopupGetText', text) - + + + import PySimpleGUI as sg + + text = sg.PopupGetText('Title', 'Please input something') + sg.Popup('Results', 'The value returned from PopupGetText', text) + ![popupgettext](https://user-images.githubusercontent.com/13696193/44957281-8721b880-ae9e-11e8-98cd-d06369f4187e.jpg) ![popup gettext response](https://user-images.githubusercontent.com/13696193/44957282-8721b880-ae9e-11e8-84ae-dc8bb30504a0.jpg) - text = sg.PopupGetFile('Please enter a file name') + text = sg.PopupGetFile('Please enter a file name') sg.Popup('Results', 'The value returned from PopupGetFile', text) - + ![popupgetfile](https://user-images.githubusercontent.com/13696193/44957857-2fd31680-aea5-11e8-8eb7-f6b91c202cc8.jpg) The window created to get a folder name looks the same as the get a file name. The difference is in what the browse button does. `PopupGetFile` shows an Open File dialog box while `PopupGetFolder` shows an Open Folder dialog box. - text = sg.PopupGetFolder('Please enter a folder name') + text = sg.PopupGetFolder('Please enter a folder name') sg.Popup('Results', 'The value returned from PopupGetFolder', text) ![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) -#### Progress Meters! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - OneLineProgressMeter(title, - current_value, - max_value, +#### Progress Meters! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + OneLineProgressMeter(title, + current_value, + max_value, key, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. + + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom Form API Calls (Your First Form) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. + +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. ## The Form Designer The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. @@ -539,7 +546,7 @@ It's a manual process, but if you follow the instructions, it will take only a m 3. Label each Element with the Element name 4. Write your Python code using the labels as pseudo-code -Let's take a couple of examples. +Let's take a couple of examples. **Enter a number**.... Popular beginner programs are often based on a game or logic puzzle that requires the user to enter something, like a number. The "high-low" answer game comes to mind where you try to guess the number based on high or low tips. @@ -570,20 +577,20 @@ Row 3 has an OK button Now that we've got the 3 rows defined, they are put into a list that represents the entire window. - layout = [ [sg.Text('Enter a Number')], - [sg.Input()], + layout = [ [sg.Text('Enter a Number')], + [sg.Input()], [sg.OK()] ] Finally we can put it all together into a program that will display our window. - import PySimpleGUI as sg - - layout = [[sg.Text('Enter a Number')], - [sg.Input()], - [sg.OK()] ] - - button, (number,) = sg.FlexForm('Enter a number example').LayoutAndRead(layout) - + import PySimpleGUI as sg + + layout = [[sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + + button, (number,) = sg.Window('Enter a number example').LayoutAndRead(layout) + sg.Popup(button, number) ### Example 2 - Get a filename @@ -594,14 +601,14 @@ Let's say you've got a utility you've written that operates on some input file a Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] - - button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) - + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) + sg.Popup(button, number) @@ -609,140 +616,140 @@ Read on for detailed instructions on the calls that show the form and return you -# Copy these design patterns! +# Copy these design patterns! All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. - + ## Pattern 1 - Single read forms This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - form = sg.FlexForm('SHA-1 & 256 Hash') + form = sg.Window('SHA-1 & 256 Hash') - button, (source_filename,) = form.LayoutAndRead(form_rows) - - ---- + button, (source_filename,) = form.LayoutAndRead(form_rows) + + ---- ## Pattern 2 - Single-read form "chained" -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling FlexForm and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, (source_filename,) = sg.FlexForm('SHA-1 & 256 Hash').LayoutAndRead(form_rows) +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. + + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) ## Pattern 3 - Persistent form (multiple reads) Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling FlexForm which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. - - import PySimpleGUI as sg - - layout = [[sg.Text('Persistent form')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.FlexForm('Raspberry Pi GUI').Layout(layout) - - while True: - button, values = form.Read() - if button is None: +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. + + import PySimpleGUI as sg + + layout = [[sg.Text('Persistent form')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + form = sg.Window('Raspberry Pi GUI').Layout(layout) + + while True: + button, values = form.Read() + if button is None: break ### How GUI Programming in Python Should Look? At least for beginners - + Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. - + +The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. + Let's dissect this little program - import PySimpleGUI as sg - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - - form = sg.FlexForm('Rename Files or Folders') - + import PySimpleGUI as sg + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + form = sg.Window('Rename Files or Folders') + button, (folder_path, file_path) = form.LayoutAndRead(layout) - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -## Return values - + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the form has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. + +For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. + + button, (folder_path, file_path) = form.LayoutAndRead(layout) + +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +## Return values + As of version 2.8 there are 2 forms of return values, list and dictionary. - + ### Return values as a list By default return values are a list of values, one entry for each input field. - - Return information from FlexForm, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - + + Return information from Window, SG's primary form builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + + Or, you can unpack the return results separately. + + button, values = form.LayoutAndRead(form_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = form.LayoutAndRead(form_rows) + + Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... + + button, value_list = form.LayoutAndRead(form_rows) + value1 = value_list[0] + value2 = value_list[1] + ... ### Return values as a dictionary @@ -766,17 +773,17 @@ If **any** element in the form has a `key`, then **all** of the return values ar Let's take a look at your first dictionary-based form. import PySimpleGUI as sg - form = sg.FlexForm('Simple data entry form') - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - + form = sg.Window('Simple data entry form') + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = form.LayoutAndRead(layout) + sg.Popup(button, values, values['name'], values['address'], values['phone']) To get the value of an input field, you use whatever value used as the `key` value as the index value. Thus to get the value of the name field, it is written as @@ -794,20 +801,20 @@ The button value from a Read call will be one of 3 values: If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. -None is returned when the user clicks the X to close a window. +None is returned when the user clicks the X to close a window. If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: - while True: - button, values= form.Read() - if button is None or button == 'Quit': + while True: + button, values= form.Read() + if button is None or button == 'Quit': break ## The Event Loop / Callback Functions All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. -Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. +Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. @@ -818,195 +825,195 @@ This little program has a typical Event Loop import PySimpleGUI as sg - layout = [[sg.T('Raspberry Pi LEDs')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.FlexForm('Raspberry Pi).Layout(layout) - - # ---- Event Loop ---- # - while True: - button, values = form.Read() - - # ---- Process Button Clicks ---- # - if button is None or button == 'Exit': - break - if button == 'Turn LED Off': - turn_LED_off() - elif button == 'Turn LED On': - turn_LED_on() - - # ---- After Event Loop ---- # + layout = [[sg.T('Raspberry Pi LEDs')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + form = sg.Window('Raspberry Pi).Layout(layout) + + # ---- Event Loop ---- # + while True: + button, values = form.Read() + + # ---- Process Button Clicks ---- # + if button is None or button == 'Exit': + break + if button == 'Turn LED Off': + turn_LED_off() + elif button == 'Turn LED On': + turn_LED_on() + + # ---- After Event Loop ---- # sg.Popup('Done... exiting') In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) -The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. -There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. +There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. -PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . +PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible trade-off to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. - ---- - -## All Widgets / Elements - -This code utilizes as many of the elements in one form as possible. - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ Column Definition ------ # - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Frame(layout=[ - [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame('Labelled Group',[[ - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]])], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] - ] - - - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - - button, values = form.Read() - - sg.Popup('Title', - 'The results of the form.', - 'The button clicked was "{}"'.format(button), + +--- + +## All Widgets / Elements + +This code utilizes as many of the elements in one form as possible. + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] + ] + + + form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = form.Read() + + sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), 'The values are', values) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - + +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. + ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) - -Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. + +Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms - -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with FlexForm('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the FlexForm object: - - def FlexForm(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. + +You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom Forms + +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. + +NON-BLOCKING form call: + + form.Show(non_blocking=True) + +### Beginning a Form +The first step is to create the form object using the desired form customization. + + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + +This is the definition of the Window object: + + def Window(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), default_button_element_size = (None, None), - auto_size_text=None, - auto_size_buttons=None, - location=(None, None), + auto_size_text=None, + auto_size_buttons=None, + location=(None, None), font=None, - button_color=None,Font=None, - progress_bar_color=(None,None), + button_color=None,Font=None, + progress_bar_color=(None,None), background_color=None - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True - keep_on_top=False): - + keep_on_top=False): + -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. + + default_element_size - Size of elements in form in characters (width, height) default_button_element_size - Size of buttons on this form - auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - location - (x,y) Location to place window in pixels - font - Font name and size for elements of the form - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - background_color - Color of the window background - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar + auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + location - (x,y) Location to place window in pixels + font - Font name and size for elements of the form + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + background_color - Color of the window background + is_tabbed_form - Bool. If True then form is a tabbed form + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. - + #### Window Location PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. #### No Titlebar -Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. +Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. Be sure an provide your user an "exit" button or they will not be able to close the window! When no titlebar is enabled, there will be no icon on your taskbar for the window. Without an exit button you will need to kill via taskmanager... not fun. @@ -1020,7 +1027,7 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. @@ -1028,35 +1035,40 @@ It is turned off for non-blocking because there is a warning message printed out To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse + +## Elements +"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse Folder Browse - Non-closing return - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar + Calendar picker + Date Chooser + Read form + Close form + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Option Menu Menu Frame + Column Graph + Image Table - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - + Async/Non-Blocking Windows + Tabbed forms + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + #### Common Parameters Some parameters that you will see on almost all Elements are: key @@ -1068,23 +1080,23 @@ Tooltips are text boxes that popup next to an element if you hold your mouse ove Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. - -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. - + +### Output Elements +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. + +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. + Text(text size=(None, None) auto_size_text=None @@ -1098,150 +1110,150 @@ The most basic element is the Text element. It simply displays text. Many of t key=None tooltip=None) -. - - Text - The text that's displayed - size - Element's size +. + + Text - The text that's displayed + size - Element's size click_submits - if clicked will cause a read call to return they key value as the button relief - relief to use around the text - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color background_color - background color - justification - Justification for the text. String - 'left', 'right', 'center' + justification - Justification for the text. String - 'left', 'right', 'center' pad - (x,y) amount of padding in pixels to use around element when packing key - used to identify element. This value will return as button if click_submits True tooltip - string representing tooltip - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. - - (foreground, background) - + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. + + (foreground, background) + Individual colors are specified using either the color names as defined in tkinter or an RGB string of this format: - - "#RRGGBB" - -**auto_size_text** + + "#RRGGBB" + +**auto_size_text** A `True` value for `auto_size_text`, when placed on Text Elements, indicates that the width of the Element should be shrunk do the width of the text. The default setting is True. - [ ] List item - -**Shortcut functions** -The shorthand functions for `Text` are `Txt` and `T` - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] + +**Shortcut functions** +The shorthand functions for `Text` are `Txt` and `T` + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] ![multiline](https://user-images.githubusercontent.com/13696193/44959853-b139a180-aec3-11e8-972f-f52188510c88.jpg) - -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) - - Output(size=(None, None)) -. - - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] + +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits form + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. + + form.AddRow(gg.Output(size=(100,20))) + +![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) + + Output(size=(None, None)) +. + + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] ![inputtext 2](https://user-images.githubusercontent.com/13696193/44959861-b5fe5580-aec3-11e8-8040-53ec241b5079.jpg) - - - def InputText(default_text = '', - size=(None, None), - auto_size_text=None, + + + def InputText(default_text = '', + size=(None, None), + auto_size_text=None, password_char='', - background_color=None, - text_color=None, + background_color=None, + text_color=None, do_not_clear=False, key=None, focus=False - ) -. - - default_text - Text initially shown in the input box - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + ) +. + + default_text - Text initially shown in the input box + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) - + There are two methods that can be called: InputText.Update(new_Value) - sets the input value - Input.Text(Get() - returns the current value of the field. - - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) + Input.Text(Get() - returns the current value of the field. - InputCombo(values, , - size=(None, None), + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) + + InputCombo(values, , + size=(None, None), auto_size_text=None, background_color = None, text_color = None, - key = None) -. - - values - Choices to be displayed. List of strings - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + key = None) +. + + values - Choices to be displayed. List of strings + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) - - + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) + + Listbox(values default_values=None select_mode=None @@ -1255,207 +1267,207 @@ The standard listbox like you'll find in most GUIs. Note that the return values key=None pad=None tooltip=None): - -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' + +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' change_submits - if True, the form read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background font - font to use for items in list text_color - color to use for the typed text key - Dictionary key to use for return values and to find element pad - amount of padding to use when packing tooltip - tooltip text - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. - -#### Slider Element - -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - size=(None, None), + +#### Slider Element + +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + size=(None, None), font=None, background_color = None, text_color = None, - key = None) ): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text + key = None) ): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Radio Button Element - -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) - - Radio(text, - group_id, - default=False, - size=(None, None), - auto_size_text=None, + +#### Radio Button Element + +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) + + Radio(text, + group_id, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display + key = None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the text - key = Dictionary key to use for return values - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] - - + key = Dictionary key to use for return values + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + + ![checkbox](https://user-images.githubusercontent.com/13696193/44959906-6f5d2b00-aec4-11e8-9c8a-962c787f0286.jpg) - Checkbox(text, - default=False, - size=(None, None), - auto_size_text=None, + Checkbox(text, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None): -. - - text - Text to display next to checkbox + key = None): +. + + text - Text to display next to checkbox default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - - -#### Spin Element - -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) - - Spin(values, - intiial_value=None, - size=(None, None), - auto_size_text=None, + key = Dictionary key to use for return values + + +#### Spin Element + +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) + + Spin(values, + intiial_value=None, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, key = None): -. - - values - List of valid values - initial_value - String with initial value - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display +. + + values - List of valid values + initial_value - String with initial value + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - -### Button Element - -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse + key = Dictionary key to use for return values + +### Button Element + +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse * Files Browse * File SaveAs * File Save -* Close Form (normal button) -* Read Form -* Realtime +* Close Form (normal button) +* Read Form +* Realtime * Calendar Chooser * Color Chooser - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + + + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog - -Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - + +Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. + +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. + Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. -Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. +Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. The 3 primary forms of PySimpleGUI buttons and their names are: - 1. `Button` = `SimpleButton` + 1. `Button` = `SimpleButton` 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` 3. `RealtimeButton` -You will find the long-form in the older programs. - -The most basic Button element call to use is `Button` +You will find the long-form in the older programs. +The most basic Button element call to use is `Button` + Button(button_text='' button_type=BUTTON_TYPE_CLOSES_WIN target=(None, None) @@ -1475,7 +1487,7 @@ The most basic Button element call to use is `Button` focus=False pad=None key=None): - + Parameters button_text - Text to be displayed on the button @@ -1499,69 +1511,69 @@ Parameters key - key used for finding the element #### Pre-defined Buttons -These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: - - OK - Ok - Submit - Cancel - Yes - No +These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: + + OK + Ok + Submit + Cancel + Yes + No Exit Quit Help Save SaveAs - FileBrowse + FileBrowse FilesBrowse - FileSaveAs - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - + FileSaveAs + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + ![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) - + #### Button targets + +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. - -The Target comes in two forms. +The Target comes in two forms. 1. Key 2. (row, column) Targets that are specified using a key will find its target element by using the target's key value. This is the "preferred" method. -If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. - -The (row, col) targeting can only target elements that are in the same "container". Containers are the FlexForm, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. +If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +The (row, col) targeting can only target elements that are in the same "container". Containers are the Window, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. + The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. (ThisRow, -1) means the Element to the left of the button, on the same row. If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. + +Let's examine this form as an example: -Let's examine this form as an example: - - + ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) - - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) - -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], + + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) + +The code for the entire form could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] or if using keys, then the code would be: - layout = [[sg.T('Source Folder')], - [sg.In(key='input')], + layout = [[sg.T('Source Folder')], + [sg.In(key='input')], [sg.FolderBrowse(target='input'), sg.OK()]] - + See how much easier the key method is? **Save & Open Buttons** @@ -1591,162 +1603,162 @@ These buttons pop up a standard color chooser window. The result is returned as ![color](https://user-images.githubusercontent.com/13696193/45243375-99965a80-b2c1-11e8-9779-b71bed85fab6.jpg) - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. - -layout = [[sg.Button('My Button')]] - -![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. - - - sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - + +**Custom Buttons** +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. + +layout = [[sg.Button('My Button')]] + +![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. + + + sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example form made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form + + sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) - - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. - -**File Types** -The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. + + +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this form: + + form = sg.Window('Robotics Remote Control', auto_size_text=True) + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + form.LayoutAndRead(form_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = form.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. + +**File Types** +The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a form where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen OneLineProgressMeter calls presented earlier in this readme. - - sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') - -The return value for `OneLineProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. - -#### Progress Mater in Your Form -Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen OneLineProgressMeter calls presented earlier in this readme. + + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') + +The return value for `OneLineProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. + +#### Progress Mater in Your Form +Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) - import PySimpleGUI as sg - - # layout the form - layout = [[sg.Text('A custom progress meter')], - [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], - [sg.Cancel()]] - - # create the form` - form = sg.FlexForm('Custom Progress Meter').Layout(layout) - progress_bar = form.FindElement('progressbar') - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i + 1) - # done with loop... need to destroy the window as it's still open + import PySimpleGUI as sg + + # layout the form + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], + [sg.Cancel()]] + + # create the form` + form = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = form.FindElement('progressbar') + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = form.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open form.CloseNonBlockingForm()) - - -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - - # Blocking form that doesn't close - def ChatBot(): - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), - sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), - sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - - form = sg.FlexForm('Chat Window', default_element_size=(30, 2)).Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(size=(None, None)) + +Here's a complete solution for a chat-window using an Async form with an Output Element + + import PySimpleGUI as sg + + # Blocking form that doesn't close + def ChatBot(): + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = form.Read() + if button == 'SEND': + print(value) + else: + break + ChatBot() ------------------- @@ -1760,8 +1772,8 @@ Columns are specified in exactly the same way as a form is, as a list of lists. size - size of visible portion of column pad - element padding to use when packing scrollable - bool. True if should add scrollbars - - + + Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1771,47 +1783,47 @@ Columns are needed when you have an element that has a height > 1 line on the le This code produced the above window. - import PySimpleGUI as sg - - # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. - - form = sg.FlexForm('Columns') # blank form - - # Column layout - col = [[sg.Text('col Row 1')], - [sg.Text('col Row 2'), sg.Input('col input 1')], - [sg.Text('col Row 3'), sg.Input('col input 2')], - [sg.Text('col Row 4'), sg.Input('col input 3')], - [sg.Text('col Row 5'), sg.Input('col input 4')], - [sg.Text('col Row 6'), sg.Input('col input 5')], - [sg.Text('col Row 7'), sg.Input('col input 6')]] - - layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], - [sg.In('Last input')], - [sg.OK()]] - - # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + form = sg.Window('Columns') # blank form + + # Column layout + col = [[sg.Text('col Row 1')], + [sg.Text('col Row 2'), sg.Input('col input 1')], + [sg.Text('col Row 3'), sg.Input('col input 2')], + [sg.Text('col Row 4'), sg.Input('col input 3')], + [sg.Text('col Row 5'), sg.Input('col input 4')], + [sg.Text('col Row 6'), sg.Input('col input 5')], + [sg.Text('col Row 7'), sg.Input('col input 6')]] + + layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], + [sg.In('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. Column(layout, background_color=None) The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. - + ---- ## Frames (Labelled Frames, Frames with a title) -Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. +Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. def Frame(title - the label / title to put on frame layout - list of rows of elements the frame contains @@ -1830,29 +1842,29 @@ Frames work exactly the same way as Columns. You create layout that is then use This code creates a form with a Frame and 2 buttons. - frame_layout = [ - [sg.T('Text inside of a frame')], - [sg.CB('Check 1'), sg.CB('Check 2')], - ] - layout = [ - [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], - [sg.Submit(), sg.Cancel()] - ] - - form = sg.FlexForm('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + frame_layout = [ + [sg.T('Text inside of a frame')], + [sg.CB('Check 1'), sg.CB('Check 2')], + ] + layout = [ + [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], + [sg.Submit(), sg.Cancel()] + ] + + form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. ## Canvas Element -In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. +In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. ### Matplotlib, Pyplot Integration @@ -1867,25 +1879,25 @@ One such integration is with Matploplib and Pyplot. There is a Demo program wri The order of operations to obtain a tkinter Canvas Widget is: - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the form layout - layout = [[sg.Text('Plot test')], - [sg.Canvas(size=(figure_w, figure_h), key='canvas')], - [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - - # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() - - - # add the plot to the window - fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) - - # show it all again and get buttons + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # define the form layout + layout = [[sg.Text('Plot test')], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], + [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] + + # create the form and show it without the plot + form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + + + # add the plot to the window + fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) + + # show it all again and get buttons button, values = form.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: * Add Canvas Element to your form -* Layout your form +* Layout your form * Call `form.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas @@ -1927,7 +1939,7 @@ This Element is relatively new and may have some parameter additions or deletion background_color - color to use for background pad - element padding for pack key - key used to lookup element - tooltip - tooltip text + tooltip - tooltip text @@ -1957,133 +1969,133 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `FlexForm` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: - -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... - - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format + + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) + +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your forms can go from this: + +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None text_color=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None element_text_color=None input_text_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) tooltip_time = None - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color element_text_color - Text color of elements that have text, like Radio Buttons input_text_color - Color of the text that you type in - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - + + +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: + + - Form level + - Row level + - Element level + +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). + ## Persistent Forms (Window stays open after button click) There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. @@ -2092,16 +2104,16 @@ The `RButton` Element creates a button that when clicked will return control to -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! +## Asynchronous (Non-Blocking) Forms +So you want to be a wizard do ya? Well go boldly! Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. -When to use a non-blocking form: -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. +When to use a non-blocking form: +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. @@ -2125,88 +2137,88 @@ One example is you have an input field that changes as you press buttons on an o Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking forms. +There are 2 methods of interacting with non-blocking forms. 1. Read the form just as you would a normal form 2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values - With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - + With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + #### Exiting a Non-Blocking Form It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - form = FlexForm() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) - - -Periodic refresh - +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: + + while True: + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + + +We're going to build an app that does the latter. It's going to update our form with a running clock. + +The basic flow and functions you will be calling are: +Setup + + form = Window() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) + + +Periodic refresh + form.ReadNonBlocking() or form.Refresh() - -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - - # Create the layout - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], - [sg.Button('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - + +If you need to close the form + + form.CloseNonBlockingForm() + +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. + +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # form that doesn't block + # Make a form, but don't use context manager + form = sg.Window('Running Timer', auto_size_text=True) + + # Create the layout + form_rows = [[sg.Text('Non-blocking GUI with updates')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], + [sg.Button('Quit')]] + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + form.CloseNonBlockingForm() + + +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. + The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. + ## Updating Elements (changing elements in active form) Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). @@ -2220,35 +2232,35 @@ In some programs these updates happen in response to another Element. This prog + - - # Testing async form, see if can have a slider - # that adjusts the size of text displayed - - import PySimpleGUI as sg - fontSize = 12 - layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), - sg.Slider(range=(6,172), orientation='h', size=(10,20), - change_submits=True, key='slider', font=('Helvetica 20')), - sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] - - sz = fontSize - form = sg.FlexForm("Font size selector", grab_anywhere=False).Layout(layout) + # Testing async form, see if can have a slider + # that adjusts the size of text displayed + + import PySimpleGUI as sg + fontSize = 12 + layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), + change_submits=True, key='slider', font=('Helvetica 20')), + sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] + + sz = fontSize + form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop - while True: - button, values= form.Read() - if button is None: - break - sz_spin = int(values['spin']) - sz_slider = int(values['slider']) - sz = sz_spin if sz_spin != fontSize else sz_slider - if sz != fontSize: - fontSize = sz - font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - + while True: + button, values= form.Read() + if button is None: + break + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + print("Done.") @@ -2257,25 +2269,25 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) + Remember this design pattern because you will use it OFTEN if you use persistent forms. It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: text_element = form.FindElement('text') - text_element.Update(font=font) + text_element.Update(font=font) The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. ## Keyboard & Mouse Capture -Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the FlexForm call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. +Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the Window call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. -Keys and scroll-wheel events are returned in exactly the same way as buttons. +Keys and scroll-wheel events are returned in exactly the same way as buttons. For scroll-wheel events, if the mouse is scrolled up, then the `button` text will be `MouseWheel:Up`. For downward scrolling, the text returned is `MouseWheel:Down` @@ -2285,50 +2297,50 @@ Keyboard keys return 2 types of key events. For "normal" keys (a,b,c, etc), a si Key Sym is a string such as 'Control_L'. The Key Code is a numeric representation of that key. The left control key, when pressed will return the value 'Control_L:17' - import PySimpleGUI as sg - - # Recipe for getting keys, one at a time as they are released - # If want to use the space bar, then be sure and disable the "default focus" - - with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - text_elem = sg.Text("", size=(18,1)) - layout = [[sg.Text("Press a key or scroll mouse")], - [text_elem], - [sg.Button("OK")]] - - form.Layout(layout) - # ---===--- Loop taking in user input --- # - while True: - button, value = form.ReadNonBlocking() - - if button == "OK" or (button is None and value is None): - print(button, "exiting") - break - if button is not None: + import PySimpleGUI as sg + + # Recipe for getting keys, one at a time as they are released + # If want to use the space bar, then be sure and disable the "default focus" + + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], + [text_elem], + [sg.Button("OK")]] + + form.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = form.ReadNonBlocking() + + if button == "OK" or (button is None and value is None): + print(button, "exiting") + break + if button is not None: text_elem.Update(button) -You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. +You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. ### Realtime Keyboard Capture -Use realtime keyboard capture by calling - - import PySimpleGUI as sg - - with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text("Hold down a key")], - [sg.Button("OK")]] - - form.Layout(layout) - - while True: - button, value = form.ReadNonBlocking() - - if button == "OK": - print(button, value, "exiting") - break - if button is not None: - print(button) - elif value is None: +Use realtime keyboard capture by calling + + import PySimpleGUI as sg + + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + layout = [[sg.Text("Hold down a key")], + [sg.Button("OK")]] + + form.Layout(layout) + + while True: + button, value = form.ReadNonBlocking() + + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + print(button) + elif value is None: break ## Menus @@ -2337,8 +2349,8 @@ Beginning in version 3.01 you can add a menubar to your form/window. You specif This definition: - menu_def = [['File', ['Open', 'Save', 'Exit',]], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + menu_def = [['File', ['Open', 'Save', 'Exit',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] Note the placement of ',' and of []. It's tricky to get the nested menus correct that implement cascading menus. See how paste has Special and Normal as a list after it. This means that Paste has a cascading menu with items Special and Normal. @@ -2354,7 +2366,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2381,68 +2393,68 @@ You can use Update to do things like: * etc + +## Sample Applications + +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: -## Sample Applications - -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - - | Source File| Description | -|--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form + | Source File| Description | +|--|--| +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form -|**Demo_Chat.py** | A chat window with scrollable history -|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project -|**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex forms -|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form +|**Demo_Chat.py** | A chat window with scrollable history +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors +|**Demo_Columns.py** | Using the Column Element to create more complex forms +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook -|**Demo_Dictionary.py** | Specifying and using return values in dictionary format +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format **Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility -|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter |**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements -|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them -|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors -|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code -|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files -|**Demo_Keyboard.py** | Using blocking keyboard events -|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events -|**Demo_Machine_Learning.py** | A sample Machine Learning front end -|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph -|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph -|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files +|**Demo_Keyboard.py** | Using blocking keyboard events +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events +|**Demo_Machine_Learning.py** | A sample Machine Learning front end +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method -|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +|**Demo_NonBlocking_Form.py** | a basic async form |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 -|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_LEDs.py** | Control GPIO using buttons -|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons -|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | **Demo_Progress_Meters.py** | Demonstrates using 2 progress meters simultaneously -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook -|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts -|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts -|**Demo_Tabbed_Form.py** | Using the Tab feature +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts +|**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables |**Demo_Timer.py** | Simple non-blocking form - + ## Packages Used In Demos - - + + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: * [Chatterbot](https://github.com/gunthercox/ChatterBot) * [Mido](https://github.com/olemb/mido) * [Matplotlib](https://matplotlib.org/) * [PyMuPDF](https://github.com/rk700/PyMuPDF) - - + + ## Creating a Windows .EXE File It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. @@ -2472,22 +2484,22 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. -Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. +Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. sg.ChangeLookAndFeel('GreenTan') @@ -2510,57 +2522,57 @@ To see the latest list of color choices, take a look at the bottom of the `PySim You can also combine the `ChangeLookAndFeel` function with the `SetOptions` function to quickly modify one of the canned color schemes. Maybe you like the colors but was more depth to your bezels. You can dial in exactly what you want. -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X - -**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + +**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others @@ -2569,7 +2581,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) -| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) +| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. @@ -2577,19 +2589,20 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.00 | Sept 20, 2018 - See release notes | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code +| 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) @@ -2599,9 +2612,9 @@ Listboxes are still without scrollwheels. The mouse can drag to see more items. 3.0 We've come a long way baby! Time for a major revision bump. One reason is that the numbers started to confuse people the latest release was 2.30, but some people read it as 2.3 and thought it went backwards. I kinda messed up the 2.x series of numbers, so why not start with a clean slate. A lot has happened anyway so it's well earned. -One change that will set PySimpleGUI apart is the parlor trick of being able to move the window by clicking on it anywhere. This is turned on by default. It's not a common way to interact with windows. Normally you have to move using the titlebar. Not so with PySimpleGUI. Now you can drag using any part of the window. You will want to turn this off for windows with sliders. This feature is enabled in the FlexForm call. +One change that will set PySimpleGUI apart is the parlor trick of being able to move the window by clicking on it anywhere. This is turned on by default. It's not a common way to interact with windows. Normally you have to move using the titlebar. Not so with PySimpleGUI. Now you can drag using any part of the window. You will want to turn this off for windows with sliders. This feature is enabled in the Window call. -Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to FlexForm. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. +Related to the Grab Anywhere feature is the no_titlebar option, again found in the call to Window. Your window will be a spiffy, borderless window. It's a really interesting effect. Slight problem is that you do not have an icon on the taskbar with these types of windows, so if you don't supply a button to close the window, there's no way to close it other than task manager. 3.0.2 Still making changes to Update methods with many more ahead in the future. Continue to mess with grab anywhere option. Needed to disable in more places such as the PopupGetText function. Any time these is text input on a form, you generally want to turn off the grab anywhere feature. @@ -2610,18 +2623,18 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t #### 3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall - -#### 3.4.0 + +#### 3.4.0 * Frame - New Element - a labelled frame for grouping elements. Similar - to Column + to Column * Graph (like a Canvas element except uses the caller's - coordinate system rather than tkinter's). -* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). -* Buttons return key value rather than button text **If** a `key` is specified, -* + coordinate system rather than tkinter's). +* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). +* Buttons return key value rather than button text **If** a `key` is specified, +* OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's - the way progress works sometimes) + the way progress works sometimes) * Popup - changed ALL of the Popup calls to provide many more customization settings * Popup * PopupGetFolder @@ -2637,7 +2650,7 @@ OneLineProgressMeter function added which gives you not only a one-line solution * PopupOKCancel * PopupYesNo -#### 3.4.1 +#### 3.4.1 * Button.GetText - Button class method. Returns the current text being shown on a button. * Menu - Tearoff option. Determines if menus should allow them to be torn off * Help - Shorcut button. Like Submit, cancel, etc @@ -2663,92 +2676,96 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Made `Finalize()` in a way that it can be chained * Fixed bug in return values from Frame Element contents +#### 3.6.0 +* Renamed FlexForm to Window +* Removed LookAndFeel capability from Mac platform. -### Upcoming -Make suggestions people! Future release features +### Upcoming +Make suggestions people! Future release features + Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. WxPython is higher priority. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. **Dictionaries** Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. You can also look up elements using their keys. This is an excellent way to update elements in reaction to another element. Call `form.FindElement(key)` to get the Element. - - + + ## Author -MikeTheWatchGuy - +MikeTheWatchGuy + ## Demo Code Contributors [JorjMcKie](https://github.com/JorjMcKie) - PDF and image viewers (plus a number of code suggestions) [Otherion](https://github.com/Otherion) - Table Demos Panda & CSV. Loads of suggestions to the core APIs -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) - - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - + + +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. From 828274af3f0266c69d8d72bcc224851372ec7333 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 17:53:28 -0400 Subject: [PATCH 445/521] Replaced form with window --- docs/cookbook.md | 2493 +++++++++++++++++++++++----------------------- 1 file changed, 1247 insertions(+), 1246 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 38857130a..292b0d179 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1,1247 +1,1248 @@ -# The PySimpleGUI Cookbook - -You will find all of these Recipes in a single Python file ([Demo_Cookbook.py](https://github.com/MikeTheWatchGuy/PySimpleGUI/blob/master/Demo_Cookbook.py)) located on the project's GitHub page. This program will allow you to view the source code and the window that it produces. You can also download over 50 demo programs that are ready to run. - -You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. - -## Simple Data Entry - Return Values As List -Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. - -![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) - - import PySimpleGUI as sg - - # Very basic form. Return values as a list - form = sg.Window('Simple data entry form') # begin with a blank form - - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - - print(button, values[0], values[1], values[2]) - -## Simple data entry - Return Values As Dictionary -A simple form with default values. Results returned in a dictionary. - -![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) - - import PySimpleGUI as sg - - # Very basic form. Return values as a dictionary - form = sg.Window('Simple data entry form') # begin with a blank form - - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - - print(button, values['name'], values['address'], values['phone']) - ---------------------- - - - ------------ -## Simple File Browse -Browse for a filename that is populated into the input field. - -![simple file browse](https://user-images.githubusercontent.com/13696193/43934539-d8bd9490-9c1d-11e8-927f-98b523776fcb.jpg) - - import PySimpleGUI as sg - - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - (button, (source_filename,)) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) - - print(button, source_filename) - --------------------------- -## Add GUI to Front-End of Script -Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. - -![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) - - - import PySimpleGUI as sg - import sys - - if len(sys.argv) == 1: - button, (fname,) = sg.Window('My Script').LayoutAndRead([[sg.Text('Document to open')], - [sg.In(), sg.FileBrowse()], - [sg.Open(), sg.Cancel()]]) - else: - fname = sys.argv[1] - - if not fname: - sg.Popup("Cancel", "No filename supplied") - raise SystemExit("Cancelling: no filename supplied") - print(button, fname) - - - --------------- - -## Compare 2 Files - -Browse to get 2 file names that can be then compared. - -![compare 2 files](https://user-images.githubusercontent.com/13696193/43934659-60dc5fbe-9c1e-11e8-8d2b-07c0e3b61892.jpg) - - import PySimpleGUI as sg - - form_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - - form = sg.Window('File Compare') - - button, values = form.LayoutAndRead(form_rows) - - print(button, values) - ---------------- -## Nearly All Widgets with Green Color Theme -Example of nearly all of the widgets in a single form. Uses a customized color scheme. - -![latest everything bagel](https://user-images.githubusercontent.com/13696193/45920376-22d89000-be71-11e8-8ac4-640f011f84d0.jpg) - - - - #!/usr/bin/env Python3 - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ Column Definition ------ # - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Frame(layout=[ - [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame('Labelled Group',[[ - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]])], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] - ] - - - form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - - button, values = form.Read() - - sg.Popup('Title', - 'The results of the form.', - 'The button clicked was "{}"'.format(button), - 'The values are', values) - -------------- - - - - -## Non-Blocking Form With Periodic Update -An async form that has a button read loop. A Text Element is updated periodically with a running timer. Note that `value` is checked for None which indicates the window was closed using X. - -![non-blocking](https://user-images.githubusercontent.com/13696193/43955295-70f6ac48-9c6d-11e8-8ea2-e6729ba9330c.jpg) - - - import PySimpleGUI as sg - import time - - form_rows = [[sg.Text('Stopwatch', size=(20, 2), justification='center')], - [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], - [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] - - form = sg.Window('Running Timer').Layout(form_rows) - - timer_running = True - i = 0 - # Event Loop - while True: - i += 1 * (timer_running is True) - button, values = form.ReadNonBlocking() - - if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - elif button == 'Start/Stop': - timer_running = not timer_running - - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - time.sleep(.01) - --------- - -## Callback Function Simulation -The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. - -![button callback 2](https://user-images.githubusercontent.com/13696193/43955588-e139ddc6-9c6e-11e8-8c78-c1c226b8d9b1.jpg) - - import PySimpleGUI as sg - - # This design pattern simulates button callbacks - # Note that callbacks are NOT a part of the package's interface to the - # caller intentionally. The underlying implementation actually does use - # tkinter callbacks. They are simply hidden from the user. - - # The callback functions - def button1(): - print('Button 1 callback') - - def button2(): - print('Button 2 callback') - - - # Layout the design of the GUI - layout = [[sg.Text('Please click a button', auto_size_text=True)], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] - - # Show the form to the user - form = sg.Window('Button callback example').Layout(layout) - - # Event loop. Read buttons, make callbacks - while True: - # Read the form - button, value = form.Read() - # Take appropriate action based on button - if button == '1': - button1() - elif button == '2': - button2() - elif button =='Quit' or button is None: - break - - # All done! - sg.PopupOK('Done') - ------ -## Realtime Buttons (Good For Raspberry Pi) -This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. - -![robot control](https://user-images.githubusercontent.com/13696193/44006710-d227f23e-9e56-11e8-89a3-2be5b2726199.jpg) - - import PySimpleGUI as sg - - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' ' * 10), sg.RealtimeButton('Forward')], - [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], - [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form = sg.Window('Robotics Remote Control', auto_size_text=True).Layout(form_rows) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh. - # - # your program's main loop - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - print(button) - if button == 'Quit' or values is None: - break - - form.CloseNonBlockingForm() # Don't forget to close your window! - ---------- - -## OneLineProgressMeter - -This recipe shows just how easy it is to add a progress meter to your code. - -![onelineprogressmeter](https://user-images.githubusercontent.com/13696193/45589254-bd285900-b8f0-11e8-9122-b43f06bf074d.jpg) - - - import PySimpleGUI as sg - - for i in range(1000): - sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') - - ------ -## Tabbed Form -Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single form. - - -![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg) - - import PySimpleGUI as sg - - layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - form = sg.Window('') - form2 = sg.Window('') - - results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), - (form2, layout_tab_2, 'Second Tab')) - - sg.Popup(results) - ------ -## Button Graphics (Media Player) -Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. - -![media player](https://user-images.githubusercontent.com/13696193/43958418-5dd133f2-9c79-11e8-9432-0a67007e85ac.jpg) - - import PySimpleGUI as sg - - background = '#F0F0F0' - # Set the backgrounds the same as the background on the buttons - sg.SetOptions(background_color=background, element_background_color=background) - # Images are located in a subfolder in the Demo Media Player.py folder - image_pause = './ButtonGraphics/Pause.png' - image_restart = './ButtonGraphics/Restart.png' - image_next = './ButtonGraphics/Next.png' - image_exit = './ButtonGraphics/Exit.png' - - # define layout of the rows - layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], - [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], - [sg.ReadButton('Restart Song', button_color=(background, background), - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadButton('Pause', button_color=(background, background), - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadButton('Next', button_color=(background, background), - image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.Button('Exit', button_color=(background, background), - image_filename=image_exit, image_size=(50, 50), image_subsample=2, - border_width=0)], - [sg.Text('_' * 30)], - [sg.Text(' ' * 30)], - [ - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 2), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 8), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15))], - [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), - sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), - sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] - ] - - form = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1), - font=("Helvetica", 25)).Layout(layout) - # Our event loop - while (True): - # Read the form (this call will not block) - button, values = form.ReadNonBlocking() - if button == 'Exit' or values is None: - break - # If a button was pressed, display it on the GUI by updating the text element - if button: - form.FindElement('output').Update(button) - ----- -## Script Launcher - Persistent Form -This form doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.Button`. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. - -![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) - - import PySimpleGUI as sg - import subprocess - - # Please check Demo programs for better examples of launchers - def ExecuteCommandSubprocess(command, *args): - try: - sp = subprocess.Popen([command, *args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = sp.communicate() - if out: - print(out.decode("utf-8")) - if err: - print(err.decode("utf-8")) - except: - pass - - - layout = [ - [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20))], - [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], - [sg.Text('Manual command', size=(15, 1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] - ] - - - form = sg.Window('Script launcher').Layout(layout) - - # ---===--- Loop taking in user input and using it to call scripts --- # - - while True: - (button, value) = form.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': - ExecuteCommandSubprocess('pip', 'list') - elif button == 'script2': - ExecuteCommandSubprocess('python', '--version') - elif button == 'Run': - ExecuteCommandSubprocess(value[0]) - ----- -## Machine Learning GUI -A standard non-blocking GUI with lots of inputs. - -![machine learning green](https://user-images.githubusercontent.com/13696193/43979000-408b77ba-9cb7-11e8-9ffd-24c156767532.jpg) - - import PySimpleGUI as sg - - # Green & tan color scheme - sg.ChangeLookAndFeel('GreenTan') - - sg.SetOptions(text_justification='right') - - layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), - sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), - sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), - sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), - sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 15), justification='left')], - [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], - [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], - [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], - [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], - [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], - [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], - [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], - [sg.Submit(), sg.Cancel()]] - - form = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) - - button, values = form.Read() - -------- -## Custom Progress Meter / Progress Bar -Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. - -![custom progress meter](https://user-images.githubusercontent.com/13696193/43982958-3393b23e-9cc6-11e8-8b49-e7f4890cbc4b.jpg) - - - import PySimpleGUI as sg - - # layout the form - layout = [[sg.Text('A custom progress meter')], - [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progbar')], - [sg.Cancel()]] - - # create the form - form = sg.Window('Custom Progress Meter').Layout(layout) - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - form.FindElement('progbar').UpdateBar(i + 1) - # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() - - - ---- - -## The One-Line GUI - -For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `Window` and the call to `LayoutAndRead`. `Window` returns a `Window` object which has the `LayoutAndRead` method. - - -![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) - - -Instead of - - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()]] - - button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) - -you can write this line of code for the exact same result (OK, two lines with the import): - - import PySimpleGUI as sg - - button, (filename,) = sg.Window('Get filename example').LayoutAndRead( - [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) - --------------------- -## Multiple Columns -Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. - -This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. - -To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. - -![cookbook columns](https://user-images.githubusercontent.com/13696193/45309948-f6c52280-b4f2-11e8-8691-a45fa0e06c50.jpg) - - - - import PySimpleGUI as sg - - # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. - - sg.ChangeLookAndFeel('BlueMono') - - # Column layout - col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], - [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], - [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] - - layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], - [sg.Input('Last input')], - [sg.OK()]] - - # Display the form and get values - - button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) - - -## Persistent Form With Text Element Updates - -This simple program keep a form open, taking input values until the user terminates the program using the "X" button. - -![math game](https://user-images.githubusercontent.com/13696193/44537842-c9444080-a6cd-11e8-94bc-6cdf1b765dd8.jpg) - - - - import PySimpleGUI as sg - - layout = [ [sg.Txt('Enter values to calculate')], - [sg.In(size=(8,1), key='numerator')], - [sg.Txt('_' * 10)], - [sg.In(size=(8,1), key='denominator')], - [sg.Txt('', size=(8,1), key='output') ], - [sg.ReadButton('Calculate', bind_return_key=True)]] - - form = sg.Window('Math').Layout(layout) - - while True: - button, values = form.Read() - - if button is not None: - try: - numerator = float(values['numerator']) - denominator = float(values['denominator']) - calc = numerator / denominator - except: - calc = 'Invalid' - - form.FindElement('output').Update(calc) - else: - break - - - -## tkinter Canvas Widget - -The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: - - can = sg.Canvas(size=(100,100)) - tkcanvas = can.TKCanvas - tkcanvas.create_oval(50, 50, 100, 100) - -While it's fun to scribble on a Canvas Widget, try Graph Element makes it a downright pleasant experience. You do not have to worry about the tkinter coordinate system and can instead work in your own coordinate system. - - -![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) - - - import PySimpleGUI as sg - - layout = [ - [sg.Canvas(size=(100, 100), background_color='red', key= 'canvas')], - [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] - ] - - form = sg.Window('Canvas test') - form.Layout(layout) - form.Finalize() - - canvas = form.FindElement('canvas') - cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) - - while True: - button, values = form.Read() - if button is None: - break - if button == 'Blue': - canvas.TKCanvas.itemconfig(cir, fill="Blue") - elif button == 'Red': - canvas.TKCanvas.itemconfig(cir, fill="Red") - -## Graph Element - drawing circle, rectangle, etc, objects - -Just like you can draw on a tkinter widget, you can also draw on a Graph Element. Graph Elements are easier on the programmer as you get to work in your own coordinate system. - -![graph recipe](https://user-images.githubusercontent.com/13696193/45920640-751bb000-be75-11e8-9530-45b71cbae07d.jpg) - - - import PySimpleGUI as sg - - layout = [ - [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], - [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] - ] - - form = sg.Window('Graph test') - form.Layout(layout) - form.Finalize() - - graph = form.FindElement('graph') - circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') - point = graph.DrawPoint((75,75), 10, color='green') - oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) - rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) - line = graph.DrawLine((0,0), (100,100)) - - while True: - button, values = form.Read() - if button is None: - break - if button is 'Blue': - graph.TKCanvas.itemconfig(circle, fill = "Blue") - elif button is 'Red': - graph.TKCanvas.itemconfig(circle, fill = "Red") - elif button is 'Move': - graph.MoveFigure(point, 10,10) - graph.MoveFigure(circle, 10,10) - graph.MoveFigure(oval, 10,10) - graph.MoveFigure(rectangle, 10,10) - - -## Keypad Touchscreen Entry - Input Element Update - -This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. -There are a number of features used in this Recipe including: -* Default Element Size -* auto_size_buttons -* ReadButton -* Dictionary Return values -* Update of Elements in form (Input, Text) -* do_not_clear of Input Elements - - -![keypad 2](https://user-images.githubusercontent.com/13696193/44640891-57504d80-a992-11e8-93f4-4e97e586505e.jpg) - - - - import PySimpleGUI as sg - - # Demonstrates a number of PySimpleGUI features including: - # Default element size - # auto_size_buttons - # ReadButton - # Dictionary return values - # Update of elements in form (Text, Input) - # do_not_clear of Input elements - - layout = [[sg.Text('Enter Your Passcode')], - [sg.Input(size=(10, 1), do_not_clear=True, justification='right', key='input')], - [sg.ReadButton('1'), sg.ReadButton('2'), sg.ReadButton('3')], - [sg.ReadButton('4'), sg.ReadButton('5'), sg.ReadButton('6')], - [sg.ReadButton('7'), sg.ReadButton('8'), sg.ReadButton('9')], - [sg.ReadButton('Submit'), sg.ReadButton('0'), sg.ReadButton('Clear')], - [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], - ] - - form = sg.Window('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) - - # Loop forever reading the form's values, updating the Input field - keys_entered = '' - while True: - button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit - break - if button == 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button == 'Submit': - keys_entered = values['input'] - form.FindElement('out').Update(keys_entered) # output the final string - - form.FindElement('input').Update(keys_entered) # change the form to reflect current key string - -## Animated Matplotlib Graph - -Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. - -![animated matplotlib](https://user-images.githubusercontent.com/13696193/44640937-91b9ea80-a992-11e8-9c1c-85ae74013679.jpg) - - - from tkinter import * - from random import randint - import PySimpleGUI as g - from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg - from matplotlib.figure import Figure - import matplotlib.backends.tkagg as tkagg - import tkinter as Tk - - - fig = Figure() - - ax = fig.add_subplot(111) - ax.set_xlabel("X axis") - ax.set_ylabel("Y axis") - ax.grid() - - layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [g.Canvas(size=(640, 480), key='canvas')], - [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - - # create the form and show it without the plot - - - form = g.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) - form.Finalize() # needed to access the canvas element prior to reading the form - - canvas_elem = form.FindElement('canvas') - - graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) - canvas = canvas_elem.TKCanvas - - dpts = [randint(0, 10) for x in range(10000)] - # Our event loop - for i in range(len(dpts)): - button, values = form.ReadNonBlocking() - if button == 'Exit' or values is None: - exit(69) - - ax.cla() - ax.grid() - - ax.plot(range(20), dpts[i:i + 20], color='purple') - graph.draw() - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - canvas.create_image(640 / 2, 480 / 2, image=photo) - - figure_canvas_agg = FigureCanvasAgg(fig) - figure_canvas_agg.draw() - - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - - - -## Tight Layout with Button States - -Saw this example layout written in tkinter and liked it so much I duplicated the interface. It's "tight", clean, and has a nice dark look and feel. - -This Recipe also contains code that implements the button interactions so that you'll have a template to build from. - -In other GUI frameworks this program would be most likely "event driven" with callback functions being used to communicate button events. The "event loop" would be handled by the GUI engine. If code already existed that used a call-back mechanism, the loop in the example code below could simply call these callback functions directly based on the button text it receives in the form.Read call. - -![timemanagement](https://user-images.githubusercontent.com/13696193/44996818-0f27c100-af78-11e8-8836-9ef6164efe3b.jpg) - - - import PySimpleGUI as sg - """ - Demonstrates using a "tight" layout with a Dark theme. - Shows how button states can be controlled by a user application. The program manages the disabled/enabled - states for buttons and changes the text color to show greyed-out (disabled) buttons - """ - - sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0,0)) - - 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), - sg.ReadFormButton('Stop', button_color=('white', 'black'), key='Stop'), - sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] - ] - - form = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1)) - form.Layout(layout) - form.Finalize() - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Reset').Update(disabled=True) - form.FindElement('Submit').Update(disabled=True) - recording = have_data = False - while True: - button, values = form.Read() - print(button) - if button is None: - exit(69) - if button is 'Start': - form.FindElement('Start').Update(disabled=True) - form.FindElement('Stop').Update(disabled=False) - form.FindElement('Reset').Update(disabled=False) - form.FindElement('Submit').Update(disabled=True) - recording = True - elif button is 'Stop' and recording: - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Start').Update(disabled=False) - form.FindElement('Submit').Update(disabled=False) - recording = False - have_data = True - elif button is 'Reset': - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Start').Update(disabled=False) - form.FindElement('Submit').Update(disabled=True) - form.FindElement('Reset').Update(disabled=False) - recording = False - have_data = False - elif button is 'Submit' and have_data: - form.FindElement('Stop').Update(disabled=True) - form.FindElement('Start').Update(disabled=False) - form.FindElement('Submit').Update(disabled=True) - form.FindElement('Reset').Update(disabled=False) - recording = False - -## Password Protection For Scripts - -You get 2 scripts in one. - -Use the upper half to generate your hash code. Then paste it into the code in the lower half. Copy and paste lower 1/2 into your code to get password protection for your script without putting the password into your source code. - -![password entry](https://user-images.githubusercontent.com/13696193/45129440-ab58f000-b151-11e8-8ebe-e519a50b3ead.jpg) - -![password hash](https://user-images.githubusercontent.com/13696193/45129441-ab58f000-b151-11e8-8a46-c2789bb7824e.jpg) - - import PySimpleGUI as sg - import hashlib - - ''' - Create a secure login for your scripts without having to include your password in the program. Create an SHA1 hash code for your password using the GUI. Paste into variable in final program - 1. Choose a password - 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password - 3. Type password into the GUI - 4. Copy and paste hash code form GUI into variable named login_password_hash - 5. Run program again and test your login! - ''' - - # Use this GUI to get your password's hash code - def HashGeneratorGUI(): - layout = [[sg.T('Password Hash Generator', size=(30,1), font='Any 15')], - [sg.T('Password'), sg.In(key='password')], - [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], - ] - - form = sg.Window('SHA Generator', auto_size_text=False, default_element_size=(10,1), - text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) - - - while True: - button, values = form.Read() - if button is None: - exit(69) - - password = values['password'] - try: - password_utf = password.encode('utf-8') - sha1hash = hashlib.sha1() - sha1hash.update(password_utf) - password_hash = sha1hash.hexdigest() - form.FindElement('hash').Update(password_hash) - except: - pass - - # ----------------------------- Paste this code into your program / script ----------------------------- - # determine if a password matches the secret password by comparing SHA1 hash codes - def PasswordMatches(password, hash): - password_utf = password.encode('utf-8') - sha1hash = hashlib.sha1() - sha1hash.update(password_utf) - password_hash = sha1hash.hexdigest() - if password_hash == hash: - return True - else: - return False - - login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' - password = sg.PopupGetText('Password', password_char='*') - if password == 'gui': # Remove when pasting into your program - HashGeneratorGUI() # Remove when pasting into your program - exit(69) # Remove when pasting into your program - if PasswordMatches(password, login_password_hash): - print('Login SUCCESSFUL') - else: - print('Login FAILED!!') - - -## Desktop Floating Toolbar - -#### Hiding your windows commmand window -For this and the Time & CPU Widgets you may wish to consider using a tool or technique that will hide your Windows Command Prompt window. I recommend the techniques found on this site: - -[http://www.robvanderwoude.com/battech_hideconsole.php](http://www.robvanderwoude.com/battech_hideconsole.php) - -At the moment I'm using the technique that involves wscript and a script named RunNHide.vbs. They are working beautifully. I'm using a hotkey program and launch by using this script with the command "python.exe insert_program_here.py". I guess the next widget should be one that shows all the programs launched this way so you can kill any bad ones. If you don't properly catch the exit button on your form then your while loop is going to keep on working while your window is no longer there so be careful in your code to always have exit explicitly handled. - - -### Floating toolbar - -This is a cool one! (Sorry about the code pastes... I'm working in it) - -Impress your friends at what a tool-wizard you are by popping a custom toolbar that you keep in the corner of your screen. It stays on top of all your other windows. - - - - -![toolbar gray](https://user-images.githubusercontent.com/13696193/45324308-bfb73700-b51b-11e8-90e7-ab24f3d6e61d.jpg) - -You can easily change colors to match your background by changing a couple of parameters in the code. - -![toolbar black](https://user-images.githubusercontent.com/13696193/45324307-bfb73700-b51b-11e8-8709-6c3c23f737c4.jpg) - - - import PySimpleGUI as sg - import subprocess - import os - import sys - - """ - Demo_Toolbar - A floating toolbar with quick launcher One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout - You can setup a specific program to launch when a button is clicked, or use the Combobox to select a .py file found in the root folder, and run that file. """ - - ROOT_PATH = './' - - def Launcher(): - - def print(line): - form.FindElement('output').Update(line) - - sg.ChangeLookAndFeel('Dark') - - namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] - - sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) - layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), - sg.ReadButton('Run', button_color=('white', '#00168B')), - sg.ReadButton('Program 1'), - sg.ReadButton('Program 2'), - sg.ReadButton('Program 3', button_color=('white', '#35008B')), - sg.Button('EXIT', button_color=('white','firebrick3'))], - [sg.T('', text_color='white', size=(50,1), key='output')]] - - form = sg.Window('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) - - # ---===--- Loop taking in user input (buttons) --- # - while True: - (button, value) = form.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'Program 1': - print('Run your program 1 here!') - elif button == 'Program 2': - print('Run your program 2 here!') - elif button == 'Run': - file = value['demofile'] - print('Launching %s'%file) - ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) - else: - print(button) - - def ExecuteCommandSubprocess(command, *args, wait=False): - try: - if sys.platform == 'linux': - arg_string = '' - for arg in args: - arg_string += ' ' + str(arg) - sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - if wait: - out, err = sp.communicate() - if out: - print(out.decode("utf-8")) - if err: - print(err.decode("utf-8")) - except: pass - - - - if __name__ == '__main__': - Launcher() - - - - -## Desktop Floating Widget - Timer - -This is a little widget you can leave running on your desktop. Will hopefully see more of these for things like checking email, checking server pings, displaying system information, dashboards, etc -. -Much of the code is handling the button states in a fancy way. It could be much simpler if you don't change the button text based on state. - -![timer](https://user-images.githubusercontent.com/13696193/45336349-26a31300-b551-11e8-8b06-d1232ff8ca10.jpg) - - import PySimpleGUI as sg - import time - - """ - Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. It will look something like: invalid command name \"1616802625480StopMove\" - """ - - - # ---------------- Create Form ---------------- - sg.ChangeLookAndFeel('Black') - sg.SetOptions(element_padding=(0, 0)) - - form_rows = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadButton('Pause', key='button', button_color=('white', '#001480')), - sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), - sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] - - form = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) - - - # ---------------- main loop ---------------- - current_time = 0 - paused = False - start_time = int(round(time.time() * 100)) - while (True): - # --------- Read and update window -------- - if not paused: - button, values = form.ReadNonBlocking() - current_time = int(round(time.time() * 100)) - start_time - else: - button, values = form.Read() - if button == 'button': - button = form.FindElement(button).GetText() - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - if button is 'Reset': - start_time = int(round(time.time() * 100)) - current_time = 0 - paused_time = start_time - elif button == 'Pause': - paused = True - paused_time = int(round(time.time() * 100)) - element = form.FindElement('button') - element.Update(text='Run') - elif button == 'Run': - paused = False - start_time = start_time + int(round(time.time() * 100)) - paused_time - element = form.FindElement('button') - element.Update(text='Pause') - - # --------- Display timer in window -------- - form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, - (current_time // 100) % 60, - current_time % 100)) - time.sleep(.01) - - # --------- After loop -------- - - # Broke out of main loop. Close the window. - form.CloseNonBlockingForm() - -## Desktop Floating Widget - CPU Utilization - -Like the Timer widget above, this script can be kept running. You will need the package psutil installed in order to run this Recipe. -The spinner changes the number of seconds between reads. Note that you will get an error message printed when exiting because the window does not have have a titlebar. It's a known problem. - - -![cpu widget 2](https://user-images.githubusercontent.com/13696193/45456096-77348080-b6b7-11e8-8906-6663c31ad0eb.jpg) - - - - import PySimpleGUI as sg - import psutil - - # ---------------- Create Form ---------------- - sg.ChangeLookAndFeel('Black') - form_rows = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(form_rows) - - - # ---------------- main loop ---------------- - while (True): - # --------- Read and update window -------- - button, values = form.ReadNonBlocking() - - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - try: - interval = int(values['spin']) - except: - interval = 1 - - cpu_percent = psutil.cpu_percent(interval=interval) - - # --------- Display timer in window -------- - - form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') - - # Broke out of main loop. Close the window. - form.CloseNonBlockingForm() - -## Menus - -Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. - -Menu's are defined separately from the GUI form. To add one to your form, simply insert sg.Menu(menu_layout). The menu definition is a list of menu choices and submenus. They are a list of lists. Copy the Recipe and play with it. You'll eventually get when you're looking for. - -If you double click the dashed line at the top of the list of choices, that menu will tear off and become a floating toolbar. How cool! - - -![tear off](https://user-images.githubusercontent.com/13696193/45307668-9aabcf80-b4ed-11e8-9b2b-8564d4bf82a8.jpg) - - - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('LightGreen') - sg.SetOptions(element_padding=(0, 0)) - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit' ]], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ GUI Defintion ------ # - layout = [ - [sg.Menu(menu_def)], - [sg.Output(size=(60, 20))] - ] - - form = sg.Window("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12, 1)).Layout(layout) - - # ------ Loop & Process button menu choices ------ # - while True: - button, values = form.Read() - if button == None or button == 'Exit': - break - print('Button = ', button) - # ------ Process menu choices ------ # - if button == 'About...': - sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') - elif button == 'Open': - filename = sg.PopupGetFile('file to open', no_window=True) - print(filename) - -## Graphing with Graph Element - -Use the Graph Element to draw points, lines, circles, rectangles using ***your*** coordinate systems rather than the underlying graphics coordinates. - -In this example we're defining our graph to be from -100, -100 to +100,+100. That means that zero is in the middle of the drawing. You define this graph description in your call to Graph. - -![snap0354](https://user-images.githubusercontent.com/13696193/45861485-cd9a6280-bd3a-11e8-83ea-32ca42dc9f3a.jpg) - - - - import math - import PySimpleGUI as sg - - layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] - - form = sg.Window('Graph of Sine Function').Layout(layout) - form.Finalize() - graph = form.FindElement('graph') - - graph.DrawLine((-100,0), (100,0)) - graph.DrawLine((0,-100), (0,100)) - - for x in range(-100,100): - y = math.sin(x/20)*50 - graph.DrawPoint((x,y), color='red') - - button, values = form.Read() - - -## Creating a Windows .EXE File - -It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. - -Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) - - pip install PySimpleGUI - pip install PyInstaller - -To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: - - pyinstaller -wF my_program.py - -You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. - -That's all... Run your `my_program.exe` file on the Windows machine of your choosing. - -> "It's just that easy." -> -(famous last words that screw up just about anything being referenced) - -Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. + +# The PySimpleGUI Cookbook + + +You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. Study them to get an idea of what design patterns to follow. + +## Simple Data Entry - Return Values As List +Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + + import PySimpleGUI as sg + + # Very basic window. Return values as a list + window = sg.Window('Simple data entry window') + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + + print(button, values[0], values[1], values[2]) + +## Simple data entry - Return Values As Dictionary +A simple GUI with default values. Results returned in a dictionary. + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + + import PySimpleGUI as sg + + # Very basic window. Return values as a dictionary + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + window = sg.Window('Simple data entry GUI') # begin with a blank Window + + button, values = window.LayoutAndRead(layout) + + print(button, values['name'], values['address'], values['phone']) + +--------------------- + + + +----------- +## Simple File Browse +Browse for a filename that is populated into the input field. + +![simple file browse](https://user-images.githubusercontent.com/13696193/43934539-d8bd9490-9c1d-11e8-927f-98b523776fcb.jpg) + + import PySimpleGUI as sg + + + GUI_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + (button, (source_filename,)) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(GUI_rows) + + print(button, source_filename) + +-------------------------- +## Add GUI to Front-End of Script +Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. + +![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) + + + import PySimpleGUI as sg + import sys + + if len(sys.argv) == 1: + button, (fname,) = sg.Window('My Script').LayoutAndRead([[sg.Text('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) + else: + fname = sys.argv[1] + + if not fname: + sg.Popup("Cancel", "No filename supplied") + raise SystemExit("Cancelling: no filename supplied") + print(button, fname) + + + +-------------- + +## Compare 2 Files + +Browse to get 2 file names that can be then compared. + +![compare 2 files](https://user-images.githubusercontent.com/13696193/43934659-60dc5fbe-9c1e-11e8-8d2b-07c0e3b61892.jpg) + + import PySimpleGUI as sg + + gui_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + + window = sg.Window('File Compare') + + button, values = window.LayoutAndRead(gui_rows) + + print(button, values) + +--------------- +## Nearly All Widgets with Green Color Theme +Example of nearly all of the widgets in a single window. Uses a customized color scheme. + +![latest everything bagel](https://user-images.githubusercontent.com/13696193/45920376-22d89000-be71-11e8-8ac4-640f011f84d0.jpg) + + + + #!/usr/bin/env Python3 + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] + ] + + + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = window.Read() + + sg.Popup('Title', + 'The results of the window.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) + +------------- + + + + +## Non-Blocking Window With Periodic Update +An async Window that has a button read loop. A Text Element is updated periodically with a running timer. Note that `value` is checked for None which indicates the window was closed using X. + +![non-blocking](https://user-images.githubusercontent.com/13696193/43955295-70f6ac48-9c6d-11e8-8ea2-e6729ba9330c.jpg) + + + import PySimpleGUI as sg + import time + + gui_rows = [[sg.Text('Stopwatch', size=(20, 2), justification='center')], + [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], + [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] + + window = sg.Window('Running Timer').Layout(gui_rows) + + timer_running = True + i = 0 + # Event Loop + while True: + i += 1 * (timer_running is True) + button, values = window.ReadNonBlocking() + + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + elif button == 'Start/Stop': + timer_running = not timer_running + + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + time.sleep(.01) + +-------- + +## Callback Function Simulation +The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. + +![button callback 2](https://user-images.githubusercontent.com/13696193/43955588-e139ddc6-9c6e-11e8-8c78-c1c226b8d9b1.jpg) + + import PySimpleGUI as sg + + # This design pattern simulates button callbacks + # Note that callbacks are NOT a part of the package's interface to the + # caller intentionally. The underlying implementation actually does use + # tkinter callbacks. They are simply hidden from the user. + + # The callback functions + def button1(): + print('Button 1 callback') + + def button2(): + print('Button 2 callback') + + + # Layout the design of the GUI + layout = [[sg.Text('Please click a button', auto_size_text=True)], + [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] + + # Show the Window to the user + window = sg.Window('Button callback example').Layout(layout) + + # Event loop. Read buttons, make callbacks + while True: + # Read the Window + button, value = window.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break + + # All done! + sg.PopupOK('Done') + +----- +## Realtime Buttons (Good For Raspberry Pi) +This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking window. + +![robot control](https://user-images.githubusercontent.com/13696193/44006710-d227f23e-9e56-11e8-89a3-2be5b2726199.jpg) + + import PySimpleGUI as sg + + + gui_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' ' * 10), sg.RealtimeButton('Forward')], + [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], + [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + window = sg.Window('Robotics Remote Control', auto_size_text=True).Layout(gui_rows) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your window every now and then or + # else it won't refresh. + # + # your program's main loop + while (True): + # This is the code that reads and updates your window + button, values = window.ReadNonBlocking() + if button is not None: + print(button) + if button == 'Quit' or values is None: + break + + window.CloseNonBlockingForm() # Don't forget to close your window! + +--------- + +## OneLineProgressMeter + +This recipe shows just how easy it is to add a progress meter to your code. + +![onelineprogressmeter](https://user-images.githubusercontent.com/13696193/45589254-bd285900-b8f0-11e8-9122-b43f06bf074d.jpg) + + + import PySimpleGUI as sg + + for i in range(1000): + sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') + + +----- +## Tabbed Form +Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single window. + + +![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg) + + import PySimpleGUI as sg + + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + window = sg.Window('') + form2 = sg.Window('') + + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2, 'Second Tab')) + + sg.Popup(results) + +----- +## Button Graphics (Media Player) +Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. + +![media player](https://user-images.githubusercontent.com/13696193/43958418-5dd133f2-9c79-11e8-9432-0a67007e85ac.jpg) + + import PySimpleGUI as sg + + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # define layout of the rows + layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], + [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], + [sg.ReadButton('Restart Song', button_color=(background, background), + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadButton('Pause', button_color=(background, background), + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadButton('Next', button_color=(background, background), + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.Button('Exit', button_color=(background, background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, + border_width=0)], + [sg.Text('_' * 30)], + [sg.Text(' ' * 30)], + [ + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] + ] + + window = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)).Layout(layout) + # Our event loop + while (True): + # Read the window (this call will not block) + button, values = window.ReadNonBlocking() + if button == 'Exit' or values is None: + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + window.FindElement('output').Update(button) + +---- +## Script Launcher - Persistent Window +This Window doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.Button`. The exception to this is the EXIT button. Clicking it will close the window. This program will run commands and display the output in the scrollable window. + +![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) + + import PySimpleGUI as sg + import subprocess + + # Please check Demo programs for better examples of launchers + def ExecuteCommandSubprocess(command, *args): + try: + sp = subprocess.Popen([command, *args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: + pass + + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], + [sg.Text('Manual command', size=(15, 1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] + ] + + + window = sg.Window('Script launcher').Layout(layout) + + # ---===--- Loop taking in user input and using it to call scripts --- # + + while True: + (button, value) = window.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip', 'list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) + +---- +## Machine Learning GUI +A standard non-blocking GUI with lots of inputs. + +![machine learning green](https://user-images.githubusercontent.com/13696193/43979000-408b77ba-9cb7-11e8-9ffd-24c156767532.jpg) + + import PySimpleGUI as sg + + # Green & tan color scheme + sg.ChangeLookAndFeel('GreenTan') + + sg.SetOptions(text_justification='right') + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), + sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), + sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), + sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + + window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) + + button, values = window.Read() + +------- +## Custom Progress Meter / Progress Bar +Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. + +![custom progress meter](https://user-images.githubusercontent.com/13696193/43982958-3393b23e-9cc6-11e8-8b49-e7f4890cbc4b.jpg) + + + import PySimpleGUI as sg + + # layout the Window + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progbar')], + [sg.Cancel()]] + + # create the Window + window = sg.Window('Custom Progress Meter').Layout(layout) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = window.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + window.FindElement('progbar').UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open + window.CloseNonBlockingForm() + + + ---- + +## The One-Line GUI + +For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `Window` and the call to `LayoutAndRead`. `Window` returns a `Window` object which has the `LayoutAndRead` method. + + +![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) + + +Instead of + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()]] + + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) + +you can write this line of code for the exact same result (OK, two lines with the import): + + import PySimpleGUI as sg + + button, (filename,) = sg.Window('Get filename example').LayoutAndRead( + [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) + +-------------------- +## Multiple Columns +Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + +This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + +To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. + +![cookbook columns](https://user-images.githubusercontent.com/13696193/45309948-f6c52280-b4f2-11e8-8691-a45fa0e06c50.jpg) + + + + import PySimpleGUI as sg + + # Demo of how columns work + # GUI has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to GUI layouts, they are a list of lists of elements. + + sg.ChangeLookAndFeel('BlueMono') + + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + + # Display the Window and get values + + button, values = sg.Window('Compact 1-line Window with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) + + +## Persistent Window With Text Element Updates + +This simple program keep a window open, taking input values until the user terminates the program using the "X" button. + +![math game](https://user-images.githubusercontent.com/13696193/44537842-c9444080-a6cd-11e8-94bc-6cdf1b765dd8.jpg) + + + + import PySimpleGUI as sg + + layout = [ [sg.Txt('Enter values to calculate')], + [sg.In(size=(8,1), key='numerator')], + [sg.Txt('_' * 10)], + [sg.In(size=(8,1), key='denominator')], + [sg.Txt('', size=(8,1), key='output') ], + [sg.ReadButton('Calculate', bind_return_key=True)]] + + window = sg.Window('Math').Layout(layout) + + while True: + button, values = window.Read() + + if button is not None: + try: + numerator = float(values['numerator']) + denominator = float(values['denominator']) + calc = numerator / denominator + except: + calc = 'Invalid' + + window.FindElement('output').Update(calc) + else: + break + + + +## tkinter Canvas Widget + +The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: + + can = sg.Canvas(size=(100,100)) + tkcanvas = can.TKCanvas + tkcanvas.create_oval(50, 50, 100, 100) + +While it's fun to scribble on a Canvas Widget, try Graph Element makes it a downright pleasant experience. You do not have to worry about the tkinter coordinate system and can instead work in your own coordinate system. + + +![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) + + + import PySimpleGUI as sg + + layout = [ + [sg.Canvas(size=(100, 100), background_color='red', key= 'canvas')], + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] + ] + + window = sg.Window('Canvas test') + window.Layout(layout) + window.Finalize() + + canvas = window.FindElement('canvas') + cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) + + while True: + button, values = window.Read() + if button is None: + break + if button == 'Blue': + canvas.TKCanvas.itemconfig(cir, fill="Blue") + elif button == 'Red': + canvas.TKCanvas.itemconfig(cir, fill="Red") + +## Graph Element - drawing circle, rectangle, etc, objects + +Just like you can draw on a tkinter widget, you can also draw on a Graph Element. Graph Elements are easier on the programmer as you get to work in your own coordinate system. + +![graph recipe](https://user-images.githubusercontent.com/13696193/45920640-751bb000-be75-11e8-9530-45b71cbae07d.jpg) + + + import PySimpleGUI as sg + + layout = [ + [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], + [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] + ] + + window = sg.Window('Graph test') + window.Layout(layout) + window.Finalize() + + graph = window.FindElement('graph') + circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') + point = graph.DrawPoint((75,75), 10, color='green') + oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) + rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) + line = graph.DrawLine((0,0), (100,100)) + + while True: + button, values = window.Read() + if button is None: + break + if button is 'Blue': + graph.TKCanvas.itemconfig(circle, fill = "Blue") + elif button is 'Red': + graph.TKCanvas.itemconfig(circle, fill = "Red") + elif button is 'Move': + graph.MoveFigure(point, 10,10) + graph.MoveFigure(circle, 10,10) + graph.MoveFigure(oval, 10,10) + graph.MoveFigure(rectangle, 10,10) + + +## Keypad Touchscreen Entry - Input Element Update + +This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. +There are a number of features used in this Recipe including: +* Default Element Size +* auto_size_buttons +* ReadButton +* Dictionary Return values +* Update of Elements in window (Input, Text) +* do_not_clear of Input Elements + + +![keypad 2](https://user-images.githubusercontent.com/13696193/44640891-57504d80-a992-11e8-93f4-4e97e586505e.jpg) + + + + import PySimpleGUI as sg + + # Demonstrates a number of PySimpleGUI features including: + # Default element size + # auto_size_buttons + # ReadButton + # Dictionary return values + # Update of elements in window (Text, Input) + # do_not_clear of Input elements + + layout = [[sg.Text('Enter Your Passcode')], + [sg.Input(size=(10, 1), do_not_clear=True, justification='right', key='input')], + [sg.ReadButton('1'), sg.ReadButton('2'), sg.ReadButton('3')], + [sg.ReadButton('4'), sg.ReadButton('5'), sg.ReadButton('6')], + [sg.ReadButton('7'), sg.ReadButton('8'), sg.ReadButton('9')], + [sg.ReadButton('Submit'), sg.ReadButton('0'), sg.ReadButton('Clear')], + [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], + ] + + window = sg.Window('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) + + # Loop forever reading the window's values, updating the Input field + keys_entered = '' + while True: + button, values = window.Read() # read the window + if button is None: # if the X button clicked, just exit + break + if button == 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button == 'Submit': + keys_entered = values['input'] + window.FindElement('out').Update(keys_entered) # output the final string + + window.FindElement('input').Update(keys_entered) # change the window to reflect current key string + +## Animated Matplotlib Graph + +Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. + +![animated matplotlib](https://user-images.githubusercontent.com/13696193/44640937-91b9ea80-a992-11e8-9c1c-85ae74013679.jpg) + + + from tkinter import * + from random import randint + import PySimpleGUI as g + from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg + from matplotlib.figure import Figure + import matplotlib.backends.tkagg as tkagg + import tkinter as Tk + + + fig = Figure() + + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() + + layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + [g.Canvas(size=(640, 480), key='canvas')], + [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + + # create the window and show it without the plot + + + window = g.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) + window.Finalize() # needed to access the canvas element prior to reading the window + + canvas_elem = window.FindElement('canvas') + + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas + + dpts = [randint(0, 10) for x in range(10000)] + # Our event loop + for i in range(len(dpts)): + button, values = window.ReadNonBlocking() + if button == 'Exit' or values is None: + exit(69) + + ax.cla() + ax.grid() + + ax.plot(range(20), dpts[i:i + 20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640 / 2, 480 / 2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + + + +## Tight Layout with Button States + +Saw this example layout written in tkinter and liked it so much I duplicated the interface. It's "tight", clean, and has a nice dark look and feel. + +This Recipe also contains code that implements the button interactions so that you'll have a template to build from. + +In other GUI frameworks this program would be most likely "event driven" with callback functions being used to communicate button events. The "event loop" would be handled by the GUI engine. If code already existed that used a call-back mechanism, the loop in the example code below could simply call these callback functions directly based on the button text it receives in the window.Read call. + +![timemanagement](https://user-images.githubusercontent.com/13696193/44996818-0f27c100-af78-11e8-8836-9ef6164efe3b.jpg) + + + import PySimpleGUI as sg + """ + Demonstrates using a "tight" layout with a Dark theme. + Shows how button states can be controlled by a user application. The program manages the disabled/enabled + states for buttons and changes the text color to show greyed-out (disabled) buttons + """ + + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0,0)) + + 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), + sg.ReadFormButton('Stop', button_color=('white', 'black'), key='Stop'), + sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), + sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] + ] + + window = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12,1)) + window.Layout(layout) + window.Finalize() + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Reset').Update(disabled=True) + window.FindElement('Submit').Update(disabled=True) + recording = have_data = False + while True: + button, values = window.Read() + print(button) + if button is None: + exit(69) + if button is 'Start': + window.FindElement('Start').Update(disabled=True) + window.FindElement('Stop').Update(disabled=False) + window.FindElement('Reset').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + recording = True + elif button is 'Stop' and recording: + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=False) + recording = False + have_data = True + elif button is 'Reset': + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + window.FindElement('Reset').Update(disabled=False) + recording = False + have_data = False + elif button is 'Submit' and have_data: + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + window.FindElement('Reset').Update(disabled=False) + recording = False + +## Password Protection For Scripts + +You get 2 scripts in one. + +Use the upper half to generate your hash code. Then paste it into the code in the lower half. Copy and paste lower 1/2 into your code to get password protection for your script without putting the password into your source code. + +![password entry](https://user-images.githubusercontent.com/13696193/45129440-ab58f000-b151-11e8-8ebe-e519a50b3ead.jpg) + +![password hash](https://user-images.githubusercontent.com/13696193/45129441-ab58f000-b151-11e8-8a46-c2789bb7824e.jpg) + + import PySimpleGUI as sg + import hashlib + + ''' + Create a secure login for your scripts without having to include your password in the program. Create an SHA1 hash code for your password using the GUI. Paste into variable in final program + 1. Choose a password + 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password + 3. Type password into the GUI + 4. Copy and paste hash code form GUI into variable named login_password_hash + 5. Run program again and test your login! + ''' + + # Use this GUI to get your password's hash code + def HashGeneratorGUI(): + layout = [[sg.T('Password Hash Generator', size=(30,1), font='Any 15')], + [sg.T('Password'), sg.In(key='password')], + [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], + ] + + window = sg.Window('SHA Generator', auto_size_text=False, default_element_size=(10,1), + text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) + + + while True: + button, values = window.Read() + if button is None: + exit(69) + + password = values['password'] + try: + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + window.FindElement('hash').Update(password_hash) + except: + pass + + # ----------------------------- Paste this code into your program / script ----------------------------- + # determine if a password matches the secret password by comparing SHA1 hash codes + def PasswordMatches(password, hash): + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + if password_hash == hash: + return True + else: + return False + + login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' + password = sg.PopupGetText('Password', password_char='*') + if password == 'gui': # Remove when pasting into your program + HashGeneratorGUI() # Remove when pasting into your program + exit(69) # Remove when pasting into your program + if PasswordMatches(password, login_password_hash): + print('Login SUCCESSFUL') + else: + print('Login FAILED!!') + + +## Desktop Floating Toolbar + +#### Hiding your windows commmand window +For this and the Time & CPU Widgets you may wish to consider using a tool or technique that will hide your Windows Command Prompt window. I recommend the techniques found on this site: + +[http://www.robvanderwoude.com/battech_hideconsole.php](http://www.robvanderwoude.com/battech_hideconsole.php) + +At the moment I'm using the technique that involves wscript and a script named RunNHide.vbs. They are working beautifully. I'm using a hotkey program and launch by using this script with the command "python.exe insert_program_here.py". I guess the next widget should be one that shows all the programs launched this way so you can kill any bad ones. If you don't properly catch the exit button on your window then your while loop is going to keep on working while your window is no longer there so be careful in your code to always have exit explicitly handled. + + +### Floating toolbar + +This is a cool one! (Sorry about the code pastes... I'm working in it) + +Impress your friends at what a tool-wizard you are by popping a custom toolbar that you keep in the corner of your screen. It stays on top of all your other windows. + + + + +![toolbar gray](https://user-images.githubusercontent.com/13696193/45324308-bfb73700-b51b-11e8-90e7-ab24f3d6e61d.jpg) + +You can easily change colors to match your background by changing a couple of parameters in the code. + +![toolbar black](https://user-images.githubusercontent.com/13696193/45324307-bfb73700-b51b-11e8-8709-6c3c23f737c4.jpg) + + + import PySimpleGUI as sg + import subprocess + import os + import sys + + """ + Demo_Toolbar - A floating toolbar with quick launcher One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout + You can setup a specific program to launch when a button is clicked, or use the Combobox to select a .py file found in the root folder, and run that file. """ + + ROOT_PATH = './' + + def Launcher(): + + def print(line): + window.FindElement('output').Update(line) + + sg.ChangeLookAndFeel('Dark') + + namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] + + sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) + layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), + sg.ReadButton('Run', button_color=('white', '#00168B')), + sg.ReadButton('Program 1'), + sg.ReadButton('Program 2'), + sg.ReadButton('Program 3', button_color=('white', '#35008B')), + sg.Button('EXIT', button_color=('white','firebrick3'))], + [sg.T('', text_color='white', size=(50,1), key='output')]] + + window = sg.Window('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) + + # ---===--- Loop taking in user input (buttons) --- # + while True: + (button, value) = window.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'Program 1': + print('Run your program 1 here!') + elif button == 'Program 2': + print('Run your program 2 here!') + elif button == 'Run': + file = value['demofile'] + print('Launching %s'%file) + ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) + else: + print(button) + + def ExecuteCommandSubprocess(command, *args, wait=False): + try: + if sys.platwindow == 'linux': + arg_string = '' + for arg in args: + arg_string += ' ' + str(arg) + sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if wait: + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + + + if __name__ == '__main__': + Launcher() + + + + +## Desktop Floating Widget - Timer + +This is a little widget you can leave running on your desktop. Will hopefully see more of these for things like checking email, checking server pings, displaying system information, dashboards, etc +. +Much of the code is handling the button states in a fancy way. It could be much simpler if you don't change the button text based on state. + +![timer](https://user-images.githubusercontent.com/13696193/45336349-26a31300-b551-11e8-8b06-d1232ff8ca10.jpg) + + import PySimpleGUI as sg + import time + + """ + Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. It will look something like: invalid command name \"1616802625480StopMove\" + """ + + + # ---------------- Create window ---------------- + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0, 0)) + + layout = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadButton('Pause', key='button', button_color=('white', '#001480')), + sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), + sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] + + window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) + + + # ---------------- main loop ---------------- + current_time = 0 + paused = False + start_time = int(round(time.time() * 100)) + while (True): + # --------- Read and update window -------- + if not paused: + button, values = window.ReadNonBlocking() + current_time = int(round(time.time() * 100)) - start_time + else: + button, values = window.Read() + if button == 'button': + button = window.FindElement(button).GetText() + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + if button is 'Reset': + start_time = int(round(time.time() * 100)) + current_time = 0 + paused_time = start_time + elif button == 'Pause': + paused = True + paused_time = int(round(time.time() * 100)) + element = window.FindElement('button') + element.Update(text='Run') + elif button == 'Run': + paused = False + start_time = start_time + int(round(time.time() * 100)) - paused_time + element = window.FindElement('button') + element.Update(text='Pause') + + # --------- Display timer in window -------- + window.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + (current_time // 100) % 60, + current_time % 100)) + time.sleep(.01) + + # --------- After loop -------- + + # Broke out of main loop. Close the window. + window.CloseNonBlockingForm() + +## Desktop Floating Widget - CPU Utilization + +Like the Timer widget above, this script can be kept running. You will need the package psutil installed in order to run this Recipe. +The spinner changes the number of seconds between reads. Note that you will get an error message printed when exiting because the window does not have have a titlebar. It's a known problem. + + +![cpu widget 2](https://user-images.githubusercontent.com/13696193/45456096-77348080-b6b7-11e8-8906-6663c31ad0eb.jpg) + + + + import PySimpleGUI as sg + import psutil + + # ---------------- Create Form ---------------- + sg.ChangeLookAndFeel('Black') + layout = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] + # Layout the rows of the window and perform a read. Indicate the window is non-blocking! + window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) + + + # ---------------- main loop ---------------- + while (True): + # --------- Read and update window -------- + button, values = window.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + interval = int(values['spin']) + except: + interval = 1 + + cpu_percent = psutil.cpu_percent(interval=interval) + + # --------- Display timer in window -------- + + window.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + + # Broke out of main loop. Close the window. + window.CloseNonBlockingForm() + +## Menus + +Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. + +Menu's are defined separately from the GUI window. To add one to your window, simply insert sg.Menu(menu_layout). The menu definition is a list of menu choices and submenus. They are a list of lists. Copy the Recipe and play with it. You'll eventually get when you're looking for. + +If you double click the dashed line at the top of the list of choices, that menu will tear off and become a floating toolbar. How cool! + + +![tear off](https://user-images.githubusercontent.com/13696193/45307668-9aabcf80-b4ed-11e8-9b2b-8564d4bf82a8.jpg) + + + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('LightGreen') + sg.SetOptions(element_padding=(0, 0)) + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit' ]], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ GUI Defintion ------ # + layout = [ + [sg.Menu(menu_def)], + [sg.Output(size=(60, 20))] + ] + + window = sg.Window("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12, 1)).Layout(layout) + + # ------ Loop & Process button menu choices ------ # + while True: + button, values = window.Read() + if button == None or button == 'Exit': + break + print('Button = ', button) + # ------ Process menu choices ------ # + if button == 'About...': + sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') + elif button == 'Open': + filename = sg.PopupGetFile('file to open', no_window=True) + print(filename) + +## Graphing with Graph Element + +Use the Graph Element to draw points, lines, circles, rectangles using ***your*** coordinate systems rather than the underlying graphics coordinates. + +In this example we're defining our graph to be from -100, -100 to +100,+100. That means that zero is in the middle of the drawing. You define this graph description in your call to Graph. + +![snap0354](https://user-images.githubusercontent.com/13696193/45861485-cd9a6280-bd3a-11e8-83ea-32ca42dc9f3a.jpg) + + + + import math + import PySimpleGUI as sg + + layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] + + window = sg.Window('Graph of Sine Function').Layout(layout) + window.Finalize() + graph = window.FindElement('graph') + + graph.DrawLine((-100,0), (100,0)) + graph.DrawLine((0,-100), (0,100)) + + for x in range(-100,100): + y = math.sin(x/20)*50 + graph.DrawPoint((x,y), color='red') + + button, values = window.Read() + + +## Creating a Windows .EXE File + +It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. + +Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) + + pip install PySimpleGUI + pip install PyInstaller + +To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: + + pyinstaller -wF my_program.py + +You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. + +That's all... Run your `my_program.exe` file on the Windows machine of your choosing. + +> "It's just that easy." +> +(famous last words that screw up just about anything being referenced) + +Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. \ No newline at end of file From eb72181182b3d766677433b26f3dc00904cacdbd Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 18:04:32 -0400 Subject: [PATCH 446/521] More Form removal. New CloseNonBlocking method instead of CloseNonBlockingForm --- PySimpleGUI.py | 11 ++++++++--- docs/cookbook.md | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3f21b0652..872cc51f2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1829,9 +1829,9 @@ def __del__(self): # ------------------------------------------------------------------------- # -# FlexForm CLASS # +# Window CLASS # # ------------------------------------------------------------------------- # -class FlexForm: +class Window: ''' Display a user defined for and return the filled in data ''' @@ -2124,7 +2124,7 @@ def _Close(self): self.RootNeedsDestroying = True return None - def CloseNonBlockingForm(self): + def CloseNonBlocking(self): if self.TKrootDestroyed: return try: @@ -2132,6 +2132,8 @@ def CloseNonBlockingForm(self): _my_windows.Decrement() except: pass + CloseNonBlockingForm = CloseNonBlocking + def OnClosingCallback(self): return @@ -2151,6 +2153,9 @@ def __del__(self): # except: # pass +FlexForm = Window + + # ------------------------------------------------------------------------- # # UberForm CLASS # # Used to make forms into TABS (it's trick) # diff --git a/docs/cookbook.md b/docs/cookbook.md index 292b0d179..7a84e1fc5 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -236,7 +236,7 @@ The architecture of some programs works better with button callbacks instead of # Layout the design of the GUI layout = [[sg.Text('Please click a button', auto_size_text=True)], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] + [sg.ReadButton('1'), sg.ReadButton('2'), sg.Quit()]] # Show the Window to the user window = sg.Window('Button callback example').Layout(layout) @@ -289,7 +289,7 @@ This recipe implements a remote control interface for a robot. There are 4 dire if button == 'Quit' or values is None: break - window.CloseNonBlockingForm() # Don't forget to close your window! + window.CloseNonBlocking() # Don't forget to close your window! --------- @@ -499,7 +499,7 @@ Perhaps you don't want all the statistics that the EasyProgressMeter provides an # update bar with loop value +1 so that bar eventually reaches the maximum window.FindElement('progbar').UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - window.CloseNonBlockingForm() + window.CloseNonBlocking() ---- @@ -650,7 +650,7 @@ Just like you can draw on a tkinter widget, you can also draw on a Graph Element layout = [ [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], - [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')] ] window = sg.Window('Graph test') @@ -820,10 +820,10 @@ In other GUI frameworks this program would be most likely "event driven" with ca 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadFormButton('Start', button_color=('white', 'black'), key='Start'), - sg.ReadFormButton('Stop', button_color=('white', 'black'), key='Stop'), - sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] + [sg.ReadButton('Start', button_color=('white', 'black'), key='Start'), + sg.ReadButton('Stop', button_color=('white', 'black'), key='Stop'), + sg.ReadButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), + sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] ] window = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, @@ -883,7 +883,7 @@ Use the upper half to generate your hash code. Then paste it into the code in t 1. Choose a password 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password 3. Type password into the GUI - 4. Copy and paste hash code form GUI into variable named login_password_hash + 4. Copy and paste hash code Window GUI into variable named login_password_hash 5. Run program again and test your login! ''' @@ -1104,7 +1104,7 @@ Much of the code is handling the button states in a fancy way. It could be much # --------- After loop -------- # Broke out of main loop. Close the window. - window.CloseNonBlockingForm() + window.CloseNonBlocking() ## Desktop Floating Widget - CPU Utilization @@ -1119,12 +1119,12 @@ The spinner changes the number of seconds between reads. Note that you will get import PySimpleGUI as sg import psutil - # ---------------- Create Form ---------------- + # ---------------- Create Window ---------------- sg.ChangeLookAndFeel('Black') layout = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] - # Layout the rows of the window and perform a read. Indicate the window is non-blocking! + [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] + window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) @@ -1148,7 +1148,7 @@ The spinner changes the number of seconds between reads. Note that you will get window.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') # Broke out of main loop. Close the window. - window.CloseNonBlockingForm() + window.CloseNonBlocking() ## Menus From 53720e3e8d3a5f488b7230fa310870507503bb34 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 18:30:29 -0400 Subject: [PATCH 447/521] DOCS - The big Form to Window rename effort... --- PySimpleGUI.py | 7 +- docs/index.md | 3268 ++++++++++++++++++++++++------------------------ readme.md | 3268 ++++++++++++++++++++++++------------------------ 3 files changed, 3271 insertions(+), 3272 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 872cc51f2..c6469fc49 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2261,12 +2261,11 @@ def Help(button_text='Help', size=(None, None), auto_size_button=None, button_co def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) # ------------------------- GENERIC BUTTON Element lazy function ------------------------- # -def ReadFormButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): +def ReadButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): return Button( button_text=button_text, button_type=BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) -ReadButton = ReadFormButton +ReadFormButton = ReadButton RButton = ReadFormButton -RFButton = ReadFormButton # ------------------------- Realtime BUTTON Element lazy function ------------------------- # @@ -4436,7 +4435,7 @@ def PopupYesNo(*args, button_color=None, background_color=None, text_color=None, def main(): - with FlexForm('Demo form..') as form: + with Window('Demo form..') as form: form_rows = [[Text('You are running the PySimpleGUI.py file itself')], [Text('You should be importing it rather than running it', size=(50,2))], [Text('Here is your sample input form....')], diff --git a/docs/index.md b/docs/index.md index e4d30b63c..4d521d0d8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -34,56 +34,56 @@ Looking for a GUI package to help with * Into Machine Learning and are sick of the command line? * How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? -Look no further, **you've found your GUI package**. - - import PySimpleGUI as sg - - sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - +Look no further, **you've found your GUI package**. + + import PySimpleGUI as sg + + sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + ![hello world](https://user-images.githubusercontent.com/13696193/44960047-1f7f6380-aec6-11e8-9d5e-12ef935bcade.jpg) Or how about a ***custom GUI*** in 1 line of code? import PySimpleGUI as sg - + button, (filename,) = sg.Window('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) - + ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. - - + Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + + ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a more friendly way. It does the layout and boilerplate code for you and presents you with a simple, efficient interface. - -![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) - + +![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) + Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The same for shown as on Pi (roughly the same) - + ![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) - - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: - - OneLineProgressMeter('My meter title', current_value, max value, 'key') - - ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - + + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: + + OneLineProgressMeter('My meter title', current_value, max value, 'key') + + ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) - + How about embedding a game inside of a GUI? This game of Pong is written in tkinter and then dropped into the PySimpleGUI window creating a game that has an accompanying GUI. -![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) Combining PySimpleGUI with PyInstaller creates something truly remarkable and special, a Python program that looks like a Windows WinForms application. This application with working menu was created in 20 lines of Python code. It is a single .EXE file that launches straight into the screen you see. And more good news, the only icon you see on the taskbar is the window itself... there is no pesky shell window. @@ -92,156 +92,156 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. -> Create a custom GUI with as little and as simple code as possible. +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -This was the primary focus used to create PySimpleGUI. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own windows using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. +> Create a custom GUI with as little and as simple code as possible. + +This was the primary focus used to create PySimpleGUI. > "Do it in a Python-like way" -was the second. +was the second. ## Features While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Files Browse - Folder Browse - SaveAs - Non-closing return - Close form - Realtime + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Files Browse + Folder Browse + SaveAs + Non-closing return + Close window + Realtime Calendar chooser Color chooser - Checkboxes - Radio Buttons - Listbox + Checkboxes + Radio Buttons + Listbox Option Menu - Slider + Slider Graph - Frame with title - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Code Proress Bar & Debug Print - Complete control of colors, look and feel + Frame with title + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar Async/Non-Blocking Windows + Tabbed windows + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Code Proress Bar & Debug Print + Complete control of colors, look and feel Selection of pre-defined palettes - Button images + Button images Return values as dictionary Set focus Bind return key to buttons - Group widgets into a column and place into form anywhere + Group widgets into a column and place into window anywhere Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected Get slider, spinner, combo as they are changed - Update elements in a live form - Bulk form-fill operation - Save / Load form to/from disk + Update elements in a live window + Bulk window-fill operation + Save / Load window to/from disk Borderless (no titlebar) windows Always on top windows Menus Tooltips Clickable links No async programming required (no callbacks to worry about) - - -An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : ->Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +An example of many widgets used on a single window. A little further down you'll find the 21 lines of code required to create this complex window. Try it if you don't believe it. Install PySimpleGUI then : + +>Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - - - import PySimpleGUI as sg - - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), - sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] - +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + + + + import PySimpleGUI as sg + + layout = [[sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] + button, values = sg.Window('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) - - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. + +--- +### Design Goals + +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. + + - windows are represented as Python lists. + - A window is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. - Return values can also be represented as a dictionary - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values - Linear programming instead of callbacks - + #### Lofty Goals > Change Python -The hope is not that ***this*** package will become part of the Python Standard Library. +The hope is not that ***this*** package will become part of the Python Standard Library. -The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. +The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. -The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. +The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. -There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. +There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. This is my attempt to find out. - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install --upgrade PySimpleGUI - + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install --upgrade PySimpleGUI + On some systems you need to run pip3. - + pip3 install --upgrade PySimpleGUI On a Raspberry Pi, this is should work: @@ -256,110 +256,110 @@ If for some reason you are unable to install using `pip`, don't worry, you can s `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: ``` -ImportError: No module named tkinter +ImportError: No module named tkinter ``` then you need to install `tkinter`. Be sure and get the Python 3 version. ``` sudo apt-get install python3-tk ``` - -### Prerequisites - -Python 3 -tkinter - -PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Prerequisites + +Python 3 +tkinter + +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### EXE file creation If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe - -## Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.Popup('This is my first Popup') - -![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: + +## Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own windows. + + sg.Popup('This is my first Popup') + +![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom form functions - - -### Python Language Features - - There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... - * Variable number of arguments to a function call - * Optional parameters to a function call + * Custom window functions + + +### Python Language Features + + There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... + * Variable number of arguments to a function call + * Optional parameters to a function call * Dictionaries - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.Popup('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Popup - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def Popup(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.Popup('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Popup + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing windows and window Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def Popup(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: -1. To identify values when a form is read +1. To identify values when a window is read 2. To identify Elements so that they can be "updated" - ---- - -### High Level API Calls - Popup's + +--- + +### High Level API Calls - Popup's "High level calls" are those that start with "Popup". They are the most basic form of communications with the user. They are named after the type of window they create, a pop-up window. These windows are meant to be short lived while, either delivering information or collecting it, and then quickly disappearing. ### Popup Output -Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. +Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. -`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking window of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. -There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). +There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). The list of Popup output functions are @@ -367,7 +367,7 @@ The list of Popup output functions are PopupOk PopupYesNo PopupCancel - PopupOkCancel + PopupOkCancel PopupError PopupTimed, PopupAutoClose PopupNoWait, PopupNonBlocking @@ -381,16 +381,16 @@ The function `PopupTimed` or `PopupAutoClose` are popup windows that will automa Here is a quick-reference showing how the Popup calls look. - sg.Popup('Popup') - sg.PopupOk('PopupOk') - sg.PopupYesNo('PopupYesNo') - sg.PopupCancel('PopupCancel') - sg.PopupOkCancel('PopupOkCancel') - sg.PopupError('PopupError') - sg.PopupTimed('PopupTimed') + sg.Popup('Popup') + sg.PopupOk('PopupOk') + sg.PopupYesNo('PopupYesNo') + sg.PopupCancel('PopupCancel') + sg.PopupOkCancel('PopupOkCancel') + sg.PopupError('PopupError') + sg.PopupTimed('PopupTimed') sg.PopupAutoClose('PopupAutoClose') - - + + ![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) @@ -409,14 +409,14 @@ Here is a quick-reference showing how the Popup calls look. #### Scrolled Output There is a scrolled version of Popups should you have a lot of information to display. - sg.PopupScrolled(my_text) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - + sg.PopupScrolled(my_text) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + The `PopupScrolled` will auto-fit the window size to the size of the text. Specify `None` in the height field of a `size` parameter to get auto-sized height. -This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. +This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. sg.PopupScrolled(my_text, size=(80, None)) @@ -426,7 +426,7 @@ Note that the default max number of lines before scrolling happens is set to 50. The Popup call PopupNoWait or PopupNonBlocking will create a popup window and then immediately return control back to you. All other popup functions will block, waiting for the user to close the popup window. -This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement +This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement A word of ***caution***... Windows that are created after the NoWait Popup are "slaves" to the NoWait'd popup. If you close the Popup, it will also lose the window the you created after the Popup. A good rule of thumb is to leave the popup open while you're interacting with the rest of your program until you understand what happens when you close the NoWaitPopup. @@ -440,103 +440,103 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFile` - get a filename - `PopupGetFolder` - get a folder name -Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. - - - import PySimpleGUI as sg - - text = sg.PopupGetText('Title', 'Please input something') - sg.Popup('Results', 'The value returned from PopupGetText', text) - +Rather than make a custom window to get one data value, call the Popup input function to get the item from the user. + + + import PySimpleGUI as sg + + text = sg.PopupGetText('Title', 'Please input something') + sg.Popup('Results', 'The value returned from PopupGetText', text) + ![popupgettext](https://user-images.githubusercontent.com/13696193/44957281-8721b880-ae9e-11e8-98cd-d06369f4187e.jpg) ![popup gettext response](https://user-images.githubusercontent.com/13696193/44957282-8721b880-ae9e-11e8-84ae-dc8bb30504a0.jpg) - text = sg.PopupGetFile('Please enter a file name') + text = sg.PopupGetFile('Please enter a file name') sg.Popup('Results', 'The value returned from PopupGetFile', text) - + ![popupgetfile](https://user-images.githubusercontent.com/13696193/44957857-2fd31680-aea5-11e8-8eb7-f6b91c202cc8.jpg) The window created to get a folder name looks the same as the get a file name. The difference is in what the browse button does. `PopupGetFile` shows an Open File dialog box while `PopupGetFolder` shows an Open Folder dialog box. - text = sg.PopupGetFolder('Please enter a folder name') + text = sg.PopupGetFolder('Please enter a folder name') sg.Popup('Results', 'The value returned from PopupGetFolder', text) ![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) -#### Progress Meters! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - OneLineProgressMeter(title, - current_value, - max_value, +#### Progress Meters! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + OneLineProgressMeter(title, + current_value, + max_value, key, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter window. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. -## The Form Designer -The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom window API Calls (Your First window) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom windows is for your typical, blocking, non-persistant window. By this I mean, when you "show" the window, the function will not return until the user has clicked a button or closed the window. When this happens, the window will be automatically closed. + +Two other types of windows exist. +1. Persistent window - rather than closing on button clicks, the show window function returns and the window continues to be visible. This is good for applications like a chat window. +2. Asynchronous window - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async windows are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. + +## The window Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a window designer. Better yet, the window designer requires no training and everyone knows how to use it. ![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) @@ -546,7 +546,7 @@ It's a manual process, but if you follow the instructions, it will take only a m 3. Label each Element with the Element name 4. Write your Python code using the labels as pseudo-code -Let's take a couple of examples. +Let's take a couple of examples. **Enter a number**.... Popular beginner programs are often based on a game or logic puzzle that requires the user to enter something, like a number. The "high-low" answer game comes to mind where you try to guess the number based on high or low tips. @@ -577,220 +577,220 @@ Row 3 has an OK button Now that we've got the 3 rows defined, they are put into a list that represents the entire window. - layout = [ [sg.Text('Enter a Number')], - [sg.Input()], + layout = [ [sg.Text('Enter a Number')], + [sg.Input()], [sg.OK()] ] Finally we can put it all together into a program that will display our window. - import PySimpleGUI as sg - - layout = [[sg.Text('Enter a Number')], - [sg.Input()], - [sg.OK()] ] - - button, (number,) = sg.Window('Enter a number example').LayoutAndRead(layout) - + import PySimpleGUI as sg + + layout = [[sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + + button, (number,) = sg.Window('Enter a number example').LayoutAndRead(layout) + sg.Popup(button, number) ### Example 2 - Get a filename -Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your window on paper, break it up into rows, label the elements. ![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) ![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) -Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the window on the paper. + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] - - button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) - sg.Popup(button, number) -Read on for detailed instructions on the calls that show the form and return your results. +Read on for detailed instructions on the calls that show the window and return your results. -# Copy these design patterns! +# Copy these design patterns! -All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of window you're implementing. - -## Pattern 1 - Single read forms -This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] +## Pattern 1 - Single read windows - form = sg.Window('SHA-1 & 256 Hash') +This is the most basic design pattern. Use this for windows that are shown to the user 1 time. The input values are gathered and returned to the program - button, (source_filename,) = form.LayoutAndRead(form_rows) - - ---- + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] -## Pattern 2 - Single-read form "chained" + window = sg.Window('SHA-1 & 256 Hash') -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) - - -## Pattern 3 - Persistent form (multiple reads) - -Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. - -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. - - import PySimpleGUI as sg - - layout = [[sg.Text('Persistent form')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.Window('Raspberry Pi GUI').Layout(layout) - - while True: - button, values = form.Read() - if button is None: + button, (source_filename,) = window.LayoutAndRead(window_rows) + + ---- + +## Pattern 2 - Single-read window "chained" + +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a window is first obtained by calling Window and then that window is then read. It's possible to combine the creation of the window with the read. This design pattern does exactly that, chain together the window creation and the window reading. + + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(window_rows) + + +## Pattern 3 - Persistent window (multiple reads) + +Some of the more advanced programs operate with the window remaining visible on the screen. Input values are collected, but rather than closing the window, it is kept visible acting as a way to both output information to the user and gather input data. + +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a window is created by calling Window which is then passed on to the Layout method. The Layout method returns the window value so that it can be stored and used later in the program to Read the window. + + import PySimpleGUI as sg + + layout = [[sg.Text('Persistent window')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + window = sg.Window('Raspberry Pi GUI').Layout(layout) + + while True: + button, values = window.Read() + if button is None: break ### How GUI Programming in Python Should Look? At least for beginners - + Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. - + +The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a window. + Let's dissect this little program - import PySimpleGUI as sg - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - - form = sg.Window('Rename Files or Folders') - - button, (folder_path, file_path) = form.LayoutAndRead(layout) + import PySimpleGUI as sg + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + window = sg.Window('Rename Files or Folders') + + button, (folder_path, file_path) = window.LayoutAndRead(layout) + + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the window has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a window, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my window's input values to be given to me. + +For return values the window is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example window, there are 2 fields, so the return values from this window will be a list with 2 values in it. + + button, (folder_path, file_path) = window.LayoutAndRead(layout) + +In the statement that shows and reads the window, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +## Return values - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -## Return values - As of version 2.8 there are 2 forms of return values, list and dictionary. - + ### Return values as a list By default return values are a list of values, one entry for each input field. - - Return information from Window, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - + + Return information from Window, SG's primary window builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = window.LayoutAndRead(window_rows) + + Or, you can unpack the return results separately. + + button, values = window.LayoutAndRead(window_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = window.LayoutAndRead(window_rows) + + Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... + + button, value_list = window.LayoutAndRead(window_rows) + value1 = value_list[0] + value2 = value_list[1] + ... ### Return values as a dictionary -For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. +For windows longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. -The most common form read statement you'll encounter looks something like this: +The most common window read statement you'll encounter looks something like this: - button, values = form.LayoutAndRead(layout) + button, values = window.LayoutAndRead(layout) or - button, values = form.Read() + button, values = window.Read() All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. -If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. +If **any** element in the window has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -Let's take a look at your first dictionary-based form. +Let's take a look at your first dictionary-based window. import PySimpleGUI as sg - form = sg.Window('Simple data entry form') - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - + window = sg.Window('Simple data entry window') + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + sg.Popup(button, values, values['name'], values['address'], values['phone']) To get the value of an input field, you use whatever value used as the `key` value as the index value. Thus to get the value of the name field, it is written as values['name'] -You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. +You will find the key field used quite heavily in most PySimpleGUI windows unless the window is very simple. ### Button Return Values @@ -799,22 +799,22 @@ The button value from a Read call will be one of 3 values: 2. The Button's key 3. None -If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the button value is None. -None is returned when the user clicks the X to close a window. +None is returned when the user clicks the X to close a window. -If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: +If your window has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: - while True: - button, values= form.Read() - if button is None or button == 'Quit': + while True: + button, values= window.Read() + if button is None or button == 'Quit': break ## The Event Loop / Callback Functions -All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single window, collects the data and then executes the primary code of the program then you likely don't need an event loop. -Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. +Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. @@ -825,195 +825,195 @@ This little program has a typical Event Loop import PySimpleGUI as sg - layout = [[sg.T('Raspberry Pi LEDs')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.Window('Raspberry Pi).Layout(layout) - - # ---- Event Loop ---- # - while True: - button, values = form.Read() - - # ---- Process Button Clicks ---- # - if button is None or button == 'Exit': - break - if button == 'Turn LED Off': - turn_LED_off() - elif button == 'Turn LED On': - turn_LED_on() - - # ---- After Event Loop ---- # + layout = [[sg.T('Raspberry Pi LEDs')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + window = sg.Window('Raspberry Pi).Layout(layout) + + # ---- Event Loop ---- # + while True: + button, values = window.Read() + + # ---- Process Button Clicks ---- # + if button is None or button == 'Exit': + break + if button == 'Turn LED Off': + turn_LED_off() + elif button == 'Turn LED On': + turn_LED_on() + + # ---- After Event Loop ---- # sg.Popup('Done... exiting') -In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) +In the Event Loop we are reading the window and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) -The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. -There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. +There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. -PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . +PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible trade-off to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. - ---- -## All Widgets / Elements +--- -This code utilizes as many of the elements in one form as possible. - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ Column Definition ------ # - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Frame(layout=[ - [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame('Labelled Group',[[ - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]])], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] - ] - - - form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - - button, values = form.Read() - - sg.Popup('Title', - 'The results of the form.', - 'The button clicked was "{}"'.format(button), +## All Widgets / Elements + +This code utilizes as many of the elements in one window as possible. + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] + ] + + + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = window.Read() + + sg.Popup('Title', + 'The results of the window.', + 'The button clicked was "{}"'.format(button), 'The values are', values) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - + +This is a somewhat complex window with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the window. + ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) - -Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. + +Clicking the Submit button caused the window call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the Window object: - - def Window(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the window using something other than a button, then `button` will be `None`. + +You can see in the Popup that the values returned are a list. Each input field in the window generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom windows + +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous windows +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI window/dialog box. +You've already seen a number of examples above that use blocking windows. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking window. You can examine the show calls to be sure. If the window is a non-blocking window, it must indicate that in the call to `window.show`. + +NON-BLOCKING window call: + + window.Show(non_blocking=True) + +### Beginning a window +The first step is to create the window object using the desired window customization. + + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as window: + +This is the definition of the Window object: + + def Window(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), default_button_element_size = (None, None), - auto_size_text=None, - auto_size_buttons=None, - location=(None, None), + auto_size_text=None, + auto_size_buttons=None, + location=(None, None), font=None, - button_color=None,Font=None, - progress_bar_color=(None,None), + button_color=None,Font=None, + progress_bar_color=(None,None), background_color=None - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True - keep_on_top=False): - - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - default_button_element_size - Size of buttons on this form - auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - location - (x,y) Location to place window in pixels - font - Font name and size for elements of the form - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - background_color - Color of the window background - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar + keep_on_top=False): + + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `window` values. + + default_element_size - Size of elements in window in characters (width, height) + default_button_element_size - Size of buttons on this window + auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + location - (x,y) Location to place window in pixels + font - Font name and size for elements of the window + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + background_color - Color of the window background + is_tabbed_form - Bool. If True then window is a tabbed window + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True window will autoclose + auto_close_duration - Duration in seconds before window closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus - text_justification - Justification to use for Text Elements in this form + text_justification - Justification to use for Text Elements in this window no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. - + #### Window Location -PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the window is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the window. Setting `size=(20,1)` in the window creation call will set all elements in the window to that size. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. #### No Titlebar -Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. +Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. Be sure an provide your user an "exit" button or they will not be able to close the window! When no titlebar is enabled, there will be no icon on your taskbar for the window. Without an exit button you will need to kill via taskmanager... not fun. @@ -1027,76 +1027,76 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the window is a non-blocking window. -It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking window using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking window, simply get grab_anywhere = True when you create the window. #### Always on top -To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse + +## Elements +"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse Folder Browse Calendar picker Date Chooser - Read form - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar - Option Menu + Read window + Close window + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Option Menu Menu Frame Column Graph Image Table - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - + Async/Non-Blocking Windows + Tabbed windows + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + #### Common Parameters Some parameters that you will see on almost all Elements are: key tooltip #### Tooltip -Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your window's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. - +### Output Elements +Building a window is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. + +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. + Text(text size=(None, None) auto_size_text=None @@ -1110,150 +1110,150 @@ The most basic element is the Text element. It simply displays text. Many of t key=None tooltip=None) -. - - Text - The text that's displayed - size - Element's size +. + + Text - The text that's displayed + size - Element's size click_submits - if clicked will cause a read call to return they key value as the button relief - relief to use around the text - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color background_color - background color - justification - Justification for the text. String - 'left', 'right', 'center' + justification - Justification for the text. String - 'left', 'right', 'center' pad - (x,y) amount of padding in pixels to use around element when packing key - used to identify element. This value will return as button if click_submits True tooltip - string representing tooltip - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. - - (foreground, background) - + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. + + (foreground, background) + Individual colors are specified using either the color names as defined in tkinter or an RGB string of this format: - - "#RRGGBB" - -**auto_size_text** + + "#RRGGBB" + +**auto_size_text** A `True` value for `auto_size_text`, when placed on Text Elements, indicates that the width of the Element should be shrunk do the width of the text. The default setting is True. - [ ] List item - -**Shortcut functions** -The shorthand functions for `Text` are `Txt` and `T` - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] + +**Shortcut functions** +The shorthand functions for `Text` are `Txt` and `T` + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] ![multiline](https://user-images.githubusercontent.com/13696193/44959853-b139a180-aec3-11e8-972f-f52188510c88.jpg) - -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) - - Output(size=(None, None)) -. - - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] + +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits window + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. More on this later. + + window.AddRow(gg.Output(size=(100,20))) + +![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) + + Output(size=(None, None)) +. + + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the window definition. Optional variables at the Element level override the window level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] ![inputtext 2](https://user-images.githubusercontent.com/13696193/44959861-b5fe5580-aec3-11e8-8040-53ec241b5079.jpg) - - - def InputText(default_text = '', - size=(None, None), - auto_size_text=None, + + + def InputText(default_text = '', + size=(None, None), + auto_size_text=None, password_char='', - background_color=None, - text_color=None, + background_color=None, + text_color=None, do_not_clear=False, key=None, focus=False - ) -. - - default_text - Text initially shown in the input box - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + ) +. + + default_text - Text initially shown in the input box + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text - do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. + do_not_clear - Bool. Normally windows clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) - + There are two methods that can be called: InputText.Update(new_Value) - sets the input value Input.Text(Get() - returns the current value of the field. - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) - - InputCombo(values, , - size=(None, None), + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) + + InputCombo(values, , + size=(None, None), auto_size_text=None, background_color = None, text_color = None, - key = None) -. - - values - Choices to be displayed. List of strings - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + key = None) +. + + values - Choices to be displayed. List of strings + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) - - + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) + + Listbox(values default_values=None select_mode=None @@ -1267,207 +1267,207 @@ The standard listbox like you'll find in most GUIs. Note that the return values key=None pad=None tooltip=None): - -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' - change_submits - if True, the form read will return with a button value of '' + +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + change_submits - if True, the window read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background font - font to use for items in list text_color - color to use for the typed text key - Dictionary key to use for return values and to find element pad - amount of padding to use when packing tooltip - tooltip text - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. -ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +ListBoxes can cause a window to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. - -#### Slider Element -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - size=(None, None), +#### Slider Element + +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + size=(None, None), font=None, background_color = None, text_color = None, - key = None) ): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text + key = None) ): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Radio Button Element - -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) - - Radio(text, - group_id, - default=False, - size=(None, None), - auto_size_text=None, + +#### Radio Button Element + +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) + + Radio(text, + group_id, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display + key = None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the text - key = Dictionary key to use for return values - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + key = Dictionary key to use for return values + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + - ![checkbox](https://user-images.githubusercontent.com/13696193/44959906-6f5d2b00-aec4-11e8-9c8a-962c787f0286.jpg) - Checkbox(text, - default=False, - size=(None, None), - auto_size_text=None, + Checkbox(text, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None): -. - - text - Text to display next to checkbox + key = None): +. + + text - Text to display next to checkbox default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - + key = Dictionary key to use for return values -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) - - Spin(values, - intiial_value=None, - size=(None, None), - auto_size_text=None, +#### Spin Element + +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) + + Spin(values, + intiial_value=None, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, key = None): -. - - values - List of valid values - initial_value - String with initial value - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display +. + + values - List of valid values + initial_value - String with initial value + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - -### Button Element + key = Dictionary key to use for return values -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse +### Button Element + +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a window, whether it be Submit or Cancel, one way or another a button is involved in all windows. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse * Files Browse * File SaveAs * File Save -* Close Form (normal button) -* Read Form -* Realtime +* Close window (normal button) +* Read window +* Realtime * Calendar Chooser * Color Chooser - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + + + Close window - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close window" buttons. They cause the input values to be read and then the window is ***closed***, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the window. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog - -Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - -Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. -Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. +Read window - This is a window button that will read a snapshot of all of the input fields, but does not close the window after it's clicked. + +Realtime - This is another async window button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -The 3 primary forms of PySimpleGUI buttons and their names are: +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the window, and ReadForm buttons that keep the window open but returns control back to the caller. - 1. `Button` = `SimpleButton` - 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` +Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. + +The 3 primary windows of PySimpleGUI buttons and their names are: + + 1. `Button` = `SimpleButton` + 2. `ReadButton` = `RButton` = `ReadFormButton` (old style... use ReadButton instead) 3. `RealtimeButton` -You will find the long-form in the older programs. +You will find the long-form in the older programs. + +The most basic Button element call to use is `Button` -The most basic Button element call to use is `Button` - Button(button_text='' button_type=BUTTON_TYPE_CLOSES_WIN target=(None, None) @@ -1487,7 +1487,7 @@ The most basic Button element call to use is `Button` focus=False pad=None key=None): - + Parameters button_text - Text to be displayed on the button @@ -1511,69 +1511,69 @@ Parameters key - key used for finding the element #### Pre-defined Buttons -These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: - - OK - Ok - Submit - Cancel - Yes - No +These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: + + OK + Ok + Submit + Cancel + Yes + No Exit Quit Help Save SaveAs - FileBrowse + FileBrowse FilesBrowse - FileSaveAs - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - + FileSaveAs + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + ![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) - + #### Button targets - -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. -The Target comes in two forms. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the window. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. + +The Target comes in two forms. 1. Key 2. (row, column) Targets that are specified using a key will find its target element by using the target's key value. This is the "preferred" method. -If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. The (row, col) targeting can only target elements that are in the same "container". Containers are the Window, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. - + The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. (ThisRow, -1) means the Element to the left of the button, on the same row. If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. - -Let's examine this form as an example: - +Let's examine this window as an example: + + ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) - - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) - -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], + + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) + +The code for the entire window could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] or if using keys, then the code would be: - layout = [[sg.T('Source Folder')], - [sg.In(key='input')], + layout = [[sg.T('Source Folder')], + [sg.In(key='input')], [sg.FolderBrowse(target='input'), sg.OK()]] - + See how much easier the key method is? **Save & Open Buttons** @@ -1603,177 +1603,177 @@ These buttons pop up a standard color chooser window. The result is returned as ![color](https://user-images.githubusercontent.com/13696193/45243375-99965a80-b2c1-11e8-9779-b71bed85fab6.jpg) - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. - -layout = [[sg.Button('My Button')]] - -![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. - - - sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - + +**Custom Buttons** +Not all buttons are created equal. A button that closes a window is different that a button that returns from the window without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the window when clicked. + +layout = [[sg.Button('My Button')]] + +![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a window is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the window. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. + + + sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example window made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player window + + sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) - - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.Window('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. - -**File Types** -The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. -The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen OneLineProgressMeter calls presented earlier in this readme. - - sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') - -The return value for `OneLineProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. - -#### Progress Mater in Your Form -Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + +This window has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this window: + + window = sg.Window('Robotics Remote Control', auto_size_text=True) + + window_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + window.LayoutAndRead(window_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your window's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = window.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `window.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. + +**File Types** +The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a window where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window. + +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar windows. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the windows have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen OneLineProgressMeter calls presented earlier in this readme. + + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') + +The return value for `OneLineProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the window, or vale reached the max value. + +#### Progress Mater in Your window +Another way of using a Progress Meter with PySimpleGUI is to build a custom window with a `ProgressBar` Element in the window. You will need to run your window as a non-blocking window. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) - import PySimpleGUI as sg - - # layout the form - layout = [[sg.Text('A custom progress meter')], - [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], - [sg.Cancel()]] - - # create the form` - form = sg.Window('Custom Progress Meter').Layout(layout) - progress_bar = form.FindElement('progressbar') - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i + 1) - # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm()) - + import PySimpleGUI as sg + + # layout the window + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], + [sg.Cancel()]] + + # create the window` + window = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = window.FindElement('progressbar') + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = window.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open + window.CloseNonBlocking()) + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(size=(None, None)) + +Here's a complete solution for a chat-window using an Async window with an Output Element + + import PySimpleGUI as sg + + # Blocking window that doesn't close + def ChatBot(): + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + window = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = window.Read() + if button == 'SEND': + print(value) + else: + break -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - - # Blocking form that doesn't close - def ChatBot(): - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), - sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), - sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - - form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - ChatBot() ------------------- ## Columns -Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a window within a window. And, yes, you can have a Column within a Column if you want. -Columns are specified in exactly the same way as a form is, as a list of lists. +Columns are specified in exactly the same way as a window is, as a list of lists. def Column(layout - the list of rows that define the layout background_color - color of background size - size of visible portion of column pad - element padding to use when packing scrollable - bool. True if should add scrollbars - - + + Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1783,47 +1783,47 @@ Columns are needed when you have an element that has a height > 1 line on the le This code produced the above window. - import PySimpleGUI as sg - - # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. - - form = sg.Window('Columns') # blank form - - # Column layout - col = [[sg.Text('col Row 1')], - [sg.Text('col Row 2'), sg.Input('col input 1')], - [sg.Text('col Row 3'), sg.Input('col input 2')], - [sg.Text('col Row 4'), sg.Input('col input 3')], - [sg.Text('col Row 5'), sg.Input('col input 4')], - [sg.Text('col Row 6'), sg.Input('col input 5')], - [sg.Text('col Row 7'), sg.Input('col input 6')]] - - layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], - [sg.In('Last input')], - [sg.OK()]] - - # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) - -The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. + import PySimpleGUI as sg + + # Demo of how columns work + # window has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to window layouts, they are a list of lists of elements. + + window = sg.Window('Columns') # blank window + + # Column layout + col = [[sg.Text('col Row 1')], + [sg.Text('col Row 2'), sg.Input('col input 1')], + [sg.Text('col Row 3'), sg.Input('col input 2')], + [sg.Text('col Row 4'), sg.Input('col input 3')], + [sg.Text('col Row 5'), sg.Input('col input 4')], + [sg.Text('col Row 6'), sg.Input('col input 5')], + [sg.Text('col Row 7'), sg.Input('col input 6')]] + + layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], + [sg.In('Last input')], + [sg.OK()]] + + # Display the window and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the window display and read down to a single line of code. + button, values = sg.Window('Compact 1-line window with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) + +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the window's background color, except it only affects the column rectangle. Column(layout, background_color=None) -The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. - +The default background color for Columns is the same as the default window background color. If you change the look and feel of the window, the column background will match the window background automatically. + ---- ## Frames (Labelled Frames, Frames with a title) -Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. +Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. def Frame(title - the label / title to put on frame layout - list of rows of elements the frame contains @@ -1840,31 +1840,31 @@ Frames work exactly the same way as Columns. You create layout that is then use -This code creates a form with a Frame and 2 buttons. +This code creates a window with a Frame and 2 buttons. - frame_layout = [ - [sg.T('Text inside of a frame')], - [sg.CB('Check 1'), sg.CB('Check 2')], - ] - layout = [ - [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], - [sg.Submit(), sg.Cancel()] - ] - - form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + frame_layout = [ + [sg.T('Text inside of a frame')], + [sg.CB('Check 1'), sg.CB('Check 2')], + ] + layout = [ + [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], + [sg.Submit(), sg.Cancel()] + ] + + window = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a window layout. A window works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. ## Canvas Element -In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. +In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. ### Matplotlib, Pyplot Integration @@ -1879,30 +1879,30 @@ One such integration is with Matploplib and Pyplot. There is a Demo program wri The order of operations to obtain a tkinter Canvas Widget is: - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the form layout - layout = [[sg.Text('Plot test')], - [sg.Canvas(size=(figure_w, figure_h), key='canvas')], - [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - - # create the form and show it without the plot - form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() - - - # add the plot to the window - fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) - - # show it all again and get buttons - button, values = form.Read() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # define the window layout + layout = [[sg.Text('Plot test')], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], + [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] + + # create the window and show it without the plot + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + + + # add the plot to the window + fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) + + # show it all again and get buttons + button, values = window.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: -* Add Canvas Element to your form -* Layout your form -* Call `form.Finalize()` - this is a critical step you must not forget +* Add Canvas Element to your window +* Layout your window +* Call `window.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas * Draw on your canvas to your heart's content -* Call `form.Read()` - Nothing will appear on your canvas until you call Read +* Call `window.Read()` - Nothing will appear on your canvas until you call Read See `Demo_Matplotlib.py` for a Recipe you can copy. @@ -1939,7 +1939,7 @@ This Element is relatively new and may have some parameter additions or deletion background_color - color to use for background pad - element padding for pack key - key used to lookup element - tooltip - tooltip text + tooltip - tooltip text @@ -1969,160 +1969,160 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: +## Tabbed windows +Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None +Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your windows can go from this: + +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or window level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your windows will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None text_color=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None element_text_color=None input_text_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) tooltip_time = None - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color element_text_color - Text color of elements that have text, like Radio Buttons input_text_color - Color of the text that you type in - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - -## Persistent Forms (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. -The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. +These settings apply to all windows `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the window-level being the highest and the Element-level the lowest. Thus the levels are: + - window level + - Row level + - Element level +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! +## Persistent windows (Window stays open after button click) -Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking windows (see the next section). The other way is to use buttons that 'read' the window instead of 'close' the window when clicked. The typical buttons you find in windows, including the shortcut buttons, close the window. These include OK, Cancel, Submit, etc. The Button Element also closes the window. -When to use a non-blocking form: -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the window open and visible. This button is also used in Non-Blocking windows. The difference is in which call is made to read the window. The `Read` call will block, the `ReadNonBlocking` will not block. -If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. + + +## Asynchronous (Non-Blocking) windows +So you want to be a wizard do ya? Well go boldly! + +Use async windows sparingly. It's possible to have a window that appears to be async, but it is not. **Please** try to find other methods before going to async windows. The reason for this plea is that async windows poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. + +When to use a non-blocking window: +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking window. ### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. -***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. +***Instead of polling, try options that cause the window to return to you.*** By using non-blocking windows, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. **Examples** @@ -2135,93 +2135,93 @@ One example is you have an input field that changes as you press buttons on an o ### Periodically Calling`ReadNonBlocking` -Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your windows will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking forms. -1. Read the form just as you would a normal form -2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values +There are 2 methods of interacting with non-blocking windows. +1. Read the window just as you would a normal window +2. "Refresh" the window's values without reading the window. It's a quick operation meant to show the user the latest values - With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - - #### Exiting a Non-Blocking Form + With asynchronous windows the window is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. -It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. + #### Exiting a Non-Blocking window -Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed windows in your code. It is possible for a window to look closed, but continue running your event loop. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - form = Window() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) +Typically when reading a window you check `if Button is None` to determine if a window was closed. With NonBlocking windows, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking window is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. - -Periodic refresh - - form.ReadNonBlocking() or form.Refresh() - -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.Window('Running Timer', auto_size_text=True) - - # Create the layout - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], - [sg.Button('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - -## Updating Elements (changing elements in active form) +The proper code to check if the user has exited the window will be a polling-loop that looks something like this: + + while True: + button, values = window.ReadNonBlocking() + if values is None or button == 'Quit': + break + + +We're going to build an app that does the latter. It's going to update our window with a running clock. -Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). +The basic flow and functions you will be calling are: +Setup + + window = Window() + window_rows = ..... + window.LayoutAndRead(window_rows, non_blocking=True) + + +Periodic refresh + + window.ReadNonBlocking() or window.Refresh() + +If you need to close the window + + window.CloseNonBlocking() + +Rather than the usual `window.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the window. After the window is shown, you simply call `window.ReadNonBlocking()` every now and then. + +When you are ready to close the window (assuming the window wasn't closed by the user or a button click) you simply call `window.CloseNonBlocking()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async windows. We're going to make a window and update one of the elements of that window every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # window that doesn't block + # Make a window, but don't use context manager + window = sg.Window('Running Timer', auto_size_text=True) + + # Create the layout + window_rows = [[sg.Text('Non-blocking GUI with updates')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], + [sg.Button('Quit')]] + # Layout the rows of the window and perform a read. Indicate the window is non-blocking! + window.LayoutAndRead(window_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your window every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = window.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + window.CloseNonBlocking() + + +What we have here is the same sequence of function calls as in the description. Get a window, add rows to it, show the window, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the window. The new value will be displayed when `window.ReadNonBlocking()` is called. if you want to have the window reflect your changes immediately, call `window.Refresh()`. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the window is still open. The user has not closed the window using the X nor a button so it's up to the caller to close the window using `CloseNonBlocking`. + +## Updating Elements (changing elements in active window) + +Persistent windows remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. @@ -2232,35 +2232,35 @@ In some programs these updates happen in response to another Element. This prog - - # Testing async form, see if can have a slider - # that adjusts the size of text displayed - - import PySimpleGUI as sg - fontSize = 12 - layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), - sg.Slider(range=(6,172), orientation='h', size=(10,20), - change_submits=True, key='slider', font=('Helvetica 20')), - sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] - - sz = fontSize - form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) + + # Testing async window, see if can have a slider + # that adjusts the size of text displayed + + import PySimpleGUI as sg + fontSize = 12 + layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), + change_submits=True, key='slider', font=('Helvetica 20')), + sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] + + sz = fontSize + window = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop - while True: - button, values= form.Read() - if button is None: - break - sz_spin = int(values['spin']) - sz_slider = int(values['slider']) - sz = sz_spin if sz_spin != fontSize else sz_slider - if sz != fontSize: - fontSize = sz - font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - + while True: + button, values= window.Read() + if button is None: + break + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) + print("Done.") @@ -2269,25 +2269,25 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - -Remember this design pattern because you will use it OFTEN if you use persistent forms. + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) -It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: +Remember this design pattern because you will use it OFTEN if you use persistent windows. - text_element = form.FindElement('text') - text_element.Update(font=font) +It works as follows. The call to `window.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: -The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. + text_element = window.FindElement('text') + text_element.Update(font=font) + +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the window and also to identify elements. As already mentioned, they are used as targets in Button calls. ## Keyboard & Mouse Capture Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the Window call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. -Keys and scroll-wheel events are returned in exactly the same way as buttons. +Keys and scroll-wheel events are returned in exactly the same way as buttons. For scroll-wheel events, if the mouse is scrolled up, then the `button` text will be `MouseWheel:Up`. For downward scrolling, the text returned is `MouseWheel:Down` @@ -2297,60 +2297,60 @@ Keyboard keys return 2 types of key events. For "normal" keys (a,b,c, etc), a si Key Sym is a string such as 'Control_L'. The Key Code is a numeric representation of that key. The left control key, when pressed will return the value 'Control_L:17' - import PySimpleGUI as sg - - # Recipe for getting keys, one at a time as they are released - # If want to use the space bar, then be sure and disable the "default focus" - - with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - text_elem = sg.Text("", size=(18,1)) - layout = [[sg.Text("Press a key or scroll mouse")], - [text_elem], - [sg.Button("OK")]] - - form.Layout(layout) - # ---===--- Loop taking in user input --- # - while True: - button, value = form.ReadNonBlocking() - - if button == "OK" or (button is None and value is None): - print(button, "exiting") - break - if button is not None: + import PySimpleGUI as sg + + # Recipe for getting keys, one at a time as they are released + # If want to use the space bar, then be sure and disable the "default focus" + + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], + [text_elem], + [sg.Button("OK")]] + + window.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = window.ReadNonBlocking() + + if button == "OK" or (button is None and value is None): + print(button, "exiting") + break + if button is not None: text_elem.Update(button) -You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. +You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. ### Realtime Keyboard Capture -Use realtime keyboard capture by calling - - import PySimpleGUI as sg - - with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text("Hold down a key")], - [sg.Button("OK")]] - - form.Layout(layout) - - while True: - button, value = form.ReadNonBlocking() - - if button == "OK": - print(button, value, "exiting") - break - if button is not None: - print(button) - elif value is None: +Use realtime keyboard capture by calling + + import PySimpleGUI as sg + + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + layout = [[sg.Text("Hold down a key")], + [sg.Button("OK")]] + + window.Layout(layout) + + while True: + button, value = window.ReadNonBlocking() + + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + print(button) + elif value is None: break ## Menus -Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. +Beginning in version 3.01 you can add a menubar to your window. You specify the menus in much the same way as you do window layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your window.Read returns. Hopefully will not be a problem. This definition: - menu_def = [['File', ['Open', 'Save', 'Exit',]], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + menu_def = [['File', ['Open', 'Save', 'Exit',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] Note the placement of ',' and of []. It's tricky to get the nested menus correct that implement cascading menus. See how paste has Special and Normal as a list after it. This means that Paste has a cascading menu with items Special and Normal. @@ -2366,7 +2366,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the window changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2377,7 +2377,7 @@ We have an InputText field that we want to update. When the Element was created To update or change the value for that Input Element, we use this construct: - form.FindElement('input').Update('new text') + window.FindElement('input').Update('new text') Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. @@ -2393,68 +2393,68 @@ You can use Update to do things like: * etc - -## Sample Applications - -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - | Source File| Description | -|--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +## Sample Applications + +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + + | Source File| Description | +|--|--| +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single window |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form -|**Demo_Chat.py** | A chat window with scrollable history -|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project +|**Demo_Canvas.py** | window with a Canvas Element that is updated outside of the window +|**Demo_Chat.py** | A chat window with scrollable history +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project |**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex forms -|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Columns.py** | Using the Column Element to create more complex windows +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook -|**Demo_Dictionary.py** | Specifying and using return values in dictionary format -**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility -|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter -|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your window +|**Demo_DisplayHash1and256.py** | Using high level API and custom window to implement a simple display hash code utility +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a window. Saving and loading a window from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements -|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them -|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors -|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code -|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files -|**Demo_Keyboard.py** | Using blocking keyboard events -|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events -|**Demo_Machine_Learning.py** | A sample Machine Learning front end -|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph -|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph -|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files +|**Demo_Keyboard.py** | Using blocking keyboard events +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events +|**Demo_Machine_Learning.py** | A sample Machine Learning front end +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method -|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_Media_Player.py** | Non-blocking window with a media player layout. Demonstrates button graphics, Update method +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +|**Demo_NonBlocking_Form.py** | a basic async window |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 -|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_LEDs.py** | Control GPIO using buttons -|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons -|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | **Demo_Progress_Meters.py** | Demonstrates using 2 progress meters simultaneously -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook -|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts -|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts -|**Demo_Tabbed_Form.py** | Using the Tab feature +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts +|**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables -|**Demo_Timer.py** | Simple non-blocking form - +|**Demo_Timer.py** | Simple non-blocking window + ## Packages Used In Demos - - + + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: * [Chatterbot](https://github.com/gunthercox/ChatterBot) * [Mido](https://github.com/olemb/mido) * [Matplotlib](https://matplotlib.org/) * [PyMuPDF](https://github.com/rk700/PyMuPDF) - - + + ## Creating a Windows .EXE File It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. @@ -2484,22 +2484,22 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. -Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. +Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. sg.ChangeLookAndFeel('GreenTan') @@ -2522,57 +2522,57 @@ To see the latest list of color choices, take a look at the bottom of the `PySim You can also combine the `ChangeLookAndFeel` function with the `SetOptions` function to quickly modify one of the canned color schemes. Maybe you like the colors but was more depth to your bezels. You can dial in exactly what you want. -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X - -**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + +**Async windows** - these include the 'easy' windows (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async windows open with normal windows then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank window. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others @@ -2581,7 +2581,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) -| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) +| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. @@ -2590,19 +2590,19 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes | 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) @@ -2623,18 +2623,18 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t #### 3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall - -#### 3.4.0 + +#### 3.4.0 * Frame - New Element - a labelled frame for grouping elements. Similar - to Column + to Column * Graph (like a Canvas element except uses the caller's - coordinate system rather than tkinter's). -* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). -* Buttons return key value rather than button text **If** a `key` is specified, -* + coordinate system rather than tkinter's). +* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). +* Buttons return key value rather than button text **If** a `key` is specified, +* OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's - the way progress works sometimes) + the way progress works sometimes) * Popup - changed ALL of the Popup calls to provide many more customization settings * Popup * PopupGetFolder @@ -2650,7 +2650,7 @@ OneLineProgressMeter function added which gives you not only a one-line solution * PopupOKCancel * PopupYesNo -#### 3.4.1 +#### 3.4.1 * Button.GetText - Button class method. Returns the current text being shown on a button. * Menu - Tearoff option. Determines if menus should allow them to be torn off * Help - Shorcut button. Like Submit, cancel, etc @@ -2681,37 +2681,37 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Removed LookAndFeel capability from Mac platform. -### Upcoming -Make suggestions people! Future release features - +### Upcoming +Make suggestions people! Future release features + Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. WxPython is higher priority. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. **Dictionaries** Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. diff --git a/readme.md b/readme.md index e4d30b63c..4d521d0d8 100644 --- a/readme.md +++ b/readme.md @@ -34,56 +34,56 @@ Looking for a GUI package to help with * Into Machine Learning and are sick of the command line? * How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? -Look no further, **you've found your GUI package**. - - import PySimpleGUI as sg - - sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') - - +Look no further, **you've found your GUI package**. + + import PySimpleGUI as sg + + sg.Popup('Hello From PySimpleGUI!', 'This is the shortest GUI program ever!') + + ![hello world](https://user-images.githubusercontent.com/13696193/44960047-1f7f6380-aec6-11e8-9d5e-12ef935bcade.jpg) Or how about a ***custom GUI*** in 1 line of code? import PySimpleGUI as sg - + button, (filename,) = sg.Window('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) - + ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. - - + Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + + ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) PySimpleGUI wraps tkinter so that you get all the same widgets as you would tkinter, but you interact with them in a more friendly way. It does the layout and boilerplate code for you and presents you with a simple, efficient interface. - -![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) - + +![everything dark theme](https://user-images.githubusercontent.com/13696193/44959854-b1d23800-aec3-11e8-90b6-5af915a86d15.jpg) + Perhaps you're looking for a way to interact with your **Raspberry Pi** in a more friendly way. The same for shown as on Pi (roughly the same) - + ![raspberry pi everything demo](https://user-images.githubusercontent.com/13696193/44279694-5b58ce80-a220-11e8-9ab6-d6021f5a944f.jpg) - - - -In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: - - OneLineProgressMeter('My meter title', current_value, max value, 'key') - - ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) - -You can build an async media player GUI with custom buttons in 30 lines of code. - + + + +In addition to a primary GUI, you can add a Progress Meter to your code with ONE LINE of code. Slide this line into any of your `for` loops and get a nice meter: + + OneLineProgressMeter('My meter title', current_value, max value, 'key') + + ![easyprogressmeter](https://user-images.githubusercontent.com/13696193/44960065-83099100-aec6-11e8-8aa8-96e4b100a0e4.jpg) + +You can build an async media player GUI with custom buttons in 30 lines of code. + ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) - + How about embedding a game inside of a GUI? This game of Pong is written in tkinter and then dropped into the PySimpleGUI window creating a game that has an accompanying GUI. -![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) Combining PySimpleGUI with PyInstaller creates something truly remarkable and special, a Python program that looks like a Windows WinForms application. This application with working menu was created in 20 lines of Python code. It is a single .EXE file that launches straight into the screen you see. And more good news, the only icon you see on the taskbar is the window itself... there is no pesky shell window. @@ -92,156 +92,156 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background -I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? - -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. - -With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. - -The `PySimpleGUI` package is focused on the ***developer***. -> Create a custom GUI with as little and as simple code as possible. +I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -This was the primary focus used to create PySimpleGUI. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own windows using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. + +With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. + +The `PySimpleGUI` package is focused on the ***developer***. +> Create a custom GUI with as little and as simple code as possible. + +This was the primary focus used to create PySimpleGUI. > "Do it in a Python-like way" -was the second. +was the second. ## Features While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. - Features of PySimpleGUI include: - Text - Single Line Input - Buttons including these types: - File Browse - Files Browse - Folder Browse - SaveAs - Non-closing return - Close form - Realtime + Features of PySimpleGUI include: + Text + Single Line Input + Buttons including these types: + File Browse + Files Browse + Folder Browse + SaveAs + Non-closing return + Close window + Realtime Calendar chooser Color chooser - Checkboxes - Radio Buttons - Listbox + Checkboxes + Radio Buttons + Listbox Option Menu - Slider + Slider Graph - Frame with title - Icons - Multi-line Text Input - Scroll-able Output - Images - Progress Bar Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling window - 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) - Single-Line-Of-Code Proress Bar & Debug Print - Complete control of colors, look and feel + Frame with title + Icons + Multi-line Text Input + Scroll-able Output + Images + Progress Bar Async/Non-Blocking Windows + Tabbed windows + Persistent Windows + Redirect Python Output/Errors to scrolling window + 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) + Single-Line-Of-Code Proress Bar & Debug Print + Complete control of colors, look and feel Selection of pre-defined palettes - Button images + Button images Return values as dictionary Set focus Bind return key to buttons - Group widgets into a column and place into form anywhere + Group widgets into a column and place into window anywhere Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected Get slider, spinner, combo as they are changed - Update elements in a live form - Bulk form-fill operation - Save / Load form to/from disk + Update elements in a live window + Bulk window-fill operation + Save / Load window to/from disk Borderless (no titlebar) windows Always on top windows Menus Tooltips Clickable links No async programming required (no callbacks to worry about) - - -An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : ->Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... + +An example of many widgets used on a single window. A little further down you'll find the 21 lines of code required to create this complex window. Try it if you don't believe it. Install PySimpleGUI then : + +>Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > - -![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) - - - import PySimpleGUI as sg - - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], - [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], - [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], - [sg.Text('_' * 100, size=(70, 1))], - [sg.Text('Choose Source and Destination Folders', size=(35, 1))], - [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), - sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), - sg.FolderBrowse()], - [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] - +![everything example](https://user-images.githubusercontent.com/13696193/43097412-0a4652aa-8e8a-11e8-8e09-939484e3c568.jpg) + + + + import PySimpleGUI as sg + + layout = [[sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText()], + [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text shoulsd you decide not to type anything',)], + [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3)), + sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], + [sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6)), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(10, 20), default_value=10)], + [sg.Text('_' * 100, size=(70, 1))], + [sg.Text('Choose Source and Destination Folders', size=(35, 1))], + [sg.Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Source'), + sg.FolderBrowse()], + [sg.Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Dest'), + sg.FolderBrowse()], + [sg.Submit(), sg.Cancel(), sg.Button('Customized', button_color=('white', 'green'))]] + button, values = sg.Window('Everything bagel', auto_size_text=True, default_element_size=(40, 1)).LayoutAndRead(layout) - - ---- -### Design Goals -> Copy, Paste, Run. - -`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. - - > Be Pythonic - - Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - - Forms are represented as Python lists. - - A form is a list of rows - - A row is a list of elements -- Return values are a list of button presses and input values. + +--- +### Design Goals + +> Copy, Paste, Run. + +`PySimpleGUI's` goal with the API is to be easy on the programmer, and to function in a Python-like way. Since GUIs are visual, it was desirable for the code to visually match what's on the screen. By providing a significant amount of documentation and an easy to use Cookbook, it's possible to see your first GUI within 5 minutes of beginning the installation. + + > Be Pythonic + + Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. + + - windows are represented as Python lists. + - A window is a list of rows + - A row is a list of elements +- Return values are a list of button presses and input values. - Return values can also be represented as a dictionary - The SDK calls collapse down into a single line of Python code that presents a custom GUI and returns values - Linear programming instead of callbacks - + #### Lofty Goals > Change Python -The hope is not that ***this*** package will become part of the Python Standard Library. +The hope is not that ***this*** package will become part of the Python Standard Library. -The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. +The hope is that Python will become ***the*** go-to language for creating GUI programs that run on Windows, Mac, and Linux *for all levels of developer*. -The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. +The hope is that beginners that are interested in graphic design will have an easy way to express themselves, right from the start of their Python experience. -There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. +There is a noticeable gap in the Python GUI solution. Fill that gap and who knows what will happen. Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Python to dominate yet another computing discipline like it has so many others. This is my attempt to find out. - ----- -## Getting Started with PySimpleGUI - -### Installing - - pip install --upgrade PySimpleGUI - + ----- +## Getting Started with PySimpleGUI + +### Installing + + pip install --upgrade PySimpleGUI + On some systems you need to run pip3. - + pip3 install --upgrade PySimpleGUI On a Raspberry Pi, this is should work: @@ -256,110 +256,110 @@ If for some reason you are unable to install using `pip`, don't worry, you can s `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: ``` -ImportError: No module named tkinter +ImportError: No module named tkinter ``` then you need to install `tkinter`. Be sure and get the Python 3 version. ``` sudo apt-get install python3-tk ``` - -### Prerequisites - -Python 3 -tkinter - -PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. + +### Prerequisites + +Python 3 +tkinter + +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### EXE file creation If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe - -## Using - -To use in your code, simply import.... - `import PySimpleGUI as sg` - -Then use either "high level" API calls or build your own forms. - - sg.Popup('This is my first Popup') - -![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) - - -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. - ---- -## APIs - -PySimpleGUI can be broken down into 2 types of API's: + +## Using + +To use in your code, simply import.... + `import PySimpleGUI as sg` + +Then use either "high level" API calls or build your own windows. + + sg.Popup('This is my first Popup') + +![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) + + +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. + +--- +## APIs + +PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom form functions - - -### Python Language Features - - There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... - * Variable number of arguments to a function call - * Optional parameters to a function call + * Custom window functions + + +### Python Language Features + + There are a number of Python language features that PySimpleGUI utilizes heavily for API access that should be understood... + * Variable number of arguments to a function call + * Optional parameters to a function call * Dictionaries - -#### Variable Number of Arguments - - The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. - - sg.Popup('Variable number of parameters example', var1, var2, "etc") - -Each new item begins on a new line in the Popup - - ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) - - - -#### Optional Parameters to a Function Call - -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. - -Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. - - def Popup(*args, - button_color=None, - button_type=MSG_BOX_OK, - auto_close=False, - auto_close_duration=None, - icon=DEFAULT_WINDOW_ICON, - line_width=MESSAGE_BOX_LINE_WIDTH, - font=None): - -If the caller wanted to change the button color to be black on yellow, the call would look something like this: - - sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) - - -![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) - - + +#### Variable Number of Arguments + + The "High Level" API calls that *output* values take a variable number of arguments so that they match a "print" statement as much as possible. The idea is to make it simple for the programmer to output as many items as desired and in any format. The user need not convert the variables to be output into the strings. The PySimpleGUI functions do that for the user. + + sg.Popup('Variable number of parameters example', var1, var2, "etc") + +Each new item begins on a new line in the Popup + + ![snap0179](https://user-images.githubusercontent.com/13696193/43658129-f6ca49c6-9725-11e8-9317-1f77443eb04a.jpg) + + + +#### Optional Parameters to a Function Call + +This feature of the Python language is utilized ***heavily*** as a method of customizing windows and window Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. + +Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. + + def Popup(*args, + button_color=None, + button_type=MSG_BOX_OK, + auto_close=False, + auto_close_duration=None, + icon=DEFAULT_WINDOW_ICON, + line_width=MESSAGE_BOX_LINE_WIDTH, + font=None): + +If the caller wanted to change the button color to be black on yellow, the call would look something like this: + + sg.Popup('This box has a custom button color', button_color=('black', 'yellow')) + + +![snap0180](https://user-images.githubusercontent.com/13696193/43658171-13a72bfe-9726-11e8-8c7a-0a46e46fb202.jpg) + + #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: -1. To identify values when a form is read +1. To identify values when a window is read 2. To identify Elements so that they can be "updated" - ---- - -### High Level API Calls - Popup's + +--- + +### High Level API Calls - Popup's "High level calls" are those that start with "Popup". They are the most basic form of communications with the user. They are named after the type of window they create, a pop-up window. These windows are meant to be short lived while, either delivering information or collecting it, and then quickly disappearing. ### Popup Output -Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. +Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. -`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking window of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. -There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). +There are a number of Popup output calls, each with a slightly different look (e.g. different button labels). The list of Popup output functions are @@ -367,7 +367,7 @@ The list of Popup output functions are PopupOk PopupYesNo PopupCancel - PopupOkCancel + PopupOkCancel PopupError PopupTimed, PopupAutoClose PopupNoWait, PopupNonBlocking @@ -381,16 +381,16 @@ The function `PopupTimed` or `PopupAutoClose` are popup windows that will automa Here is a quick-reference showing how the Popup calls look. - sg.Popup('Popup') - sg.PopupOk('PopupOk') - sg.PopupYesNo('PopupYesNo') - sg.PopupCancel('PopupCancel') - sg.PopupOkCancel('PopupOkCancel') - sg.PopupError('PopupError') - sg.PopupTimed('PopupTimed') + sg.Popup('Popup') + sg.PopupOk('PopupOk') + sg.PopupYesNo('PopupYesNo') + sg.PopupCancel('PopupCancel') + sg.PopupOkCancel('PopupOkCancel') + sg.PopupError('PopupError') + sg.PopupTimed('PopupTimed') sg.PopupAutoClose('PopupAutoClose') - - + + ![snap0256](https://user-images.githubusercontent.com/13696193/44957394-1380ab00-aea0-11e8-98b1-1ab7d7bd5b37.jpg) @@ -409,14 +409,14 @@ Here is a quick-reference showing how the Popup calls look. #### Scrolled Output There is a scrolled version of Popups should you have a lot of information to display. - sg.PopupScrolled(my_text) - -![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) - - + sg.PopupScrolled(my_text) + +![scrolledtextbox 2](https://user-images.githubusercontent.com/13696193/43667324-712aa0d4-9745-11e8-83a9-a0d0570d0865.jpg) + + The `PopupScrolled` will auto-fit the window size to the size of the text. Specify `None` in the height field of a `size` parameter to get auto-sized height. -This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. +This call will create a scrolled box 80 characters wide and a height dependent upon the number of lines of text. sg.PopupScrolled(my_text, size=(80, None)) @@ -426,7 +426,7 @@ Note that the default max number of lines before scrolling happens is set to 50. The Popup call PopupNoWait or PopupNonBlocking will create a popup window and then immediately return control back to you. All other popup functions will block, waiting for the user to close the popup window. -This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement +This function is very handy for when you're **debugging** and want to display something as output but don't want to change the programs's overall timing by blocking. Think of it like a `print` statement A word of ***caution***... Windows that are created after the NoWait Popup are "slaves" to the NoWait'd popup. If you close the Popup, it will also lose the window the you created after the Popup. A good rule of thumb is to leave the popup open while you're interacting with the rest of your program until you understand what happens when you close the NoWaitPopup. @@ -440,103 +440,103 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFile` - get a filename - `PopupGetFolder` - get a folder name -Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. - - - import PySimpleGUI as sg - - text = sg.PopupGetText('Title', 'Please input something') - sg.Popup('Results', 'The value returned from PopupGetText', text) - +Rather than make a custom window to get one data value, call the Popup input function to get the item from the user. + + + import PySimpleGUI as sg + + text = sg.PopupGetText('Title', 'Please input something') + sg.Popup('Results', 'The value returned from PopupGetText', text) + ![popupgettext](https://user-images.githubusercontent.com/13696193/44957281-8721b880-ae9e-11e8-98cd-d06369f4187e.jpg) ![popup gettext response](https://user-images.githubusercontent.com/13696193/44957282-8721b880-ae9e-11e8-84ae-dc8bb30504a0.jpg) - text = sg.PopupGetFile('Please enter a file name') + text = sg.PopupGetFile('Please enter a file name') sg.Popup('Results', 'The value returned from PopupGetFile', text) - + ![popupgetfile](https://user-images.githubusercontent.com/13696193/44957857-2fd31680-aea5-11e8-8eb7-f6b91c202cc8.jpg) The window created to get a folder name looks the same as the get a file name. The difference is in what the browse button does. `PopupGetFile` shows an Open File dialog box while `PopupGetFolder` shows an Open Folder dialog box. - text = sg.PopupGetFolder('Please enter a folder name') + text = sg.PopupGetFolder('Please enter a folder name') sg.Popup('Results', 'The value returned from PopupGetFolder', text) ![popupgetfolder](https://user-images.githubusercontent.com/13696193/44957861-45484080-aea5-11e8-926c-cf607a45251c.jpg) -#### Progress Meters! -We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? - - - OneLineProgressMeter(title, - current_value, - max_value, +#### Progress Meters! +We all have loops in our code. 'Isn't it joyful waiting, watching a counter scrolling past in a text window? How about one line of code to get a progress meter, that contains statistics about your code? + + + OneLineProgressMeter(title, + current_value, + max_value, key, - *args, - orientation=None, - bar_color=DEFAULT_PROGRESS_BAR_COLOR, - button_color=None, - size=DEFAULT_PROGRESS_BAR_SIZE, - border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): - -Here's the one-line Progress Meter in action! - - for i in range(1,10000): - sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') - -That line of code resulted in this window popping up and updating. - -![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) - -A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. - -***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. - -#### Debug Output -Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement - - print = sg.EasyPrint - -at the top of your code. -There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. - + *args, + orientation=None, + bar_color=DEFAULT_PROGRESS_BAR_COLOR, + button_color=None, + size=DEFAULT_PROGRESS_BAR_SIZE, + border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH): + +Here's the one-line Progress Meter in action! + + for i in range(1,10000): + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') + +That line of code resulted in this window popping up and updating. + +![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) + +A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. +With a little trickery you can provide a way to break out of your loop using the Progress Meter window. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. + +***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. + +#### Debug Output +Another call in the 'Easy' families of APIs is `EasyPrint`. It will output to a debug window. If the debug window isn't open, then the first call will open it. No need to do anything but stick a 'print' call in your code. You can even replace your 'print' calls with calls to EasyPrint by simply sticking the statement + + print = sg.EasyPrint + +at the top of your code. +There are a number of names for the same EasyPrint function. `Print` is one of the better ones to use as it's easy to remember. It is simply `print` with a capital P. + import PySimpleGUI as sg - - for i in range(100): - sg.Print(i) - -![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) -Or if you didn't want to change your code: - + + for i in range(100): + sg.Print(i) + +![snap0125](https://user-images.githubusercontent.com/13696193/43114979-a696189e-8ecf-11e8-83c7-473fcf0ccc66.jpg) +Or if you didn't want to change your code: + import PySimpleGUI as sg - - print=sg.Print - for i in range(100): - print(i) - -Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. - -A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. - -You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. - ---- -# Custom Form API Calls (Your First Form) - -This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. - -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. - -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. - -It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. -## The Form Designer -The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. + print=sg.Print + for i in range(100): + print(i) + +Just like the standard print call, `EasyPrint` supports the `sep` and `end` keyword arguments. Other names that can be used to call `EasyPrint` include Print, `eprint`, If you want to close the window, call the function `EasyPrintClose`. + +A word of caution. There are known problems when multiple PySimpleGUI windows are opened, particularly if the user closes them in an unusual way. Not a reason to stay away from using it. Just something to keep in mind if you encounter a problem. + +You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. + +--- +# Custom window API Calls (Your First window) + +This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. + +This first section on custom windows is for your typical, blocking, non-persistant window. By this I mean, when you "show" the window, the function will not return until the user has clicked a button or closed the window. When this happens, the window will be automatically closed. + +Two other types of windows exist. +1. Persistent window - rather than closing on button clicks, the show window function returns and the window continues to be visible. This is good for applications like a chat window. +2. Asynchronous window - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async windows are updated (refreshed) on a periodic basis. + +It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. + +## The window Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a window designer. Better yet, the window designer requires no training and everyone knows how to use it. ![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) @@ -546,7 +546,7 @@ It's a manual process, but if you follow the instructions, it will take only a m 3. Label each Element with the Element name 4. Write your Python code using the labels as pseudo-code -Let's take a couple of examples. +Let's take a couple of examples. **Enter a number**.... Popular beginner programs are often based on a game or logic puzzle that requires the user to enter something, like a number. The "high-low" answer game comes to mind where you try to guess the number based on high or low tips. @@ -577,220 +577,220 @@ Row 3 has an OK button Now that we've got the 3 rows defined, they are put into a list that represents the entire window. - layout = [ [sg.Text('Enter a Number')], - [sg.Input()], + layout = [ [sg.Text('Enter a Number')], + [sg.Input()], [sg.OK()] ] Finally we can put it all together into a program that will display our window. - import PySimpleGUI as sg - - layout = [[sg.Text('Enter a Number')], - [sg.Input()], - [sg.OK()] ] - - button, (number,) = sg.Window('Enter a number example').LayoutAndRead(layout) - + import PySimpleGUI as sg + + layout = [[sg.Text('Enter a Number')], + [sg.Input()], + [sg.OK()] ] + + button, (number,) = sg.Window('Enter a number example').LayoutAndRead(layout) + sg.Popup(button, number) ### Example 2 - Get a filename -Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your window on paper, break it up into rows, label the elements. ![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) ![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) -Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the window on the paper. + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] - - button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) - sg.Popup(button, number) -Read on for detailed instructions on the calls that show the form and return your results. +Read on for detailed instructions on the calls that show the window and return your results. -# Copy these design patterns! +# Copy these design patterns! -All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of window you're implementing. - -## Pattern 1 - Single read forms -This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] +## Pattern 1 - Single read windows - form = sg.Window('SHA-1 & 256 Hash') +This is the most basic design pattern. Use this for windows that are shown to the user 1 time. The input values are gathered and returned to the program - button, (source_filename,) = form.LayoutAndRead(form_rows) - - ---- + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] -## Pattern 2 - Single-read form "chained" + window = sg.Window('SHA-1 & 256 Hash') -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. - - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) - - -## Pattern 3 - Persistent form (multiple reads) - -Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. - -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. - - import PySimpleGUI as sg - - layout = [[sg.Text('Persistent form')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.Window('Raspberry Pi GUI').Layout(layout) - - while True: - button, values = form.Read() - if button is None: + button, (source_filename,) = window.LayoutAndRead(window_rows) + + ---- + +## Pattern 2 - Single-read window "chained" + +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a window is first obtained by calling Window and then that window is then read. It's possible to combine the creation of the window with the read. This design pattern does exactly that, chain together the window creation and the window reading. + + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(window_rows) + + +## Pattern 3 - Persistent window (multiple reads) + +Some of the more advanced programs operate with the window remaining visible on the screen. Input values are collected, but rather than closing the window, it is kept visible acting as a way to both output information to the user and gather input data. + +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a window is created by calling Window which is then passed on to the Layout method. The Layout method returns the window value so that it can be stored and used later in the program to Read the window. + + import PySimpleGUI as sg + + layout = [[sg.Text('Persistent window')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + window = sg.Window('Raspberry Pi GUI').Layout(layout) + + while True: + button, values = window.Read() + if button is None: break ### How GUI Programming in Python Should Look? At least for beginners - + Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. - -The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. - + +The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a window. + Let's dissect this little program - import PySimpleGUI as sg - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - - form = sg.Window('Rename Files or Folders') - - button, (folder_path, file_path) = form.LayoutAndRead(layout) + import PySimpleGUI as sg + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + + window = sg.Window('Rename Files or Folders') + + button, (folder_path, file_path) = window.LayoutAndRead(layout) + + + +![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) + +Let's agree the window has 4 rows. + +The first row only has **text** that reads `Rename files or folders` + +The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. + +Now let's look at how those 2 rows and the other two row from Python code: + + layout = [[sg.Text('Rename files or folders')], + [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()]] + +See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. + +And what about those return values? Most people simply want to show a window, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my window's input values to be given to me. + +For return values the window is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. + +In our example window, there are 2 fields, so the return values from this window will be a list with 2 values in it. + + button, (folder_path, file_path) = window.LayoutAndRead(layout) + +In the statement that shows and reads the window, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. + +Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. + + +## Return values - - -![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) - -Let's agree the form has 4 rows. - -The first row only has **text** that reads `Rename files or folders` - -The second row has 3 elements in it. First the **text** `Source for Folders`, then an **input** field, then a **browse** button. - -Now let's look at how those 2 rows and the other two row from Python code: - - layout = [[sg.Text('Rename files or folders')], - [sg.Text('Source for Folders', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] - -See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. - -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. - -For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. - -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - - button, (folder_path, file_path) = form.LayoutAndRead(layout) - -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. - -Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. - - -## Return values - As of version 2.8 there are 2 forms of return values, list and dictionary. - + ### Return values as a list By default return values are a list of values, one entry for each input field. - - Return information from Window, SG's primary form builder interface, is in this format: - - button, (value1, value2, ...) - -Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) - - Or, you can unpack the return results separately. - - button, values = form.LayoutAndRead(form_rows) - filename, folder1, folder2, should_overwrite = values - -If you have a SINGLE value being returned, it is written this way: - - button, (value1,) = form.LayoutAndRead(form_rows) - - + + Return information from Window, SG's primary window builder interface, is in this format: + + button, (value1, value2, ...) + +Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. + + button, (filename, folder1, folder2, should_overwrite) = window.LayoutAndRead(window_rows) + + Or, you can unpack the return results separately. + + button, values = window.LayoutAndRead(window_rows) + filename, folder1, folder2, should_overwrite = values + +If you have a SINGLE value being returned, it is written this way: + + button, (value1,) = window.LayoutAndRead(window_rows) + + Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - - button, value_list = form.LayoutAndRead(form_rows) - value1 = value_list[0] - value2 = value_list[1] - ... + + button, value_list = window.LayoutAndRead(window_rows) + value1 = value_list[0] + value2 = value_list[1] + ... ### Return values as a dictionary -For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. +For windows longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. -The most common form read statement you'll encounter looks something like this: +The most common window read statement you'll encounter looks something like this: - button, values = form.LayoutAndRead(layout) + button, values = window.LayoutAndRead(layout) or - button, values = form.Read() + button, values = window.Read() All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. -If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. +If **any** element in the window has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -Let's take a look at your first dictionary-based form. +Let's take a look at your first dictionary-based window. import PySimpleGUI as sg - form = sg.Window('Simple data entry form') - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - + window = sg.Window('Simple data entry window') + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + sg.Popup(button, values, values['name'], values['address'], values['phone']) To get the value of an input field, you use whatever value used as the `key` value as the index value. Thus to get the value of the name field, it is written as values['name'] -You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. +You will find the key field used quite heavily in most PySimpleGUI windows unless the window is very simple. ### Button Return Values @@ -799,22 +799,22 @@ The button value from a Read call will be one of 3 values: 2. The Button's key 3. None -If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the button value is None. -None is returned when the user clicks the X to close a window. +None is returned when the user clicks the X to close a window. -If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: +If your window has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: - while True: - button, values= form.Read() - if button is None or button == 'Quit': + while True: + button, values= window.Read() + if button is None or button == 'Quit': break ## The Event Loop / Callback Functions -All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single window, collects the data and then executes the primary code of the program then you likely don't need an event loop. -Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. +Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. Let's take a Pi demo program as an example. This program shows a GUI window, gets button presses, and uses them to control some LEDs. It loops, reading user input and doing something with it. @@ -825,195 +825,195 @@ This little program has a typical Event Loop import PySimpleGUI as sg - layout = [[sg.T('Raspberry Pi LEDs')], - [sg.RButton('Turn LED On')], - [sg.RButton('Turn LED Off')], - [sg.Exit()]] - - form = sg.Window('Raspberry Pi).Layout(layout) - - # ---- Event Loop ---- # - while True: - button, values = form.Read() - - # ---- Process Button Clicks ---- # - if button is None or button == 'Exit': - break - if button == 'Turn LED Off': - turn_LED_off() - elif button == 'Turn LED On': - turn_LED_on() - - # ---- After Event Loop ---- # + layout = [[sg.T('Raspberry Pi LEDs')], + [sg.RButton('Turn LED On')], + [sg.RButton('Turn LED Off')], + [sg.Exit()]] + + window = sg.Window('Raspberry Pi).Layout(layout) + + # ---- Event Loop ---- # + while True: + button, values = window.Read() + + # ---- Process Button Clicks ---- # + if button is None or button == 'Exit': + break + if button == 'Turn LED Off': + turn_LED_off() + elif button == 'Turn LED On': + turn_LED_on() + + # ---- After Event Loop ---- # sg.Popup('Done... exiting') -In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) +In the Event Loop we are reading the window and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) -The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. +The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. -There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. +There is a more communications that have to happen between parts of your program when using callbacks. Callbacks can break your program's logic apart and scatter it. One of the larger hurdles for beginners to GUI programming are these callback functions. -PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . +PySimpleGUI was specifically designed in a way that callbacks would not be required. There is no coordination between one function and another required. You simply read your button click and take appropriate action at the same location as when you . Whether or not this is a "proper" design for GUI programs can be debated. It's not a terrible trade-off to run your own event loop and having a functioning GUI application versus one that maybe never gets written because callback functions were too much to grasp. - ---- -## All Widgets / Elements +--- -This code utilizes as many of the elements in one form as possible. - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ Column Definition ------ # - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Frame(layout=[ - [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame('Labelled Group',[[ - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]])], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] - ] - - - form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - - button, values = form.Read() - - sg.Popup('Title', - 'The results of the form.', - 'The button clicked was "{}"'.format(button), +## All Widgets / Elements + +This code utilizes as many of the elements in one window as possible. + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], + [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] + ] + + + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = window.Read() + + sg.Popup('Title', + 'The results of the window.', + 'The button clicked was "{}"'.format(button), 'The values are', values) - -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. - + +This is a somewhat complex window with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the window. + ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) - -Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. + +Clicking the Submit button caused the window call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) - - -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. - -You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. - ---- -# Building Custom Forms -You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. - - Control-Q (when cursor is on function name) brings up a box with the function definition - Control-P (when cursor inside function call "()") shows a list of parameters and their default values - -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. - -NON-BLOCKING form call: - - form.Show(non_blocking=True) - -### Beginning a Form -The first step is to create the form object using the desired form customization. - - with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: - -This is the definition of the Window object: - - def Window(title, - default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), + +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the window using something other than a button, then `button` will be `None`. + +You can see in the Popup that the values returned are a list. Each input field in the window generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. + +--- +# Building Custom windows + +You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. + + Control-Q (when cursor is on function name) brings up a box with the function definition + Control-P (when cursor inside function call "()") shows a list of parameters and their default values + +## Synchronous windows +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI window/dialog box. +You've already seen a number of examples above that use blocking windows. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking window. You can examine the show calls to be sure. If the window is a non-blocking window, it must indicate that in the call to `window.show`. + +NON-BLOCKING window call: + + window.Show(non_blocking=True) + +### Beginning a window +The first step is to create the window object using the desired window customization. + + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as window: + +This is the definition of the Window object: + + def Window(title, + default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), default_button_element_size = (None, None), - auto_size_text=None, - auto_size_buttons=None, - location=(None, None), + auto_size_text=None, + auto_size_buttons=None, + location=(None, None), font=None, - button_color=None,Font=None, - progress_bar_color=(None,None), + button_color=None,Font=None, + progress_bar_color=(None,None), background_color=None - is_tabbed_form=False, - border_depth=None, - auto_close=False, - auto_close_duration=DEFAULT_AUTOCLOSE_TIME, + is_tabbed_form=False, + border_depth=None, + auto_close=False, + auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=True - keep_on_top=False): - - -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - - default_element_size - Size of elements in form in characters (width, height) - default_button_element_size - Size of buttons on this form - auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True - auto_size_buttons - Bool. True if button elements should size themselves according to their text label - location - (x,y) Location to place window in pixels - font - Font name and size for elements of the form - button_color - Default color for buttons (foreground, background). Can be text or hex - progress_bar_color - Foreground and background colors for progress bars - background_color - Color of the window background - is_tabbed_form - Bool. If True then form is a tabbed form - border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes - icon - .ICO file that will appear on the Task Bar and end of Title Bar + keep_on_top=False): + + +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `window` values. + + default_element_size - Size of elements in window in characters (width, height) + default_button_element_size - Size of buttons on this window + auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True + auto_size_buttons - Bool. True if button elements should size themselves according to their text label + location - (x,y) Location to place window in pixels + font - Font name and size for elements of the window + button_color - Default color for buttons (foreground, background). Can be text or hex + progress_bar_color - Foreground and background colors for progress bars + background_color - Color of the window background + is_tabbed_form - Bool. If True then window is a tabbed window + border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. + auto_close - Bool. If True window will autoclose + auto_close_duration - Duration in seconds before window closes + icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus - text_justification - Justification to use for Text Elements in this form + text_justification - Justification to use for Text Elements in this window no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. - + #### Window Location -PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the window is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. -#### Sizes -Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. - -The default Element size for PySimpleGUI is `(45,1)`. - -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. - -There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. +#### Sizes +Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. + +The default Element size for PySimpleGUI is `(45,1)`. + +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the window. Setting `size=(20,1)` in the window creation call will set all elements in the window to that size. + +There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. #### No Titlebar -Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. +Should you wish to create cool looking windows that are clean with no windows titlebar, use the no_titlebar option when creating the window. Be sure an provide your user an "exit" button or they will not be able to close the window! When no titlebar is enabled, there will be no icon on your taskbar for the window. Without an exit button you will need to kill via taskmanager... not fun. @@ -1027,76 +1027,76 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the window is a non-blocking window. -It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking window using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking window, simply get grab_anywhere = True when you create the window. #### Always on top -To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. - -## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. - - Text - Single Line Input - Buttons including these types: - File Browse + +## Elements +"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. + + Text + Single Line Input + Buttons including these types: + File Browse Folder Browse Calendar picker Date Chooser - Read form - Close form - Realtime - Checkboxes - Radio Buttons - Listbox - Slider - Multi-line Text Input - Scroll-able Output - Progress Bar - Option Menu + Read window + Close window + Realtime + Checkboxes + Radio Buttons + Listbox + Slider + Multi-line Text Input + Scroll-able Output + Progress Bar + Option Menu Menu Frame Column Graph Image Table - Async/Non-Blocking Windows - Tabbed forms - Persistent Windows - Redirect Python Output/Errors to scrolling Window - "Higher level" APIs (e.g. MessageBox, YesNobox, ...) - + Async/Non-Blocking Windows + Tabbed windows + Persistent Windows + Redirect Python Output/Errors to scrolling Window + "Higher level" APIs (e.g. MessageBox, YesNobox, ...) + #### Common Parameters Some parameters that you will see on almost all Elements are: key tooltip #### Tooltip -Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your window's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. - -### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: - - layout = [ [row 1 element, row 1 element], - [row 2 element, row 2 element, row 2 element] ] -The code is a crude representation of the GUI, laid out in text. -#### Text Element - - layout = [[sg.Text('This is what a Text Element looks like')]] - - ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) - - -The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. - +### Output Elements +Building a window is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: + + layout = [ [row 1 element, row 1 element], + [row 2 element, row 2 element, row 2 element] ] +The code is a crude representation of the GUI, laid out in text. + +#### Text Element + + layout = [[sg.Text('This is what a Text Element looks like')]] + + ![simple text](https://user-images.githubusercontent.com/13696193/44959877-e9d97b00-aec3-11e8-9d24-b4405ee4a148.jpg) + + +The most basic element is the Text element. It simply displays text. Many of the 'options' that can be set for a Text element are shared by other elements. + Text(text size=(None, None) auto_size_text=None @@ -1110,150 +1110,150 @@ The most basic element is the Text element. It simply displays text. Many of t key=None tooltip=None) -. - - Text - The text that's displayed - size - Element's size +. + + Text - The text that's displayed + size - Element's size click_submits - if clicked will cause a read call to return they key value as the button relief - relief to use around the text - auto_size_text - Bool. Change width to match size of text - font - Font name and size to use - text_color - text color + auto_size_text - Bool. Change width to match size of text + font - Font name and size to use + text_color - text color background_color - background color - justification - Justification for the text. String - 'left', 'right', 'center' + justification - Justification for the text. String - 'left', 'right', 'center' pad - (x,y) amount of padding in pixels to use around element when packing key - used to identify element. This value will return as button if click_submits True tooltip - string representing tooltip - -Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. - -**Fonts** in PySimpleGUI are always in this format: - - (font_name, point_size) - -The default font setting is - - ("Helvetica", 10) - -**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. - - (foreground, background) - + +Some commonly used elements have 'shorthand' versions of the functions to make the code more compact. The functions `T` and `Txt` are the same as calling `Text`. + +**Fonts** in PySimpleGUI are always in this format: + + (font_name, point_size) + +The default font setting is + + ("Helvetica", 10) + +**Color** in PySimpleGUI are in one of two format. They can be a single color or a color pair. Buttons are an example of a color pair. + + (foreground, background) + Individual colors are specified using either the color names as defined in tkinter or an RGB string of this format: - - "#RRGGBB" - -**auto_size_text** + + "#RRGGBB" + +**auto_size_text** A `True` value for `auto_size_text`, when placed on Text Elements, indicates that the width of the Element should be shrunk do the width of the text. The default setting is True. - [ ] List item - -**Shortcut functions** -The shorthand functions for `Text` are `Txt` and `T` - -#### Multiline Text Element - - layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] + +**Shortcut functions** +The shorthand functions for `Text` are `Txt` and `T` + +#### Multiline Text Element + + layout = [[sg.Multiline('This is what a Multi-line Text Element looks like', size=(45,5))]] ![multiline](https://user-images.githubusercontent.com/13696193/44959853-b139a180-aec3-11e8-972f-f52188510c88.jpg) - -This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. - - Multiline(default_text='', - enter_submits = False, - size=(None, None), - auto_size_text=None) -. - - default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form - size - Element's size - auto_size_text - Bool. Change width to match size of text - -#### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - - form.AddRow(gg.Output(size=(100,20))) - -![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) - - Output(size=(None, None)) -. - - size - Size of element (width, height) in characters - -### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. - -#### Text Input Element - - layout = [[sg.InputText('Default text')]] + +This Element doubles as both an input and output Element. The `DefaultText` optional parameter is used to indicate what to output to the window. + + Multiline(default_text='', + enter_submits = False, + size=(None, None), + auto_size_text=None) +. + + default_text - Text to display in the text box + enter_submits - Bool. If True, pressing Enter key submits window + size - Element's size + auto_size_text - Bool. Change width to match size of text + +#### Output Element +Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. More on this later. + + window.AddRow(gg.Output(size=(100,20))) + +![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) + + Output(size=(None, None)) +. + + size - Size of element (width, height) in characters + +### Input Elements + These make up the majority of the window definition. Optional variables at the Element level override the window level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + +#### Text Input Element + + layout = [[sg.InputText('Default text')]] ![inputtext 2](https://user-images.githubusercontent.com/13696193/44959861-b5fe5580-aec3-11e8-8040-53ec241b5079.jpg) - - - def InputText(default_text = '', - size=(None, None), - auto_size_text=None, + + + def InputText(default_text = '', + size=(None, None), + auto_size_text=None, password_char='', - background_color=None, - text_color=None, + background_color=None, + text_color=None, do_not_clear=False, key=None, focus=False - ) -. - - default_text - Text initially shown in the input box - size - (width, height) of element in characters - auto_size_text- Bool. True is element should be sized to fit text - password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field + ) +. + + default_text - Text initially shown in the input box + size - (width, height) of element in characters + auto_size_text- Bool. True is element should be sized to fit text + password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text - do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. + do_not_clear - Bool. Normally windows clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) - + There are two methods that can be called: InputText.Update(new_Value) - sets the input value Input.Text(Get() - returns the current value of the field. - -Shorthand functions that are equivalent to `InputText` are `Input` and `In` - - -#### Combo Element -Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. - - layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] - -![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) - - InputCombo(values, , - size=(None, None), + +Shorthand functions that are equivalent to `InputText` are `Input` and `In` + + +#### Combo Element +Also known as a drop-down list. Only required parameter is the list of choices. The return value is a string matching what's visible on the GUI. + + layout = [[sg.InputCombo(['choice 1', 'choice 2'])]] + +![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) + + InputCombo(values, , + size=(None, None), auto_size_text=None, background_color = None, text_color = None, - key = None) -. - - values - Choices to be displayed. List of strings - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + key = None) +. + + values - Choices to be displayed. List of strings + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Listbox Element -The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). - - layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] - -![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) - - + +#### Listbox Element +The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). + + layout = [[sg.Listbox(values=['Listbox 1', 'Listbox 2', 'Listbox 3'], size=(30, 6))]] + +![listbox 2](https://user-images.githubusercontent.com/13696193/44959859-b4cd2880-aec3-11e8-881c-1e369d5c6337.jpg) + + Listbox(values default_values=None select_mode=None @@ -1267,207 +1267,207 @@ The standard listbox like you'll find in most GUIs. Note that the return values key=None pad=None tooltip=None): - -. - - values - Choices to be displayed. List of strings - select_mode - Defines how to list is to operate. - Choices include constants or strings: - Constants version: - LISTBOX_SELECT_MODE_BROWSE - LISTBOX_SELECT_MODE_EXTENDED - LISTBOX_SELECT_MODE_MULTIPLE - LISTBOX_SELECT_MODE_SINGLE - the default - Strings version: - 'browse' - 'extended' - 'multiple' - 'single' - change_submits - if True, the form read will return with a button value of '' + +. + + values - Choices to be displayed. List of strings + select_mode - Defines how to list is to operate. + Choices include constants or strings: + Constants version: + LISTBOX_SELECT_MODE_BROWSE + LISTBOX_SELECT_MODE_EXTENDED + LISTBOX_SELECT_MODE_MULTIPLE + LISTBOX_SELECT_MODE_SINGLE - the default + Strings version: + 'browse' + 'extended' + 'multiple' + 'single' + change_submits - if True, the window read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text length + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background font - font to use for items in list text_color - color to use for the typed text key - Dictionary key to use for return values and to find element pad - amount of padding to use when packing tooltip - tooltip text - -The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. -ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. + +ListBoxes can cause a window to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. - -#### Slider Element -Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. - - layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] - -![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) - - Slider(range=(None,None), - default_value=None, - orientation=None, - border_width=None, - relief=None, - size=(None, None), +#### Slider Element + +Sliders have a couple of slider-specific settings as well as appearance settings. Examples include the `orientation` and `range` settings. + + layout = [[sg.Slider(range=(1,500), default_value=222, size=(20,15), orientation='horizontal', font=('Helvetica', 12))]] + +![slider](https://user-images.githubusercontent.com/13696193/44959858-b4349200-aec3-11e8-9e25-c0fcf025d19e.jpg) + + Slider(range=(None,None), + default_value=None, + orientation=None, + border_width=None, + relief=None, + size=(None, None), font=None, background_color = None, text_color = None, - key = None) ): -. - - range - (min, max) slider's range - default_value - default setting (within range) - orientation - 'horizontal' or 'vertical' ('h' or 'v' work) - border_width - how deep the widget looks - relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: - RELIEF_RAISED= 'raised' - RELIEF_SUNKEN= 'sunken' - RELIEF_FLAT= 'flat' - RELIEF_RIDGE= 'ridge' - RELIEF_GROOVE= 'groove' - RELIEF_SOLID = 'solid' - size - (width, height) of element in characters - auto_size_text - Bool. True if size should fit the text + key = None) ): +. + + range - (min, max) slider's range + default_value - default setting (within range) + orientation - 'horizontal' or 'vertical' ('h' or 'v' work) + border_width - how deep the widget looks + relief - relief style. Values are same as progress meter relief values. Can be a constant or a string: + RELIEF_RAISED= 'raised' + RELIEF_SUNKEN= 'sunken' + RELIEF_FLAT= 'flat' + RELIEF_RIDGE= 'ridge' + RELIEF_GROOVE= 'groove' + RELIEF_SOLID = 'solid' + size - (width, height) of element in characters + auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background text_color - color to use for the typed text key = Dictionary key to use for return values - -#### Radio Button Element - -Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. - - layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] - -![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) - - Radio(text, - group_id, - default=False, - size=(None, None), - auto_size_text=None, + +#### Radio Button Element + +Creates one radio button that is assigned to a group of radio buttons. Only 1 of the buttons in the group can be selected at any one time. + + layout = [[sg.Radio('My first Radio!', "RADIO1", default=True), sg.Radio('My second radio!', "RADIO1")]] + +![radio](https://user-images.githubusercontent.com/13696193/44959857-b4349200-aec3-11e8-8e2d-e6a49ffbd0b6.jpg) + + Radio(text, + group_id, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None) - -. - - text - Text to display next to button - group_id - Groups together multiple Radio Buttons. Can be any value - default - Bool. Initial state - size- (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display + key = None) + +. + + text - Text to display next to button + group_id - Groups together multiple Radio Buttons. Can be any value + default - Bool. Initial state + size- (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the text - key = Dictionary key to use for return values - - -#### Checkbox Element -Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. - - layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + key = Dictionary key to use for return values + + +#### Checkbox Element +Checkbox elements are like Radio Button elements. They return a bool indicating whether or not they are checked. + + layout = [[sg.Checkbox('My first Checkbox!', default=True), sg.Checkbox('My second Checkbox!')]] + - ![checkbox](https://user-images.githubusercontent.com/13696193/44959906-6f5d2b00-aec4-11e8-9c8a-962c787f0286.jpg) - Checkbox(text, - default=False, - size=(None, None), - auto_size_text=None, + Checkbox(text, + default=False, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, - key = None): -. - - text - Text to display next to checkbox + key = None): +. + + text - Text to display next to checkbox default- Bool + None. Initial state. True = Checked, False = unchecked, None = Not available (grayed out) - size - (width, height) size of element in characters - auto_size_text- Bool. True if should size width to fit text - font- Font type and size for text display + size - (width, height) size of element in characters + auto_size_text- Bool. True if should size width to fit text + font- Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - + key = Dictionary key to use for return values -#### Spin Element -An up/down spinner control. The valid values are passed in as a list. - - layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] - -![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) - - Spin(values, - intiial_value=None, - size=(None, None), - auto_size_text=None, +#### Spin Element + +An up/down spinner control. The valid values are passed in as a list. + + layout = [[sg.Spin([i for i in range(1,11)], initial_value=1), sg.Text('Volume level')]] + +![spinner](https://user-images.githubusercontent.com/13696193/44959855-b1d23800-aec3-11e8-9f51-afb2109879da.jpg) + + Spin(values, + intiial_value=None, + size=(None, None), + auto_size_text=None, font=None, background_color = None, text_color = None, key = None): -. - - values - List of valid values - initial_value - String with initial value - size - (width, height) size of element in characters - auto_size_text - Bool. True if should size width to fit text - font - Font type and size for text display +. + + values - List of valid values + initial_value - String with initial value + size - (width, height) size of element in characters + auto_size_text - Bool. True if should size width to fit text + font - Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text - key = Dictionary key to use for return values - -### Button Element + key = Dictionary key to use for return values -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. - -The Types of buttons include: -* Folder Browse -* File Browse +### Button Element + +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a window, whether it be Submit or Cancel, one way or another a button is involved in all windows. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. + +The Types of buttons include: +* Folder Browse +* File Browse * Files Browse * File SaveAs * File Save -* Close Form (normal button) -* Read Form -* Realtime +* Close window (normal button) +* Read window +* Realtime * Calendar Chooser * Color Chooser - - - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. - -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. - -File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. + + + Close window - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close window" buttons. They cause the input values to be read and then the window is ***closed***, returning the values to the caller. + +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the window. + +File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog - -Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. - -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. - -Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. -Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. +Read window - This is a window button that will read a snapshot of all of the input fields, but does not close the window after it's clicked. + +Realtime - This is another async window button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -The 3 primary forms of PySimpleGUI buttons and their names are: +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the window, and ReadForm buttons that keep the window open but returns control back to the caller. - 1. `Button` = `SimpleButton` - 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` +Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. + +The 3 primary windows of PySimpleGUI buttons and their names are: + + 1. `Button` = `SimpleButton` + 2. `ReadButton` = `RButton` = `ReadFormButton` (old style... use ReadButton instead) 3. `RealtimeButton` -You will find the long-form in the older programs. +You will find the long-form in the older programs. + +The most basic Button element call to use is `Button` -The most basic Button element call to use is `Button` - Button(button_text='' button_type=BUTTON_TYPE_CLOSES_WIN target=(None, None) @@ -1487,7 +1487,7 @@ The most basic Button element call to use is `Button` focus=False pad=None key=None): - + Parameters button_text - Text to be displayed on the button @@ -1511,69 +1511,69 @@ Parameters key - key used for finding the element #### Pre-defined Buttons -These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: - - OK - Ok - Submit - Cancel - Yes - No +These Pre-made buttons are some of the most important elements of all because they are used so much. They all basically do the same thing, set the button text to match the function name and set the parameters to commonly used values. If you find yourself needing to create a custom button often because it's not on this list, please post a request on GitHub. . They include: + + OK + Ok + Submit + Cancel + Yes + No Exit Quit Help Save SaveAs - FileBrowse + FileBrowse FilesBrowse - FileSaveAs - FolderBrowse -. - layout = [[sg.OK(), sg.Cancel()]] - + FileSaveAs + FolderBrowse +. + layout = [[sg.OK(), sg.Cancel()]] + ![ok cancel 3](https://user-images.githubusercontent.com/13696193/44959927-aa5f5e80-aec4-11e8-86e1-5dc0b3a2b803.jpg) - + #### Button targets - -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. -The Target comes in two forms. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the window. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. + +The Target comes in two forms. 1. Key 2. (row, column) Targets that are specified using a key will find its target element by using the target's key value. This is the "preferred" method. -If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. +If the Target is specified using (row, column) then it utilizes a grid system. The rows in your GUI are numbered starting with 0. The target can be specified as a hard coded grid item or it can be relative to the button. The (row, col) targeting can only target elements that are in the same "container". Containers are the Window, Column and Frame Elements. A File Browse button located inside of a Column is unable to target elements outside of that Column. - + The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special value that tells the GUI to use the same row as the button. The Y-value of -1 means the field one value to the left of the button. For a File or Folder Browse button, the field that it fills are generally to the left of the button is most cases. (ThisRow, -1) means the Element to the left of the button, on the same row. If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. - -Let's examine this form as an example: - +Let's examine this window as an example: + + ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) - - -The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: - - Target = (1,0) - Target = (-1,0) - -The code for the entire form could be: - - layout = [[sg.T('Source Folder')], - [sg.In()], + + +The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` button is located at position (2,0). The Target for the button could be any of these values: + + Target = (1,0) + Target = (-1,0) + +The code for the entire window could be: + + layout = [[sg.T('Source Folder')], + [sg.In()], [sg.FolderBrowse(target=(-1, 0)), sg.OK()]] or if using keys, then the code would be: - layout = [[sg.T('Source Folder')], - [sg.In(key='input')], + layout = [[sg.T('Source Folder')], + [sg.In(key='input')], [sg.FolderBrowse(target='input'), sg.OK()]] - + See how much easier the key method is? **Save & Open Buttons** @@ -1603,177 +1603,177 @@ These buttons pop up a standard color chooser window. The result is returned as ![color](https://user-images.githubusercontent.com/13696193/45243375-99965a80-b2c1-11e8-9779-b71bed85fab6.jpg) - -**Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. - -layout = [[sg.Button('My Button')]] - -![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) - -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. - -**Button Images** -Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. - -Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. - -This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. - - - sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) - -Three parameters are used for button images. - - image_filename - Filename. Can be a relative path - image_size - Size of image file in pixels - image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 - -Here's an example form made with button images. - -![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) - -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form - - sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) - -This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. - - **Realtime Buttons** - - Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: - + +**Custom Buttons** +Not all buttons are created equal. A button that closes a window is different that a button that returns from the window without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the window when clicked. + +layout = [[sg.Button('My Button')]] + +![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) + +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a window is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the window. Instead they bring up a file or folder browser dialog box. + +**Button Images** +Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. + +Your button images need to be in PNG or GIF format. When you make a button with an image, set the button background to the same color as the background. There's a button color TRANSPARENT_BUTTON that you can set your button color to in order for it to blend into the background. Note that this value is currently the same as the color as the default system background on Windows. + +This example comes from the `Demo Media Player.py` example program. Because it's a non-blocking button, it's defined as `RButton`. You also put images on blocking buttons by using `Button`. + + + sg.RButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0) + +Three parameters are used for button images. + + image_filename - Filename. Can be a relative path + image_size - Size of image file in pixels + image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 + +Here's an example window made with button images. + +![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) + +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player window + + sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) + +This is one you'll have to experiment with at this point. Not up for an exhaustive explanation. + + **Realtime Buttons** + + Normally buttons are considered "clicked" when the mouse button is let UP after a downward click on the button. What about times when you need to read the raw up/down button values. A classic example for this is a robotic remote control. Building a remote control using a GUI is easy enough. One button for each of the directions is a start. Perhaps something like this: + ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) - - -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". - -Here is the code to make, show and get results from this form: - - form = sg.Window('Robotics Remote Control', auto_size_text=True) - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' '*10), sg.RealtimeButton('Forward')], - [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], - [sg.T(' '*10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. - - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - sg.Print(button) - if button == 'Quit' or values is None: - break - time.sleep(.01) - -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. - -**File Types** -The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is - - FileTypes=(("ALL Files", "*.*"),) - -This code produces a form where the Browse button only shows files of type .TXT - - layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] - - ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. -The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. - - --- -#### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. - -The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. -You've already seen OneLineProgressMeter calls presented earlier in this readme. - - sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') - -The return value for `OneLineProgressMeter` is: -`True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. - -#### Progress Mater in Your Form -Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. + +This window has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". + +Here is the code to make, show and get results from this window: + + window = sg.Window('Robotics Remote Control', auto_size_text=True) + + window_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' '*10), sg.RealtimeButton('Forward')], + [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], + [sg.T(' '*10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + window.LayoutAndRead(window_rows, non_blocking=True) + +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your window's buttons. + + while (True): + # This is the code that reads and updates your window + button, values = window.ReadNonBlocking() + if button is not None: + sg.Print(button) + if button == 'Quit' or values is None: + break + time.sleep(.01) + +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `window.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. + +**File Types** +The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is + + FileTypes=(("ALL Files", "*.*"),) + +This code produces a window where the Browse button only shows files of type .TXT + + layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] + + ***The ENTER key*** + The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window. + +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right. + + --- +#### ProgressBar +The `ProgressBar` element is used to build custom Progress Bar windows. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the windows have to be non-blocking and they are tricky to debug. + +The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. +You've already seen OneLineProgressMeter calls presented earlier in this readme. + + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') + +The return value for `OneLineProgressMeter` is: +`True` if meter updated correctly +`False` if user clicked the Cancel button, closed the window, or vale reached the max value. + +#### Progress Mater in Your window +Another way of using a Progress Meter with PySimpleGUI is to build a custom window with a `ProgressBar` Element in the window. You will need to run your window as a non-blocking window. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) - import PySimpleGUI as sg - - # layout the form - layout = [[sg.Text('A custom progress meter')], - [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], - [sg.Cancel()]] - - # create the form` - form = sg.Window('Custom Progress Meter').Layout(layout) - progress_bar = form.FindElement('progressbar') - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i + 1) - # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm()) - + import PySimpleGUI as sg + + # layout the window + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], + [sg.Cancel()]] + + # create the window` + window = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = window.FindElement('progressbar') + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = window.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open + window.CloseNonBlocking()) + + +#### Output +The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. + + Output(size=(None, None)) + +Here's a complete solution for a chat-window using an Async window with an Output Element + + import PySimpleGUI as sg + + # Blocking window that doesn't close + def ChatBot(): + layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], + [sg.Output(size=(80, 20))], + [sg.Multiline(size=(70, 5), enter_submits=True), + sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + window = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # + while True: + button, value = window.Read() + if button == 'SEND': + print(value) + else: + break -#### Output -The Output Element is a re-direction of Stdout. Anything "printed" will be displayed in this element. - - Output(size=(None, None)) - -Here's a complete solution for a chat-window using an Async form with an Output Element - - import PySimpleGUI as sg - - # Blocking form that doesn't close - def ChatBot(): - layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], - [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), - sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), - sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - - form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button == 'SEND': - print(value) - else: - break - ChatBot() ------------------- ## Columns -Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a window within a window. And, yes, you can have a Column within a Column if you want. -Columns are specified in exactly the same way as a form is, as a list of lists. +Columns are specified in exactly the same way as a window is, as a list of lists. def Column(layout - the list of rows that define the layout background_color - color of background size - size of visible portion of column pad - element padding to use when packing scrollable - bool. True if should add scrollbars - - + + Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1783,47 +1783,47 @@ Columns are needed when you have an element that has a height > 1 line on the le This code produced the above window. - import PySimpleGUI as sg - - # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. - - form = sg.Window('Columns') # blank form - - # Column layout - col = [[sg.Text('col Row 1')], - [sg.Text('col Row 2'), sg.Input('col input 1')], - [sg.Text('col Row 3'), sg.Input('col input 2')], - [sg.Text('col Row 4'), sg.Input('col input 3')], - [sg.Text('col Row 5'), sg.Input('col input 4')], - [sg.Text('col Row 6'), sg.Input('col input 5')], - [sg.Text('col Row 7'), sg.Input('col input 6')]] - - layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], - [sg.In('Last input')], - [sg.OK()]] - - # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) - -The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. + import PySimpleGUI as sg + + # Demo of how columns work + # window has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to window layouts, they are a list of lists of elements. + + window = sg.Window('Columns') # blank window + + # Column layout + col = [[sg.Text('col Row 1')], + [sg.Text('col Row 2'), sg.Input('col input 1')], + [sg.Text('col Row 3'), sg.Input('col input 2')], + [sg.Text('col Row 4'), sg.Input('col input 3')], + [sg.Text('col Row 5'), sg.Input('col input 4')], + [sg.Text('col Row 6'), sg.Input('col input 5')], + [sg.Text('col Row 7'), sg.Input('col input 6')]] + + layout = [[sg.Slider(range=(1,100), default_value=10, orientation='v', size=(8,20)), sg.Column(col)], + [sg.In('Last input')], + [sg.OK()]] + + # Display the window and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the window display and read down to a single line of code. + button, values = sg.Window('Compact 1-line window with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) + +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the window's background color, except it only affects the column rectangle. Column(layout, background_color=None) -The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. - +The default background color for Columns is the same as the default window background color. If you change the look and feel of the window, the column background will match the window background automatically. + ---- ## Frames (Labelled Frames, Frames with a title) -Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. +Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. def Frame(title - the label / title to put on frame layout - list of rows of elements the frame contains @@ -1840,31 +1840,31 @@ Frames work exactly the same way as Columns. You create layout that is then use -This code creates a form with a Frame and 2 buttons. +This code creates a window with a Frame and 2 buttons. - frame_layout = [ - [sg.T('Text inside of a frame')], - [sg.CB('Check 1'), sg.CB('Check 2')], - ] - layout = [ - [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], - [sg.Submit(), sg.Cancel()] - ] - - form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + frame_layout = [ + [sg.T('Text inside of a frame')], + [sg.CB('Check 1'), sg.CB('Check 2')], + ] + layout = [ + [sg.Frame('My Frame Title', frame_layout, font='Any 12', title_color='blue')], + [sg.Submit(), sg.Cancel()] + ] + + window = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a window layout. A window works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. ## Canvas Element -In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. +In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter widget. While I try my best to completely isolate the user from anything that is tkinter related, the Canvas Element is the one exception. It enables integration with a number of other packages, often with spectacular results. ### Matplotlib, Pyplot Integration @@ -1879,30 +1879,30 @@ One such integration is with Matploplib and Pyplot. There is a Demo program wri The order of operations to obtain a tkinter Canvas Widget is: - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the form layout - layout = [[sg.Text('Plot test')], - [sg.Canvas(size=(figure_w, figure_h), key='canvas')], - [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - - # create the form and show it without the plot - form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() - - - # add the plot to the window - fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) - - # show it all again and get buttons - button, values = form.Read() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + # define the window layout + layout = [[sg.Text('Plot test')], + [sg.Canvas(size=(figure_w, figure_h), key='canvas')], + [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] + + # create the window and show it without the plot + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + + + # add the plot to the window + fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) + + # show it all again and get buttons + button, values = window.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: -* Add Canvas Element to your form -* Layout your form -* Call `form.Finalize()` - this is a critical step you must not forget +* Add Canvas Element to your window +* Layout your window +* Call `window.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas * Draw on your canvas to your heart's content -* Call `form.Read()` - Nothing will appear on your canvas until you call Read +* Call `window.Read()` - Nothing will appear on your canvas until you call Read See `Demo_Matplotlib.py` for a Recipe you can copy. @@ -1939,7 +1939,7 @@ This Element is relatively new and may have some parameter additions or deletion background_color - color to use for background pad - element padding for pack key - key used to lookup element - tooltip - tooltip text + tooltip - tooltip text @@ -1969,160 +1969,160 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format - - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) - -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` - -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: - - (button, (values)) - -Recall that values is a list as well. Multiple tabs in the form would return like this: - - ((button1, (values1)), (button2, (values2)) - - ## Colors ## -Starting in version 2.5 you can change the background colors for the window and the Elements. - -Your forms can go from this: +## Tabbed windows +Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format -![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) - - -to this... with one function call... + results = ShowTabbedForm('Title for the form', + (form,layout,'Tab 1 label'), + (form2,layout2, 'Tab 2 label'), ...) - -![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) - - - -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. - -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. - -This call sets all of the different color options. - - SetOptions(background_color='#9FB8AD', - text_element_background_color='#9FB8AD', - element_background_color='#9FB8AD', - scrollbar_color=None, - input_elements_background_color='#F7F3EC', - progress_meter_color = ('green', 'blue') - button_color=('white','#475841')) - - - -## Global Settings -**Global Settings** -Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. - - SetOptions(icon=None - button_color=(None,None) - element_size=(None,None), - margins=(None,None), - element_padding=(None,None) - auto_size_text=None - auto_size_buttons=None - font=None - border_width=None - slider_border_width=None - slider_relief=None - slider_orientation=None - autoclose_time=None - message_box_line_width=None - progress_meter_border_depth=None - progress_meter_style=None - progress_meter_relief=None - progress_meter_color=None - progress_meter_size=None - text_justification=None +Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` + +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: + + (button, (values)) + +Recall that values is a list as well. Multiple tabs in the form would return like this: + + ((button1, (values1)), (button2, (values2)) + + ## Colors ## +Starting in version 2.5 you can change the background colors for the window and the Elements. + +Your windows can go from this: + +![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) + + +to this... with one function call... + + +![snap0156](https://user-images.githubusercontent.com/13696193/43273880-aa1955e6-90cb-11e8-94b6-673ecdb2698c.jpg) + + + +While you can do it on an element by element or window level basis, the easiest way, by far, is a call to `SetOptions`. + +Be aware that once you change these options they are changed for the rest of your program's execution. All of your windows will have that look and feel, until you change it to something else (which could be the system default colors. + +This call sets all of the different color options. + + SetOptions(background_color='#9FB8AD', + text_element_background_color='#9FB8AD', + element_background_color='#9FB8AD', + scrollbar_color=None, + input_elements_background_color='#F7F3EC', + progress_meter_color = ('green', 'blue') + button_color=('white','#475841')) + + + +## Global Settings +**Global Settings** +Let's have some fun customizing! Make PySimpleGUI look the way you want it to look. You can set the global settings using the function `PySimpleGUI.SetOptions`. Each option has an optional parameter that's used to set it. + + SetOptions(icon=None + button_color=(None,None) + element_size=(None,None), + margins=(None,None), + element_padding=(None,None) + auto_size_text=None + auto_size_buttons=None + font=None + border_width=None + slider_border_width=None + slider_relief=None + slider_orientation=None + autoclose_time=None + message_box_line_width=None + progress_meter_border_depth=None + progress_meter_style=None + progress_meter_relief=None + progress_meter_color=None + progress_meter_size=None + text_justification=None text_color=None - background_color=None - element_background_color=None - text_element_background_color=None - input_elements_background_color=None + background_color=None + element_background_color=None + text_element_background_color=None + input_elements_background_color=None element_text_color=None input_text_color=None - scrollbar_color=None, text_color=None - debug_win_size=(None,None) - window_location=(None,None) + scrollbar_color=None, text_color=None + debug_win_size=(None,None) + window_location=(None,None) tooltip_time = None - -Explanation of parameters - - icon - filename of icon used for taskbar and title bar - button_color - button color (foreground, background) - element_size - element size (width, height) in characters - margins - tkinter margins around outsize - element_padding - tkinter padding around each element - auto_size_text - autosize the elements to fit their text - auto_size_buttons - autosize the buttons to fit their text - font - font used for elements - border_width - amount of bezel or border around sunken or raised elements - slider_border_width - changes the way sliders look - slider_relief - changes the way sliders look - slider_orientation - changes orientation of slider - autoclose_time - time in seconds for autoclose boxes - message_box_line_width - number of characers in a line of text in message boxes - progress_meter_border_depth - amount of border around raised or lowered progress meters - progress_meter_style - style of progress meter as defined by tkinter - progress_meter_relief - relief style - progress_meter_color - color of the bar and background of progress meters - progress_meter_size - size in (characters, pixels) - background_color - Color of the main window's background - element_background_color - Background color of the elements - text_element_background_color - Text element background color - input_elements_background_color - Input fields background color + +Explanation of parameters + + icon - filename of icon used for taskbar and title bar + button_color - button color (foreground, background) + element_size - element size (width, height) in characters + margins - tkinter margins around outsize + element_padding - tkinter padding around each element + auto_size_text - autosize the elements to fit their text + auto_size_buttons - autosize the buttons to fit their text + font - font used for elements + border_width - amount of bezel or border around sunken or raised elements + slider_border_width - changes the way sliders look + slider_relief - changes the way sliders look + slider_orientation - changes orientation of slider + autoclose_time - time in seconds for autoclose boxes + message_box_line_width - number of characers in a line of text in message boxes + progress_meter_border_depth - amount of border around raised or lowered progress meters + progress_meter_style - style of progress meter as defined by tkinter + progress_meter_relief - relief style + progress_meter_color - color of the bar and background of progress meters + progress_meter_size - size in (characters, pixels) + background_color - Color of the main window's background + element_background_color - Background color of the elements + text_element_background_color - Text element background color + input_elements_background_color - Input fields background color element_text_color - Text color of elements that have text, like Radio Buttons input_text_color - Color of the text that you type in - scrollbar_color - Color for scrollbars (may not always work) - text_color - Text element default text color - text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' - debug_win_size - size of the Print output window - window_location - location on the screen (x,y) of window's top left cornder + scrollbar_color - Color for scrollbars (may not always work) + text_color - Text element default text color + text_justification - justification to use on Text Elements. Values are strings - 'left', 'right', 'center' + debug_win_size - size of the Print output window + window_location - location on the screen (x,y) of window's top left cornder tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms - - -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - - Form level - - Row level - - Element level - -Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). - -## Persistent Forms (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. -The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. +These settings apply to all windows `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the window-level being the highest and the Element-level the lowest. Thus the levels are: + - window level + - Row level + - Element level +Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). -## Asynchronous (Non-Blocking) Forms -So you want to be a wizard do ya? Well go boldly! +## Persistent windows (Window stays open after button click) -Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking windows (see the next section). The other way is to use buttons that 'read' the window instead of 'close' the window when clicked. The typical buttons you find in windows, including the shortcut buttons, close the window. These include OK, Cancel, Submit, etc. The Button Element also closes the window. -When to use a non-blocking form: -* A media file player like an MP3 player -* A status dashboard that's periodically updated -* Progress Meters - when you want to make your own progress meters -* Output using print to a scrolled text element. Good for debugging. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the window open and visible. This button is also used in Non-Blocking windows. The difference is in which call is made to read the window. The `Read` call will block, the `ReadNonBlocking` will not block. -If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. + + +## Asynchronous (Non-Blocking) windows +So you want to be a wizard do ya? Well go boldly! + +Use async windows sparingly. It's possible to have a window that appears to be async, but it is not. **Please** try to find other methods before going to async windows. The reason for this plea is that async windows poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. + +When to use a non-blocking window: +* A media file player like an MP3 player +* A status dashboard that's periodically updated +* Progress Meters - when you want to make your own progress meters +* Output using print to a scrolled text element. Good for debugging. + +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking window. ### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. -***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. +***Instead of polling, try options that cause the window to return to you.*** By using non-blocking windows, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. **Examples** @@ -2135,93 +2135,93 @@ One example is you have an input field that changes as you press buttons on an o ### Periodically Calling`ReadNonBlocking` -Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your windows will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking forms. -1. Read the form just as you would a normal form -2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values +There are 2 methods of interacting with non-blocking windows. +1. Read the window just as you would a normal window +2. "Refresh" the window's values without reading the window. It's a quick operation meant to show the user the latest values - With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - - #### Exiting a Non-Blocking Form + With asynchronous windows the window is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. -It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. + #### Exiting a Non-Blocking window -Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed windows in your code. It is possible for a window to look closed, but continue running your event loop. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: - - while True: - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - - -We're going to build an app that does the latter. It's going to update our form with a running clock. - -The basic flow and functions you will be calling are: -Setup - - form = Window() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) +Typically when reading a window you check `if Button is None` to determine if a window was closed. With NonBlocking windows, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking window is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. - -Periodic refresh - - form.ReadNonBlocking() or form.Refresh() - -If you need to close the form - - form.CloseNonBlockingForm() - -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. - -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` - -**Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. - - - import PySimpleGUI as sg - import time - - # form that doesn't block - # Make a form, but don't use context manager - form = sg.Window('Running Timer', auto_size_text=True) - - # Create the layout - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], - [sg.Button('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh - # - - for i in range(1, 1000): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() - - -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. - -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. - -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. - -## Updating Elements (changing elements in active form) +The proper code to check if the user has exited the window will be a polling-loop that looks something like this: + + while True: + button, values = window.ReadNonBlocking() + if values is None or button == 'Quit': + break + + +We're going to build an app that does the latter. It's going to update our window with a running clock. -Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). +The basic flow and functions you will be calling are: +Setup + + window = Window() + window_rows = ..... + window.LayoutAndRead(window_rows, non_blocking=True) + + +Periodic refresh + + window.ReadNonBlocking() or window.Refresh() + +If you need to close the window + + window.CloseNonBlocking() + +Rather than the usual `window.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the window. After the window is shown, you simply call `window.ReadNonBlocking()` every now and then. + +When you are ready to close the window (assuming the window wasn't closed by the user or a button click) you simply call `window.CloseNonBlocking()` + +**Example - Running timer that updates** +See the sample code on the GitHub named Demo Media Player for another example of Async windows. We're going to make a window and update one of the elements of that window every .01 seconds. Here's the entire code to do that. + + + import PySimpleGUI as sg + import time + + # window that doesn't block + # Make a window, but don't use context manager + window = sg.Window('Running Timer', auto_size_text=True) + + # Create the layout + window_rows = [[sg.Text('Non-blocking GUI with updates')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], + [sg.Button('Quit')]] + # Layout the rows of the window and perform a read. Indicate the window is non-blocking! + window.LayoutAndRead(window_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your window every now and then or + # else it won't refresh + # + + for i in range(1, 1000): + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = window.ReadNonBlocking() + if values is None or button == 'Quit': + break + time.sleep(.01) + else: + window.CloseNonBlocking() + + +What we have here is the same sequence of function calls as in the description. Get a window, add rows to it, show the window, and then refresh it every now and then. + +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the window. The new value will be displayed when `window.ReadNonBlocking()` is called. if you want to have the window reflect your changes immediately, call `window.Refresh()`. + +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the window is still open. The user has not closed the window using the X nor a button so it's up to the caller to close the window using `CloseNonBlocking`. + +## Updating Elements (changing elements in active window) + +Persistent windows remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. @@ -2232,35 +2232,35 @@ In some programs these updates happen in response to another Element. This prog - - # Testing async form, see if can have a slider - # that adjusts the size of text displayed - - import PySimpleGUI as sg - fontSize = 12 - layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), - sg.Slider(range=(6,172), orientation='h', size=(10,20), - change_submits=True, key='slider', font=('Helvetica 20')), - sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] - - sz = fontSize - form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) + + # Testing async window, see if can have a slider + # that adjusts the size of text displayed + + import PySimpleGUI as sg + fontSize = 12 + layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), + sg.Slider(range=(6,172), orientation='h', size=(10,20), + change_submits=True, key='slider', font=('Helvetica 20')), + sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] + + sz = fontSize + window = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop - while True: - button, values= form.Read() - if button is None: - break - sz_spin = int(values['spin']) - sz_slider = int(values['slider']) - sz = sz_spin if sz_spin != fontSize else sz_slider - if sz != fontSize: - fontSize = sz - font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - + while True: + button, values= window.Read() + if button is None: + break + sz_spin = int(values['spin']) + sz_slider = int(values['slider']) + sz = sz_spin if sz_spin != fontSize else sz_slider + if sz != fontSize: + fontSize = sz + font = "Helvetica " + str(fontSize) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) + print("Done.") @@ -2269,25 +2269,25 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) - -Remember this design pattern because you will use it OFTEN if you use persistent forms. + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) -It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: +Remember this design pattern because you will use it OFTEN if you use persistent windows. - text_element = form.FindElement('text') - text_element.Update(font=font) +It works as follows. The call to `window.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: -The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. + text_element = window.FindElement('text') + text_element.Update(font=font) + +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the window and also to identify elements. As already mentioned, they are used as targets in Button calls. ## Keyboard & Mouse Capture Beginning in version 2.10 you can capture keyboard key presses and mouse scroll-wheel events. Keyboard keys can be used, for example, to detect the page-up and page-down keys for a PDF viewer. To use this feature, there's a boolean setting in the Window call `return_keyboard_events` that is set to True in order to get keys returned along with buttons. -Keys and scroll-wheel events are returned in exactly the same way as buttons. +Keys and scroll-wheel events are returned in exactly the same way as buttons. For scroll-wheel events, if the mouse is scrolled up, then the `button` text will be `MouseWheel:Up`. For downward scrolling, the text returned is `MouseWheel:Down` @@ -2297,60 +2297,60 @@ Keyboard keys return 2 types of key events. For "normal" keys (a,b,c, etc), a si Key Sym is a string such as 'Control_L'. The Key Code is a numeric representation of that key. The left control key, when pressed will return the value 'Control_L:17' - import PySimpleGUI as sg - - # Recipe for getting keys, one at a time as they are released - # If want to use the space bar, then be sure and disable the "default focus" - - with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - text_elem = sg.Text("", size=(18,1)) - layout = [[sg.Text("Press a key or scroll mouse")], - [text_elem], - [sg.Button("OK")]] - - form.Layout(layout) - # ---===--- Loop taking in user input --- # - while True: - button, value = form.ReadNonBlocking() - - if button == "OK" or (button is None and value is None): - print(button, "exiting") - break - if button is not None: + import PySimpleGUI as sg + + # Recipe for getting keys, one at a time as they are released + # If want to use the space bar, then be sure and disable the "default focus" + + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + text_elem = sg.Text("", size=(18,1)) + layout = [[sg.Text("Press a key or scroll mouse")], + [text_elem], + [sg.Button("OK")]] + + window.Layout(layout) + # ---===--- Loop taking in user input --- # + while True: + button, value = window.ReadNonBlocking() + + if button == "OK" or (button is None and value is None): + print(button, "exiting") + break + if button is not None: text_elem.Update(button) -You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. +You want to turn off the default focus so that there no buttons that will be selected should you press the spacebar. ### Realtime Keyboard Capture -Use realtime keyboard capture by calling - - import PySimpleGUI as sg - - with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text("Hold down a key")], - [sg.Button("OK")]] - - form.Layout(layout) - - while True: - button, value = form.ReadNonBlocking() - - if button == "OK": - print(button, value, "exiting") - break - if button is not None: - print(button) - elif value is None: +Use realtime keyboard capture by calling + + import PySimpleGUI as sg + + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + layout = [[sg.Text("Hold down a key")], + [sg.Button("OK")]] + + window.Layout(layout) + + while True: + button, value = window.ReadNonBlocking() + + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + print(button) + elif value is None: break ## Menus -Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. +Beginning in version 3.01 you can add a menubar to your window. You specify the menus in much the same way as you do window layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your window.Read returns. Hopefully will not be a problem. This definition: - menu_def = [['File', ['Open', 'Save', 'Exit',]], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + menu_def = [['File', ['Open', 'Save', 'Exit',]], + ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] Note the placement of ',' and of []. It's tricky to get the nested menus correct that implement cascading menus. See how paste has Special and Normal as a list after it. This means that Paste has a cascading menu with items Special and Normal. @@ -2366,7 +2366,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the window changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2377,7 +2377,7 @@ We have an InputText field that we want to update. When the Element was created To update or change the value for that Input Element, we use this construct: - form.FindElement('input').Update('new text') + window.FindElement('input').Update('new text') Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. @@ -2393,68 +2393,68 @@ You can use Update to do things like: * etc - -## Sample Applications - -Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: - | Source File| Description | -|--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +## Sample Applications + +Use the example programs as a starting basis for your GUI. Copy, paste, modify and run! The demo files are: + + | Source File| Description | +|--|--| +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single window |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form -|**Demo_Chat.py** | A chat window with scrollable history -|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project +|**Demo_Canvas.py** | window with a Canvas Element that is updated outside of the window +|**Demo_Chat.py** | A chat window with scrollable history +|**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project |**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex forms -|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility +|**Demo_Columns.py** | Using the Column Element to create more complex windows +|**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook -|**Demo_Dictionary.py** | Specifying and using return values in dictionary format -**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility -|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter -|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk +|**Demo_Dictionary.py** | Specifying and using return values in dictionary format +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your window +|**Demo_DisplayHash1and256.py** | Using high level API and custom window to implement a simple display hash code utility +|**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a window. Saving and loading a window from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements -|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them -|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors -|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code -|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files -|**Demo_Keyboard.py** | Using blocking keyboard events -|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events -|**Demo_Machine_Learning.py** | A sample Machine Learning front end -|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph -|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph -|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph +|**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them +|**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors +|**Demo_HowDoI.py** | This is a utility to be experienced! It will change how you code +|**Demo_Img_Viewer.py** | Display jpg, png,tiff, bmp files +|**Demo_Keyboard.py** | Using blocking keyboard events +|**Demo_Keyboard_Realtime.py** | Using non-blocking / realtime keyboard events +|**Demo_Machine_Learning.py** | A sample Machine Learning front end +|**Demo_Matplotlib.py** | Integrating with Matplotlib to create a single graph +|**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph +|**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method -|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_Media_Player.py** | Non-blocking window with a media player layout. Demonstrates button graphics, Update method +|**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices +|**Demo_NonBlocking_Form.py** | a basic async window |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 -|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate +|**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate |**Demo_Pi_LEDs.py** | Control GPIO using buttons -|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons -|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files +|**Demo_Pi_Robotics.py** | Simulated robot control using realtime buttons +|**Demo_PNG_Vierwer.py** | Uses Image Element to display PNG files | **Demo_Progress_Meters.py** | Demonstrates using 2 progress meters simultaneously -|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook -|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts -|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts -|**Demo_Tabbed_Form.py** | Using the Tab feature +|**Demo_Recipes.py** | A collection of various Recipes. Note these are not the same as the Recipes in the Recipe Cookbook +|**Demo_Script_Launcher.py** | Demonstrates one way of adding a front-end onto several command line scripts +|**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts +|**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables -|**Demo_Timer.py** | Simple non-blocking form - +|**Demo_Timer.py** | Simple non-blocking window + ## Packages Used In Demos - - + + While the core PySimpleGUI code does not utilize any 3rd party packages, some of the demos do. They add a GUI to a few popular packages. These packages include: * [Chatterbot](https://github.com/gunthercox/ChatterBot) * [Mido](https://github.com/olemb/mido) * [Matplotlib](https://matplotlib.org/) * [PyMuPDF](https://github.com/rk700/PyMuPDF) - - + + ## Creating a Windows .EXE File It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. @@ -2484,22 +2484,22 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. -## Fun Stuff -Here are some things to try if you're bored or want to further customize - -**Debug Output** -Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. - -For a fun time, add these lines to the top of your script - - import PySimpleGUI as sg - print = sg.Print - -This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. - -**Look and Feel** -Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. -Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. +## Fun Stuff +Here are some things to try if you're bored or want to further customize + +**Debug Output** +Be sure and check out the EasyPrint (Print) function described in the high-level API section. Leave your code the way it is, route your stdout and stderror to a scrolling window. + +For a fun time, add these lines to the top of your script + + import PySimpleGUI as sg + print = sg.Print + +This will turn all of your print statements into prints that display in a window on your screen rather than to the terminal. + +**Look and Feel** +Dial in the look and feel that you like with the `SetOptions` function. You can change all of the defaults in one function call. One line of code to customize the entire GUI. +Or beginning in version 2.9 you can choose from a look and feel using pre-defined color schemes. Call ChangeLookAndFeel with a description string. sg.ChangeLookAndFeel('GreenTan') @@ -2522,57 +2522,57 @@ To see the latest list of color choices, take a look at the bottom of the `PySim You can also combine the `ChangeLookAndFeel` function with the `SetOptions` function to quickly modify one of the canned color schemes. Maybe you like the colors but was more depth to your bezels. You can dial in exactly what you want. -**ObjToString** -Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. -This statement: - - print(sg.ObjToSting(x)) - -And this was the output - - - abc = abc - attr12 = 12 - c = - b = - a = - attr1 = 1 - attr2 = 2 - attr3 = three - attr10 = 10 - attrx = x - -You'll quickly wonder how you ever coded without it. - ---- -# Known Issues -While not an "issue" this is a ***stern warning*** - -## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads - +**ObjToString** +Ever wanted to easily display an objects contents easily? Use ObjToString to get a nicely formatted recursive walk of your objects. +This statement: + + print(sg.ObjToSting(x)) + +And this was the output + + + abc = abc + attr12 = 12 + c = + b = + a = + attr1 = 1 + attr2 = 2 + attr3 = three + attr10 = 10 + attrx = x + +You'll quickly wonder how you ever coded without it. + +--- +# Known Issues +While not an "issue" this is a ***stern warning*** + +## **Do not attempt** to call `PySimpleGUI` from multiple threads! It's `tkinter` based and `tkinter` has issues with multiple threads + **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X - -**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. - -**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. - -## Contributing - -A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. - -## Versions -|Version | Description | -|--|--| -| 1.0.9 | July 10, 2018 - Initial Release | -| 1.0.21 | July 13, 2018 - Readme updates | -| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case -| 2.1.1 | July 18, 2018 - Global settings exposed, fixes -| 2.2.0| July 20, 2018 - Image Elements, Print output -| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. -| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi -| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. -| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ -| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting + +**Async windows** - these include the 'easy' windows (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async windows open with normal windows then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank window. + +**EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. + +## Contributing + +A MikeTheWatchGuy production... entirely responsible for this code.... unless it causes you trouble in which case I'm not at all responsible. + +## Versions +|Version | Description | +|--|--| +| 1.0.9 | July 10, 2018 - Initial Release | +| 1.0.21 | July 13, 2018 - Readme updates | +| 2.0.0 | July 16, 2018 - ALL optional parameters renamed from CamelCase to all_lower_case +| 2.1.1 | July 18, 2018 - Global settings exposed, fixes +| 2.2.0| July 20, 2018 - Image Elements, Print output +| 2.3.0 | July 23, 2018 - Changed form.Read return codes, Slider Elements, Listbox element. Renamed some methods but left legacy calls in place for now. +| 2.4.0 | July 24, 2018 - Button images. Fixes so can run on Raspberry Pi +| 2.5.0 | July 26, 2018 - Colors. Listbox scrollbar. tkinter Progress Bar instead of homegrown. +| 2.6.0 | July 27, 2018 - auto_size_button setting. License changed to LGPL 3+ +| 2.7.0 | July 30, 2018 - realtime buttons, window_location default setting | 2.8.0 | Aug 9, 2018 - New None default option for Checkbox element, text color option for all elements, return values as a dictionary, setting focus, binding return key | 2.9.0 | Aug 16,2018 - Screen flash fix, `do_not_clear` input field option, `autosize_text` defaults to `True` now, return values as ordered dict, removed text target from progress bar, rework of return values and initial return values, removed legacy Form.Refresh() method (replaced by Form.ReadNonBlockingForm()), COLUMN elements!!, colored text defaults | 2.10.0 | Aug 25, 2018 - Keyboard & Mouse features (Return individual keys as if buttons, return mouse scroll-wheel as button, bind return-key to button, control over keyboard focus), SaveAs Button, Update & Get methods for InputText, Update for Listbox, Update & Get for Checkbox, Get for Multiline, Color options for Text Element Update, Progess bar Update can change max value, Update for Button to change text & colors, Update for Image Element, Update for Slider, Form level text justification, Turn off default focus, scroll bar for Listboxes, Images can be from filename or from in-RAM, Update for Image). Fixes - text wrapping in buttons, msg box, removed slider borders entirely and others @@ -2581,7 +2581,7 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 2.30.0 | Sept 6, 2018 - Calendar Chooser (button), borderless windows, load/save form to disk | 3.0.0 | Sept 7, 2018 - The "fix for poor choice of 2.x numbers" release. Color Chooser (button), "grab anywhere" windows are on by default, disable combo boxes, Input Element text justification (last part needed for 'tables'), Image Element changes to support OpenCV?, PopupGetFile and PopupGetFolder have better no_window option | 3.01.01 | Sept 10, 2018 - Menus! (sort of a big deal) -| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) +| 3.01.02 | Step 11, 2018 - All Element.Update functions have a `disabled` parameter so they can be disabled. Renamed some parameters in Update function (sorry if I broke your code), fix for bug in Image.Update. Wasn't setting size correctly, changed grab_anywhere logic again,added grab anywhere option to PupupGetText (assumes disabled) | 3.02.00 | Sept 14, 2018 - New Table Element (Beta release), MsgBox removed entirely, font setting for InputText Element, **packing change** risky change that allows some Elements to be resized,removed command parameter from Menu Element, new function names for ReadNonBlocking (Finalize, PreRead), change to text element autosizing and wrapping (yet again), lots of parameter additions to Popup functions (colors, etc). | 3.03.00 | New feature - One Line Progress Meters, new display_row_numbers for Table Element, fixed bug in EasyProgresssMeters (function will soon go away), OneLine and Easy progress meters set to grab anywhere but can be turned off. | 03,04.00 | Sept 18, 2018 - New features - Graph Element, Frame Element, more settings exposed to Popup calls. See notes below for more. @@ -2590,19 +2590,19 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes | 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window - -### Release Notes -2.3 - Sliders, Listbox's and Image elements (oh my!) - -If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. - -New debug printing capability. `sg.Print` - -2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. - -Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. - -2.7 Is the "feature complete" release. Pretty much all features are done and in the code + +### Release Notes +2.3 - Sliders, Listbox's and Image elements (oh my!) + +If using Progress Meters, avoid cancelling them when you have another window open. It could lead to future windows being blank. It's being worked on. + +New debug printing capability. `sg.Print` + +2.5 Discovered issue with scroll bar on `Output` elements. The bar will match size of ROW not the size of the element. Normally you never notice this due to where on a form the `Output` element goes. + +Listboxes are still without scrollwheels. The mouse can drag to see more items. The mouse scrollwheel will also scroll the list and will `page up` and `page down` keys. + +2.7 Is the "feature complete" release. Pretty much all features are done and in the code 2.8 More text color controls. The caller has more control over things like the focus and what buttons should be clicked when enter key is pressed. Return values as a dictionary! (NICE addition) @@ -2623,18 +2623,18 @@ Related to the Grab Anywhere feature is the no_titlebar option, again found in t #### 3.3.0 OneLineProgressMeter function added which gives you not only a one-line solution to progress meters, but it also gives you the ability to have more than 1 running at the same time, something not possible with the EasyProgressMeterCall - -#### 3.4.0 + +#### 3.4.0 * Frame - New Element - a labelled frame for grouping elements. Similar - to Column + to Column * Graph (like a Canvas element except uses the caller's - coordinate system rather than tkinter's). -* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). -* Buttons return key value rather than button text **If** a `key` is specified, -* + coordinate system rather than tkinter's). +* initial_folder - sets starting folder for browsing type buttons (browse for file/folder). +* Buttons return key value rather than button text **If** a `key` is specified, +* OneLineProgressMeter! Replaced EasyProgressMeter (sorry folks that's - the way progress works sometimes) + the way progress works sometimes) * Popup - changed ALL of the Popup calls to provide many more customization settings * Popup * PopupGetFolder @@ -2650,7 +2650,7 @@ OneLineProgressMeter function added which gives you not only a one-line solution * PopupOKCancel * PopupYesNo -#### 3.4.1 +#### 3.4.1 * Button.GetText - Button class method. Returns the current text being shown on a button. * Menu - Tearoff option. Determines if menus should allow them to be torn off * Help - Shorcut button. Like Submit, cancel, etc @@ -2681,37 +2681,37 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Removed LookAndFeel capability from Mac platform. -### Upcoming -Make suggestions people! Future release features - +### Upcoming +Make suggestions people! Future release features + Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. WxPython is higher priority. - - - -## Code Condition - - Make it run - Make it right - Make it fast - -It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. - -While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. - -Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? - -## Design - -A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. - -**Single File** -While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. - -**Functions as objects** -In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. - -**Lists** -It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. + + + +## Code Condition + + Make it run + Make it right + Make it fast + +It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module is particularly poor for PEP 8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems. + +While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP 8 for the most part. + +Please log bugs and suggestions in the GitHub! It will only make the code stronger and better in the end, a good thing for us all, right? + +## Design + +A moment about the design-spirit of `PySimpleGUI`. From the beginning, this package was meant to take advantage of Python's capabilities with the goal of programming ease. + +**Single File** +While not the best programming practice, the implementation resulted in a single file solution. Only one file is needed, PySimpleGUI.py. You can post this file, email it, and easily import it using one statement. + +**Functions as objects** +In Python, functions behave just like object. When you're placing a Text Element into your form, you may be sometimes calling a function and other times declaring an object. If you use the word Text, then you're getting an object. If you're using `Txt`, then you're calling a function that returns a `Text` object. + +**Lists** +It seemed quite natural to use Python's powerful list constructs when possible. The form is specified as a series of lists. Each "row" of the GUI is represented as a list of Elements. When the form read returns the results to the user, all of the results are presented as a single list. This makes reading a form's values super-simple to do in a single line of Python code. **Dictionaries** Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. From def0f3287d1b71d58a22a04b8c10d0b0b71f5cb3 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 21:30:56 -0400 Subject: [PATCH 448/521] Readme updates --- PySimpleGUI.py | 18 +- docs/index.md | 708 +++++++++++++++++++++++++------------------------ readme.md | 708 +++++++++++++++++++++++++------------------------ 3 files changed, 719 insertions(+), 715 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c6469fc49..0d2bf45fd 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -4435,15 +4435,15 @@ def PopupYesNo(*args, button_color=None, background_color=None, text_color=None, def main(): - with Window('Demo form..') as form: - form_rows = [[Text('You are running the PySimpleGUI.py file itself')], - [Text('You should be importing it rather than running it', size=(50,2))], - [Text('Here is your sample input form....')], - [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], - [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], - [Ok(), Cancel()]] - - button, (source, dest) = form.LayoutAndRead(form_rows) + window = Window('Demo window..') + window_rows = [[Text('You are running the PySimpleGUI.py file itself')], + [Text('You should be importing it rather than running it', size=(50,2))], + [Text('Here is your sample input window....')], + [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], + [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], + [Ok(), Cancel()]] + + button, (source, dest) = window.LayoutAndRead(window_rows) if __name__ == '__main__': diff --git a/docs/index.md b/docs/index.md index 4d521d0d8..69009ef39 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,13 +1,14 @@ -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) # PySimpleGUI - -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.0-red.svg?longCache=true&style=for-the-badge) + +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.1-red.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -22,16 +23,16 @@ [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -Super-simple GUI to use... Powerfully customizable. +Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter - -Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - + +Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + Looking for a GUI package to help with * Taking your Python code from the world of command lines and into the convenience of a GUI? * -* Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? -* Into Machine Learning and are sick of the command line? +* Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? +* Into Machine Learning and are sick of the command line? * How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. @@ -53,7 +54,7 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) @@ -94,7 +95,7 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own windows using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. @@ -120,7 +121,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Folder Browse SaveAs Non-closing return - Close window + Close form Realtime Calendar chooser Color chooser @@ -136,7 +137,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Scroll-able Output Images Progress Bar Async/Non-Blocking Windows - Tabbed windows + Tabbed forms Persistent Windows Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) @@ -147,15 +148,15 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Return values as dictionary Set focus Bind return key to buttons - Group widgets into a column and place into window anywhere + Group widgets into a column and place into form anywhere Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected Get slider, spinner, combo as they are changed - Update elements in a live window - Bulk window-fill operation - Save / Load window to/from disk + Update elements in a live form + Bulk form-fill operation + Save / Load form to/from disk Borderless (no titlebar) windows Always on top windows Menus @@ -164,7 +165,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad No async programming required (no callbacks to worry about) -An example of many widgets used on a single window. A little further down you'll find the 21 lines of code required to create this complex window. Try it if you don't believe it. Install PySimpleGUI then : +An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : >Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > @@ -175,7 +176,7 @@ An example of many widgets used on a single window. A little further down you'l import PySimpleGUI as sg - layout = [[sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText()], [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], @@ -210,8 +211,8 @@ An example of many widgets used on a single window. A little further down you'l Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - windows are represented as Python lists. - - A window is a list of rows + - Forms are represented as Python lists. + - A form is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary @@ -280,21 +281,21 @@ If you wish to create an EXE from your PySimpleGUI application, you will need to To use in your code, simply import.... `import PySimpleGUI as sg` -Then use either "high level" API calls or build your own windows. +Then use either "high level" API calls or build your own forms. sg.Popup('This is my first Popup') ![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. --- ## APIs PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom window functions + * Custom form functions ### Python Language Features @@ -318,7 +319,7 @@ Each new item begins on a new line in the Popup #### Optional Parameters to a Function Call -This feature of the Python language is utilized ***heavily*** as a method of customizing windows and window Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. @@ -342,7 +343,7 @@ If the caller wanted to change the button color to be black on yellow, the call #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: -1. To identify values when a window is read +1. To identify values when a form is read 2. To identify Elements so that they can be "updated" --- @@ -355,7 +356,7 @@ Dictionaries are used by more advanced PySimpleGUI users. You'll know that dict Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. -`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking window of Popup discussed in the async section. +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. @@ -440,7 +441,7 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFile` - get a filename - `PopupGetFolder` - get a folder name -Rather than make a custom window to get one data value, call the Popup input function to get the item from the user. +Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. import PySimpleGUI as sg @@ -490,7 +491,7 @@ That line of code resulted in this window popping up and updating. ![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter window. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -523,20 +524,20 @@ A word of caution. There are known problems when multiple PySimpleGUI windows a You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. --- -# Custom window API Calls (Your First window) +# Custom Form API Calls (Your First Form) This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. -This first section on custom windows is for your typical, blocking, non-persistant window. By this I mean, when you "show" the window, the function will not return until the user has clicked a button or closed the window. When this happens, the window will be automatically closed. +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. -Two other types of windows exist. -1. Persistent window - rather than closing on button clicks, the show window function returns and the window continues to be visible. This is good for applications like a chat window. -2. Asynchronous window - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async windows are updated (refreshed) on a periodic basis. +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. -## The window Designer -The good news to newcomers to GUI programming is that PySimpleGUI has a window designer. Better yet, the window designer requires no training and everyone knows how to use it. +## The Form Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. ![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) @@ -594,12 +595,12 @@ Finally we can put it all together into a program that will display our window. sg.Popup(button, number) ### Example 2 - Get a filename -Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your window on paper, break it up into rows, label the elements. +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. ![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) ![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) -Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the window on the paper. +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. import PySimpleGUI as sg @@ -612,57 +613,57 @@ Writing the code for this one is just as straightforward. There is one tricky t sg.Popup(button, number) -Read on for detailed instructions on the calls that show the window and return your results. +Read on for detailed instructions on the calls that show the form and return your results. # Copy these design patterns! -All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of window you're implementing. +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. -## Pattern 1 - Single read windows +## Pattern 1 - Single read forms -This is the most basic design pattern. Use this for windows that are shown to the user 1 time. The input values are gathered and returned to the program +This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program - window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - window = sg.Window('SHA-1 & 256 Hash') + form = sg.Window('SHA-1 & 256 Hash') - button, (source_filename,) = window.LayoutAndRead(window_rows) + button, (source_filename,) = form.LayoutAndRead(form_rows) ---- -## Pattern 2 - Single-read window "chained" +## Pattern 2 - Single-read form "chained" -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a window is first obtained by calling Window and then that window is then read. It's possible to combine the creation of the window with the read. This design pattern does exactly that, chain together the window creation and the window reading. +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. - window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(window_rows) + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) -## Pattern 3 - Persistent window (multiple reads) +## Pattern 3 - Persistent form (multiple reads) -Some of the more advanced programs operate with the window remaining visible on the screen. Input values are collected, but rather than closing the window, it is kept visible acting as a way to both output information to the user and gather input data. +Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a window is created by calling Window which is then passed on to the Layout method. The Layout method returns the window value so that it can be stored and used later in the program to Read the window. +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. import PySimpleGUI as sg - layout = [[sg.Text('Persistent window')], + layout = [[sg.Text('Persistent form')], [sg.RButton('Turn LED On')], [sg.RButton('Turn LED Off')], [sg.Exit()]] - window = sg.Window('Raspberry Pi GUI').Layout(layout) + form = sg.Window('Raspberry Pi GUI').Layout(layout) while True: - button, values = window.Read() + button, values = form.Read() if button is None: break @@ -671,7 +672,7 @@ This is done by splitting the LayoutAndRead call apart into a Layout call and a Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a window. +The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. Let's dissect this little program @@ -682,15 +683,15 @@ The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()]] - window = sg.Window('Rename Files or Folders') + form = sg.Window('Rename Files or Folders') - button, (folder_path, file_path) = window.LayoutAndRead(layout) + button, (folder_path, file_path) = form.LayoutAndRead(layout) ![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) -Let's agree the window has 4 rows. +Let's agree the form has 4 rows. The first row only has **text** that reads `Rename files or folders` @@ -705,15 +706,15 @@ Now let's look at how those 2 rows and the other two row from Python code: See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. -And what about those return values? Most people simply want to show a window, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my window's input values to be given to me. +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. -For return values the window is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. +For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. -In our example window, there are 2 fields, so the return values from this window will be a list with 2 values in it. +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - button, (folder_path, file_path) = window.LayoutAndRead(layout) + button, (folder_path, file_path) = form.LayoutAndRead(layout) -In the statement that shows and reads the window, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. @@ -726,54 +727,54 @@ Isn't this what almost every Python programmer looking for a GUI wants?? Someth By default return values are a list of values, one entry for each input field. - Return information from Window, SG's primary window builder interface, is in this format: + Return information from Window, SG's primary form builder interface, is in this format: button, (value1, value2, ...) Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - button, (filename, folder1, folder2, should_overwrite) = window.LayoutAndRead(window_rows) + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) Or, you can unpack the return results separately. - button, values = window.LayoutAndRead(window_rows) + button, values = form.LayoutAndRead(form_rows) filename, folder1, folder2, should_overwrite = values If you have a SINGLE value being returned, it is written this way: - button, (value1,) = window.LayoutAndRead(window_rows) + button, (value1,) = form.LayoutAndRead(form_rows) Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - button, value_list = window.LayoutAndRead(window_rows) + button, value_list = form.LayoutAndRead(form_rows) value1 = value_list[0] value2 = value_list[1] ... ### Return values as a dictionary -For windows longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. +For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. -The most common window read statement you'll encounter looks something like this: +The most common form read statement you'll encounter looks something like this: - button, values = window.LayoutAndRead(layout) + button, values = form.LayoutAndRead(layout) or - button, values = window.Read() + button, values = form.Read() All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. -If **any** element in the window has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. +If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -Let's take a look at your first dictionary-based window. +Let's take a look at your first dictionary-based form. import PySimpleGUI as sg - window = sg.Window('Simple data entry window') + form = sg.Window('Simple data entry form') layout = [ [sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], @@ -782,7 +783,7 @@ Let's take a look at your first dictionary-based window. [sg.Submit(), sg.Cancel()] ] - button, values = window.LayoutAndRead(layout) + button, values = form.LayoutAndRead(layout) sg.Popup(button, values, values['name'], values['address'], values['phone']) @@ -790,7 +791,7 @@ To get the value of an input field, you use whatever value used as the `key` val values['name'] -You will find the key field used quite heavily in most PySimpleGUI windows unless the window is very simple. +You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. ### Button Return Values @@ -799,20 +800,20 @@ The button value from a Read call will be one of 3 values: 2. The Button's key 3. None -If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the button value is None. +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. None is returned when the user clicks the X to close a window. -If your window has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: +If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: while True: - button, values= window.Read() + button, values= form.Read() if button is None or button == 'Quit': break ## The Event Loop / Callback Functions -All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single window, collects the data and then executes the primary code of the program then you likely don't need an event loop. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. @@ -830,16 +831,16 @@ This little program has a typical Event Loop [sg.RButton('Turn LED Off')], [sg.Exit()]] - window = sg.Window('Raspberry Pi).Layout(layout) + form = sg.Window('Raspberry Pi).Layout(layout) # ---- Event Loop ---- # while True: - button, values = window.Read() + button, values = form.Read() # ---- Process Button Clicks ---- # if button is None or button == 'Exit': break - if button == 'Turn LED Off': + if button == 'Turn LED Off': turn_LED_off() elif button == 'Turn LED On': turn_LED_on() @@ -849,7 +850,7 @@ This little program has a typical Event Loop -In the Event Loop we are reading the window and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) +In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. @@ -863,7 +864,7 @@ Whether or not this is a "proper" design for GUI programs can be debated. It's ## All Widgets / Elements -This code utilizes as many of the elements in one window as possible. +This code utilizes as many of the elements in one form as possible. import PySimpleGUI as sg @@ -882,7 +883,7 @@ This code utilizes as many of the elements in one window as possible. layout = [ [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Frame(layout=[ @@ -903,52 +904,52 @@ This code utilizes as many of the elements in one window as possible. [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] ] - window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - button, values = window.Read() + button, values = form.Read() sg.Popup('Title', - 'The results of the window.', + 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) -This is a somewhat complex window with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the window. +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) -Clicking the Submit button caused the window call to return. The call to Popup resulted in this dialog box. +Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the window using something other than a button, then `button` will be `None`. +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the Popup that the values returned are a list. Each input field in the window generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- -# Building Custom windows +# Building Custom Forms You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values -## Synchronous windows -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI window/dialog box. -You've already seen a number of examples above that use blocking windows. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking window. You can examine the show calls to be sure. If the window is a non-blocking window, it must indicate that in the call to `window.show`. +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. -NON-BLOCKING window call: +NON-BLOCKING form call: - window.Show(non_blocking=True) + form.Show(non_blocking=True) -### Beginning a window -The first step is to create the window object using the desired window customization. +### Beginning a Form +The first step is to create the form object using the desired form customization. - with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as window: + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: This is the definition of the Window object: @@ -975,39 +976,39 @@ This is the definition of the Window object: keep_on_top=False): -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `window` values. +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - default_element_size - Size of elements in window in characters (width, height) - default_button_element_size - Size of buttons on this window + default_element_size - Size of elements in form in characters (width, height) + default_button_element_size - Size of buttons on this form auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label location - (x,y) Location to place window in pixels - font - Font name and size for elements of the window + font - Font name and size for elements of the form button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background - is_tabbed_form - Bool. If True then window is a tabbed window + is_tabbed_form - Bool. If True then form is a tabbed form border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True window will autoclose - auto_close_duration - Duration in seconds before window closes + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus - text_justification - Justification to use for Text Elements in this window + text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. #### Window Location -PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the window is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. The default Element size for PySimpleGUI is `(45,1)`. -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the window. Setting `size=(20,1)` in the window creation call will set all elements in the window to that size. +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. @@ -1027,17 +1028,17 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the window is a non-blocking window. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. -It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking window using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking window, simply get grab_anywhere = True when you create the window. +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. #### Always on top -To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. ## Elements -"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. +"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. Text Single Line Input @@ -1046,8 +1047,8 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Folder Browse Calendar picker Date Chooser - Read window - Close window + Read form + Close form Realtime Checkboxes Radio Buttons @@ -1064,7 +1065,7 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Image Table Async/Non-Blocking Windows - Tabbed windows + Tabbed forms Persistent Windows Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) @@ -1075,14 +1076,14 @@ key tooltip #### Tooltip -Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your window's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. ### Output Elements -Building a window is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: layout = [ [row 1 element, row 1 element], [row 2 element, row 2 element, row 2 element] ] @@ -1167,14 +1168,14 @@ This Element doubles as both an input and output Element. The `DefaultText` opt . default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits window + enter_submits - Bool. If True, pressing Enter key submits form size - Element's size auto_size_text - Bool. Change width to match size of text #### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. More on this later. +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - window.AddRow(gg.Output(size=(100,20))) + form.AddRow(gg.Output(size=(100,20))) ![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) @@ -1184,7 +1185,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. size - Size of element (width, height) in characters ### Input Elements - These make up the majority of the window definition. Optional variables at the Element level override the window level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. #### Text Input Element @@ -1211,7 +1212,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text - do_not_clear - Bool. Normally windows clear when read, turn off clearing with this flag. + do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) @@ -1283,7 +1284,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values 'extended' 'multiple' 'single' - change_submits - if True, the window read will return with a button value of '' + change_submits - if True, the form read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length @@ -1296,7 +1297,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. -ListBoxes can cause a window to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. #### Slider Element @@ -1425,7 +1426,7 @@ An up/down spinner control. The valid values are passed in as a list. ### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a window, whether it be Submit or Cancel, one way or another a button is involved in all windows. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse @@ -1433,16 +1434,16 @@ The Types of buttons include: * Files Browse * File SaveAs * File Save -* Close window (normal button) -* Read window +* Close Form (normal button) +* Read Form * Realtime * Calendar Chooser * Color Chooser - Close window - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close window" buttons. They cause the input values to be read and then the window is ***closed***, returning the values to the caller. + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the window. +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. @@ -1450,18 +1451,18 @@ Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog -Read window - This is a window button that will read a snapshot of all of the input fields, but does not close the window after it's clicked. +Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. -Realtime - This is another async window button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the window, and ReadForm buttons that keep the window open but returns control back to the caller. +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. -The 3 primary windows of PySimpleGUI buttons and their names are: +The 3 primary forms of PySimpleGUI buttons and their names are: 1. `Button` = `SimpleButton` - 2. `ReadButton` = `RButton` = `ReadFormButton` (old style... use ReadButton instead) + 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` 3. `RealtimeButton` You will find the long-form in the older programs. @@ -1535,7 +1536,7 @@ These Pre-made buttons are some of the most important elements of all because th #### Button targets -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the window. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target comes in two forms. 1. Key @@ -1551,7 +1552,7 @@ The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special valu If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. -Let's examine this window as an example: +Let's examine this form as an example: ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) @@ -1562,7 +1563,7 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (1,0) Target = (-1,0) -The code for the entire window could be: +The code for the entire form could be: layout = [[sg.T('Source Folder')], [sg.In()], @@ -1605,13 +1606,13 @@ These buttons pop up a standard color chooser window. The result is returned as **Custom Buttons** -Not all buttons are created equal. A button that closes a window is different that a button that returns from the window without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the window when clicked. +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. layout = [[sg.Button('My Button')]] ![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a window is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the window. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -1630,11 +1631,11 @@ Three parameters are used for button images. image_size - Size of image file in pixels image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 -Here's an example window made with button images. +Here's an example form made with button images. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player window +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) @@ -1648,13 +1649,13 @@ This is one you'll have to experiment with at this point. Not up for an exhaust ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) -This window has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". -Here is the code to make, show and get results from this window: +Here is the code to make, show and get results from this form: - window = sg.Window('Robotics Remote Control', auto_size_text=True) + form = sg.Window('Robotics Remote Control', auto_size_text=True) - window_rows = [[sg.Text('Robotics Remote Control')], + form_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], @@ -1662,39 +1663,39 @@ Here is the code to make, show and get results from this window: [sg.Quit(button_color=('black', 'orange'))] ] - window.LayoutAndRead(window_rows, non_blocking=True) + form.LayoutAndRead(form_rows, non_blocking=True) -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your window's buttons. +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. while (True): # This is the code that reads and updates your window - button, values = window.ReadNonBlocking() + button, values = form.ReadNonBlocking() if button is not None: sg.Print(button) if button == 'Quit' or values is None: break time.sleep(.01) -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `window.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) -This code produces a window where the Browse button only shows files of type .TXT +This code produces a form where the Browse button only shows files of type .TXT layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. -The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right. +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. --- #### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar windows. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the windows have to be non-blocking and they are tricky to debug. +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen OneLineProgressMeter calls presented earlier in this readme. @@ -1703,33 +1704,33 @@ You've already seen OneLineProgressMeter calls presented earlier in this readme. The return value for `OneLineProgressMeter` is: `True` if meter updated correctly -`False` if user clicked the Cancel button, closed the window, or vale reached the max value. +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -#### Progress Mater in Your window -Another way of using a Progress Meter with PySimpleGUI is to build a custom window with a `ProgressBar` Element in the window. You will need to run your window as a non-blocking window. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +#### Progress Mater in Your Form +Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) import PySimpleGUI as sg - # layout the window + # layout the form layout = [[sg.Text('A custom progress meter')], [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], [sg.Cancel()]] - # create the window` - window = sg.Window('Custom Progress Meter').Layout(layout) - progress_bar = window.FindElement('progressbar') + # create the form` + form = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = form.FindElement('progressbar') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked - button, values = window.ReadNonBlocking() + button, values = form.ReadNonBlocking() if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - window.CloseNonBlocking()) + form.CloseNonBlockingForm()) #### Output @@ -1737,11 +1738,11 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Output(size=(None, None)) -Here's a complete solution for a chat-window using an Async window with an Output Element +Here's a complete solution for a chat-window using an Async form with an Output Element import PySimpleGUI as sg - # Blocking window that doesn't close + # Blocking form that doesn't close def ChatBot(): layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], [sg.Output(size=(80, 20))], @@ -1749,11 +1750,11 @@ Here's a complete solution for a chat-window using an Async window with an Outpu sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - window = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: - button, value = window.Read() + button, value = form.Read() if button == 'SEND': print(value) else: @@ -1763,15 +1764,15 @@ Here's a complete solution for a chat-window using an Async window with an Outpu ------------------- ## Columns -Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a window within a window. And, yes, you can have a Column within a Column if you want. +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. -Columns are specified in exactly the same way as a window is, as a list of lists. +Columns are specified in exactly the same way as a form is, as a list of lists. def Column(layout - the list of rows that define the layout - background_color - color of background - size - size of visible portion of column - pad - element padding to use when packing - scrollable - bool. True if should add scrollbars + background_color - color of background + size - size of visible portion of column + pad - element padding to use when packing + scrollable - bool. True if should add scrollbars Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1786,11 +1787,11 @@ This code produced the above window. import PySimpleGUI as sg # Demo of how columns work - # window has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows # Prior to the Column element, this layout was not possible - # Columns layouts look identical to window layouts, they are a list of lists of elements. + # Columns layouts look identical to form layouts, they are a list of lists of elements. - window = sg.Window('Columns') # blank window + form = sg.Window('Columns') # blank form # Column layout col = [[sg.Text('col Row 1')], @@ -1805,18 +1806,18 @@ This code produced the above window. [sg.In('Last input')], [sg.OK()]] - # Display the window and get values + # Display the form and get values # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the window display and read down to a single line of code. - button, values = sg.Window('Compact 1-line window with column').LayoutAndRead(layout) + # to collapse the form display and read down to a single line of code. + button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) sg.Popup(button, values, line_width=200) -The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the window's background color, except it only affects the column rectangle. +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. Column(layout, background_color=None) -The default background color for Columns is the same as the default window background color. If you change the look and feel of the window, the column background will match the window background automatically. +The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. @@ -1826,21 +1827,21 @@ The default background color for Columns is the same as the default window backg Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. def Frame(title - the label / title to put on frame - layout - list of rows of elements the frame contains - title_color - color of the title text - background_color - color of background - title_location - locations to put the title - relief - type of relief to use - size - size of Frame in characters. Do not use if you want frame to autosize - font - font to use for title - pad - element padding to use when packing - border_width - how thick the line going around frame should be - key - key used to location the element - tooltip - tooltip text + layout - list of rows of elements the frame contains + title_color - color of the title text + background_color - color of background + title_location - locations to put the title + relief - type of relief to use + size - size of Frame in characters. Do not use if you want frame to autosize + font - font to use for title + pad - element padding to use when packing + border_width - how thick the line going around frame should be + key - key used to location the element + tooltip - tooltip text -This code creates a window with a Frame and 2 buttons. +This code creates a form with a Frame and 2 buttons. frame_layout = [ [sg.T('Text inside of a frame')], @@ -1851,14 +1852,14 @@ This code creates a window with a Frame and 2 buttons. [sg.Submit(), sg.Cancel()] ] - window = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a window layout. A window works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. @@ -1871,38 +1872,38 @@ In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter wid One such integration is with Matploplib and Pyplot. There is a Demo program written that you can use as a design pattern to get an understanding of how to use the Canvas Widget once you get it. def Canvas(canvas - a tkinter canvasf if you created one. Normally not set - background_color - canvas color - size - size in pixels - pad - element padding for packing - key - key used to lookup element - tooltip - tooltip text + background_color - canvas color + size - size in pixels + pad - element padding for packing + key - key used to lookup element + tooltip - tooltip text The order of operations to obtain a tkinter Canvas Widget is: figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the window layout + # define the form layout layout = [[sg.Text('Plot test')], [sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - # create the window and show it without the plot - window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + # create the form and show it without the plot + form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() # add the plot to the window - fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) + fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) # show it all again and get buttons - button, values = window.Read() + button, values = form.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: -* Add Canvas Element to your window -* Layout your window -* Call `window.Finalize()` - this is a critical step you must not forget +* Add Canvas Element to your form +* Layout your form +* Call `form.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas * Draw on your canvas to your heart's content -* Call `window.Read()` - Nothing will appear on your canvas until you call Read +* Call `form.Read()` - Nothing will appear on your canvas until you call Read See `Demo_Matplotlib.py` for a Recipe you can copy. @@ -1969,16 +1970,16 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed windows -Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), (form2,layout2, 'Tab 2 label'), ...) -Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: (button, (values)) @@ -1989,7 +1990,7 @@ Recall that values is a list as well. Multiple tabs in the form would return li ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. -Your windows can go from this: +Your forms can go from this: ![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) @@ -2001,9 +2002,9 @@ to this... with one function call... -While you can do it on an element by element or window level basis, the easiest way, by far, is a call to `SetOptions`. +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. -Be aware that once you change these options they are changed for the rest of your program's execution. All of your windows will have that look and feel, until you change it to something else (which could be the system default colors. +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. This call sets all of the different color options. @@ -2088,41 +2089,41 @@ Explanation of parameters tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms -These settings apply to all windows `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the window-level being the highest and the Element-level the lowest. Thus the levels are: +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - window level + - Form level - Row level - Element level Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). -## Persistent windows (Window stays open after button click) +## Persistent Forms (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking windows (see the next section). The other way is to use buttons that 'read' the window instead of 'close' the window when clicked. The typical buttons you find in windows, including the shortcut buttons, close the window. These include OK, Cancel, Submit, etc. The Button Element also closes the window. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. -The `RButton` Element creates a button that when clicked will return control to the user, but will leave the window open and visible. This button is also used in Non-Blocking windows. The difference is in which call is made to read the window. The `Read` call will block, the `ReadNonBlocking` will not block. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. -## Asynchronous (Non-Blocking) windows +## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! -Use async windows sparingly. It's possible to have a window that appears to be async, but it is not. **Please** try to find other methods before going to async windows. The reason for this plea is that async windows poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. +Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. -When to use a non-blocking window: +When to use a non-blocking form: * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking window. +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. ### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. -***Instead of polling, try options that cause the window to return to you.*** By using non-blocking windows, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. +***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. **Examples** @@ -2135,93 +2136,93 @@ One example is you have an input field that changes as you press buttons on an o ### Periodically Calling`ReadNonBlocking` -Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your windows will feel. It is up to you to make these calls or your GUI will freeze. +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking windows. -1. Read the window just as you would a normal window -2. "Refresh" the window's values without reading the window. It's a quick operation meant to show the user the latest values +There are 2 methods of interacting with non-blocking forms. +1. Read the form just as you would a normal form +2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values - With asynchronous windows the window is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - #### Exiting a Non-Blocking window + #### Exiting a Non-Blocking Form -It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed windows in your code. It is possible for a window to look closed, but continue running your event loop. +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. -Typically when reading a window you check `if Button is None` to determine if a window was closed. With NonBlocking windows, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking window is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. +Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. -The proper code to check if the user has exited the window will be a polling-loop that looks something like this: +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: - button, values = window.ReadNonBlocking() + button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break -We're going to build an app that does the latter. It's going to update our window with a running clock. +We're going to build an app that does the latter. It's going to update our form with a running clock. The basic flow and functions you will be calling are: Setup - window = Window() - window_rows = ..... - window.LayoutAndRead(window_rows, non_blocking=True) + form = Window() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) Periodic refresh - window.ReadNonBlocking() or window.Refresh() + form.ReadNonBlocking() or form.Refresh() -If you need to close the window +If you need to close the form - window.CloseNonBlocking() + form.CloseNonBlockingForm() -Rather than the usual `window.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the window. After the window is shown, you simply call `window.ReadNonBlocking()` every now and then. +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. -When you are ready to close the window (assuming the window wasn't closed by the user or a button click) you simply call `window.CloseNonBlocking()` +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` **Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async windows. We're going to make a window and update one of the elements of that window every .01 seconds. Here's the entire code to do that. +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. import PySimpleGUI as sg import time - # window that doesn't block - # Make a window, but don't use context manager - window = sg.Window('Running Timer', auto_size_text=True) + # form that doesn't block + # Make a form, but don't use context manager + form = sg.Window('Running Timer', auto_size_text=True) # Create the layout - window_rows = [[sg.Text('Non-blocking GUI with updates')], + form_rows = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], [sg.Button('Quit')]] - # Layout the rows of the window and perform a read. Indicate the window is non-blocking! - window.LayoutAndRead(window_rows, non_blocking=True) + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) # # Some place later in your code... - # You need to perform a ReadNonBlocking on your window every now and then or + # You need to perform a ReadNonBlocking on your form every now and then or # else it won't refresh # for i in range(1, 1000): - window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = window.ReadNonBlocking() + form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break time.sleep(.01) else: - window.CloseNonBlocking() + form.CloseNonBlockingForm() -What we have here is the same sequence of function calls as in the description. Get a window, add rows to it, show the window, and then refresh it every now and then. +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the window. The new value will be displayed when `window.ReadNonBlocking()` is called. if you want to have the window reflect your changes immediately, call `window.Refresh()`. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the window is still open. The user has not closed the window using the X nor a button so it's up to the caller to close the window using `CloseNonBlocking`. +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. -## Updating Elements (changing elements in active window) +## Updating Elements (changing elements in active form) -Persistent windows remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). +Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. @@ -2234,7 +2235,7 @@ In some programs these updates happen in response to another Element. This prog - # Testing async window, see if can have a slider + # Testing async form, see if can have a slider # that adjusts the size of text displayed import PySimpleGUI as sg @@ -2245,10 +2246,10 @@ In some programs these updates happen in response to another Element. This prog sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize - window = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) + form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop while True: - button, values= window.Read() + button, values= form.Read() if button is None: break sz_spin = int(values['spin']) @@ -2257,9 +2258,9 @@ In some programs these updates happen in response to another Element. This prog if sz != fontSize: fontSize = sz font = "Helvetica " + str(fontSize) - window.FindElement('text').Update(font=font) - window.FindElement('slider').Update(sz) - window.FindElement('spin').Update(sz) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) print("Done.") @@ -2269,18 +2270,18 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - window.FindElement('text').Update(font=font) - window.FindElement('slider').Update(sz) - window.FindElement('spin').Update(sz) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) -Remember this design pattern because you will use it OFTEN if you use persistent windows. +Remember this design pattern because you will use it OFTEN if you use persistent forms. -It works as follows. The call to `window.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: +It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: - text_element = window.FindElement('text') + text_element = form.FindElement('text') text_element.Update(font=font) -The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the window and also to identify elements. As already mentioned, they are used as targets in Button calls. +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. @@ -2302,16 +2303,16 @@ Key Sym is a string such as 'Control_L'. The Key Code is a numeric representati # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" - with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], [sg.Button("OK")]] - window.Layout(layout) + form.Layout(layout) # ---===--- Loop taking in user input --- # while True: - button, value = window.ReadNonBlocking() + button, value = form.ReadNonBlocking() if button == "OK" or (button is None and value is None): print(button, "exiting") @@ -2326,26 +2327,26 @@ Use realtime keyboard capture by calling import PySimpleGUI as sg - with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: layout = [[sg.Text("Hold down a key")], [sg.Button("OK")]] - window.Layout(layout) + form.Layout(layout) while True: - button, value = window.ReadNonBlocking() + button, value = form.ReadNonBlocking() if button == "OK": print(button, value, "exiting") break - if button is not None: + if button is not None: print(button) elif value is None: break ## Menus -Beginning in version 3.01 you can add a menubar to your window. You specify the menus in much the same way as you do window layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your window.Read returns. Hopefully will not be a problem. +Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. This definition: @@ -2366,7 +2367,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the window changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2377,7 +2378,7 @@ We have an InputText field that we want to update. When the Element was created To update or change the value for that Input Element, we use this construct: - window.FindElement('input').Update('new text') + form.FindElement('input').Update('new text') Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. @@ -2400,22 +2401,22 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify | Source File| Description | |--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single window +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | window with a Canvas Element that is updated outside of the window +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project -|**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex windows +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors +|**Demo_Columns.py** | Using the Column Element to create more complex forms |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format -**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your window -|**Demo_DisplayHash1and256.py** | Using high level API and custom window to implement a simple display hash code utility +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter -|**Demo_Fill_Form.py** | How to perform a bulk-fill for a window. Saving and loading a window from disk +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements |**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them |**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors @@ -2428,9 +2429,9 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph |**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking window with a media player layout. Demonstrates button graphics, Update method +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async window +|**Demo_NonBlocking_Form.py** | a basic async form |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate @@ -2443,7 +2444,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables -|**Demo_Timer.py** | Simple non-blocking window +|**Demo_Timer.py** | Simple non-blocking form ## Packages Used In Demos @@ -2505,18 +2506,18 @@ Or beginning in version 2.9 you can choose from a look and feel using pre-define Valid values for the description string are: - GreenTan - LightGreen - BluePurple - Purple - BlueMono - GreenMono - BrownBlue - BrightColors - NeutralBlue - Kayak - SandyBeach - TealMono + GreenTan + LightGreen + BluePurple + Purple + BlueMono + GreenMono + BrownBlue + BrightColors + NeutralBlue + Kayak + SandyBeach + TealMono To see the latest list of color choices, take a look at the bottom of the `PySimpleGUI.py` file where you'll find the `ChangLookAndFeel` function. @@ -2552,7 +2553,7 @@ While not an "issue" this is a ***stern warning*** **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X -**Async windows** - these include the 'easy' windows (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async windows open with normal windows then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank window. +**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. @@ -2662,8 +2663,8 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Text Element relief setting * Keys as targets for buttons * New names for buttons: - * Button = SimpleButton - * RButton = ReadButton = ReadFormButton + * Button = SimpleButton + * RButton = ReadButton = ReadFormButton * Double clickable list entries * Auto sizing table widths works now * Feature DELETED - Scaling. Removed from all elements @@ -2680,6 +2681,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Renamed FlexForm to Window * Removed LookAndFeel capability from Mac platform. +#### 3.6.1 +* Forgot Readme update in 3.6.0 + ### Upcoming Make suggestions people! Future release features @@ -2717,55 +2721,53 @@ It seemed quite natural to use Python's powerful list constructs when possible. Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. You can also look up elements using their keys. This is an excellent way to update elements in reaction to another element. Call `form.FindElement(key)` to get the Element. - - + + ## Author -MikeTheWatchGuy - +MikeTheWatchGuy + ## Demo Code Contributors [JorjMcKie](https://github.com/JorjMcKie) - PDF and image viewers (plus a number of code suggestions) [Otherion](https://github.com/Otherion) - Table Demos Panda & CSV. Loads of suggestions to the core APIs -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) - - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file diff --git a/readme.md b/readme.md index 4d521d0d8..69009ef39 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,14 @@ -![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) - + +![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) + [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) # PySimpleGUI - -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.0-red.svg?longCache=true&style=for-the-badge) + +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.1-red.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -22,16 +23,16 @@ [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) -Super-simple GUI to use... Powerfully customizable. +Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter - -Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. - + +Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. + Looking for a GUI package to help with * Taking your Python code from the world of command lines and into the convenience of a GUI? * -* Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? -* Into Machine Learning and are sick of the command line? +* Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? +* Into Machine Learning and are sick of the command line? * How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. @@ -53,7 +54,7 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) @@ -94,7 +95,7 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own windows using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. @@ -120,7 +121,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Folder Browse SaveAs Non-closing return - Close window + Close form Realtime Calendar chooser Color chooser @@ -136,7 +137,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Scroll-able Output Images Progress Bar Async/Non-Blocking Windows - Tabbed windows + Tabbed forms Persistent Windows Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) @@ -147,15 +148,15 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Return values as dictionary Set focus Bind return key to buttons - Group widgets into a column and place into window anywhere + Group widgets into a column and place into form anywhere Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected Get slider, spinner, combo as they are changed - Update elements in a live window - Bulk window-fill operation - Save / Load window to/from disk + Update elements in a live form + Bulk form-fill operation + Save / Load form to/from disk Borderless (no titlebar) windows Always on top windows Menus @@ -164,7 +165,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad No async programming required (no callbacks to worry about) -An example of many widgets used on a single window. A little further down you'll find the 21 lines of code required to create this complex window. Try it if you don't believe it. Install PySimpleGUI then : +An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : >Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > @@ -175,7 +176,7 @@ An example of many widgets used on a single window. A little further down you'l import PySimpleGUI as sg - layout = [[sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText()], [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], @@ -210,8 +211,8 @@ An example of many widgets used on a single window. A little further down you'l Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - windows are represented as Python lists. - - A window is a list of rows + - Forms are represented as Python lists. + - A form is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary @@ -280,21 +281,21 @@ If you wish to create an EXE from your PySimpleGUI application, you will need to To use in your code, simply import.... `import PySimpleGUI as sg` -Then use either "high level" API calls or build your own windows. +Then use either "high level" API calls or build your own forms. sg.Popup('This is my first Popup') ![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. --- ## APIs PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom window functions + * Custom form functions ### Python Language Features @@ -318,7 +319,7 @@ Each new item begins on a new line in the Popup #### Optional Parameters to a Function Call -This feature of the Python language is utilized ***heavily*** as a method of customizing windows and window Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. +This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. @@ -342,7 +343,7 @@ If the caller wanted to change the button color to be black on yellow, the call #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: -1. To identify values when a window is read +1. To identify values when a form is read 2. To identify Elements so that they can be "updated" --- @@ -355,7 +356,7 @@ Dictionaries are used by more advanced PySimpleGUI users. You'll know that dict Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. -`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking window of Popup discussed in the async section. +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. @@ -440,7 +441,7 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFile` - get a filename - `PopupGetFolder` - get a folder name -Rather than make a custom window to get one data value, call the Popup input function to get the item from the user. +Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. import PySimpleGUI as sg @@ -490,7 +491,7 @@ That line of code resulted in this window popping up and updating. ![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter window. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -523,20 +524,20 @@ A word of caution. There are known problems when multiple PySimpleGUI windows a You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. --- -# Custom window API Calls (Your First window) +# Custom Form API Calls (Your First Form) This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. -This first section on custom windows is for your typical, blocking, non-persistant window. By this I mean, when you "show" the window, the function will not return until the user has clicked a button or closed the window. When this happens, the window will be automatically closed. +This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. -Two other types of windows exist. -1. Persistent window - rather than closing on button clicks, the show window function returns and the window continues to be visible. This is good for applications like a chat window. -2. Asynchronous window - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async windows are updated (refreshed) on a periodic basis. +Two other types of forms exist. +1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. +2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. -## The window Designer -The good news to newcomers to GUI programming is that PySimpleGUI has a window designer. Better yet, the window designer requires no training and everyone knows how to use it. +## The Form Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. ![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) @@ -594,12 +595,12 @@ Finally we can put it all together into a program that will display our window. sg.Popup(button, number) ### Example 2 - Get a filename -Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your window on paper, break it up into rows, label the elements. +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. ![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) ![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) -Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the window on the paper. +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. import PySimpleGUI as sg @@ -612,57 +613,57 @@ Writing the code for this one is just as straightforward. There is one tricky t sg.Popup(button, number) -Read on for detailed instructions on the calls that show the window and return your results. +Read on for detailed instructions on the calls that show the form and return your results. # Copy these design patterns! -All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of window you're implementing. +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. -## Pattern 1 - Single read windows +## Pattern 1 - Single read forms -This is the most basic design pattern. Use this for windows that are shown to the user 1 time. The input values are gathered and returned to the program +This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program - window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - window = sg.Window('SHA-1 & 256 Hash') + form = sg.Window('SHA-1 & 256 Hash') - button, (source_filename,) = window.LayoutAndRead(window_rows) + button, (source_filename,) = form.LayoutAndRead(form_rows) ---- -## Pattern 2 - Single-read window "chained" +## Pattern 2 - Single-read form "chained" -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a window is first obtained by calling Window and then that window is then read. It's possible to combine the creation of the window with the read. This design pattern does exactly that, chain together the window creation and the window reading. +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. - window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(window_rows) + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) -## Pattern 3 - Persistent window (multiple reads) +## Pattern 3 - Persistent form (multiple reads) -Some of the more advanced programs operate with the window remaining visible on the screen. Input values are collected, but rather than closing the window, it is kept visible acting as a way to both output information to the user and gather input data. +Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a window is created by calling Window which is then passed on to the Layout method. The Layout method returns the window value so that it can be stored and used later in the program to Read the window. +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. import PySimpleGUI as sg - layout = [[sg.Text('Persistent window')], + layout = [[sg.Text('Persistent form')], [sg.RButton('Turn LED On')], [sg.RButton('Turn LED Off')], [sg.Exit()]] - window = sg.Window('Raspberry Pi GUI').Layout(layout) + form = sg.Window('Raspberry Pi GUI').Layout(layout) while True: - button, values = window.Read() + button, values = form.Read() if button is None: break @@ -671,7 +672,7 @@ This is done by splitting the LayoutAndRead call apart into a Layout call and a Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a window. +The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. Let's dissect this little program @@ -682,15 +683,15 @@ The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()]] - window = sg.Window('Rename Files or Folders') + form = sg.Window('Rename Files or Folders') - button, (folder_path, file_path) = window.LayoutAndRead(layout) + button, (folder_path, file_path) = form.LayoutAndRead(layout) ![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) -Let's agree the window has 4 rows. +Let's agree the form has 4 rows. The first row only has **text** that reads `Rename files or folders` @@ -705,15 +706,15 @@ Now let's look at how those 2 rows and the other two row from Python code: See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. -And what about those return values? Most people simply want to show a window, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my window's input values to be given to me. +And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. -For return values the window is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. +For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. -In our example window, there are 2 fields, so the return values from this window will be a list with 2 values in it. +In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. - button, (folder_path, file_path) = window.LayoutAndRead(layout) + button, (folder_path, file_path) = form.LayoutAndRead(layout) -In the statement that shows and reads the window, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. +In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. @@ -726,54 +727,54 @@ Isn't this what almost every Python programmer looking for a GUI wants?? Someth By default return values are a list of values, one entry for each input field. - Return information from Window, SG's primary window builder interface, is in this format: + Return information from Window, SG's primary form builder interface, is in this format: button, (value1, value2, ...) Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - button, (filename, folder1, folder2, should_overwrite) = window.LayoutAndRead(window_rows) + button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) Or, you can unpack the return results separately. - button, values = window.LayoutAndRead(window_rows) + button, values = form.LayoutAndRead(form_rows) filename, folder1, folder2, should_overwrite = values If you have a SINGLE value being returned, it is written this way: - button, (value1,) = window.LayoutAndRead(window_rows) + button, (value1,) = form.LayoutAndRead(form_rows) Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - button, value_list = window.LayoutAndRead(window_rows) + button, value_list = form.LayoutAndRead(form_rows) value1 = value_list[0] value2 = value_list[1] ... ### Return values as a dictionary -For windows longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. +For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. -The most common window read statement you'll encounter looks something like this: +The most common form read statement you'll encounter looks something like this: - button, values = window.LayoutAndRead(layout) + button, values = form.LayoutAndRead(layout) or - button, values = window.Read() + button, values = form.Read() All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. -If **any** element in the window has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. +If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -Let's take a look at your first dictionary-based window. +Let's take a look at your first dictionary-based form. import PySimpleGUI as sg - window = sg.Window('Simple data entry window') + form = sg.Window('Simple data entry form') layout = [ [sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], @@ -782,7 +783,7 @@ Let's take a look at your first dictionary-based window. [sg.Submit(), sg.Cancel()] ] - button, values = window.LayoutAndRead(layout) + button, values = form.LayoutAndRead(layout) sg.Popup(button, values, values['name'], values['address'], values['phone']) @@ -790,7 +791,7 @@ To get the value of an input field, you use whatever value used as the `key` val values['name'] -You will find the key field used quite heavily in most PySimpleGUI windows unless the window is very simple. +You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. ### Button Return Values @@ -799,20 +800,20 @@ The button value from a Read call will be one of 3 values: 2. The Button's key 3. None -If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the button value is None. +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. None is returned when the user clicks the X to close a window. -If your window has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: +If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: while True: - button, values= window.Read() + button, values= form.Read() if button is None or button == 'Quit': break ## The Event Loop / Callback Functions -All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single window, collects the data and then executes the primary code of the program then you likely don't need an event loop. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. @@ -830,16 +831,16 @@ This little program has a typical Event Loop [sg.RButton('Turn LED Off')], [sg.Exit()]] - window = sg.Window('Raspberry Pi).Layout(layout) + form = sg.Window('Raspberry Pi).Layout(layout) # ---- Event Loop ---- # while True: - button, values = window.Read() + button, values = form.Read() # ---- Process Button Clicks ---- # if button is None or button == 'Exit': break - if button == 'Turn LED Off': + if button == 'Turn LED Off': turn_LED_off() elif button == 'Turn LED On': turn_LED_on() @@ -849,7 +850,7 @@ This little program has a typical Event Loop -In the Event Loop we are reading the window and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) +In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. @@ -863,7 +864,7 @@ Whether or not this is a "proper" design for GUI programs can be debated. It's ## All Widgets / Elements -This code utilizes as many of the elements in one window as possible. +This code utilizes as many of the elements in one form as possible. import PySimpleGUI as sg @@ -882,7 +883,7 @@ This code utilizes as many of the elements in one window as possible. layout = [ [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Frame(layout=[ @@ -903,52 +904,52 @@ This code utilizes as many of the elements in one window as possible. [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] + [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] ] - window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - button, values = window.Read() + button, values = form.Read() sg.Popup('Title', - 'The results of the window.', + 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) -This is a somewhat complex window with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the window. +This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) -Clicking the Submit button caused the window call to return. The call to Popup resulted in this dialog box. +Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the window using something other than a button, then `button` will be `None`. +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. -You can see in the Popup that the values returned are a list. Each input field in the window generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- -# Building Custom windows +# Building Custom Forms You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values -## Synchronous windows -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI window/dialog box. -You've already seen a number of examples above that use blocking windows. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking window. You can examine the show calls to be sure. If the window is a non-blocking window, it must indicate that in the call to `window.show`. +## Synchronous Forms +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. +You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. -NON-BLOCKING window call: +NON-BLOCKING form call: - window.Show(non_blocking=True) + form.Show(non_blocking=True) -### Beginning a window -The first step is to create the window object using the desired window customization. +### Beginning a Form +The first step is to create the form object using the desired form customization. - with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as window: + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: This is the definition of the Window object: @@ -975,39 +976,39 @@ This is the definition of the Window object: keep_on_top=False): -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `window` values. +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. - default_element_size - Size of elements in window in characters (width, height) - default_button_element_size - Size of buttons on this window + default_element_size - Size of elements in form in characters (width, height) + default_button_element_size - Size of buttons on this form auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label location - (x,y) Location to place window in pixels - font - Font name and size for elements of the window + font - Font name and size for elements of the form button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background - is_tabbed_form - Bool. If True then window is a tabbed window + is_tabbed_form - Bool. If True then form is a tabbed form border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True window will autoclose - auto_close_duration - Duration in seconds before window closes + auto_close - Bool. If True form will autoclose + auto_close_duration - Duration in seconds before form closes icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus - text_justification - Justification to use for Text Elements in this window + text_justification - Justification to use for Text Elements in this form no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. #### Window Location -PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the window is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. The default Element size for PySimpleGUI is `(45,1)`. -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the window. Setting `size=(20,1)` in the window creation call will set all elements in the window to that size. +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. @@ -1027,17 +1028,17 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the window is a non-blocking window. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. -It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking window using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking window, simply get grab_anywhere = True when you create the window. +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. #### Always on top -To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. ## Elements -"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. +"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. Text Single Line Input @@ -1046,8 +1047,8 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Folder Browse Calendar picker Date Chooser - Read window - Close window + Read form + Close form Realtime Checkboxes Radio Buttons @@ -1064,7 +1065,7 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Image Table Async/Non-Blocking Windows - Tabbed windows + Tabbed forms Persistent Windows Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) @@ -1075,14 +1076,14 @@ key tooltip #### Tooltip -Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your window's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. ### Output Elements -Building a window is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: +Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: layout = [ [row 1 element, row 1 element], [row 2 element, row 2 element, row 2 element] ] @@ -1167,14 +1168,14 @@ This Element doubles as both an input and output Element. The `DefaultText` opt . default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits window + enter_submits - Bool. If True, pressing Enter key submits form size - Element's size auto_size_text - Bool. Change width to match size of text #### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. More on this later. +Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. - window.AddRow(gg.Output(size=(100,20))) + form.AddRow(gg.Output(size=(100,20))) ![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) @@ -1184,7 +1185,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. size - Size of element (width, height) in characters ### Input Elements - These make up the majority of the window definition. Optional variables at the Element level override the window level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. #### Text Input Element @@ -1211,7 +1212,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text - do_not_clear - Bool. Normally windows clear when read, turn off clearing with this flag. + do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) @@ -1283,7 +1284,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values 'extended' 'multiple' 'single' - change_submits - if True, the window read will return with a button value of '' + change_submits - if True, the form read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length @@ -1296,7 +1297,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. -ListBoxes can cause a window to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. #### Slider Element @@ -1425,7 +1426,7 @@ An up/down spinner control. The valid values are passed in as a list. ### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a window, whether it be Submit or Cancel, one way or another a button is involved in all windows. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse @@ -1433,16 +1434,16 @@ The Types of buttons include: * Files Browse * File SaveAs * File Save -* Close window (normal button) -* Read window +* Close Form (normal button) +* Read Form * Realtime * Calendar Chooser * Color Chooser - Close window - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close window" buttons. They cause the input values to be read and then the window is ***closed***, returning the values to the caller. + Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the window. +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. @@ -1450,18 +1451,18 @@ Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog -Read window - This is a window button that will read a snapshot of all of the input fields, but does not close the window after it's clicked. +Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. -Realtime - This is another async window button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. +Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the window, and ReadForm buttons that keep the window open but returns control back to the caller. +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. -The 3 primary windows of PySimpleGUI buttons and their names are: +The 3 primary forms of PySimpleGUI buttons and their names are: 1. `Button` = `SimpleButton` - 2. `ReadButton` = `RButton` = `ReadFormButton` (old style... use ReadButton instead) + 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` 3. `RealtimeButton` You will find the long-form in the older programs. @@ -1535,7 +1536,7 @@ These Pre-made buttons are some of the most important elements of all because th #### Button targets -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the window. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target comes in two forms. 1. Key @@ -1551,7 +1552,7 @@ The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special valu If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. -Let's examine this window as an example: +Let's examine this form as an example: ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) @@ -1562,7 +1563,7 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (1,0) Target = (-1,0) -The code for the entire window could be: +The code for the entire form could be: layout = [[sg.T('Source Folder')], [sg.In()], @@ -1605,13 +1606,13 @@ These buttons pop up a standard color chooser window. The result is returned as **Custom Buttons** -Not all buttons are created equal. A button that closes a window is different that a button that returns from the window without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the window when clicked. +Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. layout = [[sg.Button('My Button')]] ![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a window is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the window. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -1630,11 +1631,11 @@ Three parameters are used for button images. image_size - Size of image file in pixels image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 -Here's an example window made with button images. +Here's an example form made with button images. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player window +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) @@ -1648,13 +1649,13 @@ This is one you'll have to experiment with at this point. Not up for an exhaust ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) -This window has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". +This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". -Here is the code to make, show and get results from this window: +Here is the code to make, show and get results from this form: - window = sg.Window('Robotics Remote Control', auto_size_text=True) + form = sg.Window('Robotics Remote Control', auto_size_text=True) - window_rows = [[sg.Text('Robotics Remote Control')], + form_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], @@ -1662,39 +1663,39 @@ Here is the code to make, show and get results from this window: [sg.Quit(button_color=('black', 'orange'))] ] - window.LayoutAndRead(window_rows, non_blocking=True) + form.LayoutAndRead(form_rows, non_blocking=True) -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your window's buttons. +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. while (True): # This is the code that reads and updates your window - button, values = window.ReadNonBlocking() + button, values = form.ReadNonBlocking() if button is not None: sg.Print(button) if button == 'Quit' or values is None: break time.sleep(.01) -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `window.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) -This code produces a window where the Browse button only shows files of type .TXT +This code produces a form where the Browse button only shows files of type .TXT layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window. + The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. -The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right. +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. --- #### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar windows. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the windows have to be non-blocking and they are tricky to debug. +The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen OneLineProgressMeter calls presented earlier in this readme. @@ -1703,33 +1704,33 @@ You've already seen OneLineProgressMeter calls presented earlier in this readme. The return value for `OneLineProgressMeter` is: `True` if meter updated correctly -`False` if user clicked the Cancel button, closed the window, or vale reached the max value. +`False` if user clicked the Cancel button, closed the form, or vale reached the max value. -#### Progress Mater in Your window -Another way of using a Progress Meter with PySimpleGUI is to build a custom window with a `ProgressBar` Element in the window. You will need to run your window as a non-blocking window. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +#### Progress Mater in Your Form +Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) import PySimpleGUI as sg - # layout the window + # layout the form layout = [[sg.Text('A custom progress meter')], [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], [sg.Cancel()]] - # create the window` - window = sg.Window('Custom Progress Meter').Layout(layout) - progress_bar = window.FindElement('progressbar') + # create the form` + form = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = form.FindElement('progressbar') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked - button, values = window.ReadNonBlocking() + button, values = form.ReadNonBlocking() if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - window.CloseNonBlocking()) + form.CloseNonBlockingForm()) #### Output @@ -1737,11 +1738,11 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Output(size=(None, None)) -Here's a complete solution for a chat-window using an Async window with an Output Element +Here's a complete solution for a chat-window using an Async form with an Output Element import PySimpleGUI as sg - # Blocking window that doesn't close + # Blocking form that doesn't close def ChatBot(): layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], [sg.Output(size=(80, 20))], @@ -1749,11 +1750,11 @@ Here's a complete solution for a chat-window using an Async window with an Outpu sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - window = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: - button, value = window.Read() + button, value = form.Read() if button == 'SEND': print(value) else: @@ -1763,15 +1764,15 @@ Here's a complete solution for a chat-window using an Async window with an Outpu ------------------- ## Columns -Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a window within a window. And, yes, you can have a Column within a Column if you want. +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. -Columns are specified in exactly the same way as a window is, as a list of lists. +Columns are specified in exactly the same way as a form is, as a list of lists. def Column(layout - the list of rows that define the layout - background_color - color of background - size - size of visible portion of column - pad - element padding to use when packing - scrollable - bool. True if should add scrollbars + background_color - color of background + size - size of visible portion of column + pad - element padding to use when packing + scrollable - bool. True if should add scrollbars Columns are needed when you have an element that has a height > 1 line on the left, with single-line elements on the right. Here's an example of this kind of layout: @@ -1786,11 +1787,11 @@ This code produced the above window. import PySimpleGUI as sg # Demo of how columns work - # window has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows # Prior to the Column element, this layout was not possible - # Columns layouts look identical to window layouts, they are a list of lists of elements. + # Columns layouts look identical to form layouts, they are a list of lists of elements. - window = sg.Window('Columns') # blank window + form = sg.Window('Columns') # blank form # Column layout col = [[sg.Text('col Row 1')], @@ -1805,18 +1806,18 @@ This code produced the above window. [sg.In('Last input')], [sg.OK()]] - # Display the window and get values + # Display the form and get values # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the window display and read down to a single line of code. - button, values = sg.Window('Compact 1-line window with column').LayoutAndRead(layout) + # to collapse the form display and read down to a single line of code. + button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) sg.Popup(button, values, line_width=200) -The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the window's background color, except it only affects the column rectangle. +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. Column(layout, background_color=None) -The default background color for Columns is the same as the default window background color. If you change the look and feel of the window, the column background will match the window background automatically. +The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. @@ -1826,21 +1827,21 @@ The default background color for Columns is the same as the default window backg Frames work exactly the same way as Columns. You create layout that is then used to initialize the Frame. def Frame(title - the label / title to put on frame - layout - list of rows of elements the frame contains - title_color - color of the title text - background_color - color of background - title_location - locations to put the title - relief - type of relief to use - size - size of Frame in characters. Do not use if you want frame to autosize - font - font to use for title - pad - element padding to use when packing - border_width - how thick the line going around frame should be - key - key used to location the element - tooltip - tooltip text + layout - list of rows of elements the frame contains + title_color - color of the title text + background_color - color of background + title_location - locations to put the title + relief - type of relief to use + size - size of Frame in characters. Do not use if you want frame to autosize + font - font to use for title + pad - element padding to use when packing + border_width - how thick the line going around frame should be + key - key used to location the element + tooltip - tooltip text -This code creates a window with a Frame and 2 buttons. +This code creates a form with a Frame and 2 buttons. frame_layout = [ [sg.T('Text inside of a frame')], @@ -1851,14 +1852,14 @@ This code creates a window with a Frame and 2 buttons. [sg.Submit(), sg.Cancel()] ] - window = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a window layout. A window works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. @@ -1871,38 +1872,38 @@ In my opinion, the tkinter Canvas Widget is the most powerful of the tkinter wid One such integration is with Matploplib and Pyplot. There is a Demo program written that you can use as a design pattern to get an understanding of how to use the Canvas Widget once you get it. def Canvas(canvas - a tkinter canvasf if you created one. Normally not set - background_color - canvas color - size - size in pixels - pad - element padding for packing - key - key used to lookup element - tooltip - tooltip text + background_color - canvas color + size - size in pixels + pad - element padding for packing + key - key used to lookup element + tooltip - tooltip text The order of operations to obtain a tkinter Canvas Widget is: figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the window layout + # define the form layout layout = [[sg.Text('Plot test')], [sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - # create the window and show it without the plot - window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + # create the form and show it without the plot + form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() # add the plot to the window - fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) + fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) # show it all again and get buttons - button, values = window.Read() + button, values = form.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: -* Add Canvas Element to your window -* Layout your window -* Call `window.Finalize()` - this is a critical step you must not forget +* Add Canvas Element to your form +* Layout your form +* Call `form.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas * Draw on your canvas to your heart's content -* Call `window.Read()` - Nothing will appear on your canvas until you call Read +* Call `form.Read()` - Nothing will appear on your canvas until you call Read See `Demo_Matplotlib.py` for a Recipe you can copy. @@ -1969,16 +1970,16 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed windows -Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format +## Tabbed Forms +Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), (form2,layout2, 'Tab 2 label'), ...) -Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` +Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: (button, (values)) @@ -1989,7 +1990,7 @@ Recall that values is a list as well. Multiple tabs in the form would return li ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. -Your windows can go from this: +Your forms can go from this: ![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) @@ -2001,9 +2002,9 @@ to this... with one function call... -While you can do it on an element by element or window level basis, the easiest way, by far, is a call to `SetOptions`. +While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. -Be aware that once you change these options they are changed for the rest of your program's execution. All of your windows will have that look and feel, until you change it to something else (which could be the system default colors. +Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. This call sets all of the different color options. @@ -2088,41 +2089,41 @@ Explanation of parameters tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms -These settings apply to all windows `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the window-level being the highest and the Element-level the lowest. Thus the levels are: +These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: - - window level + - Form level - Row level - Element level Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). -## Persistent windows (Window stays open after button click) +## Persistent Forms (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking windows (see the next section). The other way is to use buttons that 'read' the window instead of 'close' the window when clicked. The typical buttons you find in windows, including the shortcut buttons, close the window. These include OK, Cancel, Submit, etc. The Button Element also closes the window. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. -The `RButton` Element creates a button that when clicked will return control to the user, but will leave the window open and visible. This button is also used in Non-Blocking windows. The difference is in which call is made to read the window. The `Read` call will block, the `ReadNonBlocking` will not block. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. -## Asynchronous (Non-Blocking) windows +## Asynchronous (Non-Blocking) Forms So you want to be a wizard do ya? Well go boldly! -Use async windows sparingly. It's possible to have a window that appears to be async, but it is not. **Please** try to find other methods before going to async windows. The reason for this plea is that async windows poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. +Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. -When to use a non-blocking window: +When to use a non-blocking form: * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking window. +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. ### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. -***Instead of polling, try options that cause the window to return to you.*** By using non-blocking windows, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. +***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. **Examples** @@ -2135,93 +2136,93 @@ One example is you have an input field that changes as you press buttons on an o ### Periodically Calling`ReadNonBlocking` -Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your windows will feel. It is up to you to make these calls or your GUI will freeze. +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking windows. -1. Read the window just as you would a normal window -2. "Refresh" the window's values without reading the window. It's a quick operation meant to show the user the latest values +There are 2 methods of interacting with non-blocking forms. +1. Read the form just as you would a normal form +2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values - With asynchronous windows the window is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - #### Exiting a Non-Blocking window + #### Exiting a Non-Blocking Form -It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed windows in your code. It is possible for a window to look closed, but continue running your event loop. +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. -Typically when reading a window you check `if Button is None` to determine if a window was closed. With NonBlocking windows, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking window is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. +Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. -The proper code to check if the user has exited the window will be a polling-loop that looks something like this: +The proper code to check if the user has exited the form will be a polling-loop that looks something like this: while True: - button, values = window.ReadNonBlocking() + button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break -We're going to build an app that does the latter. It's going to update our window with a running clock. +We're going to build an app that does the latter. It's going to update our form with a running clock. The basic flow and functions you will be calling are: Setup - window = Window() - window_rows = ..... - window.LayoutAndRead(window_rows, non_blocking=True) + form = Window() + form_rows = ..... + form.LayoutAndRead(form_rows, non_blocking=True) Periodic refresh - window.ReadNonBlocking() or window.Refresh() + form.ReadNonBlocking() or form.Refresh() -If you need to close the window +If you need to close the form - window.CloseNonBlocking() + form.CloseNonBlockingForm() -Rather than the usual `window.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the window. After the window is shown, you simply call `window.ReadNonBlocking()` every now and then. +Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. -When you are ready to close the window (assuming the window wasn't closed by the user or a button click) you simply call `window.CloseNonBlocking()` +When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` **Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async windows. We're going to make a window and update one of the elements of that window every .01 seconds. Here's the entire code to do that. +See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. import PySimpleGUI as sg import time - # window that doesn't block - # Make a window, but don't use context manager - window = sg.Window('Running Timer', auto_size_text=True) + # form that doesn't block + # Make a form, but don't use context manager + form = sg.Window('Running Timer', auto_size_text=True) # Create the layout - window_rows = [[sg.Text('Non-blocking GUI with updates')], + form_rows = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], [sg.Button('Quit')]] - # Layout the rows of the window and perform a read. Indicate the window is non-blocking! - window.LayoutAndRead(window_rows, non_blocking=True) + # Layout the rows of the form and perform a read. Indicate the form is non-blocking! + form.LayoutAndRead(form_rows, non_blocking=True) # # Some place later in your code... - # You need to perform a ReadNonBlocking on your window every now and then or + # You need to perform a ReadNonBlocking on your form every now and then or # else it won't refresh # for i in range(1, 1000): - window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = window.ReadNonBlocking() + form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = form.ReadNonBlocking() if values is None or button == 'Quit': break time.sleep(.01) else: - window.CloseNonBlocking() + form.CloseNonBlockingForm() -What we have here is the same sequence of function calls as in the description. Get a window, add rows to it, show the window, and then refresh it every now and then. +What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the window. The new value will be displayed when `window.ReadNonBlocking()` is called. if you want to have the window reflect your changes immediately, call `window.Refresh()`. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the window is still open. The user has not closed the window using the X nor a button so it's up to the caller to close the window using `CloseNonBlocking`. +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. -## Updating Elements (changing elements in active window) +## Updating Elements (changing elements in active form) -Persistent windows remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). +Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. @@ -2234,7 +2235,7 @@ In some programs these updates happen in response to another Element. This prog - # Testing async window, see if can have a slider + # Testing async form, see if can have a slider # that adjusts the size of text displayed import PySimpleGUI as sg @@ -2245,10 +2246,10 @@ In some programs these updates happen in response to another Element. This prog sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize - window = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) + form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop while True: - button, values= window.Read() + button, values= form.Read() if button is None: break sz_spin = int(values['spin']) @@ -2257,9 +2258,9 @@ In some programs these updates happen in response to another Element. This prog if sz != fontSize: fontSize = sz font = "Helvetica " + str(fontSize) - window.FindElement('text').Update(font=font) - window.FindElement('slider').Update(sz) - window.FindElement('spin').Update(sz) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) print("Done.") @@ -2269,18 +2270,18 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - window.FindElement('text').Update(font=font) - window.FindElement('slider').Update(sz) - window.FindElement('spin').Update(sz) + form.FindElement('text').Update(font=font) + form.FindElement('slider').Update(sz) + form.FindElement('spin').Update(sz) -Remember this design pattern because you will use it OFTEN if you use persistent windows. +Remember this design pattern because you will use it OFTEN if you use persistent forms. -It works as follows. The call to `window.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: +It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: - text_element = window.FindElement('text') + text_element = form.FindElement('text') text_element.Update(font=font) -The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the window and also to identify elements. As already mentioned, they are used as targets in Button calls. +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. @@ -2302,16 +2303,16 @@ Key Sym is a string such as 'Control_L'. The Key Code is a numeric representati # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" - with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], [sg.Button("OK")]] - window.Layout(layout) + form.Layout(layout) # ---===--- Loop taking in user input --- # while True: - button, value = window.ReadNonBlocking() + button, value = form.ReadNonBlocking() if button == "OK" or (button is None and value is None): print(button, "exiting") @@ -2326,26 +2327,26 @@ Use realtime keyboard capture by calling import PySimpleGUI as sg - with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: layout = [[sg.Text("Hold down a key")], [sg.Button("OK")]] - window.Layout(layout) + form.Layout(layout) while True: - button, value = window.ReadNonBlocking() + button, value = form.ReadNonBlocking() if button == "OK": print(button, value, "exiting") break - if button is not None: + if button is not None: print(button) elif value is None: break ## Menus -Beginning in version 3.01 you can add a menubar to your window. You specify the menus in much the same way as you do window layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your window.Read returns. Hopefully will not be a problem. +Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. This definition: @@ -2366,7 +2367,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the window changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2377,7 +2378,7 @@ We have an InputText field that we want to update. When the Element was created To update or change the value for that Input Element, we use this construct: - window.FindElement('input').Update('new text') + form.FindElement('input').Update('new text') Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. @@ -2400,22 +2401,22 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify | Source File| Description | |--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single window +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | window with a Canvas Element that is updated outside of the window +|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project -|**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex windows +|**Demo_Color.py** | How to interact with color using RGB hex values and named colors +|**Demo_Columns.py** | Using the Column Element to create more complex forms |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format -**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your window -|**Demo_DisplayHash1and256.py** | Using high level API and custom window to implement a simple display hash code utility +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form +|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter -|**Demo_Fill_Form.py** | How to perform a bulk-fill for a window. Saving and loading a window from disk +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements |**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them |**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors @@ -2428,9 +2429,9 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph |**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking window with a media player layout. Demonstrates button graphics, Update method +|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async window +|**Demo_NonBlocking_Form.py** | a basic async form |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate @@ -2443,7 +2444,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables -|**Demo_Timer.py** | Simple non-blocking window +|**Demo_Timer.py** | Simple non-blocking form ## Packages Used In Demos @@ -2505,18 +2506,18 @@ Or beginning in version 2.9 you can choose from a look and feel using pre-define Valid values for the description string are: - GreenTan - LightGreen - BluePurple - Purple - BlueMono - GreenMono - BrownBlue - BrightColors - NeutralBlue - Kayak - SandyBeach - TealMono + GreenTan + LightGreen + BluePurple + Purple + BlueMono + GreenMono + BrownBlue + BrightColors + NeutralBlue + Kayak + SandyBeach + TealMono To see the latest list of color choices, take a look at the bottom of the `PySimpleGUI.py` file where you'll find the `ChangLookAndFeel` function. @@ -2552,7 +2553,7 @@ While not an "issue" this is a ***stern warning*** **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X -**Async windows** - these include the 'easy' windows (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async windows open with normal windows then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank window. +**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. @@ -2662,8 +2663,8 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Text Element relief setting * Keys as targets for buttons * New names for buttons: - * Button = SimpleButton - * RButton = ReadButton = ReadFormButton + * Button = SimpleButton + * RButton = ReadButton = ReadFormButton * Double clickable list entries * Auto sizing table widths works now * Feature DELETED - Scaling. Removed from all elements @@ -2680,6 +2681,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Renamed FlexForm to Window * Removed LookAndFeel capability from Mac platform. +#### 3.6.1 +* Forgot Readme update in 3.6.0 + ### Upcoming Make suggestions people! Future release features @@ -2717,55 +2721,53 @@ It seemed quite natural to use Python's powerful list constructs when possible. Want to view your form's results as a dictionary instead of a list... no problem, just use the `key` keyword on your elements. For complex forms with a lot of values that need to be changed frequently, this is by far the best way of consuming the results. You can also look up elements using their keys. This is an excellent way to update elements in reaction to another element. Call `form.FindElement(key)` to get the Element. - - + + ## Author -MikeTheWatchGuy - +MikeTheWatchGuy + ## Demo Code Contributors [JorjMcKie](https://github.com/JorjMcKie) - PDF and image viewers (plus a number of code suggestions) [Otherion](https://github.com/Otherion) - Table Demos Panda & CSV. Loads of suggestions to the core APIs -## License - -GNU Lesser General Public License (LGPL 3) + - -## Acknowledgments - -* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence -* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` +## License + +GNU Lesser General Public License (LGPL 3) + + +## Acknowledgments + +* [JorjMcKie](https://github.com/JorjMcKie) was the motivator behind the entire project. His wxsimpleGUI concepts sparked PySimpleGUI into existence +* [Fredrik Lundh](https://wiki.python.org/moin/FredrikLundh) for his work on `tkinter` * [Ruud van der Ham](https://forum.pythonistacafe.com/u/Ruud) for all the help he's provided as a Python-mentor. Quite a few tricky bits of logic was supplied by Ruud. The dual-purpose return values scheme is Ruud's for example * **Numerous** users who provided feature suggestions! Many of the cool features were suggested by others. If you were one of them and are willing to take more credit, I'll list you here if you give me permission. Most are too modest * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help - - -## How Do I -Finally, I must thank the fine folks at How Do I. -https://github.com/gleitz/howdoi -Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** -Here are the steps to run that application - - Install howdoi: - pip install howdoi - Test your install: - python -m howdoi howdoi.py - To run it: - Python HowDoI.py - -The pip command is all there is to the setup. - -The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. -For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. + + +## How Do I +Finally, I must thank the fine folks at How Do I. +https://github.com/gleitz/howdoi +Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!** +Here are the steps to run that application + + Install howdoi: + pip install howdoi + Test your install: + python -m howdoi howdoi.py + To run it: + Python HowDoI.py + +The pip command is all there is to the setup. + +The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well. +For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see. ![howdoiwithhistory](https://user-images.githubusercontent.com/13696193/45064009-5fd61180-b07f-11e8-8ead-eb0d1ff3a6be.jpg) - - -In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. - -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. +In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. + +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file From 5891ee00b905edfc7d4a64e19016274ec32d369c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 21:36:40 -0400 Subject: [PATCH 449/521] STILL trying to get the docs right! --- docs/index.md | 548 +++++++++++++++++++++++++------------------------- readme.md | 548 +++++++++++++++++++++++++------------------------- 2 files changed, 546 insertions(+), 550 deletions(-) diff --git a/docs/index.md b/docs/index.md index 69009ef39..812257a8e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,5 +1,6 @@ - + + ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) @@ -8,7 +9,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.2-red.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -54,7 +55,7 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) @@ -95,7 +96,7 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own windows using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. @@ -121,7 +122,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Folder Browse SaveAs Non-closing return - Close form + Close window Realtime Calendar chooser Color chooser @@ -137,7 +138,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Scroll-able Output Images Progress Bar Async/Non-Blocking Windows - Tabbed forms + Tabbed windows Persistent Windows Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) @@ -148,15 +149,15 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Return values as dictionary Set focus Bind return key to buttons - Group widgets into a column and place into form anywhere + Group widgets into a column and place into window anywhere Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected Get slider, spinner, combo as they are changed - Update elements in a live form - Bulk form-fill operation - Save / Load form to/from disk + Update elements in a live window + Bulk window-fill operation + Save / Load window to/from disk Borderless (no titlebar) windows Always on top windows Menus @@ -165,7 +166,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad No async programming required (no callbacks to worry about) -An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : +An example of many widgets used on a single window. A little further down you'll find the 21 lines of code required to create this complex window. Try it if you don't believe it. Install PySimpleGUI then : >Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > @@ -176,7 +177,7 @@ An example of many widgets used on a single form. A little further down you'll import PySimpleGUI as sg - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + layout = [[sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText()], [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], @@ -211,8 +212,8 @@ An example of many widgets used on a single form. A little further down you'll Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - Forms are represented as Python lists. - - A form is a list of rows + - windows are represented as Python lists. + - A window is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary @@ -281,21 +282,21 @@ If you wish to create an EXE from your PySimpleGUI application, you will need to To use in your code, simply import.... `import PySimpleGUI as sg` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own windows. sg.Popup('This is my first Popup') ![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. --- ## APIs PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom form functions + * Custom window functions ### Python Language Features @@ -319,7 +320,7 @@ Each new item begins on a new line in the Popup #### Optional Parameters to a Function Call -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. +This feature of the Python language is utilized ***heavily*** as a method of customizing windows and window Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. @@ -343,7 +344,7 @@ If the caller wanted to change the button color to be black on yellow, the call #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: -1. To identify values when a form is read +1. To identify values when a window is read 2. To identify Elements so that they can be "updated" --- @@ -356,7 +357,7 @@ Dictionaries are used by more advanced PySimpleGUI users. You'll know that dict Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. -`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking window of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. @@ -441,7 +442,7 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFile` - get a filename - `PopupGetFolder` - get a folder name -Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. +Rather than make a custom window to get one data value, call the Popup input function to get the item from the user. import PySimpleGUI as sg @@ -491,7 +492,7 @@ That line of code resulted in this window popping up and updating. ![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter window. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -524,20 +525,20 @@ A word of caution. There are known problems when multiple PySimpleGUI windows a You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. --- -# Custom Form API Calls (Your First Form) +# Custom window API Calls (Your First window) This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. +This first section on custom windows is for your typical, blocking, non-persistant window. By this I mean, when you "show" the window, the function will not return until the user has clicked a button or closed the window. When this happens, the window will be automatically closed. -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. +Two other types of windows exist. +1. Persistent window - rather than closing on button clicks, the show window function returns and the window continues to be visible. This is good for applications like a chat window. +2. Asynchronous window - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async windows are updated (refreshed) on a periodic basis. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. -## The Form Designer -The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. +## The window Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a window designer. Better yet, the window designer requires no training and everyone knows how to use it. ![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) @@ -595,12 +596,12 @@ Finally we can put it all together into a program that will display our window. sg.Popup(button, number) ### Example 2 - Get a filename -Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your window on paper, break it up into rows, label the elements. ![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) ![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) -Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the window on the paper. import PySimpleGUI as sg @@ -613,57 +614,57 @@ Writing the code for this one is just as straightforward. There is one tricky t sg.Popup(button, number) -Read on for detailed instructions on the calls that show the form and return your results. +Read on for detailed instructions on the calls that show the window and return your results. # Copy these design patterns! -All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of window you're implementing. -## Pattern 1 - Single read forms +## Pattern 1 - Single read windows -This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program +This is the most basic design pattern. Use this for windows that are shown to the user 1 time. The input values are gathered and returned to the program - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - form = sg.Window('SHA-1 & 256 Hash') + window = sg.Window('SHA-1 & 256 Hash') - button, (source_filename,) = form.LayoutAndRead(form_rows) + button, (source_filename,) = window.LayoutAndRead(window_rows) ---- -## Pattern 2 - Single-read form "chained" +## Pattern 2 - Single-read window "chained" -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a window is first obtained by calling Window and then that window is then read. It's possible to combine the creation of the window with the read. This design pattern does exactly that, chain together the window creation and the window reading. - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(window_rows) -## Pattern 3 - Persistent form (multiple reads) +## Pattern 3 - Persistent window (multiple reads) -Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. +Some of the more advanced programs operate with the window remaining visible on the screen. Input values are collected, but rather than closing the window, it is kept visible acting as a way to both output information to the user and gather input data. -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a window is created by calling Window which is then passed on to the Layout method. The Layout method returns the window value so that it can be stored and used later in the program to Read the window. import PySimpleGUI as sg - layout = [[sg.Text('Persistent form')], + layout = [[sg.Text('Persistent window')], [sg.RButton('Turn LED On')], [sg.RButton('Turn LED Off')], [sg.Exit()]] - form = sg.Window('Raspberry Pi GUI').Layout(layout) + window = sg.Window('Raspberry Pi GUI').Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is None: break @@ -672,7 +673,7 @@ This is done by splitting the LayoutAndRead call apart into a Layout call and a Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. +The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a window. Let's dissect this little program @@ -683,15 +684,15 @@ The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. E [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()]] - form = sg.Window('Rename Files or Folders') + window = sg.Window('Rename Files or Folders') - button, (folder_path, file_path) = form.LayoutAndRead(layout) + button, (folder_path, file_path) = window.LayoutAndRead(layout) ![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) -Let's agree the form has 4 rows. +Let's agree the window has 4 rows. The first row only has **text** that reads `Rename files or folders` @@ -706,15 +707,15 @@ Now let's look at how those 2 rows and the other two row from Python code: See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. +And what about those return values? Most people simply want to show a window, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my window's input values to be given to me. -For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. +For return values the window is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. +In our example window, there are 2 fields, so the return values from this window will be a list with 2 values in it. - button, (folder_path, file_path) = form.LayoutAndRead(layout) + button, (folder_path, file_path) = window.LayoutAndRead(layout) -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. +In the statement that shows and reads the window, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. @@ -727,54 +728,54 @@ Isn't this what almost every Python programmer looking for a GUI wants?? Someth By default return values are a list of values, one entry for each input field. - Return information from Window, SG's primary form builder interface, is in this format: + Return information from Window, SG's primary window builder interface, is in this format: button, (value1, value2, ...) Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + button, (filename, folder1, folder2, should_overwrite) = window.LayoutAndRead(window_rows) Or, you can unpack the return results separately. - button, values = form.LayoutAndRead(form_rows) + button, values = window.LayoutAndRead(window_rows) filename, folder1, folder2, should_overwrite = values If you have a SINGLE value being returned, it is written this way: - button, (value1,) = form.LayoutAndRead(form_rows) + button, (value1,) = window.LayoutAndRead(window_rows) Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - button, value_list = form.LayoutAndRead(form_rows) + button, value_list = window.LayoutAndRead(window_rows) value1 = value_list[0] value2 = value_list[1] ... ### Return values as a dictionary -For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. +For windows longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. -The most common form read statement you'll encounter looks something like this: +The most common window read statement you'll encounter looks something like this: - button, values = form.LayoutAndRead(layout) + button, values = window.LayoutAndRead(layout) or - button, values = form.Read() + button, values = window.Read() All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. -If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. +If **any** element in the window has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -Let's take a look at your first dictionary-based form. +Let's take a look at your first dictionary-based window. import PySimpleGUI as sg - form = sg.Window('Simple data entry form') + window = sg.Window('Simple data entry window') layout = [ [sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], @@ -783,7 +784,7 @@ Let's take a look at your first dictionary-based form. [sg.Submit(), sg.Cancel()] ] - button, values = form.LayoutAndRead(layout) + button, values = window.LayoutAndRead(layout) sg.Popup(button, values, values['name'], values['address'], values['phone']) @@ -791,7 +792,7 @@ To get the value of an input field, you use whatever value used as the `key` val values['name'] -You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. +You will find the key field used quite heavily in most PySimpleGUI windows unless the window is very simple. ### Button Return Values @@ -800,20 +801,20 @@ The button value from a Read call will be one of 3 values: 2. The Button's key 3. None -If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the button value is None. None is returned when the user clicks the X to close a window. -If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: +If your window has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: while True: - button, values= form.Read() + button, values= window.Read() if button is None or button == 'Quit': break ## The Event Loop / Callback Functions -All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single window, collects the data and then executes the primary code of the program then you likely don't need an event loop. Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. @@ -831,11 +832,11 @@ This little program has a typical Event Loop [sg.RButton('Turn LED Off')], [sg.Exit()]] - form = sg.Window('Raspberry Pi).Layout(layout) + window = sg.Window('Raspberry Pi).Layout(layout) # ---- Event Loop ---- # while True: - button, values = form.Read() + button, values = window.Read() # ---- Process Button Clicks ---- # if button is None or button == 'Exit': @@ -850,7 +851,7 @@ This little program has a typical Event Loop -In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) +In the Event Loop we are reading the window and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. @@ -864,7 +865,7 @@ Whether or not this is a "proper" design for GUI programs can be debated. It's ## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. +This code utilizes as many of the elements in one window as possible. import PySimpleGUI as sg @@ -883,7 +884,7 @@ This code utilizes as many of the elements in one form as possible. layout = [ [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Frame(layout=[ @@ -904,52 +905,52 @@ This code utilizes as many of the elements in one form as possible. [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] + [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] ] - form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - button, values = form.Read() + button, values = window.Read() sg.Popup('Title', - 'The results of the form.', + 'The results of the window.', 'The button clicked was "{}"'.format(button), 'The values are', values) -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. +This is a somewhat complex window with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the window. ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) -Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. +Clicking the Submit button caused the window call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the window using something other than a button, then `button` will be `None`. -You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the Popup that the values returned are a list. Each input field in the window generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- -# Building Custom Forms +# Building Custom windows You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. +## Synchronous windows +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI window/dialog box. +You've already seen a number of examples above that use blocking windows. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking window. You can examine the show calls to be sure. If the window is a non-blocking window, it must indicate that in the call to `window.show`. -NON-BLOCKING form call: +NON-BLOCKING window call: - form.Show(non_blocking=True) + window.Show(non_blocking=True) -### Beginning a Form -The first step is to create the form object using the desired form customization. +### Beginning a window +The first step is to create the window object using the desired window customization. - with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as window: This is the definition of the Window object: @@ -976,39 +977,39 @@ This is the definition of the Window object: keep_on_top=False): -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `window` values. - default_element_size - Size of elements in form in characters (width, height) - default_button_element_size - Size of buttons on this form + default_element_size - Size of elements in window in characters (width, height) + default_button_element_size - Size of buttons on this window auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label location - (x,y) Location to place window in pixels - font - Font name and size for elements of the form + font - Font name and size for elements of the window button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background - is_tabbed_form - Bool. If True then form is a tabbed form + is_tabbed_form - Bool. If True then window is a tabbed window border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes + auto_close - Bool. If True window will autoclose + auto_close_duration - Duration in seconds before window closes icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus - text_justification - Justification to use for Text Elements in this form + text_justification - Justification to use for Text Elements in this window no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. #### Window Location -PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the window is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. The default Element size for PySimpleGUI is `(45,1)`. -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the window. Setting `size=(20,1)` in the window creation call will set all elements in the window to that size. There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. @@ -1028,17 +1029,17 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the window is a non-blocking window. -It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking window using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking window, simply get grab_anywhere = True when you create the window. #### Always on top -To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. ## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. +"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. Text Single Line Input @@ -1047,8 +1048,8 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Folder Browse Calendar picker Date Chooser - Read form - Close form + Read window + Close window Realtime Checkboxes Radio Buttons @@ -1065,7 +1066,7 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Image Table Async/Non-Blocking Windows - Tabbed forms + Tabbed windows Persistent Windows Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) @@ -1076,14 +1077,14 @@ key tooltip #### Tooltip -Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your window's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. ### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: +Building a window is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: layout = [ [row 1 element, row 1 element], [row 2 element, row 2 element, row 2 element] ] @@ -1168,14 +1169,14 @@ This Element doubles as both an input and output Element. The `DefaultText` opt . default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form + enter_submits - Bool. If True, pressing Enter key submits window size - Element's size auto_size_text - Bool. Change width to match size of text #### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. +Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. More on this later. - form.AddRow(gg.Output(size=(100,20))) + window.AddRow(gg.Output(size=(100,20))) ![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) @@ -1185,7 +1186,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. size - Size of element (width, height) in characters ### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + These make up the majority of the window definition. Optional variables at the Element level override the window level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. #### Text Input Element @@ -1212,7 +1213,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text - do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. + do_not_clear - Bool. Normally windows clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) @@ -1284,7 +1285,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values 'extended' 'multiple' 'single' - change_submits - if True, the form read will return with a button value of '' + change_submits - if True, the window read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length @@ -1297,7 +1298,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. -ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +ListBoxes can cause a window to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. #### Slider Element @@ -1426,7 +1427,7 @@ An up/down spinner control. The valid values are passed in as a list. ### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a window, whether it be Submit or Cancel, one way or another a button is involved in all windows. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse @@ -1434,16 +1435,16 @@ The Types of buttons include: * Files Browse * File SaveAs * File Save -* Close Form (normal button) -* Read Form +* Close window (normal button) +* Read window * Realtime * Calendar Chooser * Color Chooser - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. + Close window - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close window" buttons. They cause the input values to be read and then the window is ***closed***, returning the values to the caller. -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the window. File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. @@ -1451,18 +1452,18 @@ Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog -Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. +Read window - This is a window button that will read a snapshot of all of the input fields, but does not close the window after it's clicked. -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. +Realtime - This is another async window button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the window, and ReadForm buttons that keep the window open but returns control back to the caller. Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. -The 3 primary forms of PySimpleGUI buttons and their names are: +The 3 primary windows of PySimpleGUI buttons and their names are: 1. `Button` = `SimpleButton` - 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` + 2. `ReadButton` = `RButton` = `ReadFormButton` (old style... use ReadButton instead) 3. `RealtimeButton` You will find the long-form in the older programs. @@ -1536,7 +1537,7 @@ These Pre-made buttons are some of the most important elements of all because th #### Button targets -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the window. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target comes in two forms. 1. Key @@ -1552,7 +1553,7 @@ The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special valu If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. -Let's examine this form as an example: +Let's examine this window as an example: ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) @@ -1563,7 +1564,7 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (1,0) Target = (-1,0) -The code for the entire form could be: +The code for the entire window could be: layout = [[sg.T('Source Folder')], [sg.In()], @@ -1606,13 +1607,13 @@ These buttons pop up a standard color chooser window. The result is returned as **Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. +Not all buttons are created equal. A button that closes a window is different that a button that returns from the window without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the window when clicked. layout = [[sg.Button('My Button')]] ![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a window is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the window. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -1631,11 +1632,11 @@ Three parameters are used for button images. image_size - Size of image file in pixels image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 -Here's an example form made with button images. +Here's an example window made with button images. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player window sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) @@ -1649,13 +1650,13 @@ This is one you'll have to experiment with at this point. Not up for an exhaust ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". +This window has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". -Here is the code to make, show and get results from this form: +Here is the code to make, show and get results from this window: - form = sg.Window('Robotics Remote Control', auto_size_text=True) + window = sg.Window('Robotics Remote Control', auto_size_text=True) - form_rows = [[sg.Text('Robotics Remote Control')], + window_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], @@ -1663,39 +1664,39 @@ Here is the code to make, show and get results from this form: [sg.Quit(button_color=('black', 'orange'))] ] - form.LayoutAndRead(form_rows, non_blocking=True) + window.LayoutAndRead(window_rows, non_blocking=True) -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your window's buttons. while (True): # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is not None: sg.Print(button) if button == 'Quit' or values is None: break time.sleep(.01) -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `window.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) -This code produces a form where the Browse button only shows files of type .TXT +This code produces a window where the Browse button only shows files of type .TXT layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. + The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window. -The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right. --- #### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. +The `ProgressBar` element is used to build custom Progress Bar windows. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the windows have to be non-blocking and they are tricky to debug. The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen OneLineProgressMeter calls presented earlier in this readme. @@ -1704,33 +1705,33 @@ You've already seen OneLineProgressMeter calls presented earlier in this readme. The return value for `OneLineProgressMeter` is: `True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +`False` if user clicked the Cancel button, closed the window, or vale reached the max value. -#### Progress Mater in Your Form -Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +#### Progress Mater in Your window +Another way of using a Progress Meter with PySimpleGUI is to build a custom window with a `ProgressBar` Element in the window. You will need to run your window as a non-blocking window. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) import PySimpleGUI as sg - # layout the form + # layout the window layout = [[sg.Text('A custom progress meter')], [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], [sg.Cancel()]] - # create the form` - form = sg.Window('Custom Progress Meter').Layout(layout) - progress_bar = form.FindElement('progressbar') + # create the window` + window = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = window.FindElement('progressbar') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm()) + window.CloseNonBlocking()) #### Output @@ -1738,11 +1739,11 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Output(size=(None, None)) -Here's a complete solution for a chat-window using an Async form with an Output Element +Here's a complete solution for a chat-window using an Async window with an Output Element import PySimpleGUI as sg - # Blocking form that doesn't close + # Blocking window that doesn't close def ChatBot(): layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], [sg.Output(size=(80, 20))], @@ -1750,11 +1751,11 @@ Here's a complete solution for a chat-window using an Async form with an Output sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + window = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: - button, value = form.Read() + button, value = window.Read() if button == 'SEND': print(value) else: @@ -1764,9 +1765,9 @@ Here's a complete solution for a chat-window using an Async form with an Output ------------------- ## Columns -Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a window within a window. And, yes, you can have a Column within a Column if you want. -Columns are specified in exactly the same way as a form is, as a list of lists. +Columns are specified in exactly the same way as a window is, as a list of lists. def Column(layout - the list of rows that define the layout background_color - color of background @@ -1787,11 +1788,11 @@ This code produced the above window. import PySimpleGUI as sg # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # window has on row 1 a vertical slider followed by a COLUMN with 7 rows # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. + # Columns layouts look identical to window layouts, they are a list of lists of elements. - form = sg.Window('Columns') # blank form + window = sg.Window('Columns') # blank window # Column layout col = [[sg.Text('col Row 1')], @@ -1806,18 +1807,18 @@ This code produced the above window. [sg.In('Last input')], [sg.OK()]] - # Display the form and get values + # Display the window and get values # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) + # to collapse the window display and read down to a single line of code. + button, values = sg.Window('Compact 1-line window with column').LayoutAndRead(layout) sg.Popup(button, values, line_width=200) -The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the window's background color, except it only affects the column rectangle. Column(layout, background_color=None) -The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. +The default background color for Columns is the same as the default window background color. If you change the look and feel of the window, the column background will match the window background automatically. @@ -1841,7 +1842,7 @@ Frames work exactly the same way as Columns. You create layout that is then use -This code creates a form with a Frame and 2 buttons. +This code creates a window with a Frame and 2 buttons. frame_layout = [ [sg.T('Text inside of a frame')], @@ -1852,14 +1853,14 @@ This code creates a form with a Frame and 2 buttons. [sg.Submit(), sg.Cancel()] ] - form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + window = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a window layout. A window works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. @@ -1881,29 +1882,29 @@ One such integration is with Matploplib and Pyplot. There is a Demo program wri The order of operations to obtain a tkinter Canvas Widget is: figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the form layout + # define the window layout layout = [[sg.Text('Plot test')], [sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - # create the form and show it without the plot - form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + # create the window and show it without the plot + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() # add the plot to the window - fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) + fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) # show it all again and get buttons - button, values = form.Read() + button, values = window.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: -* Add Canvas Element to your form -* Layout your form -* Call `form.Finalize()` - this is a critical step you must not forget +* Add Canvas Element to your window +* Layout your window +* Call `window.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas * Draw on your canvas to your heart's content -* Call `form.Read()` - Nothing will appear on your canvas until you call Read +* Call `window.Read()` - Nothing will appear on your canvas until you call Read See `Demo_Matplotlib.py` for a Recipe you can copy. @@ -1970,16 +1971,16 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format +## Tabbed windows +Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), (form2,layout2, 'Tab 2 label'), ...) -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` +Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: (button, (values)) @@ -1990,7 +1991,7 @@ Recall that values is a list as well. Multiple tabs in the form would return li ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. -Your forms can go from this: +Your windows can go from this: ![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) @@ -2002,9 +2003,9 @@ to this... with one function call... -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. +While you can do it on an element by element or window level basis, the easiest way, by far, is a call to `SetOptions`. -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. +Be aware that once you change these options they are changed for the rest of your program's execution. All of your windows will have that look and feel, until you change it to something else (which could be the system default colors. This call sets all of the different color options. @@ -2089,41 +2090,41 @@ Explanation of parameters tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: +These settings apply to all windows `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the window-level being the highest and the Element-level the lowest. Thus the levels are: - - Form level + - window level - Row level - Element level Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). -## Persistent Forms (Window stays open after button click) +## Persistent windows (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking windows (see the next section). The other way is to use buttons that 'read' the window instead of 'close' the window when clicked. The typical buttons you find in windows, including the shortcut buttons, close the window. These include OK, Cancel, Submit, etc. The Button Element also closes the window. -The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the window open and visible. This button is also used in Non-Blocking windows. The difference is in which call is made to read the window. The `Read` call will block, the `ReadNonBlocking` will not block. -## Asynchronous (Non-Blocking) Forms +## Asynchronous (Non-Blocking) windows So you want to be a wizard do ya? Well go boldly! -Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. +Use async windows sparingly. It's possible to have a window that appears to be async, but it is not. **Please** try to find other methods before going to async windows. The reason for this plea is that async windows poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. -When to use a non-blocking form: +When to use a non-blocking window: * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking window. ### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. -***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. +***Instead of polling, try options that cause the window to return to you.*** By using non-blocking windows, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. **Examples** @@ -2136,93 +2137,93 @@ One example is you have an input field that changes as you press buttons on an o ### Periodically Calling`ReadNonBlocking` -Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your windows will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking forms. -1. Read the form just as you would a normal form -2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values +There are 2 methods of interacting with non-blocking windows. +1. Read the window just as you would a normal window +2. "Refresh" the window's values without reading the window. It's a quick operation meant to show the user the latest values - With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + With asynchronous windows the window is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - #### Exiting a Non-Blocking Form + #### Exiting a Non-Blocking window -It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed windows in your code. It is possible for a window to look closed, but continue running your event loop. -Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. +Typically when reading a window you check `if Button is None` to determine if a window was closed. With NonBlocking windows, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking window is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: +The proper code to check if the user has exited the window will be a polling-loop that looks something like this: while True: - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if values is None or button == 'Quit': break -We're going to build an app that does the latter. It's going to update our form with a running clock. +We're going to build an app that does the latter. It's going to update our window with a running clock. The basic flow and functions you will be calling are: Setup - form = Window() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) + window = Window() + window_rows = ..... + window.LayoutAndRead(window_rows, non_blocking=True) Periodic refresh - form.ReadNonBlocking() or form.Refresh() + window.ReadNonBlocking() or window.Refresh() -If you need to close the form +If you need to close the window - form.CloseNonBlockingForm() + window.CloseNonBlocking() -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. +Rather than the usual `window.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the window. After the window is shown, you simply call `window.ReadNonBlocking()` every now and then. -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` +When you are ready to close the window (assuming the window wasn't closed by the user or a button click) you simply call `window.CloseNonBlocking()` **Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. +See the sample code on the GitHub named Demo Media Player for another example of Async windows. We're going to make a window and update one of the elements of that window every .01 seconds. Here's the entire code to do that. import PySimpleGUI as sg import time - # form that doesn't block - # Make a form, but don't use context manager - form = sg.Window('Running Timer', auto_size_text=True) + # window that doesn't block + # Make a window, but don't use context manager + window = sg.Window('Running Timer', auto_size_text=True) # Create the layout - form_rows = [[sg.Text('Non-blocking GUI with updates')], + window_rows = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], [sg.Button('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) + # Layout the rows of the window and perform a read. Indicate the window is non-blocking! + window.LayoutAndRead(window_rows, non_blocking=True) # # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or + # You need to perform a ReadNonBlocking on your window every now and then or # else it won't refresh # for i in range(1, 1000): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = window.ReadNonBlocking() if values is None or button == 'Quit': break time.sleep(.01) else: - form.CloseNonBlockingForm() + window.CloseNonBlocking() -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. +What we have here is the same sequence of function calls as in the description. Get a window, add rows to it, show the window, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the window. The new value will be displayed when `window.ReadNonBlocking()` is called. if you want to have the window reflect your changes immediately, call `window.Refresh()`. -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the window is still open. The user has not closed the window using the X nor a button so it's up to the caller to close the window using `CloseNonBlocking`. -## Updating Elements (changing elements in active form) +## Updating Elements (changing elements in active window) -Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). +Persistent windows remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. @@ -2235,7 +2236,7 @@ In some programs these updates happen in response to another Element. This prog - # Testing async form, see if can have a slider + # Testing async window, see if can have a slider # that adjusts the size of text displayed import PySimpleGUI as sg @@ -2246,10 +2247,10 @@ In some programs these updates happen in response to another Element. This prog sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize - form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) + window = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop while True: - button, values= form.Read() + button, values= window.Read() if button is None: break sz_spin = int(values['spin']) @@ -2258,9 +2259,9 @@ In some programs these updates happen in response to another Element. This prog if sz != fontSize: fontSize = sz font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) print("Done.") @@ -2270,18 +2271,18 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) -Remember this design pattern because you will use it OFTEN if you use persistent forms. +Remember this design pattern because you will use it OFTEN if you use persistent windows. -It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: +It works as follows. The call to `window.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: - text_element = form.FindElement('text') + text_element = window.FindElement('text') text_element.Update(font=font) -The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the window and also to identify elements. As already mentioned, they are used as targets in Button calls. @@ -2303,16 +2304,16 @@ Key Sym is a string such as 'Control_L'. The Key Code is a numeric representati # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" - with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], [sg.Button("OK")]] - form.Layout(layout) + window.Layout(layout) # ---===--- Loop taking in user input --- # while True: - button, value = form.ReadNonBlocking() + button, value = window.ReadNonBlocking() if button == "OK" or (button is None and value is None): print(button, "exiting") @@ -2327,14 +2328,14 @@ Use realtime keyboard capture by calling import PySimpleGUI as sg - with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: layout = [[sg.Text("Hold down a key")], [sg.Button("OK")]] - form.Layout(layout) + window.Layout(layout) while True: - button, value = form.ReadNonBlocking() + button, value = window.ReadNonBlocking() if button == "OK": print(button, value, "exiting") @@ -2346,7 +2347,7 @@ Use realtime keyboard capture by calling ## Menus -Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. +Beginning in version 3.01 you can add a menubar to your window. You specify the menus in much the same way as you do window layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your window.Read returns. Hopefully will not be a problem. This definition: @@ -2367,7 +2368,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the window changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2378,7 +2379,7 @@ We have an InputText field that we want to update. When the Element was created To update or change the value for that Input Element, we use this construct: - form.FindElement('input').Update('new text') + window.FindElement('input').Update('new text') Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. @@ -2401,22 +2402,22 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify | Source File| Description | |--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single window |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form +|**Demo_Canvas.py** | window with a Canvas Element that is updated outside of the window |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project |**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex forms +|**Demo_Columns.py** | Using the Column Element to create more complex windows |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format -**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your window +|**Demo_DisplayHash1and256.py** | Using high level API and custom window to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter -|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a window. Saving and loading a window from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements |**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them |**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors @@ -2429,9 +2430,9 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph |**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method +|**Demo_Media_Player.py** | Non-blocking window with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_NonBlocking_Form.py** | a basic async window |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate @@ -2444,7 +2445,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables -|**Demo_Timer.py** | Simple non-blocking form +|**Demo_Timer.py** | Simple non-blocking window ## Packages Used In Demos @@ -2553,7 +2554,7 @@ While not an "issue" this is a ***stern warning*** **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X -**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. +**Async windows** - these include the 'easy' windows (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async windows open with normal windows then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank window. **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. @@ -2681,9 +2682,6 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Renamed FlexForm to Window * Removed LookAndFeel capability from Mac platform. -#### 3.6.1 -* Forgot Readme update in 3.6.0 - ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index 69009ef39..812257a8e 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,6 @@ - + + ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) @@ -8,7 +9,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.2-red.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -54,7 +55,7 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized forms that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) @@ -95,7 +96,7 @@ Combining PySimpleGUI with PyInstaller creates something truly remarkable and sp ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? -There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own forms using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. +There are a number of 'easy to use' Python GUIs, but they were too limited for my requirements. PySimpleGUI aims for the same simplicity found in packages like `EasyGUI`and `WxSimpleGUI` , both really handy but limited, and adds the ability to define your own layouts. This ability to make your own windows using a large palette of widgets is but one difference between the existing "simple" packages and `PySimpleGUI`. With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. @@ -121,7 +122,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Folder Browse SaveAs Non-closing return - Close form + Close window Realtime Calendar chooser Color chooser @@ -137,7 +138,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Scroll-able Output Images Progress Bar Async/Non-Blocking Windows - Tabbed forms + Tabbed windows Persistent Windows Redirect Python Output/Errors to scrolling window 'Higher level' APIs (e.g. MessageBox, YesNobox, ...) @@ -148,15 +149,15 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Return values as dictionary Set focus Bind return key to buttons - Group widgets into a column and place into form anywhere + Group widgets into a column and place into window anywhere Scrollable columns Keyboard low-level key capture Mouse scroll-wheel support Get Listbox values as they are selected Get slider, spinner, combo as they are changed - Update elements in a live form - Bulk form-fill operation - Save / Load form to/from disk + Update elements in a live window + Bulk window-fill operation + Save / Load window to/from disk Borderless (no titlebar) windows Always on top windows Menus @@ -165,7 +166,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad No async programming required (no callbacks to worry about) -An example of many widgets used on a single form. A little further down you'll find the 21 lines of code required to create this complex form. Try it if you don't believe it. Install PySimpleGUI then : +An example of many widgets used on a single window. A little further down you'll find the 21 lines of code required to create this complex window. Try it if you don't believe it. Install PySimpleGUI then : >Start Python, copy and paste the code below into the >>> prompt and hit enter. This will pop up... > @@ -176,7 +177,7 @@ An example of many widgets used on a single form. A little further down you'll import PySimpleGUI as sg - layout = [[sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], + layout = [[sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25), text_color='blue')], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText()], [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], @@ -211,8 +212,8 @@ An example of many widgets used on a single form. A little further down you'll Be Pythonic... Attempted to use language constructs in a natural way and to exploit some of Python's interesting features. Python's lists and optional parameters make PySimpleGUI work smoothly. - - Forms are represented as Python lists. - - A form is a list of rows + - windows are represented as Python lists. + - A window is a list of rows - A row is a list of elements - Return values are a list of button presses and input values. - Return values can also be represented as a dictionary @@ -281,21 +282,21 @@ If you wish to create an EXE from your PySimpleGUI application, you will need to To use in your code, simply import.... `import PySimpleGUI as sg` -Then use either "high level" API calls or build your own forms. +Then use either "high level" API calls or build your own windows. sg.Popup('This is my first Popup') ![first popup](https://user-images.githubusercontent.com/13696193/44957300-c7813680-ae9e-11e8-9a8c-c70198db7907.jpg) -Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom form appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. --- ## APIs PySimpleGUI can be broken down into 2 types of API's: * High Level single call functions (The `Popup` calls) - * Custom form functions + * Custom window functions ### Python Language Features @@ -319,7 +320,7 @@ Each new item begins on a new line in the Popup #### Optional Parameters to a Function Call -This feature of the Python language is utilized ***heavily*** as a method of customizing forms and form Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. +This feature of the Python language is utilized ***heavily*** as a method of customizing windows and window Elements. Rather than requiring the programmer to specify every possible option for a widget, instead only the options the caller wants to override are specified. Here is the function definition for the Popup function. The details aren't important. What is important is seeing that there is a long list of potential tweaks that a caller can make. However, they don't *have* to be specified on each and every call. @@ -343,7 +344,7 @@ If the caller wanted to change the button color to be black on yellow, the call #### Dictionaries Dictionaries are used by more advanced PySimpleGUI users. You'll know that dictionaries are being used if you see a `key` parameter on any Element. Dictionaries are used in 2 ways: -1. To identify values when a form is read +1. To identify values when a window is read 2. To identify Elements so that they can be "updated" --- @@ -356,7 +357,7 @@ Dictionaries are used by more advanced PySimpleGUI users. You'll know that dict Think of the `Popup` call as the GUI equivalent of a `print` statement. It's your way of displaying results to a user in the windowed world. Each call to Popup will create a new Popup window. -`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking form of Popup discussed in the async section. +`Popup` calls are normally blocking. your program will stop executing until the user has closed the Popup window. A non-blocking window of Popup discussed in the async section. Just like a print statement, you can pass any number of arguments you wish. They will all be turned into strings and displayed in the popup window. @@ -441,7 +442,7 @@ There are Popup calls for single-item inputs. These follow the pattern of `Popup - `PopupGetFile` - get a filename - `PopupGetFolder` - get a folder name -Rather than make a custom form to get one data value, call the Popup input function to get the item from the user. +Rather than make a custom window to get one data value, call the Popup input function to get the item from the user. import PySimpleGUI as sg @@ -491,7 +492,7 @@ That line of code resulted in this window popping up and updating. ![preogress meter](https://user-images.githubusercontent.com/13696193/43667625-d47da702-9746-11e8-91e6-e5177883abae.jpg) A meter AND fun statistics to watch while your machine grinds away, all for the price of 1 line of code. -With a little trickery you can provide a way to break out of your loop using the Progress Meter form. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. +With a little trickery you can provide a way to break out of your loop using the Progress Meter window. The cancel button results in a `False` return value from `OneLineProgressMeter`. It normally returns `True`. ***Be sure and add one to your loop counter*** so that your counter goes from 1 to the max value. If you do not add one, your counter will never hit the max value. Instead it will go from 0 to max-1. @@ -524,20 +525,20 @@ A word of caution. There are known problems when multiple PySimpleGUI windows a You can change the size of the debug window using the `SetOptions` call with the `debug_win_size` parameter. --- -# Custom Form API Calls (Your First Form) +# Custom window API Calls (Your First window) This is the FUN part of the programming of this GUI. In order to really get the most out of the API, you should be using an IDE that supports auto complete or will show you the definition of the function. This will make customizing go smoother. -This first section on custom forms is for your typical, blocking, non-persistant form. By this I mean, when you "show" the form, the function will not return until the user has clicked a button or closed the window. When this happens, the form's window will be automatically closed. +This first section on custom windows is for your typical, blocking, non-persistant window. By this I mean, when you "show" the window, the function will not return until the user has clicked a button or closed the window. When this happens, the window will be automatically closed. -Two other types of forms exist. -1. Persistent form - rather than closing on button clicks, the show form function returns and the form continues to be visible. This is good for applications like a chat window. -2. Asynchronous form - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async forms are updated (refreshed) on a periodic basis. +Two other types of windows exist. +1. Persistent window - rather than closing on button clicks, the show window function returns and the window continues to be visible. This is good for applications like a chat window. +2. Asynchronous window - the trickiest of the lot. Great care must be exercised. Examples are an MP3 player or status dashboard. Async windows are updated (refreshed) on a periodic basis. It's both not enjoyable nor helpful to immediately jump into tweaking each and every little thing available to you. -## The Form Designer -The good news to newcomers to GUI programming is that PySimpleGUI has a form designer. Better yet, the form designer requires no training and everyone knows how to use it. +## The window Designer +The good news to newcomers to GUI programming is that PySimpleGUI has a window designer. Better yet, the window designer requires no training and everyone knows how to use it. ![gui0_1](https://user-images.githubusercontent.com/13696193/44159598-e2257400-a085-11e8-9b02-343e72cc75c3.JPG) @@ -595,12 +596,12 @@ Finally we can put it all together into a program that will display our window. sg.Popup(button, number) ### Example 2 - Get a filename -Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your form on paper, break it up into rows, label the elements. +Let's say you've got a utility you've written that operates on some input file and you're ready to use a GUI to enter than filename rather than the command line. Follow the same steps as the previous example - draw your window on paper, break it up into rows, label the elements. ![gui4_1](https://user-images.githubusercontent.com/13696193/44160132-6a584900-a087-11e8-862f-7d791a67ee5d.JPG) ![gui5_1](https://user-images.githubusercontent.com/13696193/44160133-6af0df80-a087-11e8-9dec-bb4d4c59393d.JPG) -Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the form on the paper. +Writing the code for this one is just as straightforward. There is one tricky thing, that browse for a file button. Thankfully PySimpleGUI takes care of associating it with the input field next to it. As a result, the code looks almost exactly like the window on the paper. import PySimpleGUI as sg @@ -613,57 +614,57 @@ Writing the code for this one is just as straightforward. There is one tricky t sg.Popup(button, number) -Read on for detailed instructions on the calls that show the form and return your results. +Read on for detailed instructions on the calls that show the window and return your results. # Copy these design patterns! -All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of form you're implementing. +All of your PySimpleGUI programs will utilize one of these 3 design patterns depending on the type of window you're implementing. -## Pattern 1 - Single read forms +## Pattern 1 - Single read windows -This is the most basic design pattern. Use this for forms that are shown to the user 1 time. The input values are gathered and returned to the program +This is the most basic design pattern. Use this for windows that are shown to the user 1 time. The input values are gathered and returned to the program - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - form = sg.Window('SHA-1 & 256 Hash') + window = sg.Window('SHA-1 & 256 Hash') - button, (source_filename,) = form.LayoutAndRead(form_rows) + button, (source_filename,) = window.LayoutAndRead(window_rows) ---- -## Pattern 2 - Single-read form "chained" +## Pattern 2 - Single-read window "chained" -Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a form is first obtained by calling Window and then that form is then read. It's possible to combine the creation of the form with the read. This design pattern does exactly that, chain together the form creation and the form reading. +Python has a ***beautiful*** way of compacting code known as "chaining". You take the output from one function and feed it as input to the next. Notice in the first example how a window is first obtained by calling Window and then that window is then read. It's possible to combine the creation of the window with the read. This design pattern does exactly that, chain together the window creation and the window reading. - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + window_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], [sg.InputText(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] - button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(form_rows) + button, (source_filename,) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(window_rows) -## Pattern 3 - Persistent form (multiple reads) +## Pattern 3 - Persistent window (multiple reads) -Some of the more advanced programs operate with the form remaining visible on the screen. Input values are collected, but rather than closing the form, it is kept visible acting as a way to both output information to the user and gather input data. +Some of the more advanced programs operate with the window remaining visible on the screen. Input values are collected, but rather than closing the window, it is kept visible acting as a way to both output information to the user and gather input data. -This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a form is created by calling Window which is then passed on to the Layout method. The Layout method returns the form value so that it can be stored and used later in the program to Read the form. +This is done by splitting the LayoutAndRead call apart into a Layout call and a Read call. Note how chaining is again used. In this case a window is created by calling Window which is then passed on to the Layout method. The Layout method returns the window value so that it can be stored and used later in the program to Read the window. import PySimpleGUI as sg - layout = [[sg.Text('Persistent form')], + layout = [[sg.Text('Persistent window')], [sg.RButton('Turn LED On')], [sg.RButton('Turn LED Off')], [sg.Exit()]] - form = sg.Window('Raspberry Pi GUI').Layout(layout) + window = sg.Window('Raspberry Pi GUI').Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is None: break @@ -672,7 +673,7 @@ This is done by splitting the LayoutAndRead call apart into a Layout call and a Why is Python such a great teaching language and yet no GUI framework exists that lends itself to the basic building blocks of Python, the list or dictionary? PySimpleGUI set out to be a Pythonic solution to the GUI problem. Whether it achieved this goal is debatable, but it was an attempt just the same. -The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a form or window. +The key to custom windows in PySimpleGUI is to view windows as ROWS of Elements. Each row is specified as a list of these Elements. Put the rows together and you've got a window. Let's dissect this little program @@ -683,15 +684,15 @@ The key to custom forms in PySimpleGUI is to view forms as ROWS of Elements. E [sg.Text('Source for Files ', size=(15, 1)), sg.InputText(), sg.FolderBrowse()], [sg.Submit(), sg.Cancel()]] - form = sg.Window('Rename Files or Folders') + window = sg.Window('Rename Files or Folders') - button, (folder_path, file_path) = form.LayoutAndRead(layout) + button, (folder_path, file_path) = window.LayoutAndRead(layout) ![snap0131](https://user-images.githubusercontent.com/13696193/43417007-df6d8408-9407-11e8-9986-30f0415f08a5.jpg) -Let's agree the form has 4 rows. +Let's agree the window has 4 rows. The first row only has **text** that reads `Rename files or folders` @@ -706,15 +707,15 @@ Now let's look at how those 2 rows and the other two row from Python code: See how the source code mirrors the layout? You simply make lists for each row, then submit that table to PySimpleGUI to show and get values from. -And what about those return values? Most people simply want to show a form, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my form's input values to be given to me. +And what about those return values? Most people simply want to show a window, get the input values and do something with them. So why break up the code into button callbacks, etc, when I simply want my window's input values to be given to me. -For return values the form is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. +For return values the window is scanned from top to bottom, left to right. Each field that's an input field will occupy a spot in the return values. -In our example form, there are 2 fields, so the return values from this form will be a list with 2 values in it. +In our example window, there are 2 fields, so the return values from this window will be a list with 2 values in it. - button, (folder_path, file_path) = form.LayoutAndRead(layout) + button, (folder_path, file_path) = window.LayoutAndRead(layout) -In the statement that shows and reads the form, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. +In the statement that shows and reads the window, the two input fields are directly assigned to the caller's variables `folder_path` and `file_path`, ready to use. No parsing no callbacks. Isn't this what almost every Python programmer looking for a GUI wants?? Something easy to work with to get the values and move on to the rest of the program, where the real action is taking place. Why write pages of GUI code when the same layout can be achieved with PySimpleGUI in 3 or 4 lines of code. 4 lines or 40? I chose 4. @@ -727,54 +728,54 @@ Isn't this what almost every Python programmer looking for a GUI wants?? Someth By default return values are a list of values, one entry for each input field. - Return information from Window, SG's primary form builder interface, is in this format: + Return information from Window, SG's primary window builder interface, is in this format: button, (value1, value2, ...) Each of the Elements that are Input Elements will have a value in the list of return values. You can unpack your GUI directly into the variables you want to use. - button, (filename, folder1, folder2, should_overwrite) = form.LayoutAndRead(form_rows) + button, (filename, folder1, folder2, should_overwrite) = window.LayoutAndRead(window_rows) Or, you can unpack the return results separately. - button, values = form.LayoutAndRead(form_rows) + button, values = window.LayoutAndRead(window_rows) filename, folder1, folder2, should_overwrite = values If you have a SINGLE value being returned, it is written this way: - button, (value1,) = form.LayoutAndRead(form_rows) + button, (value1,) = window.LayoutAndRead(window_rows) Another way of parsing the return values is to store the list of values into a variable representing the list of values and then index each individual value. This is not the preferred way of doing it. - button, value_list = form.LayoutAndRead(form_rows) + button, value_list = window.LayoutAndRead(window_rows) value1 = value_list[0] value2 = value_list[1] ... ### Return values as a dictionary -For forms longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. +For windows longer than 3 or 4 fields you will want to use a dictionary to help you organize your return values. In almost all (if not all) of the demo programs you'll find the return values being passed as a dictionary. It is not a difficult concept to grasp, the syntax is easy to understand, and it makes for very readable code. -The most common form read statement you'll encounter looks something like this: +The most common window read statement you'll encounter looks something like this: - button, values = form.LayoutAndRead(layout) + button, values = window.LayoutAndRead(layout) or - button, values = form.Read() + button, values = window.Read() All of your return values will be stored in the variable `values`. When using the dictionary return values, the `values` variable is a dictionary. To use a dictionary, you will need to: * Mark each input element you wish to be in the dictionary with the keyword `key`. -If **any** element in the form has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. +If **any** element in the window has a `key`, then **all** of the return values are returned via a dictionary. If some elements do not have a key, then they are numbered starting at zero. -Let's take a look at your first dictionary-based form. +Let's take a look at your first dictionary-based window. import PySimpleGUI as sg - form = sg.Window('Simple data entry form') + window = sg.Window('Simple data entry window') layout = [ [sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], @@ -783,7 +784,7 @@ Let's take a look at your first dictionary-based form. [sg.Submit(), sg.Cancel()] ] - button, values = form.LayoutAndRead(layout) + button, values = window.LayoutAndRead(layout) sg.Popup(button, values, values['name'], values['address'], values['phone']) @@ -791,7 +792,7 @@ To get the value of an input field, you use whatever value used as the `key` val values['name'] -You will find the key field used quite heavily in most PySimpleGUI forms unless the form is very simple. +You will find the key field used quite heavily in most PySimpleGUI windows unless the window is very simple. ### Button Return Values @@ -800,20 +801,20 @@ The button value from a Read call will be one of 3 values: 2. The Button's key 3. None -If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the form returned anyway, the button value is None. +If a button has a key set for it when it's created, then that key will be returned. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the button value is None. None is returned when the user clicks the X to close a window. -If your form has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: +If your window has an event loop where it is read over and over, remember to give your user an "out". You should always check for a None value and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop: while True: - button, values= form.Read() + button, values= window.Read() if button is None or button == 'Quit': break ## The Event Loop / Callback Functions -All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single form, collects the data and then executes the primary code of the program then you likely don't need an event loop. +All GUIs have one thing in common, an "event loop" or some kind. If your program shows a single window, collects the data and then executes the primary code of the program then you likely don't need an event loop. Event Loops are used in programs where the window ***stays open*** after button presses. The program processes button clicks and user input in a loop called the event loop. You often hear the term event loop when discussing embedded systems or on a Raspberry Pi. @@ -831,11 +832,11 @@ This little program has a typical Event Loop [sg.RButton('Turn LED Off')], [sg.Exit()]] - form = sg.Window('Raspberry Pi).Layout(layout) + window = sg.Window('Raspberry Pi).Layout(layout) # ---- Event Loop ---- # while True: - button, values = form.Read() + button, values = window.Read() # ---- Process Button Clicks ---- # if button is None or button == 'Exit': @@ -850,7 +851,7 @@ This little program has a typical Event Loop -In the Event Loop we are reading the form and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) +In the Event Loop we are reading the window and then doing a series of button compares to determine what to do based on the button that was clicks (value of `button` variable) The way buttons are presented to the caller in PySimpleGUI is ***not*** how *most* GUI frameworks handle button clicks. Most GUI frameworks, including tkinter, use ***callback*** functions, a function you define would be called when a button is clicked. This requires you to write code where data is shared. @@ -864,7 +865,7 @@ Whether or not this is a "proper" design for GUI programs can be debated. It's ## All Widgets / Elements -This code utilizes as many of the elements in one form as possible. +This code utilizes as many of the elements in one window as possible. import PySimpleGUI as sg @@ -883,7 +884,7 @@ This code utilizes as many of the elements in one form as possible. layout = [ [sg.Menu(menu_def, tearoff=True)], - [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], + [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Frame(layout=[ @@ -904,52 +905,52 @@ This code utilizes as many of the elements in one form as possible. [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] + [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] ] - form = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - button, values = form.Read() + button, values = window.Read() sg.Popup('Title', - 'The results of the form.', + 'The results of the window.', 'The button clicked was "{}"'.format(button), 'The values are', values) -This is a somewhat complex form with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the form. +This is a somewhat complex window with quite a bit of custom sizing to make things line up well. This is code you only have to write once. When looking at the code, remember that what you're seeing is a list of lists. Each row contains a list of Graphical Elements that are used to create the window. ![everything bagel](https://user-images.githubusercontent.com/13696193/45914128-87163800-be0e-11e8-9a83-7ee5960e88b9.jpg) -Clicking the Submit button caused the form call to return. The call to Popup resulted in this dialog box. +Clicking the Submit button caused the window call to return. The call to Popup resulted in this dialog box. ![everything bagel reseults](https://user-images.githubusercontent.com/13696193/45914129-87aece80-be0e-11e8-8aae-9a483a9ad4a6.jpg) -**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the form using something other than a button, then `button` will be `None`. +**`Note, button value can be None`**. The value for `button` will be the text that is displayed on the button element when it was created. If the user closed the window using something other than a button, then `button` will be `None`. -You can see in the Popup that the values returned are a list. Each input field in the form generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. +You can see in the Popup that the values returned are a list. Each input field in the window generates one item in the return values list. All input fields return a `string` except for Check Boxes and Radio Buttons. These return `bool`. --- -# Building Custom Forms +# Building Custom windows You will find it much easier to write code using PySimpleGUI if you use an IDE such as PyCharm. The features that show you documentation about the API call you are making will help you determine which settings you want to change, if any. In PyCharm, two commands are particularly helpful. Control-Q (when cursor is on function name) brings up a box with the function definition Control-P (when cursor inside function call "()") shows a list of parameters and their default values -## Synchronous Forms -The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI form/dialog box. -You've already seen a number of examples above that use blocking forms. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking form. You can examine the show calls to be sure. If the form is a non-blocking form, it must indicate that in the call to `form.show`. +## Synchronous windows +The most common use of PySimpleGUI is to display and collect information from the user. The most straightforward way to do this is using a "blocking" GUI call. Execution is "blocked" while waiting for the user to close the GUI window/dialog box. +You've already seen a number of examples above that use blocking windows. Anytime you see a context manager used (see the `with` statement) it's most likely a blocking window. You can examine the show calls to be sure. If the window is a non-blocking window, it must indicate that in the call to `window.show`. -NON-BLOCKING form call: +NON-BLOCKING window call: - form.Show(non_blocking=True) + window.Show(non_blocking=True) -### Beginning a Form -The first step is to create the form object using the desired form customization. +### Beginning a window +The first step is to create the window object using the desired window customization. - with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as form: + with Window('Everything bagel', auto_size_text=True, default_element_size=(30,1)) as window: This is the definition of the Window object: @@ -976,39 +977,39 @@ This is the definition of the Window object: keep_on_top=False): -Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `Form` values. +Parameter Descriptions. You will find these same parameters specified for each `Element` and some of them in `Row` specifications. The `Element` specified value will take precedence over the `Row` and `window` values. - default_element_size - Size of elements in form in characters (width, height) - default_button_element_size - Size of buttons on this form + default_element_size - Size of elements in window in characters (width, height) + default_button_element_size - Size of buttons on this window auto_size_text - Bool. True if elements should size themselves according to contents. Defaults to True auto_size_buttons - Bool. True if button elements should size themselves according to their text label location - (x,y) Location to place window in pixels - font - Font name and size for elements of the form + font - Font name and size for elements of the window button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background - is_tabbed_form - Bool. If True then form is a tabbed form + is_tabbed_form - Bool. If True then window is a tabbed window border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. - auto_close - Bool. If True form will autoclose - auto_close_duration - Duration in seconds before form closes + auto_close - Bool. If True window will autoclose + auto_close_duration - Duration in seconds before window closes icon - .ICO file that will appear on the Task Bar and end of Title Bar return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus - text_justification - Justification to use for Text Elements in this form + text_justification - Justification to use for Text Elements in this window no_titlebar - Create window without a titlebar grab_anywhere - Grab any location on the window to move the window keep_on_top - if True then window will always stop on top of other windows on the screen. Great for floating toolbars. #### Window Location -PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the form is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. +PySimpleGUI computes the exact center of your window and centers the window on the screen. If you want to locate your window elsewhere, such as the system default of (0,0), if you have 2 ways of doing this. The first is when the window is created. Use the `location` parameter to set where the window. The second way of doing this is to use the `SetOptions` call which will set the default window location for all windows in the future. #### Sizes Note several variables that deal with "size". Element sizes are measured in characters. A Text Element with a size of 20,1 has a size of 20 characters wide by 1 character tall. The default Element size for PySimpleGUI is `(45,1)`. -Sizes can be set at the element level, or in this case, the size variables apply to all elements in the form. Setting `size=(20,1)` in the form creation call will set all elements in the form to that size. +Sizes can be set at the element level, or in this case, the size variables apply to all elements in the window. Setting `size=(20,1)` in the window creation call will set all elements in the window to that size. There are a couple of widgets where one of the size values is in pixels rather than characters. This is true for Progress Meters and Sliders. The second parameter is the 'height' in pixels. @@ -1028,17 +1029,17 @@ Windows without a titlebar can be used to easily create a floating launcher. #### Grab Anywhere -This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the form is a non-blocking form. +This is a feature unique to PySimpleGUI. The default is ENABLED.... unless the window is a non-blocking window. -It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking form using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking form, simply get grab_anywhere = True when you create the form. +It is turned off for non-blocking because there is a warning message printed out if the user closes a non-blocking window using a button with grab_anywhere enabled. There is no harm in these messages, but it may be distressing to the user. Should you wish to enable for a non-blocking window, simply get grab_anywhere = True when you create the window. #### Always on top -To keep a window on top of all other windows on the screen, set keep_on_top = True when the form is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. ## Elements -"Elements" are the building blocks used to create forms. Some GUI APIs use the term "Widget" to describe these graphic elements. +"Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. Text Single Line Input @@ -1047,8 +1048,8 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Folder Browse Calendar picker Date Chooser - Read form - Close form + Read window + Close window Realtime Checkboxes Radio Buttons @@ -1065,7 +1066,7 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Image Table Async/Non-Blocking Windows - Tabbed forms + Tabbed windows Persistent Windows Redirect Python Output/Errors to scrolling Window "Higher level" APIs (e.g. MessageBox, YesNobox, ...) @@ -1076,14 +1077,14 @@ key tooltip #### Tooltip -Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your form's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. +Tooltips are text boxes that popup next to an element if you hold your mouse over the top of it. If you want to be extra kind to your window's user, then you can create tooltips for them by setting the parameter `tooltip` to some text string. You will need to supply your own line breaks / text wrapping. If you don't want to manually add them, then take a look at the standard library package `textwrap`. Tooltips are one of those "polish" items that really dress-up a GUI and show's a level of sophistication. Go ahead, impress people, throw some tooltips into your GUI. ### Output Elements -Building a form is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: +Building a window is simply making lists of Elements. Each list is a row in the overall GUI dialog box. The definition looks something like this: layout = [ [row 1 element, row 1 element], [row 2 element, row 2 element, row 2 element] ] @@ -1168,14 +1169,14 @@ This Element doubles as both an input and output Element. The `DefaultText` opt . default_text - Text to display in the text box - enter_submits - Bool. If True, pressing Enter key submits form + enter_submits - Bool. If True, pressing Enter key submits window size - Element's size auto_size_text - Bool. Change width to match size of text #### Output Element -Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. More on this later. +Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. More on this later. - form.AddRow(gg.Output(size=(100,20))) + window.AddRow(gg.Output(size=(100,20))) ![output](https://user-images.githubusercontent.com/13696193/44959863-b72f8280-aec3-11e8-8caa-7bc743149953.jpg) @@ -1185,7 +1186,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. size - Size of element (width, height) in characters ### Input Elements - These make up the majority of the form definition. Optional variables at the Element level override the Form level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. + These make up the majority of the window definition. Optional variables at the Element level override the window level values (e.g. `size` is specified in the Element). All input Elements create an entry in the list of return values. A Text Input Element creates a string in the list of items returned. #### Text Input Element @@ -1212,7 +1213,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async forms. password_char - Character that will be used to replace each entered character. Setting to a value indicates this field is a password entry field background_color - color to use for the input field background text_color - color to use for the typed text - do_not_clear - Bool. Normally forms clear when read, turn off clearing with this flag. + do_not_clear - Bool. Normally windows clear when read, turn off clearing with this flag. key = Dictionary key to use for return values focus = Bool. True if this field should capture the focus (moves cursor to this field) @@ -1284,7 +1285,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values 'extended' 'multiple' 'single' - change_submits - if True, the form read will return with a button value of '' + change_submits - if True, the window read will return with a button value of '' bind_return_key - if the focus is on the listbox and the user presses return key, or if the user double clicks an item, then the read will return size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length @@ -1297,7 +1298,7 @@ The standard listbox like you'll find in most GUIs. Note that the return values The `select_mode` option can be a string or a constant value defined as a variable. Generally speaking strings are used for these kinds of options. -ListBoxes can cause a form to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. +ListBoxes can cause a window to return from a Read call. If the flag change_submits is set, then when a user makes a selection, the Read immediately returns. Another way ListBoxes can cause Reads to return is if the flag bind_return_key is set. If True, then if the user presses the return key while an entry is selected, then the Read returns. Also, if this flag is set, if the user double-clicks an entry it will return from the Read. #### Slider Element @@ -1426,7 +1427,7 @@ An up/down spinner control. The valid values are passed in as a list. ### Button Element -Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a form, whether it be Submit or Cancel, one way or another a button is involved in all forms. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. +Buttons are the most important element of all! They cause the majority of the action to happen. After all, it's a button press that will get you out of a window, whether it be Submit or Cancel, one way or another a button is involved in all windows. The only exception is to this is when the user closes the window using the "X" in the upper corner which means no button was involved. The Types of buttons include: * Folder Browse @@ -1434,16 +1435,16 @@ The Types of buttons include: * Files Browse * File SaveAs * File Save -* Close Form (normal button) -* Read Form +* Close window (normal button) +* Read window * Realtime * Calendar Chooser * Color Chooser - Close Form - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close Form" buttons. They cause the input values to be read and then the form is ***closed***, returning the values to the caller. + Close window - Normal buttons like Submit, Cancel, Yes, No, etc, are "Close window" buttons. They cause the input values to be read and then the window is ***closed***, returning the values to the caller. -Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the form. +Folder Browse - When clicked a folder browse dialog box is opened. The results of the Folder Browse dialog box are written into one of the input fields of the window. File Browse - Same as the Folder Browse except rather than choosing a folder, a single file is chosen. @@ -1451,18 +1452,18 @@ Calendar Chooser - Opens a graphical calendar to select a date. Color Chooser - Opens a color chooser dialog -Read Form - This is a form button that will read a snapshot of all of the input fields, but does not close the form after it's clicked. +Read window - This is a window button that will read a snapshot of all of the input fields, but does not close the window after it's clicked. -Realtime - This is another async form button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. +Realtime - This is another async window button. Normal button clicks occur after a button's click is released. Realtime buttons report a click the entire time the button is held down. -Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the form, and ReadForm buttons that keep the window open but returns control back to the caller. +Most programs will use a combination of shortcut button calls (Submit, Cancel, etc), plain buttons that close the window, and ReadForm buttons that keep the window open but returns control back to the caller. Sometimes there are multiple names for the same function. This is simply to make the job of the programmer quicker and easier. -The 3 primary forms of PySimpleGUI buttons and their names are: +The 3 primary windows of PySimpleGUI buttons and their names are: 1. `Button` = `SimpleButton` - 2. `ReadFormButton` = `ReadButton` = `RFButton` = `RButton` + 2. `ReadButton` = `RButton` = `ReadFormButton` (old style... use ReadButton instead) 3. `RealtimeButton` You will find the long-form in the older programs. @@ -1536,7 +1537,7 @@ These Pre-made buttons are some of the most important elements of all because th #### Button targets -The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the form. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. +The `FileBrowse`, `FolderBrowse`, `FileSaveAs` , `FilesSaveAs`, `CalendarButton`, `ColorChooserButton` buttons all fill-in values into another element located on the window. The target can be a Text Element or an InputText Element. The location of the element is specified by the `target` variable in the function call. The Target comes in two forms. 1. Key @@ -1552,7 +1553,7 @@ The default value for `target` is `(ThisRow, -1)`. `ThisRow` is a special valu If a value of `(None, None)` is chosen for the target, then the button itself will hold the information. Later the button can be queried for the value by using the button's key. -Let's examine this form as an example: +Let's examine this window as an example: ![file browse](https://user-images.githubusercontent.com/13696193/44959944-d1b62b80-aec4-11e8-8a68-9d79d37b2c81.jpg) @@ -1563,7 +1564,7 @@ The `InputText` element is located at (1,0)... row 1, column 0. The `Browse` bu Target = (1,0) Target = (-1,0) -The code for the entire form could be: +The code for the entire window could be: layout = [[sg.T('Source Folder')], [sg.In()], @@ -1606,13 +1607,13 @@ These buttons pop up a standard color chooser window. The result is returned as **Custom Buttons** -Not all buttons are created equal. A button that closes a form is different that a button that returns from the form without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the form when clicked. +Not all buttons are created equal. A button that closes a window is different that a button that returns from the window without closing it. If you want to define your own button, you will generally do this with the Button Element `Button`, which closes the window when clicked. layout = [[sg.Button('My Button')]] ![button](https://user-images.githubusercontent.com/13696193/44959862-b696ec00-aec3-11e8-9e88-4b9af0338a03.jpg) -All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a form is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the form. Instead they bring up a file or folder browser dialog box. +All buttons can have their text changed by changing the `button_text` variable in the button call. It is this text that is returned when a window is read. This text will be what tells you which button is called so make it unique. Most of the convenience buttons (Submit, Cancel, Yes, etc) are all Buttons. Some that are not are `FileBrowse` , `FolderBrowse`, `FileSaveAs`. They clearly do not close the window. Instead they bring up a file or folder browser dialog box. **Button Images** Now this is an exciting feature not found in many simplified packages.... images on buttons! You can make a pretty spiffy user interface with the help of a few button images. @@ -1631,11 +1632,11 @@ Three parameters are used for button images. image_size - Size of image file in pixels image_subsample - Amount to divide the size by. 2 means your image will be 1/2 the size. 3 means 1/3 -Here's an example form made with button images. +Here's an example window made with button images. ![media file player](https://user-images.githubusercontent.com/13696193/43161977-9ee7cace-8f57-11e8-8ff8-3ea24b69dab9.jpg) -You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player form +You'll find the source code in the file Demo Media Player. Here is what the button calls look like to create media player window sg.RButton('Pause', button_color=sg.TRANSPARENT_BUTTON, image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0) @@ -1649,13 +1650,13 @@ This is one you'll have to experiment with at this point. Not up for an exhaust ![robot remote](https://user-images.githubusercontent.com/13696193/44959958-ff9b7000-aec4-11e8-99ea-7450926409be.jpg) -This form has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". +This window has 2 button types. There's the normal "Simple Button" (Quit) and 4 "Realtime Buttons". -Here is the code to make, show and get results from this form: +Here is the code to make, show and get results from this window: - form = sg.Window('Robotics Remote Control', auto_size_text=True) + window = sg.Window('Robotics Remote Control', auto_size_text=True) - form_rows = [[sg.Text('Robotics Remote Control')], + window_rows = [[sg.Text('Robotics Remote Control')], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], @@ -1663,39 +1664,39 @@ Here is the code to make, show and get results from this form: [sg.Quit(button_color=('black', 'orange'))] ] - form.LayoutAndRead(form_rows, non_blocking=True) + window.LayoutAndRead(window_rows, non_blocking=True) -Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your form's buttons. +Somewhere later in your code will be your main event loop. This is where you do your polling of devices, do input/output, etc. It's here that you will read your window's buttons. while (True): # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is not None: sg.Print(button) if button == 'Quit' or values is None: break time.sleep(.01) -This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `form.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. +This loop will read button values and print them. When one of the Realtime buttons is clicked, the call to `window.ReadNonBlocking` will return a button name matching the name on the button that was depressed. It will continue to return values as long as the button remains depressed. Once released, the ReadNonBlocking will return None for buttons until a button is again clicked. **File Types** The `FileBrowse` & `SaveAs` buttons have an additional setting named `file_types`. This variable is used to filter the files shown in the file dialog box. The default value for this setting is FileTypes=(("ALL Files", "*.*"),) -This code produces a form where the Browse button only shows files of type .TXT +This code produces a window where the Browse button only shows files of type .TXT layout = [[sg.In() ,sg.FileBrowse(file_types=(("Text Files", "*.txt"),))]] ***The ENTER key*** - The ENTER key is an important part of data entry for forms. There's a long tradition of the enter key being used to quickly submit forms. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a form. + The ENTER key is an important part of data entry for windows. There's a long tradition of the enter key being used to quickly submit windows. PySimpleGUI implements this by tying the ENTER key to the first button that closes or reads a window. -The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the form to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. -If there are more than 1 button on a form, the FIRST button that is of type Close Form or Read Form is used. First is determined by scanning the form, top to bottom and left to right. +The Enter Key can be "bound" to a particular button so that when the key is pressed, it causes the window to return as if the button was clicked. This is done using the `bind_return_key` parameter in the button calls. +If there are more than 1 button on a window, the FIRST button that is of type Close window or Read window is used. First is determined by scanning the window, top to bottom and left to right. --- #### ProgressBar -The `ProgressBar` element is used to build custom Progress Bar forms. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the forms have to be non-blocking and they are tricky to debug. +The `ProgressBar` element is used to build custom Progress Bar windows. It is HIGHLY recommended that you use OneLineProgressMeter that provides a complete progress meter solution for you. Progress Meters are not easy to work with because the windows have to be non-blocking and they are tricky to debug. The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen OneLineProgressMeter calls presented earlier in this readme. @@ -1704,33 +1705,33 @@ You've already seen OneLineProgressMeter calls presented earlier in this readme. The return value for `OneLineProgressMeter` is: `True` if meter updated correctly -`False` if user clicked the Cancel button, closed the form, or vale reached the max value. +`False` if user clicked the Cancel button, closed the window, or vale reached the max value. -#### Progress Mater in Your Form -Another way of using a Progress Meter with PySimpleGUI is to build a custom form with a `ProgressBar` Element in the form. You will need to run your form as a non-blocking form. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. +#### Progress Mater in Your window +Another way of using a Progress Meter with PySimpleGUI is to build a custom window with a `ProgressBar` Element in the window. You will need to run your window as a non-blocking window. When you are ready to update your progress bar, you call the `UpdateBar` method for the `ProgressBar` element itself. ![progress custom](https://user-images.githubusercontent.com/13696193/45243969-c3508100-b2c3-11e8-82bc-927d0307e093.jpg) import PySimpleGUI as sg - # layout the form + # layout the window layout = [[sg.Text('A custom progress meter')], [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progressbar')], [sg.Cancel()]] - # create the form` - form = sg.Window('Custom Progress Meter').Layout(layout) - progress_bar = form.FindElement('progressbar') + # create the window` + window = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = window.FindElement('progressbar') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm()) + window.CloseNonBlocking()) #### Output @@ -1738,11 +1739,11 @@ The Output Element is a re-direction of Stdout. Anything "printed" will be disp Output(size=(None, None)) -Here's a complete solution for a chat-window using an Async form with an Output Element +Here's a complete solution for a chat-window using an Async window with an Output Element import PySimpleGUI as sg - # Blocking form that doesn't close + # Blocking window that doesn't close def ChatBot(): layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], [sg.Output(size=(80, 20))], @@ -1750,11 +1751,11 @@ Here's a complete solution for a chat-window using an Async form with an Output sg.RButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] - form = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) + window = sg.Window('Chat Window', default_element_size=(30, 2)).Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: - button, value = form.Read() + button, value = window.Read() if button == 'SEND': print(value) else: @@ -1764,9 +1765,9 @@ Here's a complete solution for a chat-window using an Async form with an Output ------------------- ## Columns -Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a form within a form. And, yes, you can have a Column within a Column if you want. +Starting in version 2.9 you'll be able to do more complex layouts by using the Column Element. Think of a Column as a window within a window. And, yes, you can have a Column within a Column if you want. -Columns are specified in exactly the same way as a form is, as a list of lists. +Columns are specified in exactly the same way as a window is, as a list of lists. def Column(layout - the list of rows that define the layout background_color - color of background @@ -1787,11 +1788,11 @@ This code produced the above window. import PySimpleGUI as sg # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # window has on row 1 a vertical slider followed by a COLUMN with 7 rows # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. + # Columns layouts look identical to window layouts, they are a list of lists of elements. - form = sg.Window('Columns') # blank form + window = sg.Window('Columns') # blank window # Column layout col = [[sg.Text('col Row 1')], @@ -1806,18 +1807,18 @@ This code produced the above window. [sg.In('Last input')], [sg.OK()]] - # Display the form and get values + # Display the window and get values # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) + # to collapse the window display and read down to a single line of code. + button, values = sg.Window('Compact 1-line window with column').LayoutAndRead(layout) sg.Popup(button, values, line_width=200) -The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the form's background color, except it only affects the column rectangle. +The Column Element has 1 required parameter and 1 optional (the layout and the background color). Setting the background color has the same effect as setting the window's background color, except it only affects the column rectangle. Column(layout, background_color=None) -The default background color for Columns is the same as the default window background color. If you change the look and feel of the form, the column background will match the form background automatically. +The default background color for Columns is the same as the default window background color. If you change the look and feel of the window, the column background will match the window background automatically. @@ -1841,7 +1842,7 @@ Frames work exactly the same way as Columns. You create layout that is then use -This code creates a form with a Frame and 2 buttons. +This code creates a window with a Frame and 2 buttons. frame_layout = [ [sg.T('Text inside of a frame')], @@ -1852,14 +1853,14 @@ This code creates a form with a Frame and 2 buttons. [sg.Submit(), sg.Cancel()] ] - form = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) + window = sg.Window('Frame with buttons', font=("Helvetica", 12)).Layout(layout) ![frame element](https://user-images.githubusercontent.com/13696193/45889173-c2245700-bd8d-11e8-8f73-1e5f1be3ddb1.jpg) -Notice how the Frame layout looks identical to a form layout. A Form works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. +Notice how the Frame layout looks identical to a window layout. A window works exactly the same way as a Column and a Frame. They all are "container elements". Elements that contain other elements. *These container Elements can be nested as deep as you want.* That's a pretty spiffy feature, right? Took a lot of work so be appreciative. Recursive code isn't trivial. @@ -1881,29 +1882,29 @@ One such integration is with Matploplib and Pyplot. There is a Demo program wri The order of operations to obtain a tkinter Canvas Widget is: figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - # define the form layout + # define the window layout layout = [[sg.Text('Plot test')], [sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] - # create the form and show it without the plot - form = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + # create the window and show it without the plot + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() # add the plot to the window - fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) + fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) # show it all again and get buttons - button, values = form.Read() + button, values = window.Read() To get a tkinter Canvas Widget from PySimpleGUI, follow these steps: -* Add Canvas Element to your form -* Layout your form -* Call `form.Finalize()` - this is a critical step you must not forget +* Add Canvas Element to your window +* Layout your window +* Call `window.Finalize()` - this is a critical step you must not forget * Find the Canvas Element by looking up using key * Your Canvas Widget Object will be the found_element.TKCanvas * Draw on your canvas to your heart's content -* Call `form.Read()` - Nothing will appear on your canvas until you call Read +* Call `window.Read()` - Nothing will appear on your canvas until you call Read See `Demo_Matplotlib.py` for a Recipe you can copy. @@ -1970,16 +1971,16 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed Forms -Tabbed forms are shown using the `ShowTabbedForm` call. The call has the format +## Tabbed windows +Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format results = ShowTabbedForm('Title for the form', (form,layout,'Tab 1 label'), (form2,layout2, 'Tab 2 label'), ...) -Each of the tabs of the form is in fact a form. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` +Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal form. A single tab's values would be: +Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: (button, (values)) @@ -1990,7 +1991,7 @@ Recall that values is a list as well. Multiple tabs in the form would return li ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. -Your forms can go from this: +Your windows can go from this: ![snap0155](https://user-images.githubusercontent.com/13696193/43273879-a9fdc10a-90cb-11e8-8c20-4f6a244ebe2f.jpg) @@ -2002,9 +2003,9 @@ to this... with one function call... -While you can do it on an element by element or form level basis, the easiest way, by far, is a call to `SetOptions`. +While you can do it on an element by element or window level basis, the easiest way, by far, is a call to `SetOptions`. -Be aware that once you change these options they are changed for the rest of your program's execution. All of your forms will have that look and feel, until you change it to something else (which could be the system default colors. +Be aware that once you change these options they are changed for the rest of your program's execution. All of your windows will have that look and feel, until you change it to something else (which could be the system default colors. This call sets all of the different color options. @@ -2089,41 +2090,41 @@ Explanation of parameters tooltip_time - time in milliseconds to wait before showing a tooltip. Default is 400ms -These settings apply to all forms `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the Form-level being the highest and the Element-level the lowest. Thus the levels are: +These settings apply to all windows `SetOptions`. The Row options and Element options will take precedence over these settings. Settings can be thought of as levels of settings with the window-level being the highest and the Element-level the lowest. Thus the levels are: - - Form level + - window level - Row level - Element level Each lower level overrides the settings of the higher level. Once settings have been changed, they remain changed for the duration of the program (unless changed again). -## Persistent Forms (Window stays open after button click) +## Persistent windows (Window stays open after button click) -There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking forms (see the next section). The other way is to use buttons that 'read' the form instead of 'close' the form when clicked. The typical buttons you find in forms, including the shortcut buttons, close the form. These include OK, Cancel, Submit, etc. The Button Element also closes the form. +There are 2 ways to keep a window open after the user has clicked a button. One way is to use non-blocking windows (see the next section). The other way is to use buttons that 'read' the window instead of 'close' the window when clicked. The typical buttons you find in windows, including the shortcut buttons, close the window. These include OK, Cancel, Submit, etc. The Button Element also closes the window. -The `RButton` Element creates a button that when clicked will return control to the user, but will leave the form open and visible. This button is also used in Non-Blocking forms. The difference is in which call is made to read the form. The `Read` call will block, the `ReadNonBlocking` will not block. +The `RButton` Element creates a button that when clicked will return control to the user, but will leave the window open and visible. This button is also used in Non-Blocking windows. The difference is in which call is made to read the window. The `Read` call will block, the `ReadNonBlocking` will not block. -## Asynchronous (Non-Blocking) Forms +## Asynchronous (Non-Blocking) windows So you want to be a wizard do ya? Well go boldly! -Use async forms sparingly. It's possible to have a form that appears to be async, but it is not. **Please** try to find other methods before going to async forms. The reason for this plea is that async forms poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. +Use async windows sparingly. It's possible to have a window that appears to be async, but it is not. **Please** try to find other methods before going to async windows. The reason for this plea is that async windows poll tkinter over and over. If you do not have a sleep in your loop, you will eat up 100% of the CPU time. -When to use a non-blocking form: +When to use a non-blocking window: * A media file player like an MP3 player * A status dashboard that's periodically updated * Progress Meters - when you want to make your own progress meters * Output using print to a scrolled text element. Good for debugging. -If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking form. +If your application doesn't follow the basic design pattern at one of those, then it shouldn't be executed as a non-blocking window. ### Instead of ReadNonBlocking --- Use `change_submits = True` or return_keyboard_events = True Any time you are thinking "I want an X Element to cause a Y Element to do something", then you want to use the `change_submits` option. -***Instead of polling, try options that cause the form to return to you.*** By using non-blocking forms, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. +***Instead of polling, try options that cause the window to return to you.*** By using non-blocking windows, you are *polling*. You can indeed create your application by polling. It will work. But you're going to be maxing out your processor and may even take longer to react to an event than if you used another technique. **Examples** @@ -2136,93 +2137,93 @@ One example is you have an input field that changes as you press buttons on an o ### Periodically Calling`ReadNonBlocking` -Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your forms will feel. It is up to you to make these calls or your GUI will freeze. +Periodically "refreshing" the visible GUI. The longer you wait between updates to your GUI the more sluggish your windows will feel. It is up to you to make these calls or your GUI will freeze. -There are 2 methods of interacting with non-blocking forms. -1. Read the form just as you would a normal form -2. "Refresh" the form's values without reading the form. It's a quick operation meant to show the user the latest values +There are 2 methods of interacting with non-blocking windows. +1. Read the window just as you would a normal window +2. "Refresh" the window's values without reading the window. It's a quick operation meant to show the user the latest values - With asynchronous forms the form is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. + With asynchronous windows the window is shown, user input is read, but your code keeps right on chugging. YOUR responsibility is to call `PySimpleGUI.ReadNonBlocking` on a periodic basis. Once a second or more will produce a reasonably snappy GUI. - #### Exiting a Non-Blocking Form + #### Exiting a Non-Blocking window -It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed forms in your code. It is possible for a form to look closed, but continue running your event loop. +It's important to always provide a "way out" for your user. Make sure you have provided a button or some other mechanism to exit. Also be sure to check for closed windows in your code. It is possible for a window to look closed, but continue running your event loop. -Typically when reading a form you check `if Button is None` to determine if a form was closed. With NonBlocking forms, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking form is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. +Typically when reading a window you check `if Button is None` to determine if a window was closed. With NonBlocking windows, buttons will be None unless a button or a key was returned. The way you determine if a window was closed in a non-blocking window is to check **both** the button and the values are None. Since button is normally None, you only need to test for `value is None` in your code. -The proper code to check if the user has exited the form will be a polling-loop that looks something like this: +The proper code to check if the user has exited the window will be a polling-loop that looks something like this: while True: - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if values is None or button == 'Quit': break -We're going to build an app that does the latter. It's going to update our form with a running clock. +We're going to build an app that does the latter. It's going to update our window with a running clock. The basic flow and functions you will be calling are: Setup - form = Window() - form_rows = ..... - form.LayoutAndRead(form_rows, non_blocking=True) + window = Window() + window_rows = ..... + window.LayoutAndRead(window_rows, non_blocking=True) Periodic refresh - form.ReadNonBlocking() or form.Refresh() + window.ReadNonBlocking() or window.Refresh() -If you need to close the form +If you need to close the window - form.CloseNonBlockingForm() + window.CloseNonBlocking() -Rather than the usual `form.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the form. After the form is shown, you simply call `form.ReadNonBlocking()` every now and then. +Rather than the usual `window.LayoutAndRead()` call, we're manually adding the rows (doing the layout) and then showing the window. After the window is shown, you simply call `window.ReadNonBlocking()` every now and then. -When you are ready to close the form (assuming the form wasn't closed by the user or a button click) you simply call `form.CloseNonBlockingForm()` +When you are ready to close the window (assuming the window wasn't closed by the user or a button click) you simply call `window.CloseNonBlocking()` **Example - Running timer that updates** -See the sample code on the GitHub named Demo Media Player for another example of Async Forms. We're going to make a form and update one of the elements of that form every .01 seconds. Here's the entire code to do that. +See the sample code on the GitHub named Demo Media Player for another example of Async windows. We're going to make a window and update one of the elements of that window every .01 seconds. Here's the entire code to do that. import PySimpleGUI as sg import time - # form that doesn't block - # Make a form, but don't use context manager - form = sg.Window('Running Timer', auto_size_text=True) + # window that doesn't block + # Make a window, but don't use context manager + window = sg.Window('Running Timer', auto_size_text=True) # Create the layout - form_rows = [[sg.Text('Non-blocking GUI with updates')], + window_rows = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), key='output') ], [sg.Button('Quit')]] - # Layout the rows of the form and perform a read. Indicate the form is non-blocking! - form.LayoutAndRead(form_rows, non_blocking=True) + # Layout the rows of the window and perform a read. Indicate the window is non-blocking! + window.LayoutAndRead(window_rows, non_blocking=True) # # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or + # You need to perform a ReadNonBlocking on your window every now and then or # else it won't refresh # for i in range(1, 1000): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) - button, values = form.ReadNonBlocking() + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format(*divmod(int(i / 100), 60), i % 100)) + button, values = window.ReadNonBlocking() if values is None or button == 'Quit': break time.sleep(.01) else: - form.CloseNonBlockingForm() + window.CloseNonBlocking() -What we have here is the same sequence of function calls as in the description. Get a form, add rows to it, show the form, and then refresh it every now and then. +What we have here is the same sequence of function calls as in the description. Get a window, add rows to it, show the window, and then refresh it every now and then. -The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the form. The new value will be displayed when `form.ReadNonBlocking()` is called. if you want to have the form reflect your changes immediately, call `form.Refresh()`. +The new thing in this example is the call use of the Update method for the Text Element. The first thing we do inside the loop is "update" the text element that we made earlier. This changes the value of the text field on the window. The new value will be displayed when `window.ReadNonBlocking()` is called. if you want to have the window reflect your changes immediately, call `window.Refresh()`. -Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the form is still open. The user has not closed the form using the X nor a button so it's up to the caller to close the form using `CloseNonBlockingForm`. +Note the `else` statement on the for loop. This is needed because we're about to exit the loop while the window is still open. The user has not closed the window using the X nor a button so it's up to the caller to close the window using `CloseNonBlocking`. -## Updating Elements (changing elements in active form) +## Updating Elements (changing elements in active window) -Persistent forms remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). +Persistent windows remain open and thus continue to interact with the user after the Read has returned. Often the program wishes to communicate results (output information) or change an Element's values (such as populating a List Element). The way this is done is via an Update method that is available for nearly all of the Elements. Here is an example of a program that uses a persistent window that is updated. @@ -2235,7 +2236,7 @@ In some programs these updates happen in response to another Element. This prog - # Testing async form, see if can have a slider + # Testing async window, see if can have a slider # that adjusts the size of text displayed import PySimpleGUI as sg @@ -2246,10 +2247,10 @@ In some programs these updates happen in response to another Element. This prog sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize - form = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) + window = sg.Window("Font size selector", grab_anywhere=False).Layout(layout) # Event Loop while True: - button, values= form.Read() + button, values= window.Read() if button is None: break sz_spin = int(values['spin']) @@ -2258,9 +2259,9 @@ In some programs these updates happen in response to another Element. This prog if sz != fontSize: fontSize = sz font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) print("Done.") @@ -2270,18 +2271,18 @@ For example, `values['slider']` is the value of the Slider Element. This program changes all 3 elements if either the Slider or the Spinner changes. This is done with these statements: - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) -Remember this design pattern because you will use it OFTEN if you use persistent forms. +Remember this design pattern because you will use it OFTEN if you use persistent windows. -It works as follows. The call to `form.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: +It works as follows. The call to `window.FindElement` returns the Element object represented by they provided `key`. This element is then updated by calling it's `Update` method. This is another example of Python's "chaining" feature. We could write this code using the long-form: - text_element = form.FindElement('text') + text_element = window.FindElement('text') text_element.Update(font=font) -The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the form and also to identify elements. As already mentioned, they are used as targets in Button calls. +The takeaway from this exercise is that keys are key in PySimpleGUI's design. They are used to both read the values of the window and also to identify elements. As already mentioned, they are used as targets in Button calls. @@ -2303,16 +2304,16 @@ Key Sym is a string such as 'Control_L'. The Key Code is a numeric representati # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" - with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + with sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: text_elem = sg.Text("", size=(18,1)) layout = [[sg.Text("Press a key or scroll mouse")], [text_elem], [sg.Button("OK")]] - form.Layout(layout) + window.Layout(layout) # ---===--- Loop taking in user input --- # while True: - button, value = form.ReadNonBlocking() + button, value = window.ReadNonBlocking() if button == "OK" or (button is None and value is None): print(button, "exiting") @@ -2327,14 +2328,14 @@ Use realtime keyboard capture by calling import PySimpleGUI as sg - with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: + with sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as window: layout = [[sg.Text("Hold down a key")], [sg.Button("OK")]] - form.Layout(layout) + window.Layout(layout) while True: - button, value = form.ReadNonBlocking() + button, value = window.ReadNonBlocking() if button == "OK": print(button, value, "exiting") @@ -2346,7 +2347,7 @@ Use realtime keyboard capture by calling ## Menus -Beginning in version 3.01 you can add a menubar to your form/window. You specify the menus in much the same way as you do form layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your form.Read returns. Hopefully will not be a problem. +Beginning in version 3.01 you can add a menubar to your window. You specify the menus in much the same way as you do window layouts, with lists. Menu selections are returned as button clicks, so be aware of your overall naming conventions. If you have an Exit button and also an Exit menu option, then you won't be able to tell the difference when your window.Read returns. Hopefully will not be a problem. This definition: @@ -2367,7 +2368,7 @@ They menu_def layout produced this window: This is a somewhat advanced topic... -Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the form changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. +Typically you perform Element updates in response to events from other Elements. An example is that when you click a button some text on the window changes to red. You can change the Element's attributes, or at least some of them, and the Element's value. In some source code examples you will find an older techique for updating elements that did not involve keys. If you see a technique in the code that does not use keys, then know that there is a version using keys that is easier. @@ -2378,7 +2379,7 @@ We have an InputText field that we want to update. When the Element was created To update or change the value for that Input Element, we use this construct: - form.FindElement('input').Update('new text') + window.FindElement('input').Update('new text') Using the '.' makes the code shorter. The FindElement call returns an Element. We then call that Element's Update function. @@ -2401,22 +2402,22 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify | Source File| Description | |--|--| -|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single form +|**Demo_All_Widgets.py**| Nearly all of the Elements shown in a single window |**Demo_Borderless_Window.py**| Create clean looking windows with no border |**Demo_Button_States.py**| One way of implementing disabling of buttons |**Demo_Calendar.py** | Demo of the Calendar Chooser button -|**Demo_Canvas.py** | Form with a Canvas Element that is updated outside of the form +|**Demo_Canvas.py** | window with a Canvas Element that is updated outside of the window |**Demo_Chat.py** | A chat window with scrollable history |**Demo_Chatterbot.py** | Front-end to Chatterbot Machine Learning project |**Demo_Color.py** | How to interact with color using RGB hex values and named colors -|**Demo_Columns.py** | Using the Column Element to create more complex forms +|**Demo_Columns.py** | Using the Column Element to create more complex windows |**Demo_Compare_Files.py** | Using a simple GUI front-end to create a compare 2-files utility |**Demo_Cookbook_Browser.py** | Source code browser for all Recipes in Cookbook |**Demo_Dictionary.py** | Specifying and using return values in dictionary format -**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your form -|**Demo_DisplayHash1and256.py** | Using high level API and custom form to implement a simple display hash code utility +**Demo_DOC_Viewer_PIL.py** | Display a PDF, HTML, ebook file, etc in your window +|**Demo_DisplayHash1and256.py** | Using high level API and custom window to implement a simple display hash code utility |**Demo_DuplicateFileFinder.py** | High level API used to get a folder that is used by utility that finds duplicate files. Uses progress meter to show progress. 2 lines of code required to add GUI and meter -|**Demo_Fill_Form.py** | How to perform a bulk-fill for a form. Saving and loading a form from disk +|**Demo_Fill_Form.py** | How to perform a bulk-fill for a window. Saving and loading a window from disk |**Demo Font Sizer.py** | Demonstrates Elements updating other Elements |**Demo_Func_Callback_Simulator.py** | For the Raspberry Pi crowd. Event loop that simulates traditional GUI callback functions should you already have an architecture that uses them |**Demo_GoodColors.py** | Using some of the pre-defined PySimpleGUI individual colors @@ -2429,9 +2430,9 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Matplotlib_Animated.py** | Animated Matplotlib line graph |**Demo_Matplotlib_Animated_Scatter.py** | Animated Matplotlib scatter graph |**Demo_Matplotlib_Browser.py** | Browse Matplotlib gallery -|**Demo_Media_Player.py** | Non-blocking form with a media player layout. Demonstrates button graphics, Update method +|**Demo_Media_Player.py** | Non-blocking window with a media player layout. Demonstrates button graphics, Update method |**Demo_MIDI_Player.py** | GUI wrapper for Mido MIDI package. Functional MIDI player that controls attached MIDI devices -|**Demo_NonBlocking_Form.py** | a basic async form +|**Demo_NonBlocking_Form.py** | a basic async window |**Demo_OpenCV.py** | Integrated with OpenCV |**Demo_Password_Login** | Password protection using SHA1 |**Demo_PDF_Viewer.py** | Submitted by a user! Previews PDF documents. Uses keyboard input & mouse scrollwheel to navigate @@ -2444,7 +2445,7 @@ Use the example programs as a starting basis for your GUI. Copy, paste, modify |**Demo_Script_Parameters.py** | Add a 1-line GUI to the front of your previously command-line only scripts |**Demo_Tabbed_Form.py** | Using the Tab feature |**Demo_Table_Simulation.py** | Use input fields to display and edit tables -|**Demo_Timer.py** | Simple non-blocking form +|**Demo_Timer.py** | Simple non-blocking window ## Packages Used In Demos @@ -2553,7 +2554,7 @@ While not an "issue" this is a ***stern warning*** **Progress Meters** - the visual graphic portion of the meter may be off. May return to the native tkinter progress meter solution in the future. Right now a "custom" progress meter is used. On the bright side, the statistics shown are extremely accurate and can tell you something about the performance of your code. If you are running 2 or more progress meters at the same time using `OneLineProgressMeter`, you need to close the meter by using the "Cancel" button rather than the X -**Async Forms** - these include the 'easy' forms (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async forms open with normal forms then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank form. +**Async windows** - these include the 'easy' windows (`OneLineProgressMeter` and EasyPrint/Print). If you start overlapping having Async windows open with normal windows then things get a littler squirrelly. Still tracking down the issues and am making it more solid every day possible. You'll know there's an issue when you see blank window. **EasyPrint** - EasyPrint is a new feature that's pretty awesome. You print and the output goes to a window, with a scroll bar, that you can copy and paste from. Being a new feature, it's got some potential problems. There are known interaction problems with other GUI windows. For example, closing a Print window can also close other windows you have open. For now, don't close your debug print window until other windows are closed too. @@ -2681,9 +2682,6 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Renamed FlexForm to Window * Removed LookAndFeel capability from Mac platform. -#### 3.6.1 -* Forgot Readme update in 3.6.0 - ### Upcoming Make suggestions people! Future release features From 763ea6247933e6a460873db24de568095190c5b7 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 22:50:48 -0400 Subject: [PATCH 450/521] More removal of Form in favor of Window --- Demo_Dictionary.py | 18 ------------- docs/tutorial.md | 67 ++++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 50 deletions(-) delete mode 100644 Demo_Dictionary.py diff --git a/Demo_Dictionary.py b/Demo_Dictionary.py deleted file mode 100644 index 06d8c6e77..000000000 --- a/Demo_Dictionary.py +++ /dev/null @@ -1,18 +0,0 @@ -import PySimpleGUI as sg - -# THIS FILE REQUIRES VERSION 2.8 OF PySimpleGUI! - -form = sg.FlexForm('Simple data entry form') # begin with a blank form - -layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - -button, values = form.LayoutAndRead(layout) - -sg.Popup(button, values, values['name'], values['address'], values['phone']) - diff --git a/docs/tutorial.md b/docs/tutorial.md index cc3c2a676..7c62e9e2e 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,3 +1,5 @@ + + # Add GUIs to your programs and scripts easily with PySimpleGUI NOTE -- PySimpleGUI requires Python3. If you're running Python2, don't waste your time reading. @@ -35,7 +37,7 @@ Most GUIs do one thing.... they collect information from the user and return it. What's expected from most GUIs is the button that was clicked (OK, cancel, save, yes, no, etc), and the values that were input by the user. The essence of a GUI can be boiled down into a single line of code. -This is exactly how PySimpleGUI works (for these simple kinds of GUIs). When the call is made to display the GUI, execution does no return until a button is clicked that closes the form. +This is exactly how PySimpleGUI works (for these simple kinds of GUIs). When the call is made to display the GUI, execution does no return until a button is clicked that closes the window. There are more complex GUIs such as those that don't close after a button is clicked. These resemble a windows program and also be created with PySimpleGUI. A remote control interface for a robot and a chat window are a couple of examples where you want to keep the window open after a button is clicked. @@ -53,8 +55,7 @@ Let's look at the first recipe from the book import PySimpleGUI as sg - # Very basic form. Return values as a list - form = sg.FlexForm('Simple data entry form') # begin with a blank form + # Very basic window. Return values as a list layout = [ [sg.Text('Please enter your Name, Address, Phone')], @@ -64,12 +65,13 @@ Let's look at the first recipe from the book [sg.Submit(), sg.Cancel()] ] - button, values = form.LayoutAndRead(layout) + window = sg.Window('Simple data entry form').Layout(layout) + button, values = window.Read() print(button, values[0], values[1], values[2]) -It's a reasonably sized form. +It's a reasonably sized window. ![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) @@ -82,12 +84,11 @@ Not all GUIs take 5 minutes. Some take 5 lines of code. This is a GUI with a c import PySimpleGUI as sg - form = sg.FlexForm('My first GUI') - layout = [ [sg.Text('Enter your name'), sg.InputText()], [sg.OK()] ] - button, (name,) = form.LayoutAndRead(layout) + window = sg.Window('My first GUI').Layout(layout) + button, (name,) = window.Read() ![myfirstgui](https://user-images.githubusercontent.com/13696193/44315412-d2918c80-a3f1-11e8-9eda-0d5d9bfefb0f.jpg) @@ -107,8 +108,8 @@ Widgets are called Elements in PySimpleGUI. This list of Elements are spelled e Folder Browse Color chooser Date picker - Read Form - Close form + Read window + Close window Realtime Checkbox Radio Button @@ -124,7 +125,7 @@ Widgets are called Elements in PySimpleGUI. This list of Elements are spelled e Column Graph Table - Tabbed forms + Tabbed windows Redirected Python Output/Errors to scrolling Window ``` @@ -141,7 +142,7 @@ You can also have short-cut Elements. There are 2 types of shortcuts. One is s Drop = InputCombo OptionMenu = InputOptionMenu CB - CBox = Check = Checkbox - RButton = ReadButton = ReadFormButton + RButton = ReadButton Button = SimpleButton A number of common buttons have been implemented as shortcuts. These include: @@ -168,31 +169,31 @@ The more generic button functions, that are also shortcuts RButton (ReadButton) RealtimeButton -These are all of the GUI Widgets you have to choose from. If it's not in this list, it doesn't go in your form layout. (Maybe... unless there's been an update with more features and this tutorial wasn't updated) +These are all of the GUI Widgets you have to choose from. If it's not in this list, it doesn't go in your window layout. (Maybe... unless there's been an update with more features and this tutorial wasn't updated) ### GUI Design Pattern The stuff that tends not to change in GUIs are the calls that setup and show the Window. It's the layout of the Elements that changes from one program to another. This is the code from above with the layout removed: import PySimpleGUI as sg - # Define your form here (it's a list of lists) + # Define your window here (it's a list of lists) layout = [[ your layout ]] - form = sg.FlexForm('Simple data entry form') - button, values = form.LayoutAndRead(layout) + window = sg.Window('Simple data entry window').Layout(layout) + button, values = window.Read() The flow for most GUIs is: - * Create the Form object + * Create the window object * Define GUI as a list of lists * Show the GUI and get results -Some forms act more like Windows programs. These forms have an "Event Loop". Please see the readme for more info on these kinds of forms (Persistent Forms) +Some windows act more like Windows programs. These windows have an "Event Loop". Please see the readme for more info on these kinds of forms (Persistent windows) These are line for line what you see in design pattern above. ### GUI Layout -To create your custom GUI, first break your form down into "rows". You'll be defining your form one row at a time. Then for each for, you'll be placing one Element after another, working from left to right. +To create your custom GUI, first break your window down into "rows". You'll be defining your window one row at a time. Then for each for, you'll be placing one Element after another, working from left to right. The result is a "list of lists" that looks something like this: @@ -206,18 +207,18 @@ The layout produced this window: ## Display GUI & Get Results -Once you have your layout complete and you've copied over the lines of code that setup and show the form, it's time to look at how to display the form and get the values from the user. +Once you have your layout complete and you've copied over the lines of code that setup and show the window, it's time to look at how to display the window and get the values from the user. -First get a form. -``` form = sg.FlexForm('Simple data entry form') ``` +First get a window and display it. +``` window = sg.Window('Simple data entry window').Layout(layout) ``` -Then display the form and get the results.: +Then read the window to get the button clicked and values.: - button, values = form.LayoutAndRead(layout) + button, values = window.Read() - Forms return 2 values, the text of the button that was clicked and a ***list of values*** the user entered into the form. More advanced forms return the values as a **dictionary of values**, + windows return 2 values, the text of the button that was clicked and a ***list of values*** the user entered into the window. More advanced windows return the values as a **dictionary of values**, -If the example form was displayed and the user did nothing other than click the OK button, then the results would have been: +If the example window was displayed and the user did nothing other than click the OK button, then the results would have been: button == 'OK' values == [False, False] @@ -236,7 +237,7 @@ The most-commonly used display window is the `Popup`. To display the results of ## Putting It All Together -Now that you know the basics, let's put together a form that contains as many PySimpleGUI's elements as possible. Also, just to give it a nice look, we'll change the "look and feel" to a green and tan color scheme. +Now that you know the basics, let's put together a window that contains as many PySimpleGUI's elements as possible. Also, just to give it a nice look, we'll change the "look and feel" to a green and tan color scheme. import PySimpleGUI as sg @@ -247,7 +248,7 @@ Now that you know the basics, let's put together a form that contains as many Py [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('All graphic widgets in one window!', size=(30, 1), font=("Helvetica", 25))], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], @@ -268,8 +269,8 @@ Now that you know the basics, let's put together a form that contains as many Py [sg.Submit(), sg.Cancel()] ] - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) - button, values = form.LayoutAndRead(layout) + window = sg.Window('Everything bagel', default_element_size=(40, 1)).Layout(layout) + button, values = window.Read() sg.Popup(button, values) That may seem like a lot of code, but try coding this same GUI layout using any other GUI framework and it will be lengthier and what you see here.... by a WIDE margin. 10's of times longer. @@ -291,7 +292,7 @@ If you have a script that uses the command line, you don't have to abandon it in This kind of logic is all that's needed: if len(sys.argv) == 1: - # collect arguments from GUI + # collect arguments from GUI else: # collect arguements from sys.argv @@ -319,6 +320,8 @@ Works on all systems that run tkinter, including the Raspberry Pi [Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/) +[Tutorial](http://tutorial.pysimplegui.org) + ### Home Page (GitHub) -[www.PySimpleGUI.com](www.PySimpleGUI.com) +[www.PySimpleGUI.com](www.PySimpleGUI.com) \ No newline at end of file From 2f5a42bc8629ecb8c8b312957622c9f9390d97f2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 22:59:54 -0400 Subject: [PATCH 451/521] More design pattern changes --- docs/cookbook.md | 2403 +++++++++++++++++++++++----------------------- 1 file changed, 1201 insertions(+), 1202 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index 7a84e1fc5..a171d06a9 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -1,1248 +1,1247 @@ -# The PySimpleGUI Cookbook - - + +# The PySimpleGUI Cookbook + + You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. Study them to get an idea of what design patterns to follow. - -## Simple Data Entry - Return Values As List -Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. - -![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) - - import PySimpleGUI as sg - - # Very basic window. Return values as a list - window = sg.Window('Simple data entry window') - - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = window.LayoutAndRead(layout) - - print(button, values[0], values[1], values[2]) - -## Simple data entry - Return Values As Dictionary + +## Simple Data Entry - Return Values As List +Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. + +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) + + import PySimpleGUI as sg + + # Very basic window. Return values as a list + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] + + window = sg.Window('Simple data entry window').Layout(layout) + button, values = window.Read() + + print(button, values[0], values[1], values[2]) + +## Simple data entry - Return Values As Dictionary A simple GUI with default values. Results returned in a dictionary. - -![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) - - import PySimpleGUI as sg - - # Very basic window. Return values as a dictionary - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] - ] +![super simple 2](https://user-images.githubusercontent.com/13696193/43934091-8100e29a-9c1b-11e8-8d0a-9bd2d13e6d8e.jpg) - window = sg.Window('Simple data entry GUI') # begin with a blank Window + import PySimpleGUI as sg + + # Very basic window. Return values as a dictionary + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + window = sg.Window('Simple data entry GUI').Layout(layout) + + button, values = window.Read() + + print(button, values['name'], values['address'], values['phone']) + +--------------------- + + + +----------- +## Simple File Browse +Browse for a filename that is populated into the input field. + +![simple file browse](https://user-images.githubusercontent.com/13696193/43934539-d8bd9490-9c1d-11e8-927f-98b523776fcb.jpg) + + import PySimpleGUI as sg - button, values = window.LayoutAndRead(layout) - - print(button, values['name'], values['address'], values['phone']) - ---------------------- - - - ------------ -## Simple File Browse -Browse for a filename that is populated into the input field. - -![simple file browse](https://user-images.githubusercontent.com/13696193/43934539-d8bd9490-9c1d-11e8-927f-98b523776fcb.jpg) - - import PySimpleGUI as sg - - GUI_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - (button, (source_filename,)) = sg.Window('SHA-1 & 256 Hash').LayoutAndRead(GUI_rows) - - print(button, source_filename) - --------------------------- -## Add GUI to Front-End of Script -Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. - -![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) - - - import PySimpleGUI as sg - import sys - - if len(sys.argv) == 1: - button, (fname,) = sg.Window('My Script').LayoutAndRead([[sg.Text('Document to open')], - [sg.In(), sg.FileBrowse()], - [sg.Open(), sg.Cancel()]]) - else: - fname = sys.argv[1] - - if not fname: - sg.Popup("Cancel", "No filename supplied") - raise SystemExit("Cancelling: no filename supplied") - print(button, fname) - - - --------------- - -## Compare 2 Files - -Browse to get 2 file names that can be then compared. - -![compare 2 files](https://user-images.githubusercontent.com/13696193/43934659-60dc5fbe-9c1e-11e8-8d2b-07c0e3b61892.jpg) - - import PySimpleGUI as sg - + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + (button, (source_filename,)) = sg.Window('SHA-1 & 256 Hash').Layout(GUI_rows).Read() + + print(button, source_filename) + +-------------------------- +## Add GUI to Front-End of Script +Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. + +![script front-end](https://user-images.githubusercontent.com/13696193/44756573-39e9c380-aaf9-11e8-97b4-6679f9f5bd46.jpg) + + + import PySimpleGUI as sg + import sys + + if len(sys.argv) == 1: + button, (fname,) = sg.Window('My Script').Layout([[sg.Text('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]).Read() + else: + fname = sys.argv[1] + + if not fname: + sg.Popup("Cancel", "No filename supplied") + raise SystemExit("Cancelling: no filename supplied") + print(button, fname) + + + +-------------- + +## Compare 2 Files + +Browse to get 2 file names that can be then compared. + +![compare 2 files](https://user-images.githubusercontent.com/13696193/43934659-60dc5fbe-9c1e-11e8-8d2b-07c0e3b61892.jpg) + + import PySimpleGUI as sg + gui_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - - window = sg.Window('File Compare') - - button, values = window.LayoutAndRead(gui_rows) - - print(button, values) - ---------------- -## Nearly All Widgets with Green Color Theme -Example of nearly all of the widgets in a single window. Uses a customized color scheme. - -![latest everything bagel](https://user-images.githubusercontent.com/13696193/45920376-22d89000-be71-11e8-8ac4-640f011f84d0.jpg) - - - - #!/usr/bin/env Python3 - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ Column Definition ------ # - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Menu(menu_def, tearoff=True)], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + window = sg.Window('File Compare').Layout(gui_rows) + + button, values = window.Read() + + print(button, values) + +--------------- +## Nearly All Widgets with Green Color Theme +Example of nearly all of the widgets in a single window. Uses a customized color scheme. + +![latest everything bagel](https://user-images.githubusercontent.com/13696193/45920376-22d89000-be71-11e8-8ac4-640f011f84d0.jpg) + + + + #!/usr/bin/env Python3 + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ Column Definition ------ # + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Menu(menu_def, tearoff=True)], [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Frame(layout=[ - [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Frame('Labelled Group',[[ - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')]])], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Frame(layout=[ + [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Frame('Labelled Group',[[ + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')]])], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] - ] - - - window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - - button, values = window.Read() - - sg.Popup('Title', - 'The results of the window.', - 'The button clicked was "{}"'.format(button), - 'The values are', values) - -------------- - - - - + ] + + + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + + button, values = window.Read() + + sg.Popup('Title', + 'The results of the window.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) + +------------- + + + + ## Non-Blocking Window With Periodic Update An async Window that has a button read loop. A Text Element is updated periodically with a running timer. Note that `value` is checked for None which indicates the window was closed using X. - -![non-blocking](https://user-images.githubusercontent.com/13696193/43955295-70f6ac48-9c6d-11e8-8ea2-e6729ba9330c.jpg) - - - import PySimpleGUI as sg - import time - + +![non-blocking](https://user-images.githubusercontent.com/13696193/43955295-70f6ac48-9c6d-11e8-8ea2-e6729ba9330c.jpg) + + + import PySimpleGUI as sg + import time + gui_rows = [[sg.Text('Stopwatch', size=(20, 2), justification='center')], - [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], - [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] - + [sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], + [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] + window = sg.Window('Running Timer').Layout(gui_rows) - - timer_running = True - i = 0 - # Event Loop - while True: - i += 1 * (timer_running is True) - button, values = window.ReadNonBlocking() - - if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - elif button == 'Start/Stop': - timer_running = not timer_running - - window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - time.sleep(.01) - --------- - -## Callback Function Simulation -The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. - -![button callback 2](https://user-images.githubusercontent.com/13696193/43955588-e139ddc6-9c6e-11e8-8c78-c1c226b8d9b1.jpg) - - import PySimpleGUI as sg - - # This design pattern simulates button callbacks - # Note that callbacks are NOT a part of the package's interface to the - # caller intentionally. The underlying implementation actually does use - # tkinter callbacks. They are simply hidden from the user. - - # The callback functions - def button1(): - print('Button 1 callback') - - def button2(): - print('Button 2 callback') - - - # Layout the design of the GUI - layout = [[sg.Text('Please click a button', auto_size_text=True)], - [sg.ReadButton('1'), sg.ReadButton('2'), sg.Quit()]] - + + timer_running = True + i = 0 + # Event Loop + while True: + i += 1 * (timer_running is True) + button, values = window.ReadNonBlocking() + + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + elif button == 'Start/Stop': + timer_running = not timer_running + + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + time.sleep(.01) + +-------- + +## Callback Function Simulation +The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. + +![button callback 2](https://user-images.githubusercontent.com/13696193/43955588-e139ddc6-9c6e-11e8-8c78-c1c226b8d9b1.jpg) + + import PySimpleGUI as sg + + # This design pattern simulates button callbacks + # Note that callbacks are NOT a part of the package's interface to the + # caller intentionally. The underlying implementation actually does use + # tkinter callbacks. They are simply hidden from the user. + + # The callback functions + def button1(): + print('Button 1 callback') + + def button2(): + print('Button 2 callback') + + + # Layout the design of the GUI + layout = [[sg.Text('Please click a button', auto_size_text=True)], + [sg.ReadButton('1'), sg.ReadButton('2'), sg.Quit()]] + # Show the Window to the user - window = sg.Window('Button callback example').Layout(layout) - - # Event loop. Read buttons, make callbacks - while True: + window = sg.Window('Button callback example').Layout(layout) + + # Event loop. Read buttons, make callbacks + while True: # Read the Window - button, value = window.Read() - # Take appropriate action based on button - if button == '1': - button1() - elif button == '2': - button2() - elif button =='Quit' or button is None: - break - - # All done! - sg.PopupOK('Done') - ------ -## Realtime Buttons (Good For Raspberry Pi) -This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking window. - -![robot control](https://user-images.githubusercontent.com/13696193/44006710-d227f23e-9e56-11e8-89a3-2be5b2726199.jpg) - - import PySimpleGUI as sg - - + button, value = window.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break + + # All done! + sg.PopupOK('Done') + +----- +## Realtime Buttons (Good For Raspberry Pi) +This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking window. + +![robot control](https://user-images.githubusercontent.com/13696193/44006710-d227f23e-9e56-11e8-89a3-2be5b2726199.jpg) + + import PySimpleGUI as sg + + gui_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' ' * 10), sg.RealtimeButton('Forward')], - [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], - [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - + [sg.T(' ' * 10), sg.RealtimeButton('Forward')], + [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], + [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + window = sg.Window('Robotics Remote Control', auto_size_text=True).Layout(gui_rows) - - # - # Some place later in your code... + + # + # Some place later in your code... # You need to perform a ReadNonBlocking on your window every now and then or - # else it won't refresh. - # - # your program's main loop - while (True): - # This is the code that reads and updates your window - button, values = window.ReadNonBlocking() - if button is not None: - print(button) - if button == 'Quit' or values is None: - break - - window.CloseNonBlocking() # Don't forget to close your window! - ---------- - -## OneLineProgressMeter - -This recipe shows just how easy it is to add a progress meter to your code. - -![onelineprogressmeter](https://user-images.githubusercontent.com/13696193/45589254-bd285900-b8f0-11e8-9122-b43f06bf074d.jpg) - - - import PySimpleGUI as sg - - for i in range(1000): - sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') - - ------ -## Tabbed Form -Tabbed forms are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single window. - - -![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg) - - import PySimpleGUI as sg - - layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - window = sg.Window('') - form2 = sg.Window('') - - results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), - (form2, layout_tab_2, 'Second Tab')) - - sg.Popup(results) - ------ -## Button Graphics (Media Player) -Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. - -![media player](https://user-images.githubusercontent.com/13696193/43958418-5dd133f2-9c79-11e8-9432-0a67007e85ac.jpg) - - import PySimpleGUI as sg - - background = '#F0F0F0' - # Set the backgrounds the same as the background on the buttons - sg.SetOptions(background_color=background, element_background_color=background) - # Images are located in a subfolder in the Demo Media Player.py folder - image_pause = './ButtonGraphics/Pause.png' - image_restart = './ButtonGraphics/Restart.png' - image_next = './ButtonGraphics/Next.png' - image_exit = './ButtonGraphics/Exit.png' - - # define layout of the rows - layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], - [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], - [sg.ReadButton('Restart Song', button_color=(background, background), - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadButton('Pause', button_color=(background, background), - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadButton('Next', button_color=(background, background), - image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.Button('Exit', button_color=(background, background), - image_filename=image_exit, image_size=(50, 50), image_subsample=2, - border_width=0)], - [sg.Text('_' * 30)], - [sg.Text(' ' * 30)], - [ - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 2), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 8), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15))], - [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), - sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), - sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] - ] - - window = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1), - font=("Helvetica", 25)).Layout(layout) - # Our event loop - while (True): + # else it won't refresh. + # + # your program's main loop + while (True): + # This is the code that reads and updates your window + button, values = window.ReadNonBlocking() + if button is not None: + print(button) + if button == 'Quit' or values is None: + break + + window.CloseNonBlocking() # Don't forget to close your window! + +--------- + +## OneLineProgressMeter + +This recipe shows just how easy it is to add a progress meter to your code. + +![onelineprogressmeter](https://user-images.githubusercontent.com/13696193/45589254-bd285900-b8f0-11e8-9122-b43f06bf074d.jpg) + + + import PySimpleGUI as sg + + for i in range(1000): + sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') + + +----- +## Tabbed Window +Tabbed Windows are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single window. + + +![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg) + + import PySimpleGUI as sg + + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + window = sg.Window('') + form2 = sg.Window('') + + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2, 'Second Tab')) + + sg.Popup(results) + +----- +## Button Graphics (Media Player) +Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. + +![media player](https://user-images.githubusercontent.com/13696193/43958418-5dd133f2-9c79-11e8-9432-0a67007e85ac.jpg) + + import PySimpleGUI as sg + + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # define layout of the rows + layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], + [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], + [sg.ReadButton('Restart Song', button_color=(background, background), + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadButton('Pause', button_color=(background, background), + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadButton('Next', button_color=(background, background), + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.Button('Exit', button_color=(background, background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, + border_width=0)], + [sg.Text('_' * 30)], + [sg.Text(' ' * 30)], + [ + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] + ] + + window = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25)).Layout(layout) + # Our event loop + while (True): # Read the window (this call will not block) - button, values = window.ReadNonBlocking() - if button == 'Exit' or values is None: - break - # If a button was pressed, display it on the GUI by updating the text element - if button: - window.FindElement('output').Update(button) - ----- + button, values = window.ReadNonBlocking() + if button == 'Exit' or values is None: + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + window.FindElement('output').Update(button) + +---- ## Script Launcher - Persistent Window This Window doesn't close after button clicks. To achieve this the buttons are specified as `sg.ReadButton` instead of `sg.Button`. The exception to this is the EXIT button. Clicking it will close the window. This program will run commands and display the output in the scrollable window. - -![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) - - import PySimpleGUI as sg - import subprocess - - # Please check Demo programs for better examples of launchers - def ExecuteCommandSubprocess(command, *args): - try: - sp = subprocess.Popen([command, *args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = sp.communicate() - if out: - print(out.decode("utf-8")) - if err: - print(err.decode("utf-8")) - except: - pass - - - layout = [ - [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20))], - [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], - [sg.Text('Manual command', size=(15, 1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] - ] - - - window = sg.Window('Script launcher').Layout(layout) - - # ---===--- Loop taking in user input and using it to call scripts --- # - - while True: - (button, value) = window.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': - ExecuteCommandSubprocess('pip', 'list') - elif button == 'script2': - ExecuteCommandSubprocess('python', '--version') - elif button == 'Run': - ExecuteCommandSubprocess(value[0]) - ----- -## Machine Learning GUI -A standard non-blocking GUI with lots of inputs. - -![machine learning green](https://user-images.githubusercontent.com/13696193/43979000-408b77ba-9cb7-11e8-9ffd-24c156767532.jpg) - - import PySimpleGUI as sg - - # Green & tan color scheme - sg.ChangeLookAndFeel('GreenTan') - - sg.SetOptions(text_justification='right') - - layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), - sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), - sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), - sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), - sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 15), justification='left')], - [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], - [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], - [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], - [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], - [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], - [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], - [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], - [sg.Submit(), sg.Cancel()]] - - window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) - - button, values = window.Read() - -------- -## Custom Progress Meter / Progress Bar -Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. - -![custom progress meter](https://user-images.githubusercontent.com/13696193/43982958-3393b23e-9cc6-11e8-8b49-e7f4890cbc4b.jpg) - - - import PySimpleGUI as sg - - # layout the Window - layout = [[sg.Text('A custom progress meter')], - [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progbar')], - [sg.Cancel()]] - - # create the Window - window = sg.Window('Custom Progress Meter').Layout(layout) - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = window.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - window.FindElement('progbar').UpdateBar(i + 1) - # done with loop... need to destroy the window as it's still open - window.CloseNonBlocking() - - - ---- - -## The One-Line GUI - -For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to `Window` and the call to `LayoutAndRead`. `Window` returns a `Window` object which has the `LayoutAndRead` method. - - -![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) - - -Instead of - - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()]] - - button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) - -you can write this line of code for the exact same result (OK, two lines with the import): - - import PySimpleGUI as sg - - button, (filename,) = sg.Window('Get filename example').LayoutAndRead( - [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) - --------------------- -## Multiple Columns -Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. - -This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. - -To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. - -![cookbook columns](https://user-images.githubusercontent.com/13696193/45309948-f6c52280-b4f2-11e8-8691-a45fa0e06c50.jpg) - - - - import PySimpleGUI as sg - - # Demo of how columns work + +![launcher 2](https://user-images.githubusercontent.com/13696193/43958519-b30af218-9c79-11e8-88da-fadc69da818c.jpg) + + import PySimpleGUI as sg + import subprocess + + # Please check Demo programs for better examples of launchers + def ExecuteCommandSubprocess(command, *args): + try: + sp = subprocess.Popen([command, *args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: + pass + + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], + [sg.Text('Manual command', size=(15, 1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] + ] + + + window = sg.Window('Script launcher').Layout(layout) + + # ---===--- Loop taking in user input and using it to call scripts --- # + + while True: + (button, value) = window.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip', 'list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) + +---- +## Machine Learning GUI +A standard non-blocking GUI with lots of inputs. + +![machine learning green](https://user-images.githubusercontent.com/13696193/43979000-408b77ba-9cb7-11e8-9ffd-24c156767532.jpg) + + import PySimpleGUI as sg + + # Green & tan color scheme + sg.ChangeLookAndFeel('GreenTan') + + sg.SetOptions(text_justification='right') + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), + sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), + sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), + sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + + window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) + + button, values = window.Read() + +------- +## Custom Progress Meter / Progress Bar +Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. + +![custom progress meter](https://user-images.githubusercontent.com/13696193/43982958-3393b23e-9cc6-11e8-8b49-e7f4890cbc4b.jpg) + + + import PySimpleGUI as sg + + # layout the Window + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20, 20), key='progbar')], + [sg.Cancel()]] + + # create the Window + window = sg.Window('Custom Progress Meter').Layout(layout) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = window.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + window.FindElement('progbar').UpdateBar(i + 1) + # done with loop... need to destroy the window as it's still open + window.CloseNonBlocking() + + + ---- + +## The One-Line GUI + +For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. + + +![simple](https://user-images.githubusercontent.com/13696193/44227935-ecb53b80-a161-11e8-968b-b3f963404dec.jpg) + + +Instead of + + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()]] + + button, (number,) = sg.Window('Get filename example').Layout(layout).Read() + +you can write this line of code for the exact same result (OK, two lines with the import): + + import PySimpleGUI as sg + + button, (filename,) = sg.Window('Get filename example').Layout( + [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]).Read() + +-------------------- +## Multiple Columns +Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + +This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + +To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. + +![cookbook columns](https://user-images.githubusercontent.com/13696193/45309948-f6c52280-b4f2-11e8-8691-a45fa0e06c50.jpg) + + + + import PySimpleGUI as sg + + # Demo of how columns work # GUI has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible + # Prior to the Column element, this layout was not possible # Columns layouts look identical to GUI layouts, they are a list of lists of elements. - - sg.ChangeLookAndFeel('BlueMono') - - # Column layout - col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], - [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], - [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] - - layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], - [sg.Input('Last input')], - [sg.OK()]] - + + sg.ChangeLookAndFeel('BlueMono') + + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + # Display the Window and get values - - button, values = sg.Window('Compact 1-line Window with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) - - + + button, values = sg.Window('Compact 1-line Window with column').Layout(layout).Read() + + sg.Popup(button, values, line_width=200) + + ## Persistent Window With Text Element Updates - + This simple program keep a window open, taking input values until the user terminates the program using the "X" button. - -![math game](https://user-images.githubusercontent.com/13696193/44537842-c9444080-a6cd-11e8-94bc-6cdf1b765dd8.jpg) - - - - import PySimpleGUI as sg - - layout = [ [sg.Txt('Enter values to calculate')], - [sg.In(size=(8,1), key='numerator')], - [sg.Txt('_' * 10)], - [sg.In(size=(8,1), key='denominator')], - [sg.Txt('', size=(8,1), key='output') ], - [sg.ReadButton('Calculate', bind_return_key=True)]] - - window = sg.Window('Math').Layout(layout) - - while True: - button, values = window.Read() - - if button is not None: - try: - numerator = float(values['numerator']) - denominator = float(values['denominator']) - calc = numerator / denominator - except: - calc = 'Invalid' - - window.FindElement('output').Update(calc) - else: - break - - - -## tkinter Canvas Widget - -The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: - - can = sg.Canvas(size=(100,100)) - tkcanvas = can.TKCanvas - tkcanvas.create_oval(50, 50, 100, 100) - -While it's fun to scribble on a Canvas Widget, try Graph Element makes it a downright pleasant experience. You do not have to worry about the tkinter coordinate system and can instead work in your own coordinate system. - - -![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) - - - import PySimpleGUI as sg - - layout = [ - [sg.Canvas(size=(100, 100), background_color='red', key= 'canvas')], - [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] - ] - - window = sg.Window('Canvas test') - window.Layout(layout) - window.Finalize() - - canvas = window.FindElement('canvas') - cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) - - while True: - button, values = window.Read() - if button is None: - break - if button == 'Blue': - canvas.TKCanvas.itemconfig(cir, fill="Blue") - elif button == 'Red': - canvas.TKCanvas.itemconfig(cir, fill="Red") - -## Graph Element - drawing circle, rectangle, etc, objects - -Just like you can draw on a tkinter widget, you can also draw on a Graph Element. Graph Elements are easier on the programmer as you get to work in your own coordinate system. - -![graph recipe](https://user-images.githubusercontent.com/13696193/45920640-751bb000-be75-11e8-9530-45b71cbae07d.jpg) - - - import PySimpleGUI as sg - - layout = [ - [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], - [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')] - ] - - window = sg.Window('Graph test') - window.Layout(layout) - window.Finalize() - - graph = window.FindElement('graph') - circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') - point = graph.DrawPoint((75,75), 10, color='green') - oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) - rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) - line = graph.DrawLine((0,0), (100,100)) - - while True: - button, values = window.Read() - if button is None: - break - if button is 'Blue': - graph.TKCanvas.itemconfig(circle, fill = "Blue") - elif button is 'Red': - graph.TKCanvas.itemconfig(circle, fill = "Red") - elif button is 'Move': - graph.MoveFigure(point, 10,10) - graph.MoveFigure(circle, 10,10) - graph.MoveFigure(oval, 10,10) - graph.MoveFigure(rectangle, 10,10) - - -## Keypad Touchscreen Entry - Input Element Update - -This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. -There are a number of features used in this Recipe including: -* Default Element Size -* auto_size_buttons -* ReadButton -* Dictionary Return values + +![math game](https://user-images.githubusercontent.com/13696193/44537842-c9444080-a6cd-11e8-94bc-6cdf1b765dd8.jpg) + + + + import PySimpleGUI as sg + + layout = [ [sg.Txt('Enter values to calculate')], + [sg.In(size=(8,1), key='numerator')], + [sg.Txt('_' * 10)], + [sg.In(size=(8,1), key='denominator')], + [sg.Txt('', size=(8,1), key='output') ], + [sg.ReadButton('Calculate', bind_return_key=True)]] + + window = sg.Window('Math').Layout(layout) + + while True: + button, values = window.Read() + + if button is not None: + try: + numerator = float(values['numerator']) + denominator = float(values['denominator']) + calc = numerator / denominator + except: + calc = 'Invalid' + + window.FindElement('output').Update(calc) + else: + break + + + +## tkinter Canvas Widget + +The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: + + can = sg.Canvas(size=(100,100)) + tkcanvas = can.TKCanvas + tkcanvas.create_oval(50, 50, 100, 100) + +While it's fun to scribble on a Canvas Widget, try Graph Element makes it a downright pleasant experience. You do not have to worry about the tkinter coordinate system and can instead work in your own coordinate system. + + +![canvas](https://user-images.githubusercontent.com/13696193/44632429-5266ac00-a948-11e8-9ee0-664103c40178.jpg) + + + import PySimpleGUI as sg + + layout = [ + [sg.Canvas(size=(100, 100), background_color='red', key= 'canvas')], + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] + ] + + window = sg.Window('Canvas test') + window.Layout(layout) + window.Finalize() + + canvas = window.FindElement('canvas') + cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) + + while True: + button, values = window.Read() + if button is None: + break + if button == 'Blue': + canvas.TKCanvas.itemconfig(cir, fill="Blue") + elif button == 'Red': + canvas.TKCanvas.itemconfig(cir, fill="Red") + +## Graph Element - drawing circle, rectangle, etc, objects + +Just like you can draw on a tkinter widget, you can also draw on a Graph Element. Graph Elements are easier on the programmer as you get to work in your own coordinate system. + +![graph recipe](https://user-images.githubusercontent.com/13696193/45920640-751bb000-be75-11e8-9530-45b71cbae07d.jpg) + + + import PySimpleGUI as sg + + layout = [ + [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')] + ] + + window = sg.Window('Graph test') + window.Layout(layout) + window.Finalize() + + graph = window.FindElement('graph') + circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') + point = graph.DrawPoint((75,75), 10, color='green') + oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) + rectangle = graph.DrawRectangle((25,300), (100,280), line_color='purple' ) + line = graph.DrawLine((0,0), (100,100)) + + while True: + button, values = window.Read() + if button is None: + break + if button is 'Blue': + graph.TKCanvas.itemconfig(circle, fill = "Blue") + elif button is 'Red': + graph.TKCanvas.itemconfig(circle, fill = "Red") + elif button is 'Move': + graph.MoveFigure(point, 10,10) + graph.MoveFigure(circle, 10,10) + graph.MoveFigure(oval, 10,10) + graph.MoveFigure(rectangle, 10,10) + + +## Keypad Touchscreen Entry - Input Element Update + +This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. +There are a number of features used in this Recipe including: +* Default Element Size +* auto_size_buttons +* ReadButton +* Dictionary Return values * Update of Elements in window (Input, Text) -* do_not_clear of Input Elements - - -![keypad 2](https://user-images.githubusercontent.com/13696193/44640891-57504d80-a992-11e8-93f4-4e97e586505e.jpg) - - - - import PySimpleGUI as sg - - # Demonstrates a number of PySimpleGUI features including: - # Default element size - # auto_size_buttons - # ReadButton - # Dictionary return values +* do_not_clear of Input Elements + + +![keypad 2](https://user-images.githubusercontent.com/13696193/44640891-57504d80-a992-11e8-93f4-4e97e586505e.jpg) + + + + import PySimpleGUI as sg + + # Demonstrates a number of PySimpleGUI features including: + # Default element size + # auto_size_buttons + # ReadButton + # Dictionary return values # Update of elements in window (Text, Input) - # do_not_clear of Input elements - - layout = [[sg.Text('Enter Your Passcode')], - [sg.Input(size=(10, 1), do_not_clear=True, justification='right', key='input')], - [sg.ReadButton('1'), sg.ReadButton('2'), sg.ReadButton('3')], - [sg.ReadButton('4'), sg.ReadButton('5'), sg.ReadButton('6')], - [sg.ReadButton('7'), sg.ReadButton('8'), sg.ReadButton('9')], - [sg.ReadButton('Submit'), sg.ReadButton('0'), sg.ReadButton('Clear')], - [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], - ] - - window = sg.Window('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) - + # do_not_clear of Input elements + + layout = [[sg.Text('Enter Your Passcode')], + [sg.Input(size=(10, 1), do_not_clear=True, justification='right', key='input')], + [sg.ReadButton('1'), sg.ReadButton('2'), sg.ReadButton('3')], + [sg.ReadButton('4'), sg.ReadButton('5'), sg.ReadButton('6')], + [sg.ReadButton('7'), sg.ReadButton('8'), sg.ReadButton('9')], + [sg.ReadButton('Submit'), sg.ReadButton('0'), sg.ReadButton('Clear')], + [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], + ] + + window = sg.Window('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) + # Loop forever reading the window's values, updating the Input field - keys_entered = '' - while True: + keys_entered = '' + while True: button, values = window.Read() # read the window - if button is None: # if the X button clicked, just exit - break - if button == 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button == 'Submit': - keys_entered = values['input'] - window.FindElement('out').Update(keys_entered) # output the final string - + if button is None: # if the X button clicked, just exit + break + if button == 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button == 'Submit': + keys_entered = values['input'] + window.FindElement('out').Update(keys_entered) # output the final string + window.FindElement('input').Update(keys_entered) # change the window to reflect current key string - -## Animated Matplotlib Graph - -Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. - -![animated matplotlib](https://user-images.githubusercontent.com/13696193/44640937-91b9ea80-a992-11e8-9c1c-85ae74013679.jpg) - - - from tkinter import * - from random import randint - import PySimpleGUI as g - from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg - from matplotlib.figure import Figure - import matplotlib.backends.tkagg as tkagg - import tkinter as Tk - - - fig = Figure() - - ax = fig.add_subplot(111) - ax.set_xlabel("X axis") - ax.set_ylabel("Y axis") - ax.grid() - - layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [g.Canvas(size=(640, 480), key='canvas')], - [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] - + +## Animated Matplotlib Graph + +Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. + +![animated matplotlib](https://user-images.githubusercontent.com/13696193/44640937-91b9ea80-a992-11e8-9c1c-85ae74013679.jpg) + + + from tkinter import * + from random import randint + import PySimpleGUI as g + from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg + from matplotlib.figure import Figure + import matplotlib.backends.tkagg as tkagg + import tkinter as Tk + + + fig = Figure() + + ax = fig.add_subplot(111) + ax.set_xlabel("X axis") + ax.set_ylabel("Y axis") + ax.grid() + + layout = [[g.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], + [g.Canvas(size=(640, 480), key='canvas')], + [g.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + # create the window and show it without the plot - - - window = g.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) + + + window = g.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout) window.Finalize() # needed to access the canvas element prior to reading the window - - canvas_elem = window.FindElement('canvas') - - graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) - canvas = canvas_elem.TKCanvas - - dpts = [randint(0, 10) for x in range(10000)] - # Our event loop - for i in range(len(dpts)): - button, values = window.ReadNonBlocking() - if button == 'Exit' or values is None: - exit(69) - - ax.cla() - ax.grid() - - ax.plot(range(20), dpts[i:i + 20], color='purple') - graph.draw() - figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - canvas.create_image(640 / 2, 480 / 2, image=photo) - - figure_canvas_agg = FigureCanvasAgg(fig) - figure_canvas_agg.draw() - - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - - - -## Tight Layout with Button States - -Saw this example layout written in tkinter and liked it so much I duplicated the interface. It's "tight", clean, and has a nice dark look and feel. - -This Recipe also contains code that implements the button interactions so that you'll have a template to build from. - -In other GUI frameworks this program would be most likely "event driven" with callback functions being used to communicate button events. The "event loop" would be handled by the GUI engine. If code already existed that used a call-back mechanism, the loop in the example code below could simply call these callback functions directly based on the button text it receives in the window.Read call. - -![timemanagement](https://user-images.githubusercontent.com/13696193/44996818-0f27c100-af78-11e8-8836-9ef6164efe3b.jpg) - - - import PySimpleGUI as sg - """ - Demonstrates using a "tight" layout with a Dark theme. - Shows how button states can be controlled by a user application. The program manages the disabled/enabled - states for buttons and changes the text color to show greyed-out (disabled) buttons - """ - - sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0,0)) - - 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadButton('Start', button_color=('white', 'black'), key='Start'), - sg.ReadButton('Stop', button_color=('white', 'black'), key='Stop'), - sg.ReadButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), - sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] - ] - - window = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1)) - window.Layout(layout) - window.Finalize() - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Reset').Update(disabled=True) - window.FindElement('Submit').Update(disabled=True) - recording = have_data = False - while True: - button, values = window.Read() - print(button) - if button is None: - exit(69) - if button is 'Start': - window.FindElement('Start').Update(disabled=True) - window.FindElement('Stop').Update(disabled=False) - window.FindElement('Reset').Update(disabled=False) - window.FindElement('Submit').Update(disabled=True) - recording = True - elif button is 'Stop' and recording: - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Start').Update(disabled=False) - window.FindElement('Submit').Update(disabled=False) - recording = False - have_data = True - elif button is 'Reset': - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Start').Update(disabled=False) - window.FindElement('Submit').Update(disabled=True) - window.FindElement('Reset').Update(disabled=False) - recording = False - have_data = False - elif button is 'Submit' and have_data: - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Start').Update(disabled=False) - window.FindElement('Submit').Update(disabled=True) - window.FindElement('Reset').Update(disabled=False) - recording = False - -## Password Protection For Scripts - -You get 2 scripts in one. - -Use the upper half to generate your hash code. Then paste it into the code in the lower half. Copy and paste lower 1/2 into your code to get password protection for your script without putting the password into your source code. - -![password entry](https://user-images.githubusercontent.com/13696193/45129440-ab58f000-b151-11e8-8ebe-e519a50b3ead.jpg) - -![password hash](https://user-images.githubusercontent.com/13696193/45129441-ab58f000-b151-11e8-8a46-c2789bb7824e.jpg) - - import PySimpleGUI as sg - import hashlib - - ''' - Create a secure login for your scripts without having to include your password in the program. Create an SHA1 hash code for your password using the GUI. Paste into variable in final program - 1. Choose a password - 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password - 3. Type password into the GUI + + canvas_elem = window.FindElement('canvas') + + graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) + canvas = canvas_elem.TKCanvas + + dpts = [randint(0, 10) for x in range(10000)] + # Our event loop + for i in range(len(dpts)): + button, values = window.ReadNonBlocking() + if button == 'Exit' or values is None: + exit(69) + + ax.cla() + ax.grid() + + ax.plot(range(20), dpts[i:i + 20], color='purple') + graph.draw() + figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds + figure_w, figure_h = int(figure_w), int(figure_h) + photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) + + canvas.create_image(640 / 2, 480 / 2, image=photo) + + figure_canvas_agg = FigureCanvasAgg(fig) + figure_canvas_agg.draw() + + tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) + + + +## Tight Layout with Button States + +Saw this example layout written in tkinter and liked it so much I duplicated the interface. It's "tight", clean, and has a nice dark look and feel. + +This Recipe also contains code that implements the button interactions so that you'll have a template to build from. + +In other GUI frameworks this program would be most likely "event driven" with callback functions being used to communicate button events. The "event loop" would be handled by the GUI engine. If code already existed that used a call-back mechanism, the loop in the example code below could simply call these callback functions directly based on the button text it receives in the window.Read call. + +![timemanagement](https://user-images.githubusercontent.com/13696193/44996818-0f27c100-af78-11e8-8836-9ef6164efe3b.jpg) + + + import PySimpleGUI as sg + """ + Demonstrates using a "tight" layout with a Dark theme. + Shows how button states can be controlled by a user application. The program manages the disabled/enabled + states for buttons and changes the text color to show greyed-out (disabled) buttons + """ + + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0,0)) + + 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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadButton('Start', button_color=('white', 'black'), key='Start'), + sg.ReadButton('Stop', button_color=('white', 'black'), key='Stop'), + sg.ReadButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), + sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] + ] + + window = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12,1)) + window.Layout(layout) + window.Finalize() + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Reset').Update(disabled=True) + window.FindElement('Submit').Update(disabled=True) + recording = have_data = False + while True: + button, values = window.Read() + print(button) + if button is None: + exit(69) + if button is 'Start': + window.FindElement('Start').Update(disabled=True) + window.FindElement('Stop').Update(disabled=False) + window.FindElement('Reset').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + recording = True + elif button is 'Stop' and recording: + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=False) + recording = False + have_data = True + elif button is 'Reset': + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + window.FindElement('Reset').Update(disabled=False) + recording = False + have_data = False + elif button is 'Submit' and have_data: + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + window.FindElement('Reset').Update(disabled=False) + recording = False + +## Password Protection For Scripts + +You get 2 scripts in one. + +Use the upper half to generate your hash code. Then paste it into the code in the lower half. Copy and paste lower 1/2 into your code to get password protection for your script without putting the password into your source code. + +![password entry](https://user-images.githubusercontent.com/13696193/45129440-ab58f000-b151-11e8-8ebe-e519a50b3ead.jpg) + +![password hash](https://user-images.githubusercontent.com/13696193/45129441-ab58f000-b151-11e8-8a46-c2789bb7824e.jpg) + + import PySimpleGUI as sg + import hashlib + + ''' + Create a secure login for your scripts without having to include your password in the program. Create an SHA1 hash code for your password using the GUI. Paste into variable in final program + 1. Choose a password + 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password + 3. Type password into the GUI 4. Copy and paste hash code Window GUI into variable named login_password_hash - 5. Run program again and test your login! - ''' - - # Use this GUI to get your password's hash code - def HashGeneratorGUI(): - layout = [[sg.T('Password Hash Generator', size=(30,1), font='Any 15')], - [sg.T('Password'), sg.In(key='password')], - [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], - ] - - window = sg.Window('SHA Generator', auto_size_text=False, default_element_size=(10,1), - text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) - - - while True: - button, values = window.Read() - if button is None: - exit(69) - - password = values['password'] - try: - password_utf = password.encode('utf-8') - sha1hash = hashlib.sha1() - sha1hash.update(password_utf) - password_hash = sha1hash.hexdigest() - window.FindElement('hash').Update(password_hash) - except: - pass - - # ----------------------------- Paste this code into your program / script ----------------------------- - # determine if a password matches the secret password by comparing SHA1 hash codes - def PasswordMatches(password, hash): - password_utf = password.encode('utf-8') - sha1hash = hashlib.sha1() - sha1hash.update(password_utf) - password_hash = sha1hash.hexdigest() - if password_hash == hash: - return True - else: - return False - - login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' - password = sg.PopupGetText('Password', password_char='*') - if password == 'gui': # Remove when pasting into your program - HashGeneratorGUI() # Remove when pasting into your program - exit(69) # Remove when pasting into your program - if PasswordMatches(password, login_password_hash): - print('Login SUCCESSFUL') - else: - print('Login FAILED!!') - - -## Desktop Floating Toolbar - -#### Hiding your windows commmand window -For this and the Time & CPU Widgets you may wish to consider using a tool or technique that will hide your Windows Command Prompt window. I recommend the techniques found on this site: - -[http://www.robvanderwoude.com/battech_hideconsole.php](http://www.robvanderwoude.com/battech_hideconsole.php) - + 5. Run program again and test your login! + ''' + + # Use this GUI to get your password's hash code + def HashGeneratorGUI(): + layout = [[sg.T('Password Hash Generator', size=(30,1), font='Any 15')], + [sg.T('Password'), sg.In(key='password')], + [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], + ] + + window = sg.Window('SHA Generator', auto_size_text=False, default_element_size=(10,1), + text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) + + + while True: + button, values = window.Read() + if button is None: + exit(69) + + password = values['password'] + try: + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + window.FindElement('hash').Update(password_hash) + except: + pass + + # ----------------------------- Paste this code into your program / script ----------------------------- + # determine if a password matches the secret password by comparing SHA1 hash codes + def PasswordMatches(password, hash): + password_utf = password.encode('utf-8') + sha1hash = hashlib.sha1() + sha1hash.update(password_utf) + password_hash = sha1hash.hexdigest() + if password_hash == hash: + return True + else: + return False + + login_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' + password = sg.PopupGetText('Password', password_char='*') + if password == 'gui': # Remove when pasting into your program + HashGeneratorGUI() # Remove when pasting into your program + exit(69) # Remove when pasting into your program + if PasswordMatches(password, login_password_hash): + print('Login SUCCESSFUL') + else: + print('Login FAILED!!') + + +## Desktop Floating Toolbar + +#### Hiding your windows commmand window +For this and the Time & CPU Widgets you may wish to consider using a tool or technique that will hide your Windows Command Prompt window. I recommend the techniques found on this site: + +[http://www.robvanderwoude.com/battech_hideconsole.php](http://www.robvanderwoude.com/battech_hideconsole.php) + At the moment I'm using the technique that involves wscript and a script named RunNHide.vbs. They are working beautifully. I'm using a hotkey program and launch by using this script with the command "python.exe insert_program_here.py". I guess the next widget should be one that shows all the programs launched this way so you can kill any bad ones. If you don't properly catch the exit button on your window then your while loop is going to keep on working while your window is no longer there so be careful in your code to always have exit explicitly handled. - - -### Floating toolbar - -This is a cool one! (Sorry about the code pastes... I'm working in it) - -Impress your friends at what a tool-wizard you are by popping a custom toolbar that you keep in the corner of your screen. It stays on top of all your other windows. - - - - -![toolbar gray](https://user-images.githubusercontent.com/13696193/45324308-bfb73700-b51b-11e8-90e7-ab24f3d6e61d.jpg) - -You can easily change colors to match your background by changing a couple of parameters in the code. - -![toolbar black](https://user-images.githubusercontent.com/13696193/45324307-bfb73700-b51b-11e8-8709-6c3c23f737c4.jpg) - - - import PySimpleGUI as sg - import subprocess - import os - import sys - - """ - Demo_Toolbar - A floating toolbar with quick launcher One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout - You can setup a specific program to launch when a button is clicked, or use the Combobox to select a .py file found in the root folder, and run that file. """ - - ROOT_PATH = './' - - def Launcher(): - - def print(line): - window.FindElement('output').Update(line) - - sg.ChangeLookAndFeel('Dark') - - namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] - - sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) - layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), - sg.ReadButton('Run', button_color=('white', '#00168B')), - sg.ReadButton('Program 1'), - sg.ReadButton('Program 2'), - sg.ReadButton('Program 3', button_color=('white', '#35008B')), - sg.Button('EXIT', button_color=('white','firebrick3'))], - [sg.T('', text_color='white', size=(50,1), key='output')]] - - window = sg.Window('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) - - # ---===--- Loop taking in user input (buttons) --- # - while True: - (button, value) = window.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'Program 1': - print('Run your program 1 here!') - elif button == 'Program 2': - print('Run your program 2 here!') - elif button == 'Run': - file = value['demofile'] - print('Launching %s'%file) - ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) - else: - print(button) - - def ExecuteCommandSubprocess(command, *args, wait=False): - try: - if sys.platwindow == 'linux': - arg_string = '' - for arg in args: - arg_string += ' ' + str(arg) - sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - if wait: - out, err = sp.communicate() - if out: - print(out.decode("utf-8")) - if err: - print(err.decode("utf-8")) - except: pass - - - - if __name__ == '__main__': - Launcher() - - - - -## Desktop Floating Widget - Timer - -This is a little widget you can leave running on your desktop. Will hopefully see more of these for things like checking email, checking server pings, displaying system information, dashboards, etc -. -Much of the code is handling the button states in a fancy way. It could be much simpler if you don't change the button text based on state. - -![timer](https://user-images.githubusercontent.com/13696193/45336349-26a31300-b551-11e8-8b06-d1232ff8ca10.jpg) - - import PySimpleGUI as sg - import time - - """ - Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. It will look something like: invalid command name \"1616802625480StopMove\" - """ - - + + +### Floating toolbar + +This is a cool one! (Sorry about the code pastes... I'm working in it) + +Impress your friends at what a tool-wizard you are by popping a custom toolbar that you keep in the corner of your screen. It stays on top of all your other windows. + + + + +![toolbar gray](https://user-images.githubusercontent.com/13696193/45324308-bfb73700-b51b-11e8-90e7-ab24f3d6e61d.jpg) + +You can easily change colors to match your background by changing a couple of parameters in the code. + +![toolbar black](https://user-images.githubusercontent.com/13696193/45324307-bfb73700-b51b-11e8-8709-6c3c23f737c4.jpg) + + + import PySimpleGUI as sg + import subprocess + import os + import sys + + """ + Demo_Toolbar - A floating toolbar with quick launcher One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout + You can setup a specific program to launch when a button is clicked, or use the Combobox to select a .py file found in the root folder, and run that file. """ + + ROOT_PATH = './' + + def Launcher(): + + def print(line): + window.FindElement('output').Update(line) + + sg.ChangeLookAndFeel('Dark') + + namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] + + sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) + layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), + sg.ReadButton('Run', button_color=('white', '#00168B')), + sg.ReadButton('Program 1'), + sg.ReadButton('Program 2'), + sg.ReadButton('Program 3', button_color=('white', '#35008B')), + sg.Button('EXIT', button_color=('white','firebrick3'))], + [sg.T('', text_color='white', size=(50,1), key='output')]] + + window = sg.Window('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) + + # ---===--- Loop taking in user input (buttons) --- # + while True: + (button, value) = window.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'Program 1': + print('Run your program 1 here!') + elif button == 'Program 2': + print('Run your program 2 here!') + elif button == 'Run': + file = value['demofile'] + print('Launching %s'%file) + ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file)) + else: + print(button) + + def ExecuteCommandSubprocess(command, *args, wait=False): + try: + if sys.platwindow == 'linux': + arg_string = '' + for arg in args: + arg_string += ' ' + str(arg) + sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if wait: + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + + + if __name__ == '__main__': + Launcher() + + + + +## Desktop Floating Widget - Timer + +This is a little widget you can leave running on your desktop. Will hopefully see more of these for things like checking email, checking server pings, displaying system information, dashboards, etc +. +Much of the code is handling the button states in a fancy way. It could be much simpler if you don't change the button text based on state. + +![timer](https://user-images.githubusercontent.com/13696193/45336349-26a31300-b551-11e8-8b06-d1232ff8ca10.jpg) + + import PySimpleGUI as sg + import time + + """ + Timer Desktop Widget Creates a floating timer that is always on top of other windows You move it by grabbing anywhere on the window Good example of how to do a non-blocking, polling program using PySimpleGUI Can be used to poll hardware when running on a Pi NOTE - you will get a warning message printed when you exit using exit button. It will look something like: invalid command name \"1616802625480StopMove\" + """ + + # ---------------- Create window ---------------- - sg.ChangeLookAndFeel('Black') - sg.SetOptions(element_padding=(0, 0)) - + sg.ChangeLookAndFeel('Black') + sg.SetOptions(element_padding=(0, 0)) + layout = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadButton('Pause', key='button', button_color=('white', '#001480')), - sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), - sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] - - window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) - - - # ---------------- main loop ---------------- - current_time = 0 - paused = False - start_time = int(round(time.time() * 100)) - while (True): - # --------- Read and update window -------- - if not paused: - button, values = window.ReadNonBlocking() - current_time = int(round(time.time() * 100)) - start_time - else: - button, values = window.Read() - if button == 'button': - button = window.FindElement(button).GetText() - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - if button is 'Reset': - start_time = int(round(time.time() * 100)) - current_time = 0 - paused_time = start_time - elif button == 'Pause': - paused = True - paused_time = int(round(time.time() * 100)) - element = window.FindElement('button') - element.Update(text='Run') - elif button == 'Run': - paused = False - start_time = start_time + int(round(time.time() * 100)) - paused_time - element = window.FindElement('button') - element.Update(text='Pause') - - # --------- Display timer in window -------- - window.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, - (current_time // 100) % 60, - current_time % 100)) - time.sleep(.01) - - # --------- After loop -------- - - # Broke out of main loop. Close the window. - window.CloseNonBlocking() - -## Desktop Floating Widget - CPU Utilization - -Like the Timer widget above, this script can be kept running. You will need the package psutil installed in order to run this Recipe. -The spinner changes the number of seconds between reads. Note that you will get an error message printed when exiting because the window does not have have a titlebar. It's a known problem. - - -![cpu widget 2](https://user-images.githubusercontent.com/13696193/45456096-77348080-b6b7-11e8-8906-6663c31ad0eb.jpg) - - - - import PySimpleGUI as sg - import psutil - + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadButton('Pause', key='button', button_color=('white', '#001480')), + sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), + sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] + + window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) + + + # ---------------- main loop ---------------- + current_time = 0 + paused = False + start_time = int(round(time.time() * 100)) + while (True): + # --------- Read and update window -------- + if not paused: + button, values = window.ReadNonBlocking() + current_time = int(round(time.time() * 100)) - start_time + else: + button, values = window.Read() + if button == 'button': + button = window.FindElement(button).GetText() + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + if button is 'Reset': + start_time = int(round(time.time() * 100)) + current_time = 0 + paused_time = start_time + elif button == 'Pause': + paused = True + paused_time = int(round(time.time() * 100)) + element = window.FindElement('button') + element.Update(text='Run') + elif button == 'Run': + paused = False + start_time = start_time + int(round(time.time() * 100)) - paused_time + element = window.FindElement('button') + element.Update(text='Pause') + + # --------- Display timer in window -------- + window.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + (current_time // 100) % 60, + current_time % 100)) + time.sleep(.01) + + # --------- After loop -------- + + # Broke out of main loop. Close the window. + window.CloseNonBlocking() + +## Desktop Floating Widget - CPU Utilization + +Like the Timer widget above, this script can be kept running. You will need the package psutil installed in order to run this Recipe. +The spinner changes the number of seconds between reads. Note that you will get an error message printed when exiting because the window does not have have a titlebar. It's a known problem. + + +![cpu widget 2](https://user-images.githubusercontent.com/13696193/45456096-77348080-b6b7-11e8-8906-6663c31ad0eb.jpg) + + + + import PySimpleGUI as sg + import psutil + # ---------------- Create Window ---------------- - sg.ChangeLookAndFeel('Black') + sg.ChangeLookAndFeel('Black') layout = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')]] window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) - - - # ---------------- main loop ---------------- - while (True): - # --------- Read and update window -------- - button, values = window.ReadNonBlocking() - - # --------- Do Button Operations -------- - if values is None or button == 'Exit': - break - try: - interval = int(values['spin']) - except: - interval = 1 - - cpu_percent = psutil.cpu_percent(interval=interval) - - # --------- Display timer in window -------- - - window.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') - - # Broke out of main loop. Close the window. - window.CloseNonBlocking() - -## Menus - -Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. - + + + # ---------------- main loop ---------------- + while (True): + # --------- Read and update window -------- + button, values = window.ReadNonBlocking() + + # --------- Do Button Operations -------- + if values is None or button == 'Exit': + break + try: + interval = int(values['spin']) + except: + interval = 1 + + cpu_percent = psutil.cpu_percent(interval=interval) + + # --------- Display timer in window -------- + + window.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + + # Broke out of main loop. Close the window. + window.CloseNonBlocking() + +## Menus + +Menus are nothing more than buttons that live in a menu-bar. When you click on a menu item, you get back a "button" with that menu item's text, just as you would had that text been on a button. + Menu's are defined separately from the GUI window. To add one to your window, simply insert sg.Menu(menu_layout). The menu definition is a list of menu choices and submenus. They are a list of lists. Copy the Recipe and play with it. You'll eventually get when you're looking for. - -If you double click the dashed line at the top of the list of choices, that menu will tear off and become a floating toolbar. How cool! - - -![tear off](https://user-images.githubusercontent.com/13696193/45307668-9aabcf80-b4ed-11e8-9b2b-8564d4bf82a8.jpg) - - - - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('LightGreen') - sg.SetOptions(element_padding=(0, 0)) - - # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Exit' ]], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] - - # ------ GUI Defintion ------ # - layout = [ - [sg.Menu(menu_def)], - [sg.Output(size=(60, 20))] - ] - - window = sg.Window("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12, 1)).Layout(layout) - - # ------ Loop & Process button menu choices ------ # - while True: - button, values = window.Read() - if button == None or button == 'Exit': - break - print('Button = ', button) - # ------ Process menu choices ------ # - if button == 'About...': - sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') - elif button == 'Open': - filename = sg.PopupGetFile('file to open', no_window=True) - print(filename) - -## Graphing with Graph Element - -Use the Graph Element to draw points, lines, circles, rectangles using ***your*** coordinate systems rather than the underlying graphics coordinates. - -In this example we're defining our graph to be from -100, -100 to +100,+100. That means that zero is in the middle of the drawing. You define this graph description in your call to Graph. - -![snap0354](https://user-images.githubusercontent.com/13696193/45861485-cd9a6280-bd3a-11e8-83ea-32ca42dc9f3a.jpg) - - - - import math - import PySimpleGUI as sg - - layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] - - window = sg.Window('Graph of Sine Function').Layout(layout) - window.Finalize() - graph = window.FindElement('graph') - - graph.DrawLine((-100,0), (100,0)) - graph.DrawLine((0,-100), (0,100)) - - for x in range(-100,100): - y = math.sin(x/20)*50 - graph.DrawPoint((x,y), color='red') - - button, values = window.Read() - - -## Creating a Windows .EXE File - -It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. - -Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) - - pip install PySimpleGUI - pip install PyInstaller - -To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: - - pyinstaller -wF my_program.py - -You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. - -That's all... Run your `my_program.exe` file on the Windows machine of your choosing. - -> "It's just that easy." -> -(famous last words that screw up just about anything being referenced) - + +If you double click the dashed line at the top of the list of choices, that menu will tear off and become a floating toolbar. How cool! + + +![tear off](https://user-images.githubusercontent.com/13696193/45307668-9aabcf80-b4ed-11e8-9b2b-8564d4bf82a8.jpg) + + + + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('LightGreen') + sg.SetOptions(element_padding=(0, 0)) + + # ------ Menu Definition ------ # + menu_def = [['File', ['Open', 'Save', 'Exit' ]], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + # ------ GUI Defintion ------ # + layout = [ + [sg.Menu(menu_def)], + [sg.Output(size=(60, 20))] + ] + + window = sg.Window("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12, 1)).Layout(layout) + + # ------ Loop & Process button menu choices ------ # + while True: + button, values = window.Read() + if button == None or button == 'Exit': + break + print('Button = ', button) + # ------ Process menu choices ------ # + if button == 'About...': + sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') + elif button == 'Open': + filename = sg.PopupGetFile('file to open', no_window=True) + print(filename) + +## Graphing with Graph Element + +Use the Graph Element to draw points, lines, circles, rectangles using ***your*** coordinate systems rather than the underlying graphics coordinates. + +In this example we're defining our graph to be from -100, -100 to +100,+100. That means that zero is in the middle of the drawing. You define this graph description in your call to Graph. + +![snap0354](https://user-images.githubusercontent.com/13696193/45861485-cd9a6280-bd3a-11e8-83ea-32ca42dc9f3a.jpg) + + + + import math + import PySimpleGUI as sg + + layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph')],] + + window = sg.Window('Graph of Sine Function').Layout(layout) + window.Finalize() + graph = window.FindElement('graph') + + graph.DrawLine((-100,0), (100,0)) + graph.DrawLine((0,-100), (0,100)) + + for x in range(-100,100): + y = math.sin(x/20)*50 + graph.DrawPoint((x,y), color='red') + + button, values = window.Read() + + +## Creating a Windows .EXE File + +It's possible to create a single .EXE file that can be distributed to Windows users. There is no requirement to install the Python interpreter on the PC you wish to run it on. Everything it needs is in the one EXE file, assuming you're running a somewhat up to date version of Windows. + +Installation of the packages, you'll need to install PySimpleGUI and PyInstaller (you need to install only once) + + pip install PySimpleGUI + pip install PyInstaller + +To create your EXE file from your program that uses PySimpleGUI, `my_program.py`, enter this command in your Windows command prompt: + + pyinstaller -wF my_program.py + +You will be left with a single file, `my_program.exe`, located in a folder named `dist` under the folder where you executed the `pyinstaller` command. + +That's all... Run your `my_program.exe` file on the Windows machine of your choosing. + +> "It's just that easy." +> +(famous last words that screw up just about anything being referenced) + Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. \ No newline at end of file From 0bac183b9d2989e823c5c8f8c75dcb8e1397d23e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 23 Sep 2018 23:03:20 -0400 Subject: [PATCH 452/521] MORE form renaming to window... --- docs/tutorial.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 7c62e9e2e..9526216fe 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -27,11 +27,11 @@ What makes PySimpleGUI superior for newcomers is that the package contains the m With some GUIs arranging the GUI Widgets often requires several lines of code.... at least one or two lines per widget. PySimpleGUI uses an "auto-packer" that creates the layout for the user automatically. There is no concept of a pack nor a grid system needed to layout a GUI Window. -Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a form layout, it is configured in-place, not several lines of code away. Results are returned as a simple list or a dictionary. +Finally, PySimpleGUI leverages the Python language constructs in clever ways that shortens the amount of code and returns the GUI data in a straightforward manner. When a Widget is created in a window layout, it is configured in-place, not several lines of code away. Results are returned as a simple list or a dictionary. ## What is a GUI? -Most GUIs do one thing.... they collect information from the user and return it. From a programmer's viewpoint a GUI that collects information, like a form, could be summed up as a function call that looks like this: +Most GUIs do one thing.... they collect information from the user and return it. From a programmer's viewpoint a GUI that collects information, like a window, could be summed up as a function call that looks like this: button, values = GUI_Display(gui_layout) @@ -65,7 +65,7 @@ Let's look at the first recipe from the book [sg.Submit(), sg.Cancel()] ] - window = sg.Window('Simple data entry form').Layout(layout) + window = sg.Window('Simple data entry window').Layout(layout) button, values = window.Read() print(button, values[0], values[1], values[2]) @@ -187,7 +187,7 @@ The stuff that tends not to change in GUIs are the calls that setup and show the * Define GUI as a list of lists * Show the GUI and get results -Some windows act more like Windows programs. These windows have an "Event Loop". Please see the readme for more info on these kinds of forms (Persistent windows) +Some windows act more like Windows programs. These windows have an "Event Loop". Please see the readme for more info on these kinds of windows (Persistent windows) These are line for line what you see in design pattern above. From 4e1c7bb75fe8014c2d59669739d44e66e7aed5cb Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 00:53:24 -0400 Subject: [PATCH 453/521] Swapped parameter in OneLineProgressMeter --- docs/index.md | 4 ++-- readme.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 812257a8e..3ac9259b9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -485,7 +485,7 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! for i in range(1,10000): - sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'key','Optional message') That line of code resulted in this window popping up and updating. @@ -1701,7 +1701,7 @@ The `ProgressBar` element is used to build custom Progress Bar windows. It is H The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen OneLineProgressMeter calls presented earlier in this readme. - sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'key', 'Optional message') The return value for `OneLineProgressMeter` is: `True` if meter updated correctly diff --git a/readme.md b/readme.md index 812257a8e..3ac9259b9 100644 --- a/readme.md +++ b/readme.md @@ -485,7 +485,7 @@ We all have loops in our code. 'Isn't it joyful waiting, watching a counter scr Here's the one-line Progress Meter in action! for i in range(1,10000): - sg.OneLineProgressMeter('My Meter', i+1, 10000, 'Optional message', 'key') + sg.OneLineProgressMeter('My Meter', i+1, 10000, 'key','Optional message') That line of code resulted in this window popping up and updating. @@ -1701,7 +1701,7 @@ The `ProgressBar` element is used to build custom Progress Bar windows. It is H The **easiest** way to get progress meters into your code is to use the `OneLineProgressMeter` API. This consists of a pair of functions, `OneLineProgressMeter` and `OneLineProgressMeterCancel`. You can easily cancel any progress meter by calling it with the current value = max value. This will mark the meter as expired and close the window. You've already seen OneLineProgressMeter calls presented earlier in this readme. - sg.OneLineProgressMeter('My Meter', i+1, 1000, 'Optional message', 'key') + sg.OneLineProgressMeter('My Meter', i+1, 1000, 'key', 'Optional message') The return value for `OneLineProgressMeter` is: `True` if meter updated correctly From 20ec508234002e6058f83deca3d80483512d9d8c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 10:36:22 -0400 Subject: [PATCH 454/521] New feature! TABS - This time for real, done the "right way" (yea right) --- PySimpleGUI.py | 162 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 0d2bf45fd..5febc8671 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -194,6 +194,8 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_CANVAS = 40 ELEM_TYPE_FRAME = 41 ELEM_TYPE_GRAPH = 42 +ELEM_TYPE_TAB = 50 +ELEM_TYPE_MULTI_TAB = 51 ELEM_TYPE_INPUT_SLIDER = 10 ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 @@ -1379,6 +1381,121 @@ def __del__(self): super().__del__() + +# ---------------------------------------------------------------------- # +# Tab # +# ---------------------------------------------------------------------- # +class Tab(Element): + def __init__(self, title, layout, title_color=None, background_color=None, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): + + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + self.TKFrame = None + self.Title = title + self.BorderWidth = border_width + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + + self.Layout(layout) + + super().__init__(ELEM_TYPE_TAB, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key, tooltip=tooltip) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + super().__del__() + + + +# ---------------------------------------------------------------------- # +# MultiTab # +# ---------------------------------------------------------------------- # +class MultiTab(Element): + def __init__(self, layout, title_color=None, background_color=None, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): + + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + self.TKNotebook = None + self.BorderWidth = border_width + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + + self.Layout(layout) + + super().__init__(ELEM_TYPE_MULTI_TAB, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key, tooltip=tooltip) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + super().__del__() + + + + # ---------------------------------------------------------------------- # # Slider # # ---------------------------------------------------------------------- # @@ -2043,6 +2160,14 @@ def FindElement(self, key): return element + def UpdateElements(self, key_list, value_list): + for i, key in enumerate(key_list): + try: + self.FindElement(key).Update(value_list[i]) + except: + pass + + def SaveToDisk(self, filename): try: results = BuildResults(self, False, self) @@ -2998,6 +3123,42 @@ def CharWidthInPixels(): labeled_frame.configure(borderwidth=element.BorderWidth) if element.Tooltip is not None: element.TooltipObject = ToolTip(labeled_frame, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- Tab element ------------------------- # + elif element_type == ELEM_TYPE_TAB: + element.TKFrame = ttk.Frame(form.TKNotebook) + PackFormIntoFrame(element, element.TKFrame, toplevel_form) + form.TKNotebook.add(element.TKFrame, text='foo') + form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # form.TKNotebook.pack(row=0, sticky=tk.NW) + + # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + # element.TKFrame.configure(background=element.BackgroundColor, + # highlightbackground=element.BackgroundColor, + # highlightcolor=element.BackgroundColor) + # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + # element.TKFrame.configure(foreground=element.TextColor) + # if element.BorderWidth is not None: + # element.TKFrame.configure(borderwidth=element.BorderWidth) + # if element.Tooltip is not None: + # element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, + # timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- MultiTab element ------------------------- # + elif element_type == ELEM_TYPE_MULTI_TAB: + element.TKNotebook = ttk.Notebook(tk_row_frame) + PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form) + + # element.TKNotebook.pack(side=tk.LEFT) + # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + # element.TKNotebook.configure(background=element.BackgroundColor, + # highlightbackground=element.BackgroundColor, + # highlightcolor=element.BackgroundColor) + # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + # element.TKNotebook.configure(foreground=element.TextColor) + # if element.BorderWidth is not None: + # element.TKNotebook.configure(borderwidth=element.BorderWidth) + # if element.Tooltip is not None: + # element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip, + # timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() @@ -3170,6 +3331,7 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A for num,x in enumerate(args): form, rows, tab_name = x form.AddRows(rows) + form.UseDictionary = True if DEFAULT_BACKGROUND_COLOR: framestyle.theme_use('framestyle') From 2bf5ce46b4140a61f73647bf25a92b225d9a3000 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 10:40:08 -0400 Subject: [PATCH 455/521] Demo of new Tab Element --- Demo_Tabs.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Demo_Tabs.py diff --git a/Demo_Tabs.py b/Demo_Tabs.py new file mode 100644 index 000000000..ab8b3bdb0 --- /dev/null +++ b/Demo_Tabs.py @@ -0,0 +1,20 @@ +import PySimpleGUI as sg + +tab1_layout = [[sg.T('This is inside tab 1')]] +tab2_layout = [[sg.T('This is inside tab 2')]] + +tab3_layout = [[sg.T('This is inside tab 3')]] +tab4_layout = [[sg.T('This is inside tab 4')]] + +tab5_layout = [[sg.T('This is inside tab 5')]] +tab6_layout = [[sg.T('This is inside tab 6')], + [sg.T('How about a second row of stuff in tab 6?')]] + +layout = [[sg.T('My Window!')], + [sg.MultiTab([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.MultiTab([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], + [sg.T('Text in the middle of the mess')], + [sg.MultiTab([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], + ] +window = sg.Window('My window with tabs').Layout(layout) + +b, v = window.Read() From 1d0495a0bc02cc79cb67cc73afede2acb776bd8f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 10:49:29 -0400 Subject: [PATCH 456/521] Ability to READ TABS! How useful! --- PySimpleGUI.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 5febc8671..76ee4e2e3 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -318,7 +318,14 @@ def FindReturnKeyBoundButton(self, form): rc = self.FindReturnKeyBoundButton(element) if rc is not None: return rc - + if element.Type == ELEM_TYPE_MULTI_TAB: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + if element.Type == ELEM_TYPE_TAB: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc return None def TextClickedHandler(self, event): @@ -2484,6 +2491,30 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): if element.ReturnValues[0] is not None: # if a button was clicked button_pressed_text = element.ReturnValues[0] + if element.Type == ELEM_TYPE_MULTI_TAB: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + + if element.Type == ELEM_TYPE_TAB: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + if not initialize_only: if element.Type == ELEM_TYPE_INPUT_TEXT: value=element.TKStringVar.get() @@ -2544,7 +2575,8 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): # if an input type element, update the results if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and \ - element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME: + element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME and element.Type != ELEM_TYPE_MULTI_TAB \ + and element.Type != ELEM_TYPE_TAB: AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER and element.Target == (None,None)) or \ @@ -2582,6 +2614,10 @@ def FillSubformWithValues(form, values_dict): FillSubformWithValues(element, values_dict) if element.Type == ELEM_TYPE_FRAME: FillSubformWithValues(element, values_dict) + if element.Type == ELEM_TYPE_MULTI_TAB: + FillSubformWithValues(element, values_dict) + if element.Type == ELEM_TYPE_TAB: + FillSubformWithValues(element, values_dict) try: value = values_dict[element.Key] except: @@ -2618,6 +2654,14 @@ def _FindElementFromKeyInSubForm(form, key): matching_elem = _FindElementFromKeyInSubForm(element, key) if matching_elem is not None: return matching_elem + if element.Type == ELEM_TYPE_MULTI_TAB: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem + if element.Type == ELEM_TYPE_TAB: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem if element.Key == key: return element @@ -3127,7 +3171,7 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_TAB: element.TKFrame = ttk.Frame(form.TKNotebook) PackFormIntoFrame(element, element.TKFrame, toplevel_form) - form.TKNotebook.add(element.TKFrame, text='foo') + form.TKNotebook.add(element.TKFrame, text=element.Title) form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) # form.TKNotebook.pack(row=0, sticky=tk.NW) From d633329a5ba905ff817f66b6197bcb825b18c3a0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 10:53:24 -0400 Subject: [PATCH 457/521] Test tab inputs --- Demo_Tabs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Demo_Tabs.py b/Demo_Tabs.py index ab8b3bdb0..17bb36346 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -1,7 +1,7 @@ import PySimpleGUI as sg tab1_layout = [[sg.T('This is inside tab 1')]] -tab2_layout = [[sg.T('This is inside tab 2')]] +tab2_layout = [[sg.T('This is inside tab 2'), sg.In(key='in')]] tab3_layout = [[sg.T('This is inside tab 3')]] tab4_layout = [[sg.T('This is inside tab 4')]] @@ -14,7 +14,12 @@ [sg.MultiTab([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.MultiTab([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], [sg.T('Text in the middle of the mess')], [sg.MultiTab([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], + [sg.RButton('Read')], ] window = sg.Window('My window with tabs').Layout(layout) -b, v = window.Read() +while True: + b, v = window.Read() + print(b,v) + if b is None: # always, always give a way out! + break \ No newline at end of file From afbaa5ef971d50b761bdf19788c46da567cb2971 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 12:17:45 -0400 Subject: [PATCH 458/521] Renamed MultiTab to TabGroup --- Demo_Tabs.py | 5 +++-- PySimpleGUI.py | 37 ++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Demo_Tabs.py b/Demo_Tabs.py index 17bb36346..a90fbff35 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -11,11 +11,12 @@ [sg.T('How about a second row of stuff in tab 6?')]] layout = [[sg.T('My Window!')], - [sg.MultiTab([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.MultiTab([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], + [sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], [sg.T('Text in the middle of the mess')], - [sg.MultiTab([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], + [sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], [sg.RButton('Read')], ] + window = sg.Window('My window with tabs').Layout(layout) while True: diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 76ee4e2e3..4abd02f35 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1447,9 +1447,9 @@ def __del__(self): # ---------------------------------------------------------------------- # -# MultiTab # +# TabGroup # # ---------------------------------------------------------------------- # -class MultiTab(Element): +class TabGroup(Element): def __init__(self, layout, title_color=None, background_color=None, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): self.UseDictionary = False @@ -3173,7 +3173,6 @@ def CharWidthInPixels(): PackFormIntoFrame(element, element.TKFrame, toplevel_form) form.TKNotebook.add(element.TKFrame, text=element.Title) form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - # form.TKNotebook.pack(row=0, sticky=tk.NW) # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: # element.TKFrame.configure(background=element.BackgroundColor, @@ -3181,28 +3180,28 @@ def CharWidthInPixels(): # highlightcolor=element.BackgroundColor) # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: # element.TKFrame.configure(foreground=element.TextColor) - # if element.BorderWidth is not None: - # element.TKFrame.configure(borderwidth=element.BorderWidth) - # if element.Tooltip is not None: - # element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, - # timeout=DEFAULT_TOOLTIP_TIME) + if element.BorderWidth is not None: + element.TKFrame.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, + timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- MultiTab element ------------------------- # elif element_type == ELEM_TYPE_MULTI_TAB: element.TKNotebook = ttk.Notebook(tk_row_frame) PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form) # element.TKNotebook.pack(side=tk.LEFT) - # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: - # element.TKNotebook.configure(background=element.BackgroundColor, - # highlightbackground=element.BackgroundColor, - # highlightcolor=element.BackgroundColor) - # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - # element.TKNotebook.configure(foreground=element.TextColor) - # if element.BorderWidth is not None: - # element.TKNotebook.configure(borderwidth=element.BorderWidth) - # if element.Tooltip is not None: - # element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip, - # timeout=DEFAULT_TOOLTIP_TIME) + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + element.TKNotebook.configure(background=element.BackgroundColor, + highlightbackground=element.BackgroundColor, + highlightcolor=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + element.TKNotebook.configure(foreground=element.TextColor) + if element.BorderWidth is not None: + element.TKNotebook.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip, + timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels() From 2a066833831053366c078710665200cabc368468 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 12:24:55 -0400 Subject: [PATCH 459/521] Added a couple of very helpful contributors. Thank you to everyone that has helped!! --- docs/index.md | 3 +++ readme.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/index.md b/docs/index.md index 3ac9259b9..8be576ac0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2742,6 +2742,9 @@ GNU Lesser General Public License (LGPL 3) + * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help +* [agjunyent](https://github.com/agjunyent) figured out how to properly make tabs and wrote prototype code that demonstrated how to do it +* [jfongattw](https://github.com/jfongattw) huge suggestion... dictionaries. turned out to be one of the most critical constructs in PySimpleGUI + ## How Do I diff --git a/readme.md b/readme.md index 3ac9259b9..8be576ac0 100644 --- a/readme.md +++ b/readme.md @@ -2742,6 +2742,9 @@ GNU Lesser General Public License (LGPL 3) + * [moshekaplan](https://github.com/moshekaplan)/**[tkinter_components](https://github.com/moshekaplan/tkinter_components)** wrote the code for the Calendar Chooser Element. It was lifted straight from GitHub * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help +* [agjunyent](https://github.com/agjunyent) figured out how to properly make tabs and wrote prototype code that demonstrated how to do it +* [jfongattw](https://github.com/jfongattw) huge suggestion... dictionaries. turned out to be one of the most critical constructs in PySimpleGUI + ## How Do I From a1f4c60271a8344fbb052b9c507c0f03e91b9464 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 18:01:00 -0400 Subject: [PATCH 460/521] Major demo refresh.. switched everything to new function names, new design patterns Out with the old, in with the new!! --- Demo_All_Widgets.py | 9 +- Demo_Borderless_Window.py | 16 +- Demo_Button_Click.py | 18 +- Demo_Button_States.py | 78 +- Demo_Calendar.py | 4 +- Demo_Canvas.py | 12 +- Demo_Chat.py | 21 +- Demo_Chat_With_History.py | 31 +- Demo_Chatterbot.py | 21 +- Demo_Color.py | 20 +- Demo_Color_Names.py | 107 +++ Demo_Columns.py | 69 +- Demo_Compare_Files.py | 20 +- Demo_Cookbook_Browser.py | 793 ------------------ Demo_DOC_Viewer_PIL.py | 14 +- Demo_Desktop_Floating_Toolbar.py | 20 +- Demo_Desktop_Widget_CPU_Graph.py | 9 +- Demo_Desktop_Widget_CPU_Utilization.py | 16 +- Demo_Desktop_Widget_CPU_Utilization_Simple.py | 11 +- Demo_Desktop_Widget_Timer.py | 27 +- Demo_Disable_Elements.py | 57 +- Demo_DisplayHash1and256.py | 124 --- Demo_Fill_Form.py | 18 +- Demo_Font_Sizer.py | 12 +- Demo_Func_Callback_Simulation.py | 4 +- Demo_GoodColors.py | 54 +- Demo_Graph_Drawing.py | 8 +- Demo_Graph_Element.py | 17 +- Demo_Graph_Element_Sine_Wave.py | 6 +- Demo_Graph_Noise.py | 29 +- Demo_HowDoI.py | 34 +- Demo_Img_Viewer.py | 8 +- Demo_Keyboard.py | 32 +- Demo_Keyboard_Realtime.py | 31 +- Demo_Keypad.py | 28 +- Demo_MIDI_Player.py | 32 +- Demo_Machine_Learning.py | 22 +- Demo_Matplotlib.py | 6 +- Demo_Matplotlib_Animated.py | 16 +- Demo_Matplotlib_Animated_Scatter.py | 12 +- Demo_Matplotlib_Browser.py | 18 +- Demo_Matplotlib_Ping_Graph.py | 10 +- Demo_Matplotlib_Ping_Graph_Large.py | 12 +- Demo_Media_Player.py | 22 +- Demo_Menus.py | 11 +- Demo_NonBlocking_Form.py | 58 +- Demo_OpenCV.py | 23 +- Demo_PDF_Viewer.py | 21 +- Demo_PNG_Viewer.py | 24 +- Demo_Password_Login.py | 12 +- Demo_Pi_LEDs.py | 20 +- Demo_Pi_Robotics.py | 33 +- Demo_Ping_Line_Graph.py | 12 +- Demo_Pong.py | 12 +- Demo_Progress_Meters.py | 12 +- Demo_Recipes.py | 237 ------ Demo_Script_Launcher.py | 10 +- Demo_Script_Parameters.py | 2 +- Demo_Spinner_Compound_Element.py | 11 +- Demo_Super_Simple_Form.py | 10 +- Demo_Tabbed_Form.py | 4 +- Demo_Table_CSV.py | 20 +- Demo_Table_Element.py | 12 +- Demo_Table_Pandas.py | 11 +- Demo_Table_Simulation.py | 16 +- Demo_Tabs.py | 26 +- Demo_Tabs_Nested.py | 29 + Demo_Youtube-dl_Frontend.py | 15 +- 68 files changed, 706 insertions(+), 1863 deletions(-) create mode 100644 Demo_Color_Names.py delete mode 100644 Demo_Cookbook_Browser.py delete mode 100644 Demo_DisplayHash1and256.py delete mode 100644 Demo_Recipes.py create mode 100644 Demo_Tabs_Nested.py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index bf81163db..6a176c8af 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -38,15 +38,14 @@ [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()] -] + ] +window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) -form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) - -button, values = form.Read() +button, values = window.Read() sg.Popup('Title', - 'The results of the form.', + 'The results of the window.', 'The button clicked was "{}"'.format(button), 'The values are', values) diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py index 1d615059e..8e28a2c45 100644 --- a/Demo_Borderless_Window.py +++ b/Demo_Borderless_Window.py @@ -11,20 +11,20 @@ [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('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('Stop', button_color=('gray50', 'black')), - sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), - sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')), - sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] + [sg.ReadButton('Start', button_color=('white', 'black')), + sg.ReadButton('Stop', button_color=('gray50', 'black')), + sg.ReadButton('Reset', button_color=('white', '#9B0023')), + sg.ReadButton('Submit', button_color=('gray60', 'springgreen4')), + sg.Button('Exit', button_color=('white', '#00406B'))]] -form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, +window = sg.Window("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, auto_size_buttons=False, no_titlebar=True, default_button_element_size=(12, 1)) -form.Layout(layout) +window.Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is None or button == 'Exit': break diff --git a/Demo_Button_Click.py b/Demo_Button_Click.py index 2dfa029c6..2735e0fa0 100644 --- a/Demo_Button_Click.py +++ b/Demo_Button_Click.py @@ -1,24 +1,24 @@ import PySimpleGUI as sg import winsound - +import sys sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0,0)) layout = [ - [sg.ReadFormButton('Start', button_color=('white', 'black'), key='start'), - sg.ReadFormButton('Stop', button_color=('white', 'black'), key='stop'), - sg.ReadFormButton('Reset', button_color=('white', 'firebrick3'), key='reset'), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4'), key='submit')] + [sg.ReadButton('Start', button_color=('white', 'black'), key='start'), + sg.ReadButton('Stop', button_color=('white', 'black'), key='stop'), + sg.ReadButton('Reset', button_color=('white', 'firebrick3'), key='reset'), + sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='submit')] ] -form = sg.FlexForm("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1)).Layout(layout).Finalize() +window = sg.Window("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1), use_default_focus=False).Layout(layout).Finalize() -form.FindElement('submit').Update(disabled=True) +window.FindElement('submit').Update(disabled=True) recording = have_data = False while True: - button, values = form.Read() + button, values = window.Read() if button is None: - exit(69) + sys.exit(69) winsound.PlaySound("ButtonClick.wav", 1) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index e3a9cfb77..3871760e6 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -1,31 +1,57 @@ import PySimpleGUI as sg +import sys +""" +Demonstrates using a "tight" layout with a Dark theme. +Shows how button states can be controlled by a user application. The program manages the disabled/enabled +states for buttons and changes the text color to show greyed-out (disabled) buttons +""" -sg.ChangeLookAndFeel('LightGreen') -sg.SetOptions(element_padding=(0, 0)) +sg.ChangeLookAndFeel('Dark') +sg.SetOptions(element_padding=(0,0)) -# ------ Menu Definition ------ # -menu_def = [['File', ['Open', 'Save', 'Exit' ]], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] +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('Customer:', pad=((3,0),0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20,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.ReadButton('Start', button_color=('white', 'black'), key='Start'), + sg.ReadButton('Stop', button_color=('white', 'black'), key='Stop'), + sg.ReadButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), + sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] + ] -# ------ GUI Defintion ------ # -layout = [ - [sg.Menu(menu_def)], - [sg.Output(size=(60, 20))] -] - -form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12, 1)).Layout(layout) - -# ------ Loop & Process button menu choices ------ # +window = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12,1)).Layout(layout) +window.Finalize() +window.FindElement('Stop').Update(disabled=True) +window.FindElement('Reset').Update(disabled=True) +window.FindElement('Submit').Update(disabled=True) +recording = have_data = False while True: - button, values = form.Read() - if button == None or button == 'Exit': - break - print('Button = ', button) - # ------ Process menu choices ------ # - if button == 'About...': - sg.Popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...') - elif button == 'Open': - filename = sg.PopupGetFile('file to open', no_window=True) - print(filename) \ No newline at end of file + button, values = window.Read() + print(button) + if button is None: + sys.exit(69) + if button is 'Start': + window.FindElement('Start').Update(disabled=True) + window.FindElement('Stop').Update(disabled=False) + window.FindElement('Reset').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + recording = True + elif button is 'Stop' and recording: + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=False) + recording = False + have_data = True + elif button is 'Reset': + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + window.FindElement('Reset').Update(disabled=False) + recording = False + have_data = False + elif button is 'Submit' and have_data: + window.FindElement('Stop').Update(disabled=True) + window.FindElement('Start').Update(disabled=False) + window.FindElement('Submit').Update(disabled=True) + window.FindElement('Reset').Update(disabled=False) + recording = False diff --git a/Demo_Calendar.py b/Demo_Calendar.py index 2ecc18f6d..b04376c3d 100644 --- a/Demo_Calendar.py +++ b/Demo_Calendar.py @@ -5,6 +5,6 @@ [sg.CalendarButton('Choose Date', target='input', key='date')], [sg.Ok(key=1)]] -form = sg.FlexForm('Calendar', grab_anywhere=False) -b,v = form.LayoutAndRead(layout) +window = sg.Window('Calendar', grab_anywhere=False).Layout(layout) +b,v = window.Read() sg.Popup(v['input']) diff --git a/Demo_Canvas.py b/Demo_Canvas.py index cbe01caa2..01e1952dc 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -3,18 +3,18 @@ layout = [ [sg.Canvas(size=(150, 150), background_color='red', key='canvas')], - [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue')] + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue')] ] -form = sg.FlexForm('Canvas test').Layout(layout).Finalize() +window = sg.Window('Canvas test').Layout(layout).Finalize() -cir = form.FindElement('canvas').TKCanvas.create_oval(50, 50, 100, 100) +cir = window.FindElement('canvas').TKCanvas.create_oval(50, 50, 100, 100) while True: - button, values = form.Read() + button, values = window.Read() if button is None: break if button is 'Blue': - form.FindElement('canvas').TKCanvas.itemconfig(cir, fill = "Blue") + window.FindElement('canvas').TKCanvas.itemconfig(cir, fill = "Blue") elif button is 'Red': - form.FindElement('canvas').TKCanvas.itemconfig(cir, fill = "Red") + window.FindElement('canvas').TKCanvas.itemconfig(cir, fill = "Red") diff --git a/Demo_Chat.py b/Demo_Chat.py index db2b610a9..09f16fd63 100644 --- a/Demo_Chat.py +++ b/Demo_Chat.py @@ -1,31 +1,28 @@ import PySimpleGUI as sg +import sys ''' A chat window. Add call to your send-routine, print the response and you're done ''' -# ------- Make a new FlexForm ------- # -sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors +sg.ChangeLookAndFeel('GreenTan') # give our window a spiffy set of colors -form = sg.FlexForm('Chat window', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2)) - -layout = [ - [sg.Text('Your output will go here', size=(40, 1))], +layout = [[sg.Text('Your output will go here', size=(40, 1))], [sg.Output(size=(127, 30), font=('Helvetica 10'))], [sg.Multiline(size=(85, 5), enter_submits=True, key='query'), - 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]))] - ] -form.Layout(layout) + sg.ReadButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + +window = sg.Window('Chat window', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2)).Layout(layout) # ---===--- Loop taking in user input and using it --- # while True: - (button, value) = form.Read() + (button, value) = window.Read() if button is 'SEND': query = value['query'].rstrip() # EXECUTE YOUR COMMAND HERE print('The command you entered was {}'.format(query)) elif button is None or button is 'EXIT': # quit if exit button or X break -exit(69) +sys.exit(69) diff --git a/Demo_Chat_With_History.py b/Demo_Chat_With_History.py index 3b80ea7ca..5eda2b424 100644 --- a/Demo_Chat_With_History.py +++ b/Demo_Chat_With_History.py @@ -1,5 +1,5 @@ import PySimpleGUI as sg - +import sys ''' A chatbot with history Scroll up and down through prior commands using the arrow keys @@ -11,48 +11,45 @@ ''' def ChatBotWithHistory(): - # ------- Make a new FlexForm ------- # + # ------- Make a new Window ------- # sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors - 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) - - layout = [ - [sg.Text('Your output will go here', size=(40, 1))], + layout = [[sg.Text('Your output will go here', size=(40, 1))], [sg.Output(size=(127, 30), font=('Helvetica 10'))], [sg.T('Command History'), sg.T('', size=(20,3), key='history')], [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.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] - ] - form.Layout(layout) + sg.ReadButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + + window = sg.Window('Chat window with history', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True).Layout(layout) # ---===--- Loop taking in user input and using it --- # command_history = [] history_offset = 0 while True: - (button, value) = form.Read() + (button, value) = window.Read() if button is 'SEND': query = value['query'].rstrip() # EXECUTE YOUR COMMAND HERE print('The command you entered was {}'.format(query)) command_history.append(query) history_offset = len(command_history)-1 - form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear - form.FindElement('history').Update('\n'.join(command_history[-3:])) + window.FindElement('query').Update('') # manually clear input because keyboard events blocks clear + window.FindElement('history').Update('\n'.join(command_history[-3:])) elif button is None or button is 'EXIT': # quit if exit button or X break elif 'Up' in button and len(command_history): command = command_history[history_offset] history_offset -= 1 * (history_offset > 0) # decrement is not zero - form.FindElement('query').Update(command) + window.FindElement('query').Update(command) elif 'Down' in button and len(command_history): history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list command = command_history[history_offset] - form.FindElement('query').Update(command) + window.FindElement('query').Update(command) elif 'Escape' in button: - form.FindElement('query').Update('') + window.FindElement('query').Update('') - exit(69) + sys.exit(69) ChatBotWithHistory() diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index 12832a46a..dec613c55 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -1,6 +1,7 @@ import PySimpleGUI as sg from chatterbot import ChatBot import chatterbot.utils +import sys ''' Demo_Chatterbot.py @@ -22,7 +23,7 @@ texts.append(sg.T(' ' * 20, size=(20, 1), justification='right')) training_layout += [[texts[i], bars[i]],] # add a single row -training_form = sg.FlexForm('Training').Layout(training_layout) +training_window = sg.Window('Training').Layout(training_layout) current_bar = 0 # callback function for training runs @@ -30,13 +31,13 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar global current_bar global bars global texts - global training_form - # update the form and the bars - button, values = training_form.ReadNonBlocking() - if button is None and values is None: # if user closed the form on us, exit - exit(69) + global training_window + # update the window and the bars + button, values = training_window.ReadNonBlocking() + if button is None and values is None: # if user closed the window on us, exit + sys.exit(69) if bars[current_bar].UpdateBar(iteration_counter, max=total_items) is False: - exit(69) + sys.exit(69) texts[current_bar].Update(description) # show the training dataset name if iteration_counter == total_items: current_bar += 1 @@ -53,13 +54,13 @@ def print_progress_bar(description, iteration_counter, total_items, progress_bar layout = [[sg.Output(size=(80, 20))], [sg.Multiline(size=(70, 5), enter_submits=True), - sg.ReadFormButton('SEND', bind_return_key=True), sg.ReadFormButton('EXIT')]] + sg.ReadButton('SEND', bind_return_key=True), sg.ReadButton('EXIT')]] -form = sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)).Layout(layout) +window = sg.Window('Chat Window', auto_size_text=True, default_element_size=(30, 2)).Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # while True: - button, (value,) = form.Read() + button, (value,) = window.Read() if button is not 'SEND': break string = value.rstrip() diff --git a/Demo_Color.py b/Demo_Color.py index e826ce88a..ca2457160 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1639,7 +1639,7 @@ def show_all_colors_on_buttons(): global reverse global colorhex global colors - form = sg.FlexForm('Colors on Buttons Demo', default_element_size=(3, 1), location=(0, 0), icon=MY_WINDOW_ICON, font=("Helvetica", 7)) + window = sg.Window('Colors on Buttons Demo', default_element_size=(3, 1), location=(0, 0), icon=MY_WINDOW_ICON, font=("Helvetica", 7)) row = [] row_len = 20 for i, c in enumerate(colors): @@ -1649,11 +1649,11 @@ def show_all_colors_on_buttons(): row.append(button1) row.append(button2) if (i+1) % row_len == 0: - form.AddRow(*row) + window.AddRow(*row) row = [] if row != []: - form.AddRow(*row) - form.Show() + window.AddRow(*row) + window.Show() GoodColors = [('#0e6251', sg.RGB(255, 246, 122)), @@ -1680,16 +1680,16 @@ def main(): [sg.Text('Demonstration of colors')], [sg.Text('Enter a color name in text or hex #RRGGBB format')], [sg.InputText(key='hex')], - [sg.Listbox(list_of_colors, size=(20, 30), key='listbox'), sg.T('Or choose from list')], - [sg.Submit(), sg.SimpleButton('Many buttons', button_color=('white', '#0e6251')), sg.ColorChooserButton( 'Chooser', target=(3,0)), sg.Quit(),], + [sg.Listbox(list_of_colors, size=(20, 30), bind_return_key=True, key='listbox'), sg.T('Or choose from list')], + [sg.Submit(), sg.Button('Many buttons', button_color=('white', '#0e6251'), key='Many buttons'), sg.ColorChooserButton( 'Chooser', target=(3,0), key='Chooser'), sg.Quit(),], ] # [g.Multiline(DefaultText=str(printable), Size=(30,20))]] - button, values = sg.FlexForm('Color Demo', auto_size_buttons=False).LayoutAndRead(layout) + button, values = sg.Window('Color Demo', auto_size_buttons=False).Layout(layout).Read() # ------- OUTPUT results portion ------- # - if button == '' or button == 'Quit' or button is None: + if button == 'Quit' or button is None: exit(0) - elif button == 'Show me lots of colors!': + elif button == 'Many buttons': show_all_colors_on_buttons() drop_down_value = values['listbox'] @@ -1711,7 +1711,7 @@ def main(): [sg.Button(button_text=color_name, button_color=(color_hex, complementary_hex))], [sg.Button(button_text=complementary_hex + ' ' + complementary_color, button_color=(complementary_hex , color_hex), size=(30, 1))], ] - 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) + sg.Window('Color demo', default_element_size=(100, 1), auto_size_text=True, auto_close=True, auto_close_duration=5, icon=MY_WINDOW_ICON).Layout(layout).Read() diff --git a/Demo_Color_Names.py b/Demo_Color_Names.py new file mode 100644 index 000000000..359bf8b8b --- /dev/null +++ b/Demo_Color_Names.py @@ -0,0 +1,107 @@ +import PySimpleGUI as sg +""" + Color names courtesy of Big Daddy's Wiki-Python + http://www.wikipython.com/tkinter-ttk-tix/summary-information/colors/ + + Shows a big chart of colors... give it a few seconds to create it + Once large window is shown, you can click on any color and another window will popup + showing both white and black text on that color +""" +COLORS = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', + 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', + 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', + 'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray', + 'light slate gray', 'gray', 'light gray', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue', + 'slate blue', 'medium slate blue', 'light slate blue', 'medium blue', 'royal blue', 'blue', + 'dodger blue', 'deep sky blue', 'sky blue', 'light sky blue', 'steel blue', 'light steel blue', + 'light blue', 'powder blue', 'pale turquoise', 'dark turquoise', 'medium turquoise', 'turquoise', + 'cyan', 'light cyan', 'cadet blue', 'medium aquamarine', 'aquamarine', 'dark green', 'dark olive green', + 'dark sea green', 'sea green', 'medium sea green', 'light sea green', 'pale green', 'spring green', + 'lawn green', 'medium spring green', 'green yellow', 'lime green', 'yellow green', + 'forest green', 'olive drab', 'dark khaki', 'khaki', 'pale goldenrod', 'light goldenrod yellow', + 'light yellow', 'yellow', 'gold', 'light goldenrod', 'goldenrod', 'dark goldenrod', 'rosy brown', + 'indian red', 'saddle brown', 'sandy brown', + 'dark salmon', 'salmon', 'light salmon', 'orange', 'dark orange', + 'coral', 'light coral', 'tomato', 'orange red', 'red', 'hot pink', 'deep pink', 'pink', 'light pink', + 'pale violet red', 'maroon', 'medium violet red', 'violet red', + 'medium orchid', 'dark orchid', 'dark violet', 'blue violet', 'purple', 'medium purple', + 'thistle', 'snow2', 'snow3', + 'snow4', 'seashell2', 'seashell3', 'seashell4', 'AntiqueWhite1', 'AntiqueWhite2', + 'AntiqueWhite3', 'AntiqueWhite4', 'bisque2', 'bisque3', 'bisque4', 'PeachPuff2', + 'PeachPuff3', 'PeachPuff4', 'NavajoWhite2', 'NavajoWhite3', 'NavajoWhite4', + 'LemonChiffon2', 'LemonChiffon3', 'LemonChiffon4', 'cornsilk2', 'cornsilk3', + 'cornsilk4', 'ivory2', 'ivory3', 'ivory4', 'honeydew2', 'honeydew3', 'honeydew4', + 'LavenderBlush2', 'LavenderBlush3', 'LavenderBlush4', 'MistyRose2', 'MistyRose3', + 'MistyRose4', 'azure2', 'azure3', 'azure4', 'SlateBlue1', 'SlateBlue2', 'SlateBlue3', + 'SlateBlue4', 'RoyalBlue1', 'RoyalBlue2', 'RoyalBlue3', 'RoyalBlue4', 'blue2', 'blue4', + 'DodgerBlue2', 'DodgerBlue3', 'DodgerBlue4', 'SteelBlue1', 'SteelBlue2', + 'SteelBlue3', 'SteelBlue4', 'DeepSkyBlue2', 'DeepSkyBlue3', 'DeepSkyBlue4', + 'SkyBlue1', 'SkyBlue2', 'SkyBlue3', 'SkyBlue4', 'LightSkyBlue1', 'LightSkyBlue2', + 'LightSkyBlue3', 'LightSkyBlue4', 'Slategray1', 'Slategray2', 'Slategray3', + 'Slategray4', 'LightSteelBlue1', 'LightSteelBlue2', 'LightSteelBlue3', + 'LightSteelBlue4', 'LightBlue1', 'LightBlue2', 'LightBlue3', 'LightBlue4', + 'LightCyan2', 'LightCyan3', 'LightCyan4', 'PaleTurquoise1', 'PaleTurquoise2', + 'PaleTurquoise3', 'PaleTurquoise4', 'CadetBlue1', 'CadetBlue2', 'CadetBlue3', + 'CadetBlue4', 'turquoise1', 'turquoise2', 'turquoise3', 'turquoise4', 'cyan2', 'cyan3', + 'cyan4', 'DarkSlategray1', 'DarkSlategray2', 'DarkSlategray3', 'DarkSlategray4', + 'aquamarine2', 'aquamarine4', 'DarkSeaGreen1', 'DarkSeaGreen2', 'DarkSeaGreen3', + 'DarkSeaGreen4', 'SeaGreen1', 'SeaGreen2', 'SeaGreen3', 'PaleGreen1', 'PaleGreen2', + 'PaleGreen3', 'PaleGreen4', 'SpringGreen2', 'SpringGreen3', 'SpringGreen4', + 'green2', 'green3', 'green4', 'chartreuse2', 'chartreuse3', 'chartreuse4', + 'OliveDrab1', 'OliveDrab2', 'OliveDrab4', 'DarkOliveGreen1', 'DarkOliveGreen2', + 'DarkOliveGreen3', 'DarkOliveGreen4', 'khaki1', 'khaki2', 'khaki3', 'khaki4', + 'LightGoldenrod1', 'LightGoldenrod2', 'LightGoldenrod3', 'LightGoldenrod4', + 'LightYellow2', 'LightYellow3', 'LightYellow4', 'yellow2', 'yellow3', 'yellow4', + 'gold2', 'gold3', 'gold4', 'goldenrod1', 'goldenrod2', 'goldenrod3', 'goldenrod4', + 'DarkGoldenrod1', 'DarkGoldenrod2', 'DarkGoldenrod3', 'DarkGoldenrod4', + 'RosyBrown1', 'RosyBrown2', 'RosyBrown3', 'RosyBrown4', 'IndianRed1', 'IndianRed2', + 'IndianRed3', 'IndianRed4', 'sienna1', 'sienna2', 'sienna3', 'sienna4', 'burlywood1', + 'burlywood2', 'burlywood3', 'burlywood4', 'wheat1', 'wheat2', 'wheat3', 'wheat4', 'tan1', + 'tan2', 'tan4', 'chocolate1', 'chocolate2', 'chocolate3', 'firebrick1', 'firebrick2', + 'firebrick3', 'firebrick4', 'brown1', 'brown2', 'brown3', 'brown4', 'salmon1', 'salmon2', + 'salmon3', 'salmon4', 'LightSalmon2', 'LightSalmon3', 'LightSalmon4', 'orange2', + 'orange3', 'orange4', 'DarkOrange1', 'DarkOrange2', 'DarkOrange3', 'DarkOrange4', + 'coral1', 'coral2', 'coral3', 'coral4', 'tomato2', 'tomato3', 'tomato4', 'OrangeRed2', + 'OrangeRed3', 'OrangeRed4', 'red2', 'red3', 'red4', 'DeepPink2', 'DeepPink3', 'DeepPink4', + 'HotPink1', 'HotPink2', 'HotPink3', 'HotPink4', 'pink1', 'pink2', 'pink3', 'pink4', + 'LightPink1', 'LightPink2', 'LightPink3', 'LightPink4', 'PaleVioletRed1', + 'PaleVioletRed2', 'PaleVioletRed3', 'PaleVioletRed4', 'maroon1', 'maroon2', + 'maroon3', 'maroon4', 'VioletRed1', 'VioletRed2', 'VioletRed3', 'VioletRed4', + 'magenta2', 'magenta3', 'magenta4', 'orchid1', 'orchid2', 'orchid3', 'orchid4', 'plum1', + 'plum2', 'plum3', 'plum4', 'MediumOrchid1', 'MediumOrchid2', 'MediumOrchid3', + 'MediumOrchid4', 'DarkOrchid1', 'DarkOrchid2', 'DarkOrchid3', 'DarkOrchid4', + 'purple1', 'purple2', 'purple3', 'purple4', 'MediumPurple1', 'MediumPurple2', + 'MediumPurple3', 'MediumPurple4', 'thistle1', 'thistle2', 'thistle3', 'thistle4', + 'grey1', 'grey2', 'grey3', 'grey4', 'grey5', 'grey6', 'grey7', 'grey8', 'grey9', 'grey10', + 'grey11', 'grey12', 'grey13', 'grey14', 'grey15', 'grey16', 'grey17', 'grey18', 'grey19', + 'grey20', 'grey21', 'grey22', 'grey23', 'grey24', 'grey25', 'grey26', 'grey27', 'grey28', + 'grey29', 'grey30', 'grey31', 'grey32', 'grey33', 'grey34', 'grey35', 'grey36', 'grey37', + 'grey38', 'grey39', 'grey40', 'grey42', 'grey43', 'grey44', 'grey45', 'grey46', 'grey47', + 'grey48', 'grey49', 'grey50', 'grey51', 'grey52', 'grey53', 'grey54', 'grey55', 'grey56', + 'grey57', 'grey58', 'grey59', 'grey60', 'grey61', 'grey62', 'grey63', 'grey64', 'grey65', + 'grey66', 'grey67', 'grey68', 'grey69', 'grey70', 'grey71', 'grey72', 'grey73', 'grey74', + 'grey75', 'grey76', 'grey77', 'grey78', 'grey79', 'grey80', 'grey81', 'grey82', 'grey83', + 'grey84', 'grey85', 'grey86', 'grey87', 'grey88', 'grey89', 'grey90', 'grey91', 'grey92', + 'grey93', 'grey94', 'grey95', 'grey97', 'grey98', 'grey99'] + +sg.SetOptions(button_element_size=(12,1), element_padding=(0,0), auto_size_buttons=False, border_width=0) + +layout = [[sg.Text('Click on a color square to see both white and black text on that color', text_color='blue', font='Any 15')]] +row = [] +# -- Create primary color viewer window -- +for i, color in enumerate(COLORS): + row.append(sg.RButton(color, button_color=('black', color), key=color)) + if (i+1) % 12 == 0: + layout.append(row) + row = [] + +window = sg.Window('Color Viewer', grab_anywhere=False, font=('any 9')).Layout(layout) + +# -- Event loop -- +while True: + b, v = window.Read() + if b is None: + break + # -- Create a secondary window that shows white and black text on chosen color + layout2 =[[sg.Button(b, button_color=('white', b)), sg.Button(b, button_color=('black', b))] ] + sg.Window('Buttons with white and black text', keep_on_top=True).Layout(layout2).Read() \ No newline at end of file diff --git a/Demo_Columns.py b/Demo_Columns.py index 9ca240a26..822583166 100644 --- a/Demo_Columns.py +++ b/Demo_Columns.py @@ -1,61 +1,20 @@ import PySimpleGUI as sg -# Demo of how columns work -# Form has on row 1 a vertical slider followed by a COLUMN with 7 rows -# Prior to the Column element, this layout was not possible -# Columns layouts look identical to form layouts, they are a list of lists of elements. +sg.ChangeLookAndFeel('BlueMono') -# sg.ChangeLookAndFeel('BlueMono') +# Column layout +col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] +# Window layout +layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), + select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20, 3)), + sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] +# Display the window and get values +button, values = sg.Window('Compact 1-line form with column').Layout(layout).Read() -def ScrollableColumns(): - # sg.ChangeLookAndFeel('Dark') +sg.Popup(button, values, line_width=200) - column1 = [[sg.Text('Column 1', justification='center', size=(20, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1', key='spin1', size=(30,1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2', key='spin2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3', key='spin3')]] - - - column2 = [[sg.T('Table Test')]] - - for i in range(50): - column2.append([sg.T(f'{i}{j}', size=(4, 1), background_color='gray25', text_color='white', pad=(1, 1)) for j in range(10)]) - - layout = [[sg.Column(column2, scrollable=True), sg.Column(column1, scrollable=True, size=(200,150))], - [sg.OK()]] - - form = sg.FlexForm('Form Fill Demonstration', grab_anywhere=False, default_element_size=(40, 1)) - b, v = form.LayoutAndRead(layout) - - sg.Popup(v) - -def NormalColumns(): - # Column layout - col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], - [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], - [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] - - layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], - [sg.Input('Last input')], - [sg.OK()]] - - # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.FlexForm('Compact 1-line form with column', grab_anywhere=False).LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) - -# NormalColumns() -ScrollableColumns() \ No newline at end of file diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index b00fc5fbd..638a1c313 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -1,24 +1,28 @@ import PySimpleGUI as sg +import sys -sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) +# sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) def GetFilesToCompare(): - with sg.FlexForm('File Compare') as form: - form_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(15, 1)), sg.InputText(key='file1'), sg.FileBrowse()], - [sg.Text('File 2', size=(15, 1)), sg.InputText(key='file2'), sg.FileBrowse(target='file2')], - [sg.Submit(), sg.Cancel()]] - button, values = form.LayoutAndRead(form_rows) + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(15, 1)), sg.InputText(key='file1'), sg.FileBrowse()], + [sg.Text('File 2', size=(15, 1)), sg.InputText(key='file2'), sg.FileBrowse(target='file2')], + [sg.Submit(), sg.Cancel()]] + + window = sg.Window('File Compare') + button, values = window.Layout(form_rows).Read() return button, values def main(): button, values = GetFilesToCompare() f1 = values['file1'] f2 = values['file2'] + if any((button != 'Submit', f1 =='', f2 == '')): sg.PopupError('Operation cancelled') - exit(69) + sys.exit(69) + # --- This portion of the code is not GUI related --- with open(f1, 'rb') as file1: with open(f2, 'rb') as file2: a = file1.read() diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py deleted file mode 100644 index 2eeb06d14..000000000 --- a/Demo_Cookbook_Browser.py +++ /dev/null @@ -1,793 +0,0 @@ - - -# import PySimpleGUI as sg -import inspect - -def SimpleDataEntry(): - """Simple Data Entry - Return Values As List - Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. - """ - import PySimpleGUI as sg - # Very basic form. Return values as a list - form = sg.FlexForm('Simple data entry form') # begin with a blank form - - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - - print(button, values[0], values[1], values[2]) - -def SimpleReturnAsDict(): - """ - Simple data entry - Return Values As Dictionary - A simple form with default values. Results returned in a dictionary. Does not use a context manager - """ - import PySimpleGUI as sg - - # Very basic form. Return values as a dictionary - form = sg.FlexForm('Simple data entry form') # begin with a blank form - - layout = [ - [sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], - [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], - [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - - print(button, values['name'], values['address'], values['phone']) - -def FileBrowse(): - """ - Simple File Browse - Browse for a filename that is populated into the input field. - """ - import PySimpleGUI as sg - - with sg.FlexForm('SHA-1 & 256 Hash') as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - (button, (source_filename,)) = form.LayoutAndRead(form_rows) - - print(button, source_filename) - -def GUIAddOn(): - """ - Add GUI to Front-End of Script - Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. - """ - import PySimpleGUI as sg - import sys - - if len(sys.argv) == 1: - button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], - [sg.In(), sg.FileBrowse()], - [sg.Open(), sg.Cancel()]]) - else: - fname = sys.argv[1] - - if not fname: - sg.Popup("Cancel", "No filename supplied") - # raise SystemExit("Cancelling: no filename supplied") - -def Compare2Files(): - """ - Compare 2 Files - Browse to get 2 file names that can be then compared. Uses a context manager - """ - import PySimpleGUI as sg - - with sg.FlexForm('File Compare') as form: - form_rows = [[sg.Text('Enter 2 files to comare')], - [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - - button, values = form.LayoutAndRead(form_rows) - - print(button, values) - -def AllWidgetsWithContext(): - """ - Nearly All Widgets with Green Color Theme with Context Manager - Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method. - """ - import PySimpleGUI as sg - # Green & tan color scheme - sg.ChangeLookAndFeel('GreenTan') - - - # sg.ChangeLookAndFeel('GreenTan') - - with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: - - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - -def AllWidgetsNoContext(): - """ - All Widgets No Context Manager - """ - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('GreenTan') - - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) - - column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], - [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] - - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Column(column1, background_color='#F7F3EC')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - -def NonBlockingWithUpdates(): - """ - Non-Blocking Form With Periodic Update - An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. - """ - import PySimpleGUI as sg - import time - - form = sg.FlexForm('Running Timer') - # create a text element that will be updated periodically - - form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], - [ sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], - [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] - - form.LayoutAndRead(form_rows, non_blocking=True) - - timer_running = True - i = 0 - # loop to process user clicks - while True: - i += 1 * (timer_running is True) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button - break - elif button == 'Start/Stop': - timer_running = not timer_running - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - - time.sleep(.01) - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - -def NonBlockingWithContext(): - """ - Async Form (Non-Blocking) with Context Manager - Like the previous recipe, this form is an async form. The difference is that this form uses a context manager. - """ - import PySimpleGUI as sg - import time - - with sg.FlexForm('Running Timer') as form: - layout = [[sg.Text('Non blocking GUI with updates', justification='center')], - [sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center', key='output')], - [sg.T(' ' * 15), sg.Quit()]] - form.LayoutAndRead(layout, non_blocking=True) - - for i in range(1, 500): - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': # if user closed the window using X - break - time.sleep(.01) - else: - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - -def CallbackSimulation(): - """ - Callback Function Simulation - The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. - """ - import PySimpleGUI as sg - - # This design pattern simulates button callbacks - # Note that callbacks are NOT a part of the package's interface to the - # caller intentionally. The underlying implementation actually does use - # tkinter callbacks. They are simply hidden from the user. - - # The callback functions - def button1(): - print('Button 1 callback') - - def button2(): - print('Button 2 callback') - - # Create a standard form - form = sg.FlexForm('Button callback example') - # Layout the design of the GUI - layout = [[sg.Text('Please click a button')], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.Quit()]] - # Show the form to the user - form.Layout(layout) - - # Event loop. Read buttons, make callbacks - while True: - # Read the form - button, value = form.Read() - # Take appropriate action based on button - if button == '1': - button1() - elif button == '2': - button2() - elif button =='Quit' or button is None: - break - - # All done! - sg.PopupOk('Done') - -def RealtimeButtons(): - """ - Realtime Buttons (Good For Raspberry Pi) - This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking form. - """ - import PySimpleGUI as sg - - # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control') - - form_rows = [[sg.Text('Robotics Remote Control')], - [sg.T(' ' * 10), sg.RealtimeButton('Forward')], - [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], - [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], - [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] - - form.LayoutAndRead(form_rows, non_blocking=True) - - # - # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or - # else it won't refresh. - # - # your program's main loop - while (True): - # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() - if button is not None: - print(button) - if button is 'Quit' or values is None: - break - - form.CloseNonBlockingForm() - -def EasyProgressMeter(): - """ - Easy Progress Meter - This recipe shows just how easy it is to add a progress meter to your code. - """ - import PySimpleGUI as sg - - for i in range(1000): - sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) - -def TabbedForm(): - """ - Tabbed Form - Tabbed forms are easy to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of LayoutAndRead you call ShowTabbedForm. Results are returned as a list of form results. Each tab acts like a single form. - """ - import PySimpleGUI as sg - - with sg.FlexForm('') as form: - with sg.FlexForm('') as form2: - - layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), - (form2, layout_tab_2,'Second Tab')) - - sg.Popup(results) - -def MediaPlayer(): - """ - Button Graphics (Media Player) - Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. - """ - import PySimpleGUI as sg - - background = '#F0F0F0' - # Set the backgrounds the same as the background on the buttons - sg.SetOptions(background_color=background, element_background_color=background) - # Images are located in a subfolder in the Demo Media Player.py folder - image_pause = './ButtonGraphics/Pause.png' - image_restart = './ButtonGraphics/Restart.png' - image_next = './ButtonGraphics/Next.png' - image_exit = './ButtonGraphics/Exit.png' - - # Open a form, note that context manager can't be used generally speaking for async forms - form = sg.FlexForm('Media File Player', default_element_size=(20, 1), - font=("Helvetica", 25)) - # define layout of the rows - layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], - [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='out')], - [sg.ReadFormButton('Restart Song', button_color=(background, background), - image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=(background, background), - image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=(background, background), - image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), - sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background, background), - image_filename=image_exit, image_size=(50, 50), image_subsample=2, - border_width=0)], - [sg.Text('_' * 20)], - [sg.Text(' ' * 30)], - [sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 2), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15)), - sg.Text(' ' * 8), - sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', - font=("Helvetica", 15))], - [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), - sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), - sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] ] - - # Call the same LayoutAndRead but indicate the form is non-blocking - form.LayoutAndRead(layout, non_blocking=True) - # Our event loop - while (True): - # Read the form (this call will not block) - button, values = form.ReadNonBlocking() - if button == 'Exit' or values is None: - break - # If a button was pressed, display it on the GUI by updating the text element - if button: - form.FindElement('out').Update(button) - -def ScriptLauncher(): - """ - Script Launcher - Persistent Form - This form doesn't close after button clicks. To achieve this the buttons are specified as sg.ReadFormButton instead of sg.SimpleButton. The exception to this is the EXIT button. Clicking it will close the form. This program will run commands and display the output in the scrollable window. - """ - import PySimpleGUI as sg - import subprocess - - def Launcher(): - - form = sg.FlexForm('Script launcher') - - layout = [ - [sg.Text('Script output....', size=(40, 1))], - [sg.Output(size=(88, 20))], - [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')], - [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadFormButton('Run', bind_return_key=True)] - ] - - form.Layout(layout) - - # ---===--- Loop taking in user input and using it to query HowDoI --- # - while True: - (button, value) = form.Read() - if button == 'EXIT' or button is None: - break # exit button clicked - if button == 'script1': - ExecuteCommandSubprocess('pip','list') - elif button == 'script2': - ExecuteCommandSubprocess('python', '--version') - elif button == 'Run': - ExecuteCommandSubprocess(value[0]) - - - def ExecuteCommandSubprocess(command, *args): - try: - expanded_args = [] - for a in args: - expanded_args += a - sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = sp.communicate() - if out: - print(out.decode("utf-8")) - if err: - print(err.decode("utf-8")) - except: pass - - Launcher() - -def MachineLearning(): - """ - Machine Learning GUI - A standard non-blocking GUI with lots of inputs. - """ - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('LightGreen') - - sg.SetOptions(text_justification='right') - - form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form - - layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), - sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 15), justification='left')], - [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], - [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], - [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], - [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], - [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], - [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], - [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], - [sg.Submit(), sg.Cancel()]] - - button, values = form.LayoutAndRead(layout) - -def CustromProgressMeter(): - """" - Custom Progress Meter / Progress Bar - Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. - """ - import PySimpleGUI as sg - - def CustomMeter(): - # create the progress bar element - progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) - # layout the form - layout = [[sg.Text('A custom progress meter')], - [progress_bar], - [sg.Cancel()]] - - # create the form - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) - # loop that would normally do something useful - for i in range(10000): - # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() - if button == 'Cancel' or values == None: - break - # update bar with loop value +1 so that bar eventually reaches the maximum - progress_bar.UpdateBar(i+1) - # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() - - CustomMeter() - -def OneLineGUI(): - """ - The One-Line GUI - For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to FlexForm and the call to LayoutAndRead. FlexForm returns a FlexForm object which has the LayoutAndRead method. - """ - import PySimpleGUI as sg - - layout = [[sg.Text('Filename')], - [sg.Input(), sg.FileBrowse()], - [sg.OK(), sg.Cancel()] ] - - button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) - - """ - you can write this line of code for the exact same result (OK, two lines with the import): - """ - # import PySimpleGUI as sg - - button, (filename,) = sg.FlexForm('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) - -def MultipleColumns(): - """ - Multiple Columns - Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. - - This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. - - To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. - """ - import PySimpleGUI as sg - - # Demo of how columns work - # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows - # Prior to the Column element, this layout was not possible - # Columns layouts look identical to form layouts, they are a list of lists of elements. - - # sg.ChangeLookAndFeel('BlueMono') - - # Column layout - col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], - [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], - [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] - - layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], - [sg.Input('Last input')], - [sg.OK()]] - - # Display the form and get values - # If you're willing to not use the "context manager" design pattern, then it's possible - # to collapse the form display and read down to a single line of code. - button, values = sg.FlexForm('Compact 1-line form with column').LayoutAndRead(layout) - - sg.Popup(button, values, line_width=200) - -def PersistentForm(): - """ - Persistent Form With Text Element Updates - This simple program keep a form open, taking input values until the user terminates the program using the "X" button. - """ - import PySimpleGUI as sg - - form = sg.FlexForm('Math') - - output = sg.Txt('', size=(8,1)) - - layout = [ [sg.Txt('Enter values to calculate')], - [sg.In(size=(8,1), key='numerator')], - [sg.Txt('_' * 10)], - [sg.In(size=(8,1), key='denominator')], - [output], - [sg.ReadFormButton('Calculate', bind_return_key=True)]] - - form.Layout(layout) - - while True: - button, values = form.Read() - - if button is not None: - try: - numerator = float(values['numerator']) - denominator = float(values['denominator']) - calc = numerator / denominator - except: - calc = 'Invalid' - - output.Update(calc) - else: - break - -def CanvasWidget(): - """ - tkinter Canvas Widget - The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: - """ - - import PySimpleGUI as gui - - canvas = gui.Canvas(size=(100,100), background_color='red') - - layout = [ - [canvas], - [gui.T('Change circle color to:'), gui.ReadFormButton('Red'), gui.ReadFormButton('Blue')] - ] - - form = gui.FlexForm('Canvas test', grab_anywhere=True) - form.Layout(layout) - form.ReadNonBlocking() - - cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) - - while True: - button, values = form.Read() - if button is None: - break - if button is 'Blue': - canvas.TKCanvas.itemconfig(cir, fill = "Blue") - elif button is 'Red': - canvas.TKCanvas.itemconfig(cir, fill = "Red") - -def InputElementUpdate(): - """ - Input Element Update - This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. There are a number of features used in this Recipe including: Default Element Size auto_size_buttons ReadFormButton Dictionary Return values Update of Elements in form (Input, Text) do_not_clear of Input Elements - """ - import PySimpleGUI as g - - # Demonstrates a number of PySimpleGUI features including: - # Default element size - # auto_size_buttons - # ReadFormButton - # Dictionary return values - # Update of elements in form (Text, Input) - # do_not_clear of Input elements - - layout = [[g.Text('Enter Your Passcode')], - [g.Input(size=(10, 1), do_not_clear=True, key='input')], - [g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')], - [g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')], - [g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')], - [g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')], - [ g.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='output')], - ] - - form = g.FlexForm('Keypad', default_element_size=(5, 2), auto_size_buttons=False) - form.Layout(layout) - - # Loop forever reading the form's values, updating the Input field - keys_entered = '' - while True: - button, values = form.Read() # read the form - if button is None: # if the X button clicked, just exit - break - if button is 'Clear': # clear keys if clear button - keys_entered = '' - elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far - keys_entered += button # add the new digit - elif button is 'Submit': - keys_entered = values['input'] - form.FindElement('output').Update(keys_entered) # output the final string - - form.FindElement('input').Update(keys_entered) # change the form to reflect current key string - - -def TableSimulation(): - """ - Display data in a table format - """ - import PySimpleGUI as sg - sg.ChangeLookAndFeel('Dark1') - - layout = [[sg.T('Table Test')]] - - for i in range(20): - layout.append([sg.T('{} {}'.format(i,j), size=(4, 1), background_color='black', pad=(1, 1)) for j in range(10)]) - - sg.FlexForm('Table').LayoutAndRead(layout) - - -def TightLayout(): - """ - Turn off padding in order to get a really tight looking layout. - """ - import PySimpleGUI as sg - - sg.ChangeLookAndFeel('Dark') - sg.SetOptions(element_padding=(0, 0)) - 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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.ReadFormButton('Start', button_color=('white', 'black')), - sg.ReadFormButton('Stop', button_color=('white', 'black')), - sg.ReadFormButton('Reset', button_color=('white', '#9B0023')), - sg.ReadFormButton('Submit', button_color=('white', 'springgreen4')), - sg.SimpleButton('Exit', button_color=('white', '#00406B')), - ] - ] - - form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, - auto_size_buttons=False, no_titlebar=True, - default_button_element_size=(12, 1)) - form.Layout(layout) - while True: - button, values = form.Read() - if button is None or button == 'Exit': - return - -# -------------------------------- GUI Starts Here -------------------------------# -# fig = your figure you want to display. Assumption is that 'fig' holds the # -# information to display. # -# --------------------------------------------------------------------------------# - - -import PySimpleGUI as sg - -fig_dict = {'Simple Data Entry':SimpleDataEntry, 'Simple Entry Return Data as Dict':SimpleReturnAsDict, 'File Browse' : FileBrowse, - 'GUI Add On':GUIAddOn, 'Compare 2 Files':Compare2Files, 'All Widgets With Context Manager':AllWidgetsWithContext, 'All Widgets No Context Manager':AllWidgetsNoContext, - 'Non-Blocking With Updates':NonBlockingWithUpdates, 'Non-Bocking With Context Manager':NonBlockingWithContext, 'Callback Simulation':CallbackSimulation, - 'Realtime Buttons':RealtimeButtons, 'Easy Progress Meter':EasyProgressMeter, 'Tabbed Form':TabbedForm, 'Media Player':MediaPlayer, 'Script Launcher':ScriptLauncher, - 'Machine Learning':MachineLearning, 'Custom Progress Meter':CustromProgressMeter, 'One Line GUI':OneLineGUI, 'Multiple Columns':MultipleColumns, - 'Persistent Form':PersistentForm, 'Canvas Widget':CanvasWidget, 'Input Element Update':InputElementUpdate, - 'Table Simulation':TableSimulation, 'Tight Layout':TightLayout} - - -# define the form layout -listbox_values = [key for key in fig_dict.keys()] - -while True: - sg.ChangeLookAndFeel('Dark') - # sg.SetOptions(element_padding=(0,0)) - - col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),min(len(listbox_values), 20)), change_submits=False, key='func')], - [sg.ReadFormButton('Run', pad=(0,0)), sg.ReadFormButton('Show Code', button_color=('white', 'gray25'), pad=(0,0)), sg.Exit(button_color=('white', 'firebrick4'), pad=(0,0))]] - - layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], - [sg.Column(col_listbox), sg.Multiline(size=(50,min(len(listbox_values), 20)), do_not_clear=True, key='multi')], - ] - -# create the form and show it without the plot -# form.Layout(layout) - - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(9,1),auto_size_buttons=False, grab_anywhere=False) - form.Layout(layout) - # show it all again and get buttons - while True: - button, values = form.Read() - - if button is None or button == 'Exit': - exit(69) - try: - choice = values['func'][0] - func = fig_dict[choice] - except: - continue - - if button == 'Show Code' and values['multi']: - form.FindElement('multi').Update(inspect.getsource(func)) - elif button is 'Run' and values['func']: - # sg.ChangeLookAndFeel('SystemDefault') - form.CloseNonBlockingForm() - func() - break - else: - print('ILLEGAL values') - break - diff --git a/Demo_DOC_Viewer_PIL.py b/Demo_DOC_Viewer_PIL.py index 423be3eef..927027f16 100644 --- a/Demo_DOC_Viewer_PIL.py +++ b/Demo_DOC_Viewer_PIL.py @@ -22,7 +22,7 @@ We also interpret keyboard events (PageDown / PageUp) and mouse wheel actions to support paging as if a button was clicked. Similarly, we do not include -a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the form. +a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the window. To improve paging performance, we are not directly creating pixmaps from pages, but instead from the fitz.DisplayList of the page. A display list will be stored in a list and looked up by page number. This way, zooming @@ -121,7 +121,7 @@ def get_page(pno, zoom = False, max_size = None, first = False): root.destroy() del root -form = sg.FlexForm(title, return_keyboard_events = True, +window = sg.Window(title, return_keyboard_events = True, location = (0,0), use_default_focus = False, no_titlebar=False) cur_page = 0 @@ -137,18 +137,18 @@ def get_page(pno, zoom = False, max_size = None, first = False): layout = [ [ - sg.ReadFormButton('Next'), - sg.ReadFormButton('Prev'), + sg.ReadButton('Next'), + sg.ReadButton('Prev'), sg.Text('Page:'), goto, sg.Text('(%i)' % page_count), - sg.ReadFormButton('Zoom'), + sg.ReadButton('Zoom'), sg.Text('(toggle on/off, use arrows to navigate while zooming)'), ], [image_elem], ] -form.Layout(layout) +window.Layout(layout) # now define the buttons / events we want to handle enter_buttons = [chr(13), "Return:13"] @@ -169,7 +169,7 @@ def get_page(pno, zoom = False, max_size = None, first = False): old_zoom = False while True: - button, value = form.Read() + button, value = window.Read() if button is None and (value is None or value['PageNumber'] is None): break if button in quit_buttons: diff --git a/Demo_Desktop_Floating_Toolbar.py b/Demo_Desktop_Floating_Toolbar.py index 07d806f5a..396308459 100644 --- a/Demo_Desktop_Floating_Toolbar.py +++ b/Demo_Desktop_Floating_Toolbar.py @@ -17,28 +17,28 @@ def Launcher(): # def print(line): - # form.FindElement('output').Update(line) + # window.FindElement('output').Update(line) sg.ChangeLookAndFeel('Dark') namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ] sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False) + layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'), - sg.ReadFormButton('Run', button_color=('white', '#00168B')), - sg.ReadFormButton('Program 1'), - sg.ReadFormButton('Program 2'), - sg.ReadFormButton('Program 3', button_color=('white', '#35008B')), - sg.SimpleButton('EXIT', button_color=('white','firebrick3'))], + sg.ReadButton('Run', button_color=('white', '#00168B')), + sg.ReadButton('Program 1'), + sg.ReadButton('Program 2'), + sg.ReadButton('Program 3', button_color=('white', '#35008B')), + sg.Button('EXIT', button_color=('white','firebrick3'))], [sg.T('', text_color='white', size=(50,1), key='output')]] - form = sg.FlexForm('Floating Toolbar', no_titlebar=True, keep_on_top=True) + window = sg.Window('Floating Toolbar', no_titlebar=True, keep_on_top=True).Layout(layout) - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI --- # + # ---===--- Loop taking in user input and executing appropriate program --- # while True: - (button, value) = form.Read() + (button, value) = window.Read() if button is 'EXIT' or button is None: break # exit button clicked if button is 'Program 1': diff --git a/Demo_Desktop_Widget_CPU_Graph.py b/Demo_Desktop_Widget_CPU_Graph.py index 3456ce3ef..e7653b4e5 100644 --- a/Demo_Desktop_Widget_CPU_Graph.py +++ b/Demo_Desktop_Widget_CPU_Graph.py @@ -36,10 +36,10 @@ def main(): layout = [ [sg.Quit( button_color=('white','black')), sg.T('', pad=((100,0),0), font='Any 15', key='output')], [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,SAMPLE_MAX),background_color='black', key='graph')],] - form = sg.FlexForm('CPU Graph', grab_anywhere=True, keep_on_top=True, background_color='black', no_titlebar=True, use_default_focus=False).Layout(layout) + window = sg.Window('CPU Graph', grab_anywhere=True, keep_on_top=True, background_color='black', no_titlebar=True, use_default_focus=False).Layout(layout) - graph = form.FindElement('graph') - output = form.FindElement('output') + graph = window.FindElement('graph') + output = window.FindElement('output') # start cpu measurement thread thread = Thread(target=CPU_thread,args=(None,)) thread.start() @@ -48,7 +48,7 @@ def main(): prev_x, prev_y = 0, 0 while True: # the Event Loop time.sleep(.5) - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Quit' or values is None: # always give ths user a way out break # do CPU measurement and graph it @@ -69,4 +69,3 @@ def main(): if __name__ == '__main__': main() - exit(69) diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 691781019..60bb1ebff 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -39,19 +39,20 @@ def main(): # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') - form_rows = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], + layout = [[sg.Text('', size=(8,1), font=('Helvetica', 20),text_color=sg.YELLOWS[0], justification='center', key='text')], [sg.Text('', size=(30, 8), font=('Courier New', 12),text_color='white', justification='left', key='processes')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15,0), 0)), sg.Spin([x+1 for x in range(10)], 1, key='spin')],] - form = sg.FlexForm('CPU Utilization', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) - form.Layout(form_rows) + window = sg.Window('CPU Utilization', no_titlebar=True, auto_size_buttons=False, + keep_on_top=True, grab_anywhere=True).Layout(layout) + # start cpu measurement thread thread = Thread(target=CPU_thread,args=(None,)) thread.start() # ---------------- main loop ---------------- while (True): # --------- Read and update window -------- - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() # --------- Do Button Operations -------- if values is None or button == 'Exit': @@ -84,14 +85,13 @@ def main(): # --------- Display timer in window -------- - form.FindElement('text').Update('CPU {}'.format(cpu_percent)) - form.FindElement('processes').Update(display_string) + window.FindElement('text').Update('CPU {}'.format(cpu_percent)) + window.FindElement('processes').Update(display_string) # Broke out of main loop. Close the window. - form.CloseNonBlockingForm() + window.CloseNonBlocking() g_exit = True thread.join() - exit(69) if __name__ == "__main__": main() \ No newline at end of file diff --git a/Demo_Desktop_Widget_CPU_Utilization_Simple.py b/Demo_Desktop_Widget_CPU_Utilization_Simple.py index 17583aab7..7e9aa653a 100644 --- a/Demo_Desktop_Widget_CPU_Utilization_Simple.py +++ b/Demo_Desktop_Widget_CPU_Utilization_Simple.py @@ -3,18 +3,17 @@ # ---------------- Create Form ---------------- sg.ChangeLookAndFeel('Black') -form_rows = [[sg.Text('')], +layout = [[sg.Text('')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], [sg.Exit(button_color=('white', 'firebrick4'), pad=((15, 0), 0)), sg.Spin([x + 1 for x in range(10)], 1, key='spin')]] # Layout the rows of the form and perform a read. Indicate the form is non-blocking! -form = sg.FlexForm('CPU Meter', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) -form.Layout(form_rows) +window = sg.Window('CPU Meter', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) # ---------------- main loop ---------------- while (True): # --------- Read and update window -------- - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() # --------- Do Button Operations -------- if values is None or button == 'Exit': @@ -28,7 +27,7 @@ # --------- Display timer in window -------- - form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') + window.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%') # Broke out of main loop. Close the window. -form.CloseNonBlockingForm() \ No newline at end of file +window.CloseNonBlocking() \ No newline at end of file diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index b8ce0ae94..1c905a3f4 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -11,14 +11,13 @@ sg.ChangeLookAndFeel('Black') sg.SetOptions(element_padding=(0, 0)) -form_rows = [[sg.Text('')], - [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], - [sg.ReadFormButton('Pause', key='button', button_color=('white', '#001480')), - sg.ReadFormButton('Reset', button_color=('white', '#007339'), key='Reset'), - sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] +layout = [[sg.Text('')], + [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')], + [sg.ReadButton('Pause', key='button', button_color=('white', '#001480')), + sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), + sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] -form = sg.FlexForm('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True) -form.Layout(form_rows) +window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) # ---------------- main loop ---------------- current_time = 0 @@ -27,12 +26,12 @@ while (True): # --------- Read and update window -------- if not paused: - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() current_time = int(round(time.time() * 100)) - start_time else: - button, values = form.Read() + button, values = window.Read() if button == 'button': - button = form.FindElement(button).GetText() + button = window.FindElement(button).GetText() # --------- Do Button Operations -------- if values is None or button == 'Exit': break @@ -43,16 +42,16 @@ elif button == 'Pause': paused = True paused_time = int(round(time.time() * 100)) - element = form.FindElement('button') + element = window.FindElement('button') element.Update(text='Run') elif button == 'Run': paused = False start_time = start_time + int(round(time.time() * 100)) - paused_time - element = form.FindElement('button') + element = window.FindElement('button') element.Update(text='Pause') # --------- Display timer in window -------- - form.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, + window.FindElement('text').Update('{:02d}:{:02d}.{:02d}'.format((current_time // 100) // 60, (current_time // 100) % 60, current_time % 100)) time.sleep(.01) @@ -60,4 +59,4 @@ # --------- After loop -------- # Broke out of main loop. Close the window. -form.CloseNonBlockingForm() +window.CloseNonBlocking() diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index aed848078..789011c57 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -1,11 +1,8 @@ import PySimpleGUI as sg -""" -Turn off padding in order to get a really tight looking layout. -""" - sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0, 0)) + layout = [ [sg.T('Notes:', pad=((3, 0), 0)), sg.In(size=(44, 1), background_color='white', text_color='black', key='notes')], [sg.T('Output:', pad=((3, 0), 0)), sg.T('', size=(44, 1), text_color='white', key='output')], @@ -14,56 +11,28 @@ [sg.Spin((1,2,3,4),1, key='spin'), sg.OptionMenu((1,2,3,4), key='option'), sg.Combo(values=(1,2,3,4),key='combo')], [sg.Multiline('Multiline', size=(20,3), key='multi')], [sg.Slider((1,10), size=(20,20), orientation='h', key='slider')], - [sg.ReadFormButton('Enable', button_color=('white', 'black')), - sg.ReadFormButton('Disable', button_color=('white', 'black')), - sg.ReadFormButton('Reset', button_color=('white', '#9B0023'), key='reset'), - sg.ReadFormButton('Values', button_color=('white', 'springgreen4')), - sg.SimpleButton('Exit', button_color=('white', '#00406B'))]] + [sg.ReadButton('Enable', button_color=('white', 'black')), + sg.ReadButton('Disable', button_color=('white', 'black')), + sg.ReadButton('Reset', button_color=('white', '#9B0023'), key='reset'), + sg.ReadButton('Values', button_color=('white', 'springgreen4')), + sg.Button('Exit', button_color=('white', '#00406B'))]] -form = sg.FlexForm("Disable Elements Demo", default_element_size=(12, 1), text_justification='r', auto_size_text=False, +window = sg.Window("Disable Elements Demo", default_element_size=(12, 1), text_justification='r', auto_size_text=False, auto_size_buttons=False, keep_on_top=True, grab_anywhere=False, default_button_element_size=(12, 1)).Layout(layout).Finalize() -form.FindElement('cbox').Update(disabled=True) -form.FindElement('listbox').Update(disabled=True) -form.FindElement('radio1').Update(disabled=True) -form.FindElement('radio2').Update(disabled=True) -form.FindElement('spin').Update(disabled=True) -form.FindElement('option').Update(disabled=True) -form.FindElement('combo').Update(disabled=True) -form.FindElement('reset').Update(disabled=True) -form.FindElement('notes').Update(disabled=True) -form.FindElement('multi').Update(disabled=True) -form.FindElement('slider').Update(disabled=True) +key_list = 'cbox', 'listbox', 'radio1', 'radio2', 'spin', 'option', 'combo', 'reset', 'notes', 'multi', 'slider' + +for key in key_list: window.FindElement(key).Update(disabled=True) # don't do this kind of for-loop while True: - button, values = form.Read() + button, values = window.Read() if button is None or button == 'Exit': break elif button == 'Disable': - form.FindElement('cbox').Update(disabled=True) - form.FindElement('listbox').Update(disabled=True) - form.FindElement('radio1').Update(disabled=True) - form.FindElement('radio2').Update(disabled=True) - form.FindElement('spin').Update(disabled=True) - form.FindElement('option').Update(disabled=True) - form.FindElement('combo').Update(disabled=True) - form.FindElement('reset').Update(disabled=True) - form.FindElement('notes').Update(disabled=True) - form.FindElement('multi').Update(disabled=True) - form.FindElement('slider').Update(disabled=True) + for key in key_list: window.FindElement(key).Update(disabled=True) elif button == 'Enable': - form.FindElement('cbox').Update(disabled=False) - form.FindElement('listbox').Update(disabled=False) - form.FindElement('radio1').Update(disabled=False) - form.FindElement('radio2').Update(disabled=False) - form.FindElement('spin').Update(disabled=False) - form.FindElement('option').Update(disabled=False) - form.FindElement('combo').Update(disabled=False) - form.FindElement('reset').Update(disabled=False) - form.FindElement('notes').Update(disabled=False) - form.FindElement('multi').Update(disabled=False) - form.FindElement('slider').Update(disabled=False) + for key in key_list: window.FindElement(key).Update(disabled=False) elif button == 'Values': sg.Popup(values, keep_on_top=True) diff --git a/Demo_DisplayHash1and256.py b/Demo_DisplayHash1and256.py deleted file mode 100644 index bff8a8361..000000000 --- a/Demo_DisplayHash1and256.py +++ /dev/null @@ -1,124 +0,0 @@ -#!Python 3 -import hashlib -import PySimpleGUI as sg - - ######################################################################### -# DisplayHash # -# A PySimpleGUI demo app that displays SHA1 hash for user browsed file # -# Useful and a recipe for GUI success # - ######################################################################### - -# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # -# Reads a file, computes the Hash # -# ---------------------------------------------------------------------------------- # -def compute_sha1_hash_for_file(filename): - try: - x = open(filename, "rb").read() - except: - return 0 - - m = hashlib.sha1() - m.update(x) - f_sha = m.hexdigest() - - return f_sha - - -# ====____====____==== FUNCTION compute_hash_for_file(filename) ====____====____==== # -# Reads a file, computes the Hash # -# ---------------------------------------------------------------------------------- # -def compute_sha256_hash_for_file(filename): - try: - f = open(filename, "rb") - x = f.read() - except: - return 0 - - m = hashlib.sha256() - m.update(x) - f_sha = m.hexdigest() - - return f_sha - - - # ====____====____==== Uses A GooeyGUI GUI ====____====____== # -# Get the filename, display the hash, dirt simple all around # - # ----------------------------------------------------------- # - -# ---------------------------------------------------------------------- # -# Compute and display SHA1 hash # -# Builds and displays the form using the most basic building blocks # -# ---------------------------------------------------------------------- # -def HashManuallyBuiltGUI(): - # ------- Form design ------- # - with sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) as form: - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - (button, (source_filename, )) = form.LayoutAndRead(form_rows) - - if button == 'Submit': - if source_filename != '': - hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() - hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - sg.Popup('Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: sg.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') - else: - sg.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') - -def HashManuallyBuiltGUINonContext(): - # ------- Form design ------- # - form = sg.FlexForm('SHA-1 & 256 Hash', auto_size_text=True) - form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], - [sg.InputText(), sg.FileBrowse()], - [sg.Submit(), sg.Cancel()]] - button, (source_filename, ) = form.LayoutAndRead(form_rows) - - if button == 'Submit': - if source_filename != '': - hash_sha1 = compute_sha1_hash_for_file(source_filename).upper() - hash_sha256 = compute_sha256_hash_for_file(source_filename).upper() - sg.Popup('Display A Hash in PySimpleGUI', 'The SHA-1 Hash for the file\n', source_filename, hash_sha1, 'SHA-256 is', hash_sha256, line_width=75) - else: sg.PopupError('Display A Hash in PySimpleGUI', 'Illegal filename') - else: - sg.PopupError('Display A Hash in PySimpleGUI', '* Cancelled *') - - - - -# ---------------------------------------------------------------------- # -# Compute and display SHA1 hash # -# This one cheats and uses the higher-level Get A File pre-made func # -# Hey, it's a really common operation so why not? # -# ---------------------------------------------------------------------- # -def HashMostCompactGUI(): - # ------- INPUT GUI portion ------- # - - source_filename = sg.PopupGetFile('Display a Hash code for file of your choice') - - # ------- OUTPUT GUI results portion ------- # - if source_filename != None: - hash = compute_sha1_hash_for_file(source_filename) - sg.Print(hash) - sg.Popup('Display Hash - Compact GUI', 'The SHA-1 Hash for the file\n', source_filename, hash) - else: - sg.Popup('Display Hash - Compact GUI', '* Cancelled *') - - -# ---------------------------------------------------------------------- # -# Our main calls two GUIs that act identically but use different calls # -# ---------------------------------------------------------------------- # -def main(): - # HashManuallyBuiltGUI() - # HashManuallyBuiltGUINonContext() - HashMostCompactGUI() - - -# ====____====____==== Pseudo-MAIN program ====____====____==== # -# This is our main-alike piece of code # -# + Starts up the GUI # -# + Gets values from GUI # -# + Runs DeDupe_folder based on GUI inputs # -# ------------------------------------------------------------- # -if __name__ == '__main__': - main() diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index aaa0ae187..30c20544d 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -31,29 +31,29 @@ def Everything(): [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder', key='folder', do_not_clear=True), sg.FolderBrowse()], - [sg.ReadFormButton('Exit'), - sg.Text(' ' * 40), sg.ReadFormButton('SaveSettings'), sg.ReadFormButton('LoadSettings')] + [sg.ReadButton('Exit'), + sg.Text(' ' * 40), sg.ReadButton('SaveSettings'), sg.ReadButton('LoadSettings')] ] - form = sg.FlexForm('Form Fill Demonstration', default_element_size=(40, 1), grab_anywhere=False) - # button, values = form.LayoutAndRead(layout, non_blocking=True) - form.Layout(layout) + window = sg.Window('Form Fill Demonstration', default_element_size=(40, 1), grab_anywhere=False) + # button, values = window.LayoutAndRead(layout, non_blocking=True) + window.Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is 'SaveSettings': filename = sg.PopupGetFile('Save Settings', save_as=True, no_window=True) - form.SaveToDisk(filename) + window.SaveToDisk(filename) # save(values) elif button is 'LoadSettings': filename = sg.PopupGetFile('Load Settings', no_window=True) - form.LoadFromDisk(filename) + window.LoadFromDisk(filename) # load(form) elif button in ['Exit', None]: break - # form.CloseNonBlockingForm() + # window.CloseNonBlocking() if __name__ == '__main__': diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index d030af938..861b0b8ec 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -7,10 +7,10 @@ layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), sg.Slider(range=(6,172), orientation='h', size=(10,20), change_submits=True, key='slider', font=('Helvetica 20')), sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] sz = fontSize -form = sg.FlexForm("Font size selector", grab_anywhere=False) -form.Layout(layout) +window = sg.Window("Font size selector", grab_anywhere=False) +window.Layout(layout) while True: - button, values= form.Read() + button, values= window.Read() if button is None or button == 'Quit': break sz_spin = int(values['spin']) @@ -19,8 +19,8 @@ if sz != fontSize: fontSize = sz font = "Helvetica " + str(fontSize) - form.FindElement('text').Update(font=font) - form.FindElement('slider').Update(sz) - form.FindElement('spin').Update(sz) + window.FindElement('text').Update(font=font) + window.FindElement('slider').Update(sz) + window.FindElement('spin').Update(sz) print("Done.") diff --git a/Demo_Func_Callback_Simulation.py b/Demo_Func_Callback_Simulation.py index a3f5df846..5b0ef2d0d 100644 --- a/Demo_Func_Callback_Simulation.py +++ b/Demo_Func_Callback_Simulation.py @@ -4,11 +4,11 @@ [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]] -button, (number,) = sg.FlexForm('Get filename example').LayoutAndRead(layout) +button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) import PySimpleGUI as sg -button, (filename,) = sg.FlexForm('Get filename example').LayoutAndRead( +button, (filename,) = sg.Window('Get filename example').LayoutAndRead( [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) \ No newline at end of file diff --git a/Demo_GoodColors.py b/Demo_GoodColors.py index f1c0a09c3..332898615 100644 --- a/Demo_GoodColors.py +++ b/Demo_GoodColors.py @@ -2,48 +2,48 @@ import time def main(): - # ------- Make a new FlexForm ------- # - form = gg.FlexForm('GoodColors', auto_size_text=True, default_element_size=(30,2)) - form.AddRow(gg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) - form.AddRow(gg.Text('Here come the good colors as defined by PySimpleGUI')) + # ------- Make a new Window ------- # + window = gg.Window('GoodColors', auto_size_text=True, default_element_size=(30,2)) + window.AddRow(gg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) + window.AddRow(gg.Text('Here come the good colors as defined by PySimpleGUI')) #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# text_color = gg.YELLOWS[0] - buttons = (gg.SimpleButton('BLUES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) + buttons = (gg.Button('BLUES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) + window.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) + window.AddRow(*buttons) + window.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton('PURPLES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) + buttons = (gg.Button('PURPLES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) + window.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) + window.AddRow(*buttons) + window.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton('GREENS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) + buttons = (gg.Button('GREENS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) + window.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) + window.AddRow(*buttons) + window.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# text_color = gg.GREENS[0] # let's use GREEN text on the tan - buttons = (gg.SimpleButton('TANS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) + buttons = (gg.Button('TANS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) + window.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) + window.AddRow(*buttons) + window.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# text_color = 'black' # let's use black text on the tan - buttons = (gg.SimpleButton('YELLOWS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) - form.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) - form.AddRow(*buttons) - form.AddRow(gg.Text('_' * 100, size=(65, 1))) + buttons = (gg.Button('YELLOWS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) + window.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) + window.AddRow(*buttons) + window.AddRow(gg.Text('_' * 100, size=(65, 1))) - #===== Add a click me button for fun and SHOW the form ===== ===== ===== ===== ===== ===== =====# - form.AddRow(gg.SimpleButton('Click ME!')) - (button, value) = form.Show() # show it! + #===== Add a click me button for fun and SHOW the window ===== ===== ===== ===== ===== ===== =====# + window.AddRow(gg.Button('Click ME!')) + (button, value) = window.Show() # show it! if __name__ == '__main__': diff --git a/Demo_Graph_Drawing.py b/Demo_Graph_Drawing.py index de8a82f70..ee812c523 100644 --- a/Demo_Graph_Drawing.py +++ b/Demo_Graph_Drawing.py @@ -2,12 +2,12 @@ layout = [ [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], - [sg.T('Change circle color to:'), sg.ReadFormButton('Red'), sg.ReadFormButton('Blue'), sg.ReadFormButton('Move')] + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')] ] -form = sg.FlexForm('Graph test').Layout(layout).Finalize() +window = sg.Window('Graph test').Layout(layout) -graph = form.FindElement('graph') +graph = window.FindElement('graph') circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') point = graph.DrawPoint((75,75), 10, color='green') oval = graph.DrawOval((25,300), (100,280), fill_color='purple', line_color='purple' ) @@ -15,7 +15,7 @@ line = graph.DrawLine((0,0), (100,100)) while True: - button, values = form.Read() + button, values = window.Read() if button is None: break if button is 'Blue': diff --git a/Demo_Graph_Element.py b/Demo_Graph_Element.py index 174ce1fb2..da50d3ae8 100644 --- a/Demo_Graph_Element.py +++ b/Demo_Graph_Element.py @@ -5,8 +5,8 @@ STEP_SIZE=1 -SAMPLES = 6000 -CANVAS_SIZE = (6000,500) +SAMPLES = 1000 +CANVAS_SIZE = (1000,500) # globale used to communicate with thread.. yea yea... it's working fine g_exit = False @@ -29,11 +29,11 @@ def main(): layout = [ [sg.T('Ping times to Google.com', font='Any 12'), sg.Quit(pad=((100,0), 0), button_color=('white', 'black'))], [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,500),background_color='black', key='graph')],] - form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) - form.Layout(layout) + window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) + window.Layout(layout) - form.Finalize() - graph = form.FindElement('graph') + window.Finalize() + graph = window.FindElement('graph') prev_response_time = None i=0 @@ -41,7 +41,7 @@ def main(): while True: time.sleep(.2) - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Quit' or values is None: break if g_response_time is None or prev_response_time == g_response_time: @@ -52,7 +52,7 @@ def main(): graph.Move(-STEP_SIZE,0) prev_x = prev_x - STEP_SIZE graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white') - # form.FindElement('graph').DrawPoint((new_x, new_y), color='red') + # window.FindElement('graph').DrawPoint((new_x, new_y), color='red') prev_x, prev_y = new_x, new_y i += STEP_SIZE if i < SAMPLES else 0 @@ -63,4 +63,3 @@ def main(): if __name__ == '__main__': main() - exit(69) \ No newline at end of file diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py index 5d922fde5..2609f6a89 100644 --- a/Demo_Graph_Element_Sine_Wave.py +++ b/Demo_Graph_Element_Sine_Wave.py @@ -3,8 +3,8 @@ layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph', tooltip='This is a cool graph!')],] -form = sg.FlexForm('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize() -graph = form.FindElement('graph') +window = sg.Window('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize() +graph = window.FindElement('graph') graph.DrawLine((-100,0), (100,0)) graph.DrawLine((0,-100), (0,100)) @@ -13,4 +13,4 @@ y = math.sin(x/20)*50 graph.DrawPoint((x,y), color='red') -button, values = form.Read() +button, values = window.Read() diff --git a/Demo_Graph_Noise.py b/Demo_Graph_Noise.py index fbef4bc41..88b7c52b2 100644 --- a/Demo_Graph_Noise.py +++ b/Demo_Graph_Noise.py @@ -1,7 +1,7 @@ import time import random import PySimpleGUI as sg - +import sys STEP_SIZE=1 SAMPLES = 300 @@ -12,16 +12,16 @@ def main(): global g_exit, g_response_time - with sg.FlexForm('Enter graph size') as form: - layout = [[sg.T('Enter width, height of graph')], - [sg.In(size=(6, 1)), sg.In(size=(6, 1))], - [sg.Ok(), sg.Cancel()]] + layout = [[sg.T('Enter width, height of graph')], + [sg.In(size=(6, 1)), sg.In(size=(6, 1))], + [sg.Ok(), sg.Cancel()]] - b,v = form.LayoutAndRead(layout) - if b is None or b == 'Cancel': - exit(69) - w, h = int(v[0]), int(v[1]) - CANVAS_SIZE = (w,h) + window = sg.Window('Enter graph size').Layout(layout) + b,v = window.Read() + if b is None or b == 'Cancel': + sys.exit(69) + w, h = int(v[0]), int(v[1]) + CANVAS_SIZE = (w,h) # start ping measurement thread @@ -31,8 +31,8 @@ def main(): layout = [ [sg.Quit( button_color=('white','black'))], [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,SAMPLE_MAX),background_color='black', key='graph')],] - form = sg.FlexForm('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False).Layout(layout).Finalize() - graph = form.FindElement('graph') + window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False).Layout(layout).Finalize() + graph = window.FindElement('graph') prev_response_time = None i=0 @@ -40,7 +40,7 @@ def main(): graph_value = 250 while True: # time.sleep(.2) - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Quit' or values is None: break graph_offset = random.randint(-10, 10) @@ -55,7 +55,7 @@ def main(): graph.Move(-STEP_SIZE,0) prev_x = prev_x - STEP_SIZE graph.DrawLine((prev_x, prev_y), (new_x, new_y), color='white') - # form.FindElement('graph').DrawPoint((new_x, new_y), color='red') + # window.FindElement('graph').DrawPoint((new_x, new_y), color='red') prev_x, prev_y = new_x, new_y i += STEP_SIZE if i < SAMPLES else 0 @@ -63,4 +63,3 @@ def main(): if __name__ == '__main__': main() - exit(69) \ No newline at end of file diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index 83c7c6608..cb1c42cea 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,17 +1,6 @@ import PySimpleGUI as sg import subprocess -import ctypes -import os -import win32process - -# hwnd = ctypes.windll.kernel32.GetConsoleWindow() -# if hwnd != 0: -# ctypes.windll.user32.ShowWindow(hwnd, 0) -# ctypes.windll.kernel32.CloseHandle(hwnd) -# _, pid = win32process.GetWindowThreadProcessId(hwnd) -# os.system('taskkill /PID ' + str(pid) + ' /f') - # Test this command in a dos window if you are having trouble. HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' @@ -27,7 +16,7 @@ def HowDoI(): 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but doesn't close the form :return: never returns ''' - # ------- Make a new FlexForm ------- # + # ------- Make a new Window ------- # sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors layout = [ @@ -37,39 +26,38 @@ def HowDoI(): sg.Text('Num Answers',font='Helvetica 15'), sg.Checkbox('Display Full Text', key='full text', font='Helvetica 15'), sg.T('Command History', font='Helvetica 15'), sg.T('', size=(40,3), text_color=sg.BLUES[0], key='history')], [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.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] + sg.ReadButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True), + sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] ] - form = sg.FlexForm('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True, no_titlebar=True) - form.Layout(layout) + window = sg.Window('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True, no_titlebar=True) + window.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # command_history = [] history_offset = 0 while True: - (button, value) = form.Read() + (button, value) = window.Read() if button is 'SEND': query = value['query'].rstrip() print(query) QueryHowDoI(query, value['Num Answers'], value['full text']) # send the string to HowDoI command_history.append(query) history_offset = len(command_history)-1 - form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear - form.FindElement('history').Update('\n'.join(command_history[-3:])) + window.FindElement('query').Update('') # manually clear input because keyboard events blocks clear + window.FindElement('history').Update('\n'.join(command_history[-3:])) elif button is None or button is 'EXIT': # if exit button or closed using X break elif 'Up' in button and len(command_history): # scroll back in history command = command_history[history_offset] history_offset -= 1 * (history_offset > 0) # decrement is not zero - form.FindElement('query').Update(command) + window.FindElement('query').Update(command) 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 command = command_history[history_offset] - form.FindElement('query').Update(command) + window.FindElement('query').Update(command) elif 'Escape' in button: # clear currently line - form.FindElement('query').Update('') + window.FindElement('query').Update('') - exit(69) def QueryHowDoI(Query, num_answers, full_text): ''' diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py index df075f697..0b257e55b 100644 --- a/Demo_Img_Viewer.py +++ b/Demo_Img_Viewer.py @@ -57,7 +57,7 @@ def get_img_data(f, maxsize = (1200, 850), first = False): # create the form that also returns keyboard events -form = sg.FlexForm('Image Browser', return_keyboard_events=True, +window = sg.Window('Image Browser', return_keyboard_events=True, location=(0, 0), use_default_focus=False) # make these 2 elements outside the layout as we want to "update" them later @@ -72,18 +72,18 @@ def get_img_data(f, maxsize = (1200, 850), first = False): [image_elem]] col_files = [[sg.Listbox(values = fnames, change_submits=True, size=(60, 30), key='listbox')], - [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', + [sg.ReadButton('Next', size=(8,2)), sg.ReadButton('Prev', size=(8,2)), file_num_display_elem]] layout = [[sg.Column(col_files), sg.Column(col)]] -form.Layout(layout) # Shows form on screen +window.Layout(layout) # Shows form on screen # loop reading the user input and displaying image, filename i=0 while True: # read the form - button, values = form.Read() + button, values = window.Read() # perform button and keyboard operations if button is None: diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index 9bbde27dd..e413ac4f2 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -3,22 +3,22 @@ # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" -with sg.FlexForm("Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text("Press a key or scroll mouse")], - [sg.Text("", size=(18,1), key='text')], - [sg.SimpleButton("OK", key='OK')]] +layout = [[sg.Text("Press a key or scroll mouse")], + [sg.Text("", size=(18,1), key='text')], + [sg.Button("OK", key='OK')]] - form.Layout(layout) - # ---===--- Loop taking in user input --- # - while True: - button, value = form.Read() - text_elem = form.FindElement('text') - if button in ("OK", None): - print(button, "exiting") - break - if len(button) == 1: - text_elem.Update(value='%s - %s' % (button, ord(button))) - if button is not None: - text_elem.Update(button) +window = sg.Window("Keyboard Test", return_keyboard_events=True, use_default_focus=False).Layout(layout) + +# ---===--- Loop taking in user input --- # +while True: + button, value = window.Read() + text_elem = window.FindElement('text') + if button in ("OK", None): + print(button, "exiting") + break + if len(button) == 1: + text_elem.Update(value='%s - %s' % (button, ord(button))) + if button is not None: + text_elem.Update(button) diff --git a/Demo_Keyboard_Realtime.py b/Demo_Keyboard_Realtime.py index ab48ce736..ff94f29e7 100644 --- a/Demo_Keyboard_Realtime.py +++ b/Demo_Keyboard_Realtime.py @@ -1,21 +1,20 @@ import PySimpleGUI as sg -with sg.FlexForm("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False) as form: - layout = [[sg.Text("Hold down a key")], - [sg.SimpleButton("OK")]] +layout = [[sg.Text("Hold down a key")], + [sg.Button("OK")]] - form.Layout(layout) +window = sg.Window("Realtime Keyboard Test", return_keyboard_events=True, use_default_focus=False).Layout(layout) - while True: - button, value = form.ReadNonBlocking() +while True: + button, value = window.ReadNonBlocking() - if button == "OK": - print(button, value, "exiting") - break - if button is not None: - if len(button) == 1: - print('%s - %s'%(button, ord(button))) - else: - print(button) - elif value is None: - break + if button == "OK": + print(button, value, "exiting") + break + if button is not None: + if len(button) == 1: + print('%s - %s'%(button, ord(button))) + else: + print(button) + elif value is None: + break diff --git a/Demo_Keypad.py b/Demo_Keypad.py index 501e9d4b3..d51f32f58 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -1,43 +1,39 @@ import PySimpleGUI as sg -# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons - # Demonstrates a number of PySimpleGUI features including: # Default element size # auto_size_buttons -# ReadFormButton +# ReadButton # Dictionary return values # Update of elements in form (Text, Input) # do_not_clear of Input elements -# create the 2 Elements we want to control outside the form layout = [[sg.Text('Enter Your Passcode')], [sg.Input(size=(10, 1), do_not_clear=True, key='input')], - [sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')], - [sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')], - [sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')], - [sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')], + [sg.ReadButton('1'), sg.ReadButton('2'), sg.ReadButton('3')], + [sg.ReadButton('4'), sg.ReadButton('5'), sg.ReadButton('6')], + [sg.ReadButton('7'), sg.ReadButton('8'), sg.ReadButton('9')], + [sg.ReadButton('Submit'), sg.ReadButton('0'), sg.ReadButton('Clear')], [sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')], ] -form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False) -form.Layout(layout) +window = sg.Window('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False, grab_anywhere=False).Layout(layout) # Loop forever reading the form's values, updating the Input field keys_entered = '' while True: - button, values = form.Read() # read the form + button, values = window.Read() # read the form if button is None: # if the X button clicked, just exit break - if button is 'Clear': # clear keys if clear button + if button == 'Clear': # clear keys if clear button keys_entered = '' elif button in '1234567890': - keys_entered = values['input'] # get what's been entered so far + keys_entere=d = values['input'] # get what's been entered so far keys_entered += button # add the new digit - elif button is 'Submit': + elif button == 'Submit': keys_entered = values['input'] - form.FindElement('out').Update(keys_entered) # output the final string + window.FindElement('out').Update(keys_entered) # output the final string - form.FindElement('input').Update(keys_entered) # change the form to reflect current key string \ No newline at end of file + window.FindElement('input').Update(keys_entered) # change the form to reflect current key string \ No newline at end of file diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py index 3e4e50083..87131a1fb 100644 --- a/Demo_MIDI_Player.py +++ b/Demo_MIDI_Player.py @@ -2,6 +2,7 @@ import PySimpleGUI as g import mido import time +import sys PLAYER_COMMAND_NONE = 0 PLAYER_COMMAND_EXIT = 1 @@ -18,7 +19,7 @@ class PlayerGUI(): ''' def __init__(self): - self.Form = None + self.Window = None self.TextElem = None self.PortList = mido.get_output_names() # use to get the list of midi ports self.PortList = self.PortList[::-1] # reverse the list so the last one is first @@ -30,10 +31,8 @@ def __init__(self): def PlayerChooseSongGUI(self): # ---------------------- DEFINION OF CHOOSE WHAT TO PLAY GUI ---------------------------- - with g.FlexForm('MIDI File Player', auto_size_text=False, - default_element_size=(30, 1), - font=("Helvetica", 12)) as form: - layout = [[g.Text('MIDI File Player', font=("Helvetica", 15), size=(20, 1), text_color='green')], + + layout = [[g.Text('MIDI File Player', font=("Helvetica", 15), size=(20, 1), text_color='green')], [g.Text('File Selection', font=("Helvetica", 15), size=(20, 1))], [g.Text('Single File Playback', justification='right'), g.InputText(size=(65, 1), key='midifile'), g.FileBrowse(size=(10, 1), file_types=(("MIDI files", "*.mid"),))], [g.Text('Or Batch Play From This Folder', auto_size_text=False, justification='right'), g.InputText(size=(65, 1), key='folder'), g.FolderBrowse(size=(10, 1))], @@ -43,9 +42,9 @@ def PlayerChooseSongGUI(self): [g.Text('_' * 250, auto_size_text=False, size=(100, 1))], [g.SimpleButton('PLAY', size=(12, 2), button_color=('red', 'white'), font=("Helvetica", 15), bind_return_key=True), g.Text(' ' * 2, size=(4, 1)), g.Cancel(size=(8, 2), font=("Helvetica", 15))]] - - self.Form = form - return form.LayoutAndRead(layout) + window = g.Window('MIDI File Player', auto_size_text=False, default_element_size=(30, 1), font=("Helvetica", 12)).Layout(layout) + self.Window = window + return window.Read() def PlayerPlaybackGUIStart(self, NumFiles=1): @@ -58,7 +57,6 @@ def PlayerPlaybackGUIStart(self, NumFiles=1): self.TextElem = g.T('Song loading....', size=(70,5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) self.SliderElem = g.Slider(range=(1,100), size=(50, 8), orientation='h', text_color='#f0f0f0') - form = g.FlexForm('MIDI File Player', default_element_size=(30,1),font=("Helvetica", 25)) layout = [ [g.T('MIDI File Player', size=(30,1), font=("Helvetica", 25))], [self.TextElem], @@ -73,8 +71,8 @@ def PlayerPlaybackGUIStart(self, NumFiles=1): image_filename=image_exit, image_size=(50,50), image_subsample=2, border_width=0,)] ] - form.LayoutAndRead(layout, non_blocking=True) - self.Form = form + window = g.FlexForm('MIDI File Player', default_element_size=(30,1),font=("Helvetica", 25)).Layout(layout).Finalize() + self.Window = window @@ -83,11 +81,11 @@ def PlayerPlaybackGUIStart(self, NumFiles=1): # Refresh the GUI for the main playback interface (must call periodically # # ------------------------------------------------------------------------- # def PlayerPlaybackGUIUpdate(self, DisplayString): - form = self.Form - if 'form' not in locals() or form is None: # if the form has been destoyed don't mess with it + window = self.Window + if 'window' not in locals() or window is None: # if the form has been destoyed don't mess with it return PLAYER_COMMAND_EXIT self.TextElem.Update(DisplayString) - button, (values) = form.ReadNonBlocking() + button, (values) = window.ReadNonBlocking() if values is None: return PLAYER_COMMAND_EXIT if button == 'PAUSE': @@ -121,7 +119,7 @@ def GetCurrentTime(): button, values = pback.PlayerChooseSongGUI() if button != 'PLAY': g.PopupCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) - exit(69) + sys.exit(69) if values['device']: midi_port = values['device'][0] else: @@ -139,7 +137,7 @@ def GetCurrentTime(): filetitles = [os.path.basename(midi_filename),] else: g.PopupError('*** Error - No MIDI files specified ***') - exit(666) + sys.exit(666) # ------ LOOP THROUGH MULTIPLE FILES --------------------------------------------------------- # pback.PlayerPlaybackGUIStart(NumFiles=len(filelist) if len(filelist) <=10 else 10) @@ -215,7 +213,6 @@ def GetCurrentTime(): if cancelled: break - exit(69) # ---------------------------------------------------------------------- # # LAUNCH POINT -- program starts and ends here # @@ -223,4 +220,3 @@ def GetCurrentTime(): if __name__ == '__main__': main() - exit(69) diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index cc26952ff..4b7e7265d 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -29,38 +29,32 @@ def MachineLearningGUI(): [sg.Frame('Loss Functions', loss_functions, font='Any 12', title_color='red')], [sg.Submit(), sg.Cancel()]] - - form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) - button, values = form.LayoutAndRead(layout) - del(form) + window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) + button, values = window.Read() sg.SetOptions(text_justification='left') print(button, values) - def CustomMeter(): - # create the progress bar element - progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) # layout the form layout = [[sg.Text('A custom progress meter')], - [progress_bar], + [sg.ProgressBar(10000, orientation='h', size=(20,20), key='progress')], [sg.Cancel()]] # create the form` - form = sg.FlexForm('Custom Progress Meter') - # display the form as a non-blocking form - form.LayoutAndRead(layout, non_blocking=True) + window = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = window.FindElement('progress') # loop that would normally do something useful for i in range(10000): # check to see if the cancel button was clicked and exit loop if clicked - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Cancel' or values == None: break # update bar with loop value +1 so that bar eventually reaches the maximum progress_bar.UpdateBar(i+1) # done with loop... need to destroy the window as it's still open - form.CloseNonBlockingForm() + window.CloseNonBlocking() if __name__ == '__main__': - # CustomMeter() + CustomMeter() MachineLearningGUI() diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 7b2553f76..e7cbb863c 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -113,10 +113,10 @@ def draw_figure(canvas, figure, loc=(0, 0)): [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] # create the form and show it without the plot -form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() +window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() # add the plot to the window -fig_photo = draw_figure(form.FindElement('canvas').TKCanvas, fig) +fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) # show it all again and get buttons -button, values = form.Read() +button, values = window.Read() diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index da813c473..e3b33b75a 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -14,25 +14,23 @@ def main(): ax.set_ylabel("Y axis") ax.grid() - canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on - slider_elem = sg.Slider(range=(0, 10000), size=(60, 10), orientation='h') # define the form layout layout = [[sg.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [canvas_elem], - [slider_elem], - [sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + [sg.Canvas(size=(640, 480), key='canvas')], + [sg.Slider(range=(0, 10000), size=(60, 10), orientation='h', key='slider')], + [sg.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.Finalize() + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + canvas_elem = window.FindElement('canvas') + slider_elem = window.FindElement('slider') graph = FigureCanvasTkAgg(fig, master=canvas_elem.TKCanvas) canvas = canvas_elem.TKCanvas dpts = [randint(0, 10) for x in range(10000)] for i in range(len(dpts)): - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is 'Exit' or values is None: exit(69) diff --git a/Demo_Matplotlib_Animated_Scatter.py b/Demo_Matplotlib_Animated_Scatter.py index 0005d681e..26c2c7fcf 100644 --- a/Demo_Matplotlib_Animated_Scatter.py +++ b/Demo_Matplotlib_Animated_Scatter.py @@ -7,21 +7,19 @@ def main(): - canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on # define the form layout layout = [[sg.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')], - [canvas_elem], - [sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + [sg.Canvas(size=(640, 480), key='canvas')], + [sg.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.Finalize() + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + canvas_elem = window.FindElement('canvas') canvas = canvas_elem.TKCanvas while True: - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is 'Exit' or values is None: exit(69) diff --git a/Demo_Matplotlib_Browser.py b/Demo_Matplotlib_Browser.py index 5ab902a44..a7c6ab5ea 100644 --- a/Demo_Matplotlib_Browser.py +++ b/Demo_Matplotlib_Browser.py @@ -247,7 +247,7 @@ def PyplotLineStyles(): # For each line style, add a text annotation with a small offset from # the reference point (0 in Axes coords, y tick value in Data coords). - reference_transform = blended_transform_factory(ax.transAxes, ax.transData) + reference_transwindow = blended_transform_factory(ax.transAxes, ax.transData) for i, (name, linestyle) in enumerate(linestyles.items()): ax.annotate(str(linestyle), xy=(0.0, i), xycoords=reference_transform, xytext=(-6, -12), textcoords='offset points', color="blue", @@ -864,23 +864,24 @@ def draw_figure(canvas, figure, loc=(0, 0)): sg.ChangeLookAndFeel('LightGreen') figure_w, figure_h = 650, 650 -canvas_elem = sg.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on -multiline_elem = sg.Multiline(size=(70, 35), pad=(5, (3, 90))) # define the form layout listbox_values = [key for key in fig_dict.keys()] col_listbox = [[sg.Listbox(values=listbox_values, change_submits=True, size=(28, len(listbox_values)), key='func')], [sg.T(' ' * 12), sg.Exit(size=(5, 2))]] layout = [[sg.Text('Matplotlib Plot Test', font=('current 18'))], - [sg.Column(col_listbox, pad=(5, (3, 330))), canvas_elem, multiline_elem], - ] + [sg.Column(col_listbox, pad=(5, (3, 330))), sg.Canvas(size=(figure_w, figure_h), key='canvas') , + sg.Multiline(size=(70, 35), pad=(5, (3, 90)), key='multiline')],] # create the form and show it without the plot -form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI', grab_anywhere=False) -form.Layout(layout) +window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI', grab_anywhere=False).Layout(layout) +window.Finalize() + +canvas_elem = window.FindElement('canvas') +multiline_elem= window.FindElement('multiline') while True: - button, values = form.Read() + button, values = window.Read() print(button) # show it all again and get buttons if button is None or button is 'Exit': @@ -891,7 +892,6 @@ def draw_figure(canvas, figure, loc=(0, 0)): func = fig_dict[choice] except: pass - # func = fig_dict['Pyplot Simple'] multiline_elem.Update(inspect.getsource(func)) plt.clf() diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index 39111a989..a302d53c8 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -640,15 +640,13 @@ def draw(fig, canvas): def main(): global g_my_globals - canvas_elem = sg.Canvas(size=SIZE, background_color='white') # get the canvas we'll be drawing on # define the form layout - layout = [[canvas_elem, sg.ReadFormButton('Exit', pad=(0, (210, 0)))]] + layout = [[ sg.Canvas(size=SIZE, background_color='white',key='canvas') , sg.ReadButton('Exit', pad=(0, (210, 0)))]] # create the form and show it without the plot - form = sg.FlexForm('Ping Graph', background_color='white', grab_anywhere=True) - form.Layout(layout) - form.Finalize() + window = sg.Window('Ping Graph', background_color='white', grab_anywhere=True).Layout(layout).Finalize() + canvas_elem = window.FindElement('canvas') canvas = canvas_elem.TKCanvas fig = plt.figure(figsize=(3.1, 2.25), tight_layout={'pad':0}) @@ -659,7 +657,7 @@ def main(): plt.tight_layout() while True: - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is 'Exit' or values is None: exit(0) diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/Demo_Matplotlib_Ping_Graph_Large.py index 23bb678f6..380329970 100644 --- a/Demo_Matplotlib_Ping_Graph_Large.py +++ b/Demo_Matplotlib_Ping_Graph_Large.py @@ -74,17 +74,15 @@ def draw(fig, canvas): def main(): global g_my_globals - canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on # define the form layout layout = [[sg.Text('Animated Ping', size=(40, 1), justification='center', font='Helvetica 20')], - [canvas_elem], - [sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] + [sg.Canvas(size=(640, 480), key='canvas')], + [sg.ReadButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]] # create the form and show it without the plot - form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI') - form.Layout(layout) - form.Finalize() + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() + canvas_elem = window.FindElement('canvas') canvas = canvas_elem.TKCanvas fig = plt.figure() @@ -93,7 +91,7 @@ def main(): plt.tight_layout() while True: - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is 'Exit' or values is None: break diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index b1128f3ed..aef039f61 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -18,22 +18,20 @@ def MediaPlayerGUI(): # A text element that will be changed to display messages in the GUI - # 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), - font=("Helvetica", 25), no_titlebar=True) + # define layout of the rows layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))], [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')], - [sg.ReadFormButton('Restart Song', button_color=(background,background), + [sg.ReadButton('Restart Song', button_color=(background,background), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=(background,background), + sg.ReadButton('Pause', button_color=(background,background), image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=(background,background), + sg.ReadButton('Next', button_color=(background,background), image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background,background), + sg.Text(' ' * 2), sg.Button('Exit', button_color=(background,background), image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], [sg.Text('_'*20)], [sg.Text(' '*30)], @@ -46,20 +44,20 @@ def MediaPlayerGUI(): [sg.Text(' Bass', font=("Helvetica", 15), size=(9, 1)), sg.Text('Treble', font=("Helvetica", 15), size=(7, 1)), sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] - ] - # Call the same LayoutAndRead but indicate the form is non-blocking - form.LayoutAndRead(layout, non_blocking=True) + # Open a form, note that context manager can't be used generally speaking for async forms + window = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1), + font=("Helvetica", 25), no_titlebar=True).Layout(layout) # Our event loop while(True): # Read the form (this call will not block) - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Exit': break # If a button was pressed, display it on the GUI by updating the text element if button: - form.FindElement('output').Update(button) + window.FindElement('output').Update(button) MediaPlayerGUI() diff --git a/Demo_Menus.py b/Demo_Menus.py index 8462881f6..fe4634b0b 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -11,8 +11,8 @@ def SecondForm(): layout = [[sg.Text('The second form is small \nHere to show that opening a window using a window works')], [sg.OK()]] - form = sg.FlexForm('Second Form') - b, v = form.LayoutAndRead(layout) + window = sg.Window('Second Form').Layout(layout) + b, v = window.Read() def TestMenus(): @@ -33,13 +33,12 @@ def TestMenus(): [sg.In('Test', key='input', do_not_clear=True)] ] - form = sg.FlexForm("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12, 1)) - form.Layout(layout) + window = sg.Window("Windows-like program", default_element_size=(12, 1), auto_size_text=False, auto_size_buttons=False, + default_button_element_size=(12, 1)).Layout(layout) # ------ Loop & Process button menu choices ------ # while True: - button, values = form.Read() + button, values = window.Read() if button is None or button == 'Exit': return print('Button = ', button) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index b08b85c24..667b43e53 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -1,31 +1,28 @@ import PySimpleGUI as sg import time - -# form that doen't block +# Window that doen't block # good for applications with an loop that polls hardware def StatusOutputExample(): - # Make a form, but don't use context manager - 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 the rows - form_rows = [[sg.Text('Non-blocking GUI with updates')], + layout = [[sg.Text('Non-blocking GUI with updates')], [sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='output')], - [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! - form.LayoutAndRead(form_rows, non_blocking=True) + [sg.ReadButton('LED On'), sg.ReadButton('LED Off'), sg.ReadButton('Quit')]] + # Layout the rows of the Window and perform a read. Indicate the Window is non-blocking! + window = sg.Window('Running Timer', auto_size_text=True).Layout(layout) # # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or + # You need to perform a ReadNonBlocking on your window every now and then or # else it won't refresh. # # your program's main loop i=0 while (True): # This is the code that reads and updates your window - form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) if button == 'Quit' or values is None: break if button == 'LED On': @@ -38,14 +35,12 @@ def StatusOutputExample(): time.sleep(.01) # Broke out of main loop. Close the window. - form.CloseNonBlockingForm() + window.CloseNonBlocking() def RemoteControlExample(): - # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) - form_rows = [[sg.Text('Robotics Remote Control')], + layout = [[sg.Text('Robotics Remote Control')], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], @@ -53,55 +48,30 @@ def RemoteControlExample(): [sg.Quit(button_color=('black', 'orange'))] ] - form.LayoutAndRead(form_rows, non_blocking=True) + window = sg.Window('Robotics Remote Control', auto_size_text=True).Layout(layout).Finalize() # # Some place later in your code... - # You need to perform a ReadNonBlocking on your form every now and then or + # You need to perform a ReadNonBlocking on your window every now and then or # else it won't refresh. # # your program's main loop while (True): # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is not None: print(button) if button == 'Quit' or values is None: break # time.sleep(.01) - form.CloseNonBlockingForm() - - - + window.CloseNonBlocking() -# This design pattern follows the uses a context manager to better control the resources -# It may not be realistic to use a context manager within an embedded (Pi) environment -# If on a Pi, then consider the above design patterns instead -def StatusOutputExample_context_manager(): - with sg.FlexForm('Running Timer', auto_size_text=True) as form: - output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20)) - form_rows = [[sg.Text('Non-blocking GUI with updates')], - [output_element], - [sg.SimpleButton('Quit')]] - - form.LayoutAndRead(form_rows, non_blocking=True) - - for i in range(1, 1000): - output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button == 'Quit': - break - time.sleep(.01) - else: - form.CloseNonBlockingForm() def main(): RemoteControlExample() StatusOutputExample() - StatusOutputExample() sg.Popup('End of non-blocking demonstration') - # StatusOutputExample_context_manager() if __name__ == '__main__': diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index 2c8feb7be..078eff135 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -3,6 +3,7 @@ import tempfile import PySimpleGUI as sg import os +from sys import exit as exit """ Demo program to open and play a file using OpenCV @@ -14,8 +15,8 @@ def main(): - filename = 'C:/Python/MIDIVideo/PlainVideos/- 08-30 Ted Talk/TED Talk Short - Video+.mp4' - # filename = sg.PopupGetFile('Filename to play') + # filename = 'C:/Python/MIDIVideo/PlainVideos/- 08-30 Ted Talk/TED Talk Short - Video+.mp4' + filename = sg.PopupGetFile('Filename to play') if filename is None: exit(69) vidFile = cv.VideoCapture(filename) @@ -25,23 +26,23 @@ def main(): sg.ChangeLookAndFeel('Dark') - # define the form layout + # define the window layout layout = [[sg.Text('OpenCV Demo', size=(15, 1),pad=((510,0),3), justification='center', font='Helvetica 20')], [sg.Image(filename='', key='image')], [sg.Slider(range=(0, num_frames), size=(115, 10), orientation='h', key='slider')], - [sg.ReadFormButton('Exit', size=(10, 2), pad=((600, 0), 3), font='Helvetica 14')]] + [sg.ReadButton('Exit', size=(10, 2), pad=((600, 0), 3), font='Helvetica 14')]] - # create the form and show it without the plot - form = sg.FlexForm('Demo Application - OpenCV Integration', no_titlebar=False, location=(0,0)) - form.Layout(layout) - form.ReadNonBlocking() + # create the window and show it without the plot + window = sg.Window('Demo Application - OpenCV Integration', no_titlebar=False, location=(0,0)) + window.Layout(layout) + window.ReadNonBlocking() # ---===--- LOOP through video file by frame --- # i = 0 temp_filename = next(tempfile._get_candidate_names()) + '.png' while vidFile.isOpened(): - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is 'Exit' or values is None: os.remove(temp_filename) exit(69) @@ -49,12 +50,12 @@ def main(): if not ret: # if out of data stop looping break - form.FindElement('slider').Update(i) + window.FindElement('slider').Update(i) i += 1 with open(temp_filename, 'wb') as f: Image.fromarray(frame).save(temp_filename, 'PNG') # save the PIL image as file - form.FindElement('image').Update(filename=temp_filename) + window.FindElement('image').Update(filename=temp_filename) main() \ No newline at end of file diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py index 32889695a..96e55fd0a 100644 --- a/Demo_PDF_Viewer.py +++ b/Demo_PDF_Viewer.py @@ -24,7 +24,7 @@ We also interpret keyboard events to support paging by PageDown / PageUp keys as if the resp. buttons were clicked. Similarly, we do not include -a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the form. +a 'Quit' button. Instead, the ESCAPE key can be used, or cancelling the window. To improve paging performance, we are not directly creating pixmaps from pages, but instead from the fitz.DisplayList of the page. A display list @@ -35,6 +35,7 @@ import sys import fitz import PySimpleGUI as sg +from sys import exit as exit from binascii import hexlify sg.ChangeLookAndFeel('GreenTan') @@ -86,7 +87,7 @@ def get_page(pno, zoom=0): return pix.getPNGData() # return the PNG image -form = sg.FlexForm(title, return_keyboard_events=True, use_default_focus=False) +window = sg.Window(title, return_keyboard_events=True, use_default_focus=False) cur_page = 0 data = get_page(cur_page) # show page 1 for start @@ -95,22 +96,22 @@ def get_page(pno, zoom=0): layout = [ [ - sg.ReadFormButton('Next'), - sg.ReadFormButton('Prev'), + sg.ReadButton('Next'), + sg.ReadButton('Prev'), sg.Text('Page:'), goto, ], [ sg.Text("Zoom:"), - sg.ReadFormButton('Top-L'), - sg.ReadFormButton('Top-R'), - sg.ReadFormButton('Bot-L'), - sg.ReadFormButton('Bot-R'), + sg.ReadButton('Top-L'), + sg.ReadButton('Top-R'), + sg.ReadButton('Bot-L'), + sg.ReadButton('Bot-R'), ], [image_elem], ] -form.Layout(layout) +window.Layout(layout) my_keys = ("Next", "Next:34", "Prev", "Prior:33", "Top-L", "Top-R", "Bot-L", "Bot-R", "MouseWheel:Down", "MouseWheel:Up") zoom_buttons = ("Top-L", "Top-R", "Bot-L", "Bot-R") @@ -120,7 +121,7 @@ def get_page(pno, zoom=0): # the zoom buttons work in on/off mode. while True: - button, value = form.ReadNonBlocking() + button, value = window.ReadNonBlocking() zoom = 0 force_page = False if button is None and value is None: diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py index 1af28f72a..d90bb9b7a 100644 --- a/Demo_PNG_Viewer.py +++ b/Demo_PNG_Viewer.py @@ -1,5 +1,6 @@ import PySimpleGUI as sg import os +from sys import exit as exit # Simple Image Browser based on PySimpleGUI @@ -20,24 +21,23 @@ # define menu layout menu = [['File', ['Open Folder', 'Exit']], ['Help', ['About',]]] -# create the form that also returns keyboard events -form = sg.FlexForm('Image Browser', return_keyboard_events=True, location=(0,0), use_default_focus=False ) -# define layout, show and read the form +# define layout, show and read the window col = [[sg.Text(png_files[0], size=(80, 3), key='filename')], [sg.Image(filename=png_files[0], key='image')], - [sg.ReadFormButton('Next', size=(8,2)), sg.ReadFormButton('Prev', size=(8,2)), + [sg.ReadButton('Next', size=(8,2)), sg.ReadButton('Prev', size=(8,2)), sg.Text('File 1 of {}'.format(len(png_files)), size=(15,1), key='filenum')]] col_files = [[sg.Listbox(values=filenames_only, size=(60,30), key='listbox')], - [sg.ReadFormButton('Read')]] + [sg.ReadButton('Read')]] layout = [[sg.Menu(menu)], [sg.Column(col_files), sg.Column(col)]] -button, values = form.LayoutAndRead(layout) # Shows form on screen +window = sg.Window('Image Browser', return_keyboard_events=True, location=(0,0), use_default_focus=False ).Layout(layout) # loop reading the user input and displaying image, filename i=0 while True: + button, values = window.Read() # --------------------- Button & Keyboard --------------------- if button is None: break @@ -58,18 +58,16 @@ folder = newfolder png_files = [folder + '/' + f for f in os.listdir(folder) if '.png' in f] filenames_only = [f for f in os.listdir(folder) if '.png' in f] - form.FindElement('listbox').Update(values=filenames_only) - form.Refresh() + window.FindElement('listbox').Update(values=filenames_only) + window.Refresh() i = 0 elif button == 'About': sg.Popup('Demo PNG Viewer Program', 'Please give PySimpleGUI a try!') # update window with new image - form.FindElement('image').Update(filename=filename) + window.FindElement('image').Update(filename=filename) # update window with filename - form.FindElement('filename').Update(filename) + window.FindElement('filename').Update(filename) # update page display - form.FindElement('filenum').Update('File {} of {}'.format(i+1, len(png_files))) + window.FindElement('filenum').Update('File {} of {}'.format(i+1, len(png_files))) - # read the form - button, values = form.Read() diff --git a/Demo_Password_Login.py b/Demo_Password_Login.py index be3e764af..84662b241 100644 --- a/Demo_Password_Login.py +++ b/Demo_Password_Login.py @@ -1,5 +1,6 @@ import PySimpleGUI as sg import hashlib +from sys import exit as exit """ Create a secure login for your scripts without having to include your password @@ -7,7 +8,7 @@ 1. Choose a password 2. Generate a hash code for your chosen password by running program and entering 'gui' as the password 3. Type password into the GUI - 4. Copy and paste hash code form GUI into variable named login_password_hash + 4. Copy and paste hash code from GUI into variable named login_password_hash 5. Run program again and test your login! 6. Are you paying attention? The first person that can post an issue on GitHub with the matching password to the hash code in this example gets a $5 PayPal payment @@ -20,12 +21,11 @@ def HashGeneratorGUI(): [sg.T('SHA Hash'), sg.In('', size=(40,1), key='hash')], ] - form = sg.FlexForm('SHA Generator', auto_size_text=False, default_element_size=(10,1), - text_justification='r', return_keyboard_events=True, grab_anywhere=False) - form.Layout(layout) + window = sg.Window('SHA Generator', auto_size_text=False, default_element_size=(10,1), + text_justification='r', return_keyboard_events=True, grab_anywhere=False).Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is None: exit(69) @@ -35,7 +35,7 @@ def HashGeneratorGUI(): sha1hash = hashlib.sha1() sha1hash.update(password_utf) password_hash = sha1hash.hexdigest() - form.FindElement('hash').Update(password_hash) + window.FindElement('hash').Update(password_hash) except: pass diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py index 6ec26c5e1..68db17131 100644 --- a/Demo_Pi_LEDs.py +++ b/Demo_Pi_LEDs.py @@ -30,25 +30,23 @@ def FlashLED(): layout = [[rg.T('Raspberry Pi LEDs')], [rg.T('', size=(14, 1), key='output')], - [rg.ReadFormButton('Switch LED')], - [rg.ReadFormButton('Flash LED')], - [rg.Exit()] - ] + [rg.ReadButton('Switch LED')], + [rg.ReadButton('Flash LED')], + [rg.Exit()]] -form = rg.FlexForm('Raspberry Pi GUI', grab_anywhere=False) -form.Layout(layout) +window = rg.Window('Raspberry Pi GUI', grab_anywhere=False).Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is None: break if button is 'Switch LED': - form.FindElement('output').Update(SwitchLED()) + window.FindElement('output').Update(SwitchLED()) elif button is 'Flash LED': - form.FindElement('output').Update('LED is Flashing') - form.ReadNonBlocking() + window.FindElement('output').Update('LED is Flashing') + window.ReadNonBlocking() FlashLED() - form.FindElement('output').Update('') + window.FindElement('output').Update('') rg.Popup('Done... exiting') diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index e7efa24b2..829f08be5 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -17,18 +17,15 @@ def RemoteControlExample(): sg.SetOptions(border_width=0, button_color=('black', back), background_color=back, element_background_color=back, text_element_background_color=back) - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) - - form_rows = [[sg.Text('Robotics Remote Control')], + layout = [[sg.Text('Robotics Remote Control')], [sg.T('', justification='center', size=(19,1), key='status')], [ sg.RealtimeButton('Forward', image_filename=image_forward, pad=((50,0),0))], [ sg.RealtimeButton('Left', image_filename=image_left), sg.RealtimeButton('Right', image_filename=image_right, pad=((50,0), 0))], [ sg.RealtimeButton('Reverse', image_filename=image_backward, pad=((50,0),0))], [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] + [sg.Quit(button_color=('black', 'orange'))]] - form.LayoutAndRead(form_rows, non_blocking=True) + window = sg.Window('Robotics Remote Control', auto_size_text=True, grab_anywhere=False).Layout(layout) # # Some place later in your code... @@ -38,32 +35,30 @@ def RemoteControlExample(): # your program's main loop while (True): # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is not None: - form.FindElement('status').Update(button) + window.FindElement('status').Update(button) else: - form.FindElement('status').Update('') + window.FindElement('status').Update('') # if user clicked quit button OR closed the form using the X, then break out of loop if button == 'Quit' or values is None: break - form.CloseNonBlockingForm() + window.CloseNonBlocking() def RemoteControlExample_NoGraphics(): # Make a form, but don't use context manager - form = sg.FlexForm('Robotics Remote Control', auto_size_text=True, grab_anywhere=False) - form_rows = [[sg.Text('Robotics Remote Control', justification='center')], + layout = [[sg.Text('Robotics Remote Control', justification='center')], [sg.T('', justification='center', size=(19,1), key='status')], [sg.T(' '*8), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '), sg.RealtimeButton('Right')], [sg.T(' '*8), sg.RealtimeButton('Reverse')], [sg.T('')], - [sg.Quit(button_color=('black', 'orange'))] - ] + [sg.Quit(button_color=('black', 'orange'))]] # Display form to user - form.LayoutAndRead(form_rows, non_blocking=True) + window = sg.Window('Robotics Remote Control', auto_size_text=True, grab_anywhere=False).Layout(layout) # # Some place later in your code... @@ -73,16 +68,16 @@ def RemoteControlExample_NoGraphics(): # your program's main loop while (True): # This is the code that reads and updates your window - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button is not None: - form.FindElement('status').Update(button) + window.FindElement('status').Update(button) else: - form.FindElement('status').Update('') + window.FindElement('status').Update('') # if user clicked quit button OR closed the form using the X, then break out of loop if button == 'Quit' or values is None: break - form.CloseNonBlockingForm() + window.CloseNonBlocking() diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py index ef6e2f4db..310089b1e 100644 --- a/Demo_Ping_Line_Graph.py +++ b/Demo_Ping_Line_Graph.py @@ -1,6 +1,7 @@ from threading import Thread import time import PySimpleGUI as sg +from sys import exit as exit # !/usr/bin/env python3 # -*- coding: utf-8 -*- @@ -214,7 +215,7 @@ __description__ = 'A pure python ICMP ping implementation using raw sockets.' -if sys.platform == "win32": +if sys.platwindow == "win32": # On Windows, the best timer is time.clock() default_timer = time.clock else: @@ -619,12 +620,11 @@ def convert_xy_to_canvas_xy(x_in,y_in): layout = [ [sg.T('Ping times to Google.com', font='Any 18')], [sg.Canvas(size=(canvas_right, canvas_bottom), background_color='white', key='canvas')], - [sg.Quit()] - ] + [sg.Quit()] ] -form = sg.FlexForm('Ping Times To Google.com', grab_anywhere=True).Layout(layout).Finalize() +window = sg.Window('Ping Times To Google.com', grab_anywhere=True).Layout(layout).Finalize() -canvas = form.FindElement('canvas').TKCanvas +canvas = window.FindElement('canvas').TKCanvas prev_response_time = None i=0 @@ -632,7 +632,7 @@ def convert_xy_to_canvas_xy(x_in,y_in): while True: time.sleep(.2) - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() if button == 'Quit' or values is None: break diff --git a/Demo_Pong.py b/Demo_Pong.py index 3aef52c7b..dbbaa0e51 100644 --- a/Demo_Pong.py +++ b/Demo_Pong.py @@ -1,6 +1,8 @@ import random import PySimpleGUI as sg import time +from sys import exit as exit + """ Pong code supplied by Daniel Young (Neonzz) @@ -126,13 +128,13 @@ def draw(self): def pong(): # ------------- Define GUI layout ------------- layout = [[sg.Canvas(size=(700, 400), background_color='black', key='canvas')], - [sg.T(''), sg.ReadFormButton('Quit')]] + [sg.T(''), sg.ReadButton('Quit')]] # ------------- Create window ------------- - form = sg.FlexForm('The Classic Game of Pong', return_keyboard_events=True).Layout(layout).Finalize() - # form.Finalize() # TODO Replace with call to form.Finalize once code released + window = sg.Window('The Classic Game of Pong', return_keyboard_events=True).Layout(layout).Finalize() + # window.Finalize() # TODO Replace with call to window.Finalize once code released # ------------- Get the tkinter Canvas we're drawing on ------------- - canvas = form.FindElement('canvas').TKCanvas + canvas = window.FindElement('canvas').TKCanvas # ------------- Create line down center, the bats and ball ------------- canvas.create_line(350, 0, 350, 400, fill='white') @@ -148,7 +150,7 @@ def pong(): bat2.draw() # ------------- Read the form, get keypresses ------------- - button, values = form.ReadNonBlocking() + button, values = window.ReadNonBlocking() # ------------- If quit ------------- if button is None and values is None or button == 'Quit': exit(69) diff --git a/Demo_Progress_Meters.py b/Demo_Progress_Meters.py index 2b902fb79..9a5945161 100644 --- a/Demo_Progress_Meters.py +++ b/Demo_Progress_Meters.py @@ -1,5 +1,7 @@ from time import sleep import PySimpleGUI as sg +from sys import exit as exit + """ Demonstration of simple and multiple OneLineProgressMeter's @@ -17,7 +19,6 @@ The simple case is that you want to add a single meter to your code. The one-line solution """ -import PySimpleGUI as sg # Display a progress meter in work loop. User is not allowed to break out of the loop for i in range(10000): @@ -29,22 +30,19 @@ break - - layout = [ [sg.T('One-Line Progress Meter Demo', font=('Any 18'))], [sg.T('Outer Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountOuter', do_not_clear=True), sg.T('Delay'), sg.In(default_text='10', key='TimeOuter', size=(5,1), do_not_clear=True), sg.T('ms')], [sg.T('Inner Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountInner', do_not_clear=True) , sg.T('Delay'), sg.In(default_text='10', key='TimeInner', size=(5,1), do_not_clear=True), sg.T('ms')], - [sg.SimpleButton('Show', pad=((0,0), 3), bind_return_key=True), sg.T('me the meters!')] + [sg.Button('Show', pad=((0,0), 3), bind_return_key=True), sg.T('me the meters!')] ] -form = sg.FlexForm('One-Line Progress Meter Demo') -form.Layout(layout) +window = sg.Window('One-Line Progress Meter Demo').Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() if button is None: break if button == 'Show': diff --git a/Demo_Recipes.py b/Demo_Recipes.py deleted file mode 100644 index 585fd1337..000000000 --- a/Demo_Recipes.py +++ /dev/null @@ -1,237 +0,0 @@ -import time -from random import randint -import PySimpleGUI as sg - -# A simple blocking form. Your best starter-form -def SourceDestFolders(): - with sg.FlexForm('Demo Source / Destination Folders') as form: - form_rows = ([sg.Text('Enter the Source and Destination folders')], - [sg.Text('Source Folder', size=(15, 1), justification='right'), sg.InputText('Source', key='source'), sg.FolderBrowse()], - [sg.Text('Destination Folder', size=(15, 1), justification='right'), sg.InputText('Dest', key='dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]) - - button, values = form.LayoutAndRead(form_rows) - if button is 'Submit': - sg.Popup('Submitted', values, 'The user entered source:', values['source'], 'Destination folder:', values['dest'], 'Using button', button) - else: - sg.PopupError('Cancelled', 'User Cancelled') - - -def MachineLearningGUI(): - sg.SetOptions(text_justification='right') - form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form - - layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], - [sg.Text('Passes', size =(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), - sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], - [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], - [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], - [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Flags', font=('Helvetica', 15), justification='left')], - [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], - [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], - [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], - [sg.Text('_' * 100, size=(65, 1))], - [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], - [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], - [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], - [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], - [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], - [sg.Submit(), sg.Cancel()]] - button, values = form.LayoutAndRead(layout) - del(form) - sg.SetOptions(text_justification='left') - - return button, values - -# YOUR BEST STARTING POINT -# This is a form showing you all of the basic Elements (widgets) -# Some have a few of the optional parameters set, but there are more to choose from -# You want to use the context manager because it will free up resources when you are finished -# Use this especially if you are runningm multi-threaded -# Where you free up resources is really important to tkinter -def Everything(): - - with sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) as form: - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText()], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything',size=(35,3)), - sg.Multiline(default_text='A second multi-line',size=(35,3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3', 'Listbox 4'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] ] - - button, values = form.LayoutAndRead(layout) - - sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) - -# Should you decide not to use a context manager, then try this form as your starting point -# Be aware that tkinter, which this is based on, is picky about who frees up resources, especially if -# you are running multithreaded -def Everything_NoContextManager(): - form = sg.FlexForm('Everything bagel', default_element_size=(40, 1)) - layout = [ - [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], - [sg.Text('Here is some text.... and a place to enter text')], - [sg.InputText('This is my text')], - [sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], - [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), - sg.Multiline(default_text='A second multi-line', size=(35, 3))], - [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), - sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], - [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), - sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), - sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], - [sg.Text('_' * 80)], - [sg.Text('Choose A Folder', size=(35, 1))], - [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), - sg.InputText('Default Folder'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()] - ] - - button, values = form.LayoutAndRead(layout) - del(form) - - sg.Popup('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values) - - -def ProgressMeter(): - for i in range(1,1000): - if not sg.EasyProgressMeter('My Meter', i + 1, 1000, orientation='h'): break - time.sleep(.01) - -# Blocking form that doesn't close -def ChatBot(): - with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2), default_button_element_size=(10,2)) as form: - layout = [[(sg.Text('This is where standard out is being routed', size=(40, 1)))], - [sg.Output(size=(80, 20), font=('Courier 10'))], - [sg.Multiline(size=(70, 5), enter_submits=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]))]] - # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form - # if you call LayoutAndRead from here, then you will miss the first button click - form.Layout(layout) - # ---===--- Loop taking in user input and using it to query HowDoI web oracle --- # - while True: - button, value = form.Read() - if button is not 'SEND': - break - print(value[0]) - -# Shows a form that's a running counter -# this is the basic design pattern if you can keep your reading of the -# form within the 'with' block. If your read occurs far away in your code from the form creation -# then you will want to use the NonBlockingPeriodicUpdateForm example -def NonBlockingPeriodicUpdateForm_ContextManager(): - with sg.FlexForm('Running Timer', auto_size_text=True) as form: - text_element = sg.Text('', size=(15, 2), font=('Helvetica', 20), text_color='red', justification='center') - layout = [[sg.Text('Non blocking GUI with updates', justification='center')], - [text_element], - [sg.T(' ' * 22), sg.Quit()]] - form.LayoutAndRead(layout, non_blocking=True) - - for i in range(1,500): - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) - button, values = form.ReadNonBlocking() - if values is None or button is 'Quit': # if user closed the window using X - break - time.sleep(.01) - else: - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - -# Use this context-manager-free version if your read of the form occurs far away in your code -# from the form creation (call to LayoutAndRead) -def NonBlockingPeriodicUpdateForm(): - # Show a form that's a running counter - form = sg.FlexForm('Running Timer', auto_size_text=True) - text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center') - form_rows = [[sg.Text('Stopwatch')], - [text_element], - [sg.T(' ' * 5), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]] - - form.LayoutAndRead(form_rows, non_blocking=True) - - timer_running = True - i = 0 - while True: - i += 1 * (timer_running is True) - button, values = form.ReadNonBlocking() - if values is None or button is 'Quit': # if user closed the window using X or clicked Quit button - break - elif button is 'Start/Stop': - timer_running = not timer_running - text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100)) - - time.sleep(.01) - # if the loop finished then need to close the form for the user - form.CloseNonBlockingForm() - del(form) - -def DebugTest(): - # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) - for i in range (1,300): - sg.Print('Here are 300 random numbers', i, randint(1, 1000), sep='-') - -# Change the colors and set borders to 0 for a flat look -def ChangeLookAndFeel(colors): - sg.SetOptions(background_color=colors['BACKGROUND'], - text_element_background_color=colors['BACKGROUND'], - element_background_color=colors['BACKGROUND'], - text_color=colors['TEXT'], - input_elements_background_color=colors['INPUT'], - button_color=colors['BUTTON'], - progress_meter_color=colors['PROGRESS'], - border_width=0, - slider_border_width=0, - progress_meter_border_depth=0, - scrollbar_color=(colors['INPUT']), - element_text_color=colors['TEXT']) - -def OneLineGUI(): - return sg.FlexForm('Get filename example').LayoutAndRead( - [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]]) - -#=---------------------------------- main ------------------------------ -def main(): - # button, (filename,) = OneLineGUI() - # DebugTe`st() - sg.Popup('Hello') - ChatBot() - Everything() - SourceDestFolders() - NonBlockingPeriodicUpdateForm_ContextManager() - NonBlockingPeriodicUpdateForm() - ChatBot() - Everything() - sg.ChangeLookAndFeel('GreenTan') - Everything() - # ChatBot() - - SourceDestFolders() - MachineLearningGUI() - NonBlockingPeriodicUpdateForm() - ProgressMeter() - DebugTest() - sg.ChangeLookAndFeel('Purple') - Everything_NoContextManager() - NonBlockingPeriodicUpdateForm_ContextManager() - - sg.Popup('Done with all recipes') - -if __name__ == '__main__': - main() - exit(69) diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 5c72c8c1d..4058bd0d0 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -33,7 +33,7 @@ def execute_command_nonblocking(command, *args): def Launcher2(): sg.ChangeLookAndFeel('GreenTan') - form = sg.FlexForm('Script launcher') + window = sg.Window('Script launcher') filelist = glob.glob(LOCATION_OF_YOUR_SCRIPTS+'*.py') namesonly = [] @@ -43,14 +43,14 @@ def Launcher2(): layout = [ [sg.Listbox(values=namesonly, size=(30, 19), select_mode=sg.SELECT_MODE_EXTENDED, key='demolist'), sg.Output(size=(88, 20), font='Courier 10')], [sg.Checkbox('Wait for program to complete', default=False, key='wait')], - [sg.ReadFormButton('Run'), sg.ReadFormButton('Shortcut 1'), sg.ReadFormButton('Fav Program'), sg.SimpleButton('EXIT')], + [sg.ReadButton('Run'), sg.ReadButton('Shortcut 1'), sg.ReadButton('Fav Program'), sg.Button('EXIT')], ] - form.Layout(layout) + window.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # while True: - (button, value) = form.Read() + (button, value) = window.Read() if button in ('EXIT', None): break # exit button clicked if button in ('Shortcut 1', 'Fav Program'): @@ -60,7 +60,7 @@ def Launcher2(): elif button is 'Run': for index, file in enumerate(value['demolist']): print('Launching %s'%file) - form.Refresh() # make the print appear immediately + window.Refresh() # make the print appear immediately if value['wait']: execute_command_blocking(LOCATION_OF_YOUR_SCRIPTS + file) else: diff --git a/Demo_Script_Parameters.py b/Demo_Script_Parameters.py index 65c9c9c1e..7409e126f 100644 --- a/Demo_Script_Parameters.py +++ b/Demo_Script_Parameters.py @@ -14,7 +14,7 @@ ''' if len(sys.argv) == 1: - button, (fname,) = sg.FlexForm('My Script').LayoutAndRead([[sg.T('Document to open')], + button, (fname,) = sg.Window('My Script').LayoutAndRead([[sg.T('Document to open')], [sg.In(), sg.FileBrowse()], [sg.Open(), sg.Cancel()]]) else: diff --git a/Demo_Spinner_Compound_Element.py b/Demo_Spinner_Compound_Element.py index 49ef2cc35..575beec5f 100644 --- a/Demo_Spinner_Compound_Element.py +++ b/Demo_Spinner_Compound_Element.py @@ -7,9 +7,9 @@ sg.SetOptions(element_padding=(0,0)) # sg.ChangeLookAndFeel('Dark') # --- Define our "Big-Button-Spinner" compound element. Has 2 buttons and an input field --- # -NewSpinner = [sg.ReadFormButton('-', size=(2,1), font='Any 12'), +NewSpinner = [sg.ReadButton('-', size=(2,1), font='Any 12'), sg.In('0', size=(2,1), font='Any 14', justification='r', key='spin'), - sg.ReadFormButton('+', size=(2,1), font='Any 12')] + sg.ReadButton('+', size=(2,1), font='Any 12')] # --- Define Window --- # layout = [ [sg.Text('Spinner simulation')], @@ -18,17 +18,16 @@ [sg.Ok()] ] -form = sg.FlexForm('Spinner simulation') -form.Layout(layout) +window = sg.Window('Spinner simulation').Layout(layout) # --- Event Loop --- # counter = 0 while True: - button, value = form.Read() + button, value = window.Read() if button == 'Ok' or button is None: # be nice to your user, always have an exit from your form break # --- do spinner stuff --- # counter += 1 if button =='+' else -1 if button == '-' else 0 - form.FindElement('spin').Update(counter) + window.FindElement('spin').Update(counter) diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index 80c229a41..068455c94 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -1,14 +1,18 @@ import PySimpleGUI as sg -form = sg.FlexForm('Simple data entry form') +""" + Simple Form showing how to use keys on your input fields +""" + layout = [ [sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], [sg.Submit(), sg.Cancel()] -] + ] -button, values = form.LayoutAndRead(layout) +window = sg.Window('Simple Data Entry Window').Layout(layout) +button, values = window.Read() sg.Popup(button, values, values['name'], values['address'], values['phone']) \ No newline at end of file diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index 21b640e1d..60de7de6b 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -33,9 +33,9 @@ # the form layout -form = sg.FlexForm('EBay Super Searcher', auto_size_text=True) +window = sg.Window('EBay Super Searcher', auto_size_text=True) -form2 = sg.FlexForm('EBay Super Searcher', auto_size_text=False) +form2 = sg.Window('EBay Super Searcher', auto_size_text=False) layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], [sg.Text('Choose base configuration to run')], diff --git a/Demo_Table_CSV.py b/Demo_Table_CSV.py index 16205381c..f8b30a22f 100644 --- a/Demo_Table_CSV.py +++ b/Demo_Table_CSV.py @@ -1,11 +1,12 @@ import csv import PySimpleGUI as sg +import sys def table_example(): filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) # --- populate table with file contents --- # if filename == '': - exit(69) + sys.exit(69) data = [] header_list = [] button = sg.PopupYesNo('Does this file have column names already?') @@ -20,7 +21,7 @@ def table_example(): header_list = ['column' + str(x) for x in range(len(data[0]))] except: sg.PopupError('Error reading file') - exit(69) + sys.exit(69) sg.SetOptions(element_padding=(0, 0)) col_layout = [[sg.Table(values=data, headings=header_list, max_col_width=25, @@ -29,18 +30,9 @@ def table_example(): canvas_size = (13*10*len(header_list), 600) # estimate canvas size - 13 pixels per char * 10 char per column * num columns layout = [[sg.Column(col_layout, size=canvas_size, scrollable=True)],] - form = sg.FlexForm('Table', grab_anywhere=False) - b, v = form.LayoutAndRead(layout) + window = sg.Window('Table', grab_anywhere=False).Layout(layout) + b, v = window.Read() - exit(69) + sys.exit(69) table_example() - - - - - - - - - diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py index 85ddef33d..b0d44dd54 100644 --- a/Demo_Table_Element.py +++ b/Demo_Table_Element.py @@ -1,5 +1,6 @@ import csv import PySimpleGUI as sg +import sys filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) # --- populate table with file contents --- # @@ -11,7 +12,7 @@ data = list(reader) # read everything else into a list of rows except: sg.PopupError('Error reading file') - exit(69) + sys.exit(69) sg.SetOptions(element_padding=(0, 0)) @@ -19,11 +20,8 @@ auto_size_columns=True, display_row_numbers=True, justification='right', size=(None, len(data)))]] layout = [[sg.Column(col_layout, size=(1200,600), scrollable=True)],] -form = sg.FlexForm('Table', grab_anywhere=False) -form.Layout(layout) +window = sg.Window('Table', grab_anywhere=False).Layout(layout) -form.Finalize() +b, v = window.Read() -b, v = form.Read() - -exit(69) +sys.exit(69) diff --git a/Demo_Table_Pandas.py b/Demo_Table_Pandas.py index f5088d53c..1a519ea1d 100644 --- a/Demo_Table_Pandas.py +++ b/Demo_Table_Pandas.py @@ -1,12 +1,13 @@ import pandas as pd import PySimpleGUI as sg +import sys def table_example(): sg.SetOptions(auto_size_buttons=True) filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files", "*.csv"),)) # --- populate table with file contents --- # if filename == '': - exit(69) + sys.exit(69) data = [] header_list = [] button = sg.PopupYesNo('Does this file have column names already?') @@ -21,7 +22,7 @@ def table_example(): header_list = ['column' + str(x) for x in range(len(data[0]))] # Creates columns names for each column ('column0', 'column1', etc) except: sg.PopupError('Error reading file') - exit(69) + sys.exit(69) # sg.SetOptions(element_padding=(0, 0)) col_layout = [[sg.Table(values=data, headings=header_list, display_row_numbers=True, @@ -30,9 +31,9 @@ def table_example(): canvas_size = (13*10*len(header_list), 600) # estimate canvas size - 13 pixels per char * 10 per column * num columns layout = [[sg.Column(col_layout, size=canvas_size, scrollable=True)]] - form = sg.FlexForm('Table', grab_anywhere=False) - b, v = form.LayoutAndRead(layout) + window = sg.Window('Table', grab_anywhere=False) + b, v = window.LayoutAndRead(layout) - exit(69) + sys.exit(69) table_example() diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index 14860b3b2..a714de6af 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -6,6 +6,7 @@ def TableSimulation(): Display data in a table format """ sg.SetOptions(element_padding=(0,0)) + sg.PopupNoWait('Give it a few seconds to load please...', auto_close=True) menu_def = [['File', ['Open', 'Save', 'Exit']], ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], @@ -21,17 +22,16 @@ def TableSimulation(): layout = [ [sg.Menu(menu_def)], [sg.T('Table Using Combos and Input Elements', font='Any 18')], - [sg.T('Type in a row, column and value. The form will update the values in realtime as you type'), + [sg.T('Type in a row, column and value. The form will update the values in realtime as you type'), sg.In(key='inputrow', justification='right', size=(8,1), pad=(1,1), do_not_clear=True), sg.In(key='inputcol', size=(8,1), pad=(1,1), justification='right', do_not_clear=True), sg.In(key='value', size=(8,1), pad=(1,1), justification='right', do_not_clear=True)], - [sg.Column(columm_layout, size=(800,600), scrollable=True)]] + [sg.Column(columm_layout, size=(800,600), scrollable=True)] ] - form = sg.FlexForm('Table', return_keyboard_events=True, grab_anywhere=False) - form.Layout(layout) + window = sg.Window('Table', return_keyboard_events=True, grab_anywhere=False).Layout(layout) while True: - button, values = form.Read() + button, values = window.Read() # --- Process buttons --- # if button is None or button == 'Exit': break @@ -49,13 +49,13 @@ def TableSimulation(): sg.PopupError('Error reading file') continue # clear the table - [form.FindElement((i,j)).Update('') for j in range(MAX_COL) for i in range(MAX_ROWS)] + [window.FindElement((i,j)).Update('') for j in range(MAX_COL) for i in range(MAX_ROWS)] for i, row in enumerate(data): for j, item in enumerate(row): location = (i,j) try: # try the best we can at reading and filling the table - target_element = form.FindElement(location) + target_element = window.FindElement(location) new_value = item if target_element is not None and new_value != '': target_element.Update(new_value) @@ -65,7 +65,7 @@ def TableSimulation(): # if a valid table location entered, change that location's value try: location = (int(values['inputrow']), int(values['inputcol'])) - target_element = form.FindElement(location) + target_element = window.FindElement(location) new_value = values['value'] if target_element is not None and new_value != '': target_element.Update(new_value) diff --git a/Demo_Tabs.py b/Demo_Tabs.py index a90fbff35..fbeec147d 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -1,23 +1,19 @@ import PySimpleGUI as sg -tab1_layout = [[sg.T('This is inside tab 1')]] -tab2_layout = [[sg.T('This is inside tab 2'), sg.In(key='in')]] +tab1_layout = [ + [sg.T('This is inside tab 1')], + ] -tab3_layout = [[sg.T('This is inside tab 3')]] -tab4_layout = [[sg.T('This is inside tab 4')]] +tab2_layout = [ + [sg.T('This is inside tab 2'), sg.In(key='in')], + ] -tab5_layout = [[sg.T('This is inside tab 5')]] -tab6_layout = [[sg.T('This is inside tab 6')], - [sg.T('How about a second row of stuff in tab 6?')]] +layout = [ + [sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]])], + [sg.RButton('Read')] + ] -layout = [[sg.T('My Window!')], - [sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], - [sg.T('Text in the middle of the mess')], - [sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], - [sg.RButton('Read')], - ] - -window = sg.Window('My window with tabs').Layout(layout) +window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) while True: b, v = window.Read() diff --git a/Demo_Tabs_Nested.py b/Demo_Tabs_Nested.py new file mode 100644 index 000000000..2c0291f75 --- /dev/null +++ b/Demo_Tabs_Nested.py @@ -0,0 +1,29 @@ +import PySimpleGUI as sg + +tab1_layout = [[sg.T('This is inside tab 1')], + [sg.T('Tabs can be anywhere now!')] + ] + +tab2_layout = [[sg.T('This is inside tab 2'), sg.In(key='in')]] + +tab3_layout = [[sg.T('This is inside tab 3')]] +tab4_layout = [[sg.T('This is inside tab 4')]] + +tab5_layout = [[sg.T('This is inside tab 5')]] +tab6_layout = [[sg.T('This is inside tab 6')], + [sg.T('How about a second row of stuff in tab 6?')]] + +layout = [[sg.T('My Window!')], [sg.Frame('A Frame', layout= + [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Inside of a frame?', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])]])], + [sg.T('This text is on a row with a column'),sg.Column(layout=[[sg.T('In a column')], + [sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], + [sg.RButton('Read')]])], + ] + +window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) + +while True: + b, v = window.Read() + print(b,v) + if b is None: # always, always give a way out! + break \ No newline at end of file diff --git a/Demo_Youtube-dl_Frontend.py b/Demo_Youtube-dl_Frontend.py index e4aa2edb2..83fd77e3f 100644 --- a/Demo_Youtube-dl_Frontend.py +++ b/Demo_Youtube-dl_Frontend.py @@ -16,23 +16,22 @@ def DownloadSubtitlesGUI(): [sg.Text('Subtitle Grabber', size=(40, 1), font=('Any 15'))], [sg.T('YouTube Link'),sg.In(default_text='',size=(60,1), key='link', do_not_clear=True) ], [sg.Output(size=(90,20), font='Courier 12')], - [sg.ReadFormButton('Get List')], - [sg.T('Language Code'), combobox, sg.ReadFormButton('Download')], - [sg.SimpleButton('Exit', button_color=('white', 'firebrick3'))] + [sg.ReadButton('Get List')], + [sg.T('Language Code'), combobox, sg.ReadButton('Download')], + [sg.Button('Exit', button_color=('white', 'firebrick3'))] ] - form = sg.FlexForm('Subtitle Grabber launcher', text_justification='r', default_element_size=(15,1), font=('Any 14')) - form.Layout(layout) + window = sg.Window('Subtitle Grabber launcher', text_justification='r', default_element_size=(15,1), font=('Any 14')).Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # while True: - (button, gui) = form.Read() + (button, gui) = window.Read() if button in ('EXIT', None): break # exit button clicked link = gui['link'] if button is 'Get List': print('Getting list of subtitles....') - form.Refresh() + window.Refresh() command = [f'C:/Python/PycharmProjects/GooeyGUI/youtube-dl --list-subs {link}',] output = ExecuteCommandSubprocess(command, wait=True, quiet=True) lang_list = [o[:5].rstrip() for o in output.split('\n') if 'vtt' in o] @@ -45,7 +44,7 @@ def DownloadSubtitlesGUI(): if lang is '': lang = 'en' print(f'Downloading subtitle for {lang}...') - form.Refresh() + window.Refresh() command = (f'C:/Python/PycharmProjects/GooeyGUI/youtube-dl --sub-lang {lang} --write-sub {link}',) ExecuteCommandSubprocess(command, wait=True) print('Done') From 7b0a6be951019027453f504f8f333efb2a8780f4 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 18:28:54 -0400 Subject: [PATCH 461/521] DEMO WITH SUGGESTED DESIGN PATTERNS --- Demo_Design_Patterns.py | 31 +++++++++++++++++++++++++++++++ Demo_Graph_Element.py | 4 +--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 Demo_Design_Patterns.py diff --git a/Demo_Design_Patterns.py b/Demo_Design_Patterns.py new file mode 100644 index 000000000..1f054245f --- /dev/null +++ b/Demo_Design_Patterns.py @@ -0,0 +1,31 @@ +# DESIGN PATTERN 1 - Simple Window +import PySimpleGUI as sg + +layout = [[ sg.Text('My layout') ]] + +window = sg.Window('My window').Layout(layout) +button, value = window.Read() + +# DESIGN PATTERN 2 - Persistent Window +import PySimpleGUI as sg + +layout = [[ sg.Text('My layout') ]] + +window = sg.Window('My new window').Layout(layout) + +while True: # Event Loop + button, value = window.Read() + if button is None: + break + +# DESIGN PATTERN 3 - Persistent Window with "early update" required +import PySimpleGUI as sg + +layout = [[ sg.Text('My layout') ]] + +window = sg.Window('My new window').Layout(layout).Finalize() + +while True: # Event Loop + button, value = window.Read() + if button is None: + break \ No newline at end of file diff --git a/Demo_Graph_Element.py b/Demo_Graph_Element.py index da50d3ae8..9b8316909 100644 --- a/Demo_Graph_Element.py +++ b/Demo_Graph_Element.py @@ -29,10 +29,8 @@ def main(): layout = [ [sg.T('Ping times to Google.com', font='Any 12'), sg.Quit(pad=((100,0), 0), button_color=('white', 'black'))], [sg.Graph(CANVAS_SIZE, (0,0), (SAMPLES,500),background_color='black', key='graph')],] - window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False) - window.Layout(layout) + window = sg.Window('Canvas test', grab_anywhere=True, background_color='black', no_titlebar=False, use_default_focus=False).Layout(layout) - window.Finalize() graph = window.FindElement('graph') prev_response_time = None From 6d3436bc983f55ce852d5948167f45fe3a9a3b38 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 20:31:06 -0400 Subject: [PATCH 462/521] Tab fix - was packing on bottom... needed to pack anchored to top instead of bottom, can now set color of background --- PySimpleGUI.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4abd02f35..482aa6061 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3169,17 +3169,17 @@ def CharWidthInPixels(): element.TooltipObject = ToolTip(labeled_frame, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- Tab element ------------------------- # elif element_type == ELEM_TYPE_TAB: - element.TKFrame = ttk.Frame(form.TKNotebook) + element.TKFrame = tk.Frame(form.TKNotebook) PackFormIntoFrame(element, element.TKFrame, toplevel_form) form.TKNotebook.add(element.TKFrame, text=element.Title) - form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - - # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: - # element.TKFrame.configure(background=element.BackgroundColor, - # highlightbackground=element.BackgroundColor, - # highlightcolor=element.BackgroundColor) - # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - # element.TKFrame.configure(foreground=element.TextColor) + form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + element.TKFrame.configure(background=element.BackgroundColor, + highlightbackground=element.BackgroundColor, + highlightcolor=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + element.TKFrame.configure(foreground=element.TextColor) if element.BorderWidth is not None: element.TKFrame.configure(borderwidth=element.BorderWidth) if element.Tooltip is not None: @@ -3289,7 +3289,7 @@ def CharWidthInPixels(): #............................DONE WITH ROW pack the row of widgets ..........................# # done with row, pack the row of widgets # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) - tk_row_frame.pack(side=tk.TOP, anchor='sw', padx=DEFAULT_MARGINS[0], expand=True) + tk_row_frame.pack(side=tk.TOP, anchor='nw', padx=DEFAULT_MARGINS[0], expand=True) if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: tk_row_frame.configure(background=form.BackgroundColor) if not toplevel_form.IsTabbedForm: From bd97141255407a421bd6cfccdde5e8cb7df28c30 Mon Sep 17 00:00:00 2001 From: eagleEggs <29800532+eagleEggs@users.noreply.github.com> Date: Mon, 24 Sep 2018 21:37:54 -0400 Subject: [PATCH 463/521] Form2 call fix Corrected the 'ShowTabbedForm() argument which was referencing a 'form' variable which should be 'form2' as it's the declared Window variable for this script. --- Demo_Tabbed_Form.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py index 60de7de6b..f902152ac 100644 --- a/Demo_Tabbed_Form.py +++ b/Demo_Tabbed_Form.py @@ -76,8 +76,8 @@ layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) layout_tab_2.append([sg.ReadButton('Submit', button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) -results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) +results = sg.ShowTabbedForm('eBay Super Searcher', (form2, layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) -sg.Popup('Results', results) \ No newline at end of file +sg.Popup('Results', results) From fa8ece89a3b28c8ca40c8e71aac8b987f4930817 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 24 Sep 2018 23:03:09 -0400 Subject: [PATCH 464/521] New document.... Cookbook table.pdf --- docs/PySimpleGUI Cookbook Table.pdf | Bin 0 -> 616138 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/PySimpleGUI Cookbook Table.pdf diff --git a/docs/PySimpleGUI Cookbook Table.pdf b/docs/PySimpleGUI Cookbook Table.pdf new file mode 100644 index 0000000000000000000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9?Ia~-t z2MEvMzF9^@!AUp?F=-9Eqz7JMz2NGm`etJHLRTdDQBSCnM1mQUnWWOB=!gC}D&ygVO zb0i4QfzzzNml;^(0Vlg>&cT3^0Cj(Q^!2Z25`dFC)Y)@7ByjMDWfKOLx@XSckiu}( z+2E^FhFd1eo%-e1UId69(oMXKV=InDp;9AptlFxR3tk2OPbNoIU3}wE_3^ zzx>cHCN}mKE<^;tpSJwtsWRCA^+(D6d|1rH1^wq^BftSNa0*I9z{V!8ra(mS&u2*l nhzS0_ln$!yV&M+?vry2}$L%!H4#3;fdOKTi;B;B=p9TLP7jk}M literal 0 HcmV?d00001 From 8e541ec21c8d8e44495fd1eef79426f2a18f1591 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 01:33:32 -0400 Subject: [PATCH 465/521] RELEASE 3.8.0 --- Demo_Tabs.py | 15 +++----- Demo_Tabs_Nested.py | 28 +++++++++------ PySimpleGUI.py | 40 ++++++++++----------- docs/index.md | 87 ++++++++++++++++++++++++++++++++++++++------- readme.md | 87 ++++++++++++++++++++++++++++++++++++++------- 5 files changed, 192 insertions(+), 65 deletions(-) diff --git a/Demo_Tabs.py b/Demo_Tabs.py index fbeec147d..2f2b1639b 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -1,17 +1,12 @@ import PySimpleGUI as sg -tab1_layout = [ - [sg.T('This is inside tab 1')], - ] +tab1_layout = [[sg.T('This is inside tab 1')]] -tab2_layout = [ - [sg.T('This is inside tab 2'), sg.In(key='in')], - ] +tab2_layout = [[sg.T('This is inside tab 2')], + [sg.In(key='in')]] -layout = [ - [sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]])], - [sg.RButton('Read')] - ] +layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, tooltip='tip'), sg.Tab('Tab 2', tab2_layout)]], tooltip='TIP2')], + [sg.RButton('Read')]] window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) diff --git a/Demo_Tabs_Nested.py b/Demo_Tabs_Nested.py index 2c0291f75..0879de10d 100644 --- a/Demo_Tabs_Nested.py +++ b/Demo_Tabs_Nested.py @@ -1,29 +1,35 @@ import PySimpleGUI as sg - -tab1_layout = [[sg.T('This is inside tab 1')], +sg.ChangeLookAndFeel('GreenTan') +tab2_layout = [[sg.T('This is inside tab 2')], [sg.T('Tabs can be anywhere now!')] ] -tab2_layout = [[sg.T('This is inside tab 2'), sg.In(key='in')]] +tab1_layout = [[sg.T('Type something here and click button'), sg.In(key='in')]] tab3_layout = [[sg.T('This is inside tab 3')]] tab4_layout = [[sg.T('This is inside tab 4')]] -tab5_layout = [[sg.T('This is inside tab 5')]] +tab_layout = [[sg.T('This is inside of a tab')]] +tab_group = sg.TabGroup([[sg.Tab('Tab 7', tab_layout), sg.Tab('Tab 8', tab_layout)]]) + +tab5_layout = [[sg.T('Watch this window')], + [sg.Output(size=(40,5))]] tab6_layout = [[sg.T('This is inside tab 6')], - [sg.T('How about a second row of stuff in tab 6?')]] + [sg.T('How about a second row of stuff in tab 6?'), tab_group]] layout = [[sg.T('My Window!')], [sg.Frame('A Frame', layout= - [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Inside of a frame?', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])]])], + [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Tab3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])]])], [sg.T('This text is on a row with a column'),sg.Column(layout=[[sg.T('In a column')], [sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], - [sg.RButton('Read')]])], + [sg.RButton('Click me')]])], ] -window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) +window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout).Finalize() + +print('Are there enough tabs for you?') while True: - b, v = window.Read() - print(b,v) - if b is None: # always, always give a way out! + button, values = window.Read() + print(button,values) + if button is None: # always, always give a way out! break \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 482aa6061..8b2d13b9f 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -195,7 +195,7 @@ def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) ELEM_TYPE_FRAME = 41 ELEM_TYPE_GRAPH = 42 ELEM_TYPE_TAB = 50 -ELEM_TYPE_MULTI_TAB = 51 +ELEM_TYPE_TAB_GROUP = 51 ELEM_TYPE_INPUT_SLIDER = 10 ELEM_TYPE_INPUT_LISTBOX = 11 ELEM_TYPE_OUTPUT = 300 @@ -318,7 +318,7 @@ def FindReturnKeyBoundButton(self, form): rc = self.FindReturnKeyBoundButton(element) if rc is not None: return rc - if element.Type == ELEM_TYPE_MULTI_TAB: + if element.Type == ELEM_TYPE_TAB_GROUP: rc = self.FindReturnKeyBoundButton(element) if rc is not None: return rc @@ -1393,7 +1393,7 @@ def __del__(self): # Tab # # ---------------------------------------------------------------------- # class Tab(Element): - def __init__(self, title, layout, title_color=None, background_color=None, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): + def __init__(self, title, layout, title_color=None, background_color=None, font=None, pad=None, border_width=None, key=None, tooltip=None): self.UseDictionary = False self.ReturnValues = None @@ -1409,7 +1409,7 @@ def __init__(self, title, layout, title_color=None, background_color=None, size= self.Layout(layout) - super().__init__(ELEM_TYPE_TAB, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key, tooltip=tooltip) + super().__init__(ELEM_TYPE_TAB, background_color=background_color, text_color=title_color, font=font, pad=pad, key=key, tooltip=tooltip) return def AddRow(self, *args): @@ -1450,7 +1450,7 @@ def __del__(self): # TabGroup # # ---------------------------------------------------------------------- # class TabGroup(Element): - def __init__(self, layout, title_color=None, background_color=None, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): + def __init__(self, layout, title_color=None, background_color=None, font=None, pad=None, border_width=None, key=None, tooltip=None): self.UseDictionary = False self.ReturnValues = None @@ -1465,7 +1465,7 @@ def __init__(self, layout, title_color=None, background_color=None, size=(None, self.Layout(layout) - super().__init__(ELEM_TYPE_MULTI_TAB, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key, tooltip=tooltip) + super().__init__(ELEM_TYPE_TAB_GROUP, background_color=background_color, text_color=title_color, font=font, pad=pad, key=key, tooltip=tooltip) return def AddRow(self, *args): @@ -2491,7 +2491,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): if element.ReturnValues[0] is not None: # if a button was clicked button_pressed_text = element.ReturnValues[0] - if element.Type == ELEM_TYPE_MULTI_TAB: + if element.Type == ELEM_TYPE_TAB_GROUP: element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter element.ReturnValuesList = [] element.ReturnValuesDictionary = {} @@ -2575,7 +2575,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): # if an input type element, update the results if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and \ - element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME and element.Type != ELEM_TYPE_MULTI_TAB \ + element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME and element.Type != ELEM_TYPE_TAB_GROUP \ and element.Type != ELEM_TYPE_TAB: AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) @@ -2614,7 +2614,7 @@ def FillSubformWithValues(form, values_dict): FillSubformWithValues(element, values_dict) if element.Type == ELEM_TYPE_FRAME: FillSubformWithValues(element, values_dict) - if element.Type == ELEM_TYPE_MULTI_TAB: + if element.Type == ELEM_TYPE_TAB_GROUP: FillSubformWithValues(element, values_dict) if element.Type == ELEM_TYPE_TAB: FillSubformWithValues(element, values_dict) @@ -2654,7 +2654,7 @@ def _FindElementFromKeyInSubForm(form, key): matching_elem = _FindElementFromKeyInSubForm(element, key) if matching_elem is not None: return matching_elem - if element.Type == ELEM_TYPE_MULTI_TAB: + if element.Type == ELEM_TYPE_TAB_GROUP: matching_elem = _FindElementFromKeyInSubForm(element, key) if matching_elem is not None: return matching_elem @@ -3178,25 +3178,25 @@ def CharWidthInPixels(): element.TKFrame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) - if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - element.TKFrame.configure(foreground=element.TextColor) + # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + # element.TKFrame.configure(foreground=element.TextColor) if element.BorderWidth is not None: element.TKFrame.configure(borderwidth=element.BorderWidth) if element.Tooltip is not None: element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) - # ------------------------- MultiTab element ------------------------- # - elif element_type == ELEM_TYPE_MULTI_TAB: + # ------------------------- TabGroup element ------------------------- # + elif element_type == ELEM_TYPE_TAB_GROUP: element.TKNotebook = ttk.Notebook(tk_row_frame) PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form) # element.TKNotebook.pack(side=tk.LEFT) - if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: - element.TKNotebook.configure(background=element.BackgroundColor, - highlightbackground=element.BackgroundColor, - highlightcolor=element.BackgroundColor) - if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - element.TKNotebook.configure(foreground=element.TextColor) + # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + # element.TKNotebook.configure(background=element.BackgroundColor, + # highlightbackground=element.BackgroundColor, + # highlightcolor=element.BackgroundColor) + # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + # element.TKNotebook.configure(foreground=element.TextColor) if element.BorderWidth is not None: element.TKNotebook.configure(borderwidth=element.BorderWidth) if element.Tooltip is not None: diff --git a/docs/index.md b/docs/index.md index 8be576ac0..c81a74693 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,7 +9,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.2-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -1971,22 +1971,80 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed windows -Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format +## Tab and Tab Group Elements - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) +Tabs have been a part of PySimpleGUI since the initial release. However, the initial implementation applied tabs at the top level only. The entire window had to be tabbed. There with other limitations that came along with that implementation. That all changed in version 3.8.0 with the new elements - Tab and TabGroup. The old implementation of Tabs was removed in version 3.8.0 as well. -Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` +Tabs are another "Container Element". The other Container Elements include: +* Frame +* Column -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: +You layout a Frame in exactly the same way as a Frame or Column elements, by passing in a list of elements. - (button, (values)) +How you place a Tab into a Window is different than Graph or Frame elements. You cannot place a tab directly into a Window's layout. It much first be placed into a TabGroup. The TabGroup can then be placed into the Window. -Recall that values is a list as well. Multiple tabs in the form would return like this: +Let's look at this Window as an example: + +![tabbed 1](https://user-images.githubusercontent.com/13696193/45992808-b10f6a80-c059-11e8-9746-ac71afd4d3d6.jpg) + +View of second tab: + +![tabbed 2](https://user-images.githubusercontent.com/13696193/45992809-b10f6a80-c059-11e8-94e6-3bf543c9b0bd.jpg) + + +First we have the Tab layout definitions. They mirror what you see in the screen shots. Tab 1 has 1 Text Element in it. Tab 2 has a Text and an Input Element. + + + tab1_layout = [[sg.T('This is inside tab 1')]] + + tab2_layout = [[sg.T('This is inside tab 2')], + [sg.In(key='in')]] + +The layout for the entire window looks like this: + + layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]])], + [sg.RButton('Read')]] + +The Window layout has the TabGroup and within the tab Group are the two Tab elements. + +One important thing to notice about all of these container Elements... they all take a "list of lists" at the layout. They all have a layout that starts with `[[` + +You will want to keep this `[[ ]]` construct in your head a you're debugging your tabbed windows. It's easy to overlook one or two necessary ['s + +As mentioned earlier, the old-style Tabs were limited to being at the Window-level only. In other words, the tabs were equal in size to the entire window. This is not the case with the "new-style" tabs. This is why you're not going to be upset when you discover your old code no longer works with the new PySimpleGUI release. It'll be worth the few moments it'll take to convert your code. + +Check out what's possible with the NEW Tabs! + +![tabs tabs tabs](https://user-images.githubusercontent.com/13696193/45993438-fd0fde80-c05c-11e8-9ed0-742f14d3070f.jpg) + + +Check out Tabs 7 and 8. We've got a Window with a Column containing Tabs 5 and 6. On Tab 6 are... Tabs 7 and 8. + +As of Release 3.8.0, not all of *options* shown in the API definitions of the Tab and TabGroup Elements are working. They are there as placeholders. + +The definition of a TabGroup is + + TabGroup(layout, + title_color=None + background_color=None + font=None + pad=None + border_width=None + key=None + tooltip=None) + +The definition of a Tab Element is + + Tab(title, + layout, + title_color=None, + background_color=None, + size=(None, None),font=None, + pad=None + border_width=None + key=None + tooltip=None) - ((button1, (values1)), (button2, (values2)) ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. @@ -2592,6 +2650,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes | 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window +| 03.08.00 | Sept 25, 2018 - Tab and TabGroup Elements + ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -2682,6 +2742,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Renamed FlexForm to Window * Removed LookAndFeel capability from Mac platform. +#### 3.8.0 +* Tab and TabGroup Elements - awesome new capabilities + ### Upcoming Make suggestions people! Future release features @@ -2771,4 +2834,4 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. diff --git a/readme.md b/readme.md index 8be576ac0..c81a74693 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.6.2-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -1971,22 +1971,80 @@ Let me say up front that the Table Element has Beta status. The reason is that s -## Tabbed windows -Tabbed windows are shown using the `ShowTabbedForm` call. The call has the format +## Tab and Tab Group Elements - results = ShowTabbedForm('Title for the form', - (form,layout,'Tab 1 label'), - (form2,layout2, 'Tab 2 label'), ...) +Tabs have been a part of PySimpleGUI since the initial release. However, the initial implementation applied tabs at the top level only. The entire window had to be tabbed. There with other limitations that came along with that implementation. That all changed in version 3.8.0 with the new elements - Tab and TabGroup. The old implementation of Tabs was removed in version 3.8.0 as well. -Each of the tabs of the form is in fact a window. The same steps are taken to create the form as before. A `Window` is created, then rows are filled with Elements, and finally the form is shown. When calling `ShowTabbedForm`, each form is passed in as a tuple. The tuple has the format: `(the form, the rows, a string shown on the tab)` +Tabs are another "Container Element". The other Container Elements include: +* Frame +* Column -Results are returned as a list of lists. For each form you'll get a list that's in the same format as a normal window. A single tab's values would be: +You layout a Frame in exactly the same way as a Frame or Column elements, by passing in a list of elements. - (button, (values)) +How you place a Tab into a Window is different than Graph or Frame elements. You cannot place a tab directly into a Window's layout. It much first be placed into a TabGroup. The TabGroup can then be placed into the Window. -Recall that values is a list as well. Multiple tabs in the form would return like this: +Let's look at this Window as an example: + +![tabbed 1](https://user-images.githubusercontent.com/13696193/45992808-b10f6a80-c059-11e8-9746-ac71afd4d3d6.jpg) + +View of second tab: + +![tabbed 2](https://user-images.githubusercontent.com/13696193/45992809-b10f6a80-c059-11e8-94e6-3bf543c9b0bd.jpg) + + +First we have the Tab layout definitions. They mirror what you see in the screen shots. Tab 1 has 1 Text Element in it. Tab 2 has a Text and an Input Element. + + + tab1_layout = [[sg.T('This is inside tab 1')]] + + tab2_layout = [[sg.T('This is inside tab 2')], + [sg.In(key='in')]] + +The layout for the entire window looks like this: + + layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]])], + [sg.RButton('Read')]] + +The Window layout has the TabGroup and within the tab Group are the two Tab elements. + +One important thing to notice about all of these container Elements... they all take a "list of lists" at the layout. They all have a layout that starts with `[[` + +You will want to keep this `[[ ]]` construct in your head a you're debugging your tabbed windows. It's easy to overlook one or two necessary ['s + +As mentioned earlier, the old-style Tabs were limited to being at the Window-level only. In other words, the tabs were equal in size to the entire window. This is not the case with the "new-style" tabs. This is why you're not going to be upset when you discover your old code no longer works with the new PySimpleGUI release. It'll be worth the few moments it'll take to convert your code. + +Check out what's possible with the NEW Tabs! + +![tabs tabs tabs](https://user-images.githubusercontent.com/13696193/45993438-fd0fde80-c05c-11e8-9ed0-742f14d3070f.jpg) + + +Check out Tabs 7 and 8. We've got a Window with a Column containing Tabs 5 and 6. On Tab 6 are... Tabs 7 and 8. + +As of Release 3.8.0, not all of *options* shown in the API definitions of the Tab and TabGroup Elements are working. They are there as placeholders. + +The definition of a TabGroup is + + TabGroup(layout, + title_color=None + background_color=None + font=None + pad=None + border_width=None + key=None + tooltip=None) + +The definition of a Tab Element is + + Tab(title, + layout, + title_color=None, + background_color=None, + size=(None, None),font=None, + pad=None + border_width=None + key=None + tooltip=None) - ((button1, (values1)), (button2, (values2)) ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. @@ -2592,6 +2650,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes | 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window +| 03.08.00 | Sept 25, 2018 - Tab and TabGroup Elements + ### Release Notes 2.3 - Sliders, Listbox's and Image elements (oh my!) @@ -2682,6 +2742,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution * Renamed FlexForm to Window * Removed LookAndFeel capability from Mac platform. +#### 3.8.0 +* Tab and TabGroup Elements - awesome new capabilities + ### Upcoming Make suggestions people! Future release features @@ -2771,4 +2834,4 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. -The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. \ No newline at end of file +The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. From b4e6de5c597b47ad0746006e4554982a133d2347 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 10:44:52 -0400 Subject: [PATCH 466/521] A 2.7 Version of PySimpleGUI (partially done) --- PySimpleGUI27.py | 4584 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4584 insertions(+) create mode 100644 PySimpleGUI27.py diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py new file mode 100644 index 000000000..7eec62443 --- /dev/null +++ b/PySimpleGUI27.py @@ -0,0 +1,4584 @@ +#!/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 datetime +import sys +import textwrap +import pickle +import calendar + +import platform + +sVsn = platform.python_version()[0] + +if sVsn == '2': + __metaclass__ = type # required for Python v.2.X + +def fSuprArgs(self): + return () if sVsn != '2' else (self.__class__, self) + +# place *(fSuprArgs(self)) as parameter in every call to super(*(fSuprArgs(self))) + +g_time_start = 0 +g_time_end = 0 +g_time_delta = 0 + +import time +def TimerStart(): + global g_time_start + + g_time_start = time.time() + +def TimerStop(): + global g_time_delta, g_time_end + + g_time_end = time.time() + g_time_delta = g_time_end - g_time_start + print(g_time_delta) + +# ----====----====----==== Constants the user CAN safely change ====----====----====----# +DEFAULT_WINDOW_ICON = 'default_icon.ico' +DEFAULT_ELEMENT_SIZE = (45,1) # In CHARACTERS +DEFAULT_BUTTON_ELEMENT_SIZE = (10,1) # In CHARACTERS +DEFAULT_MARGINS = (10,5) # Margins for each LEFT/RIGHT margin is first term +DEFAULT_ELEMENT_PADDING = (5,3) # Padding between elements (row, col) in pixels +DEFAULT_AUTOSIZE_TEXT = True +DEFAULT_AUTOSIZE_BUTTONS = True +DEFAULT_FONT = ("Helvetica", 10) +DEFAULT_TEXT_JUSTIFICATION = 'left' +DEFAULT_BORDER_WIDTH = 1 +DEFAULT_AUTOCLOSE_TIME = 3 # time in seconds to show an autoclose form +DEFAULT_DEBUG_WINDOW_SIZE = (80,20) +DEFAULT_WINDOW_LOCATION = (None,None) +MAX_SCROLLED_TEXT_BOX_HEIGHT = 50 +DEFAULT_TOOLTIP_TIME = 400 +#################### COLOR STUFF #################### +BLUES = ("#082567","#0A37A3","#00345B") +PURPLES = ("#480656","#4F2398","#380474") +GREENS = ("#01826B","#40A860","#96D2AB", "#00A949","#003532") +YELLOWS = ("#F3FB62", "#F0F595") +TANS = ("#FFF9D5","#F4EFCF","#DDD8BA") +NICE_BUTTON_COLORS = ((GREENS[3], TANS[0]), ('#000000','#FFFFFF'),('#FFFFFF', '#000000'), (YELLOWS[0], PURPLES[1]), + (YELLOWS[0], GREENS[3]), (YELLOWS[0], BLUES[2])) + +COLOR_SYSTEM_DEFAULT = '1234567890' # Colors should never be this long +if sys.platform == 'darwin': + DEFAULT_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Foreground, Background (None, None) == System Default + OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = COLOR_SYSTEM_DEFAULT # Colors should never be this long +else: + DEFAULT_BUTTON_COLOR = ('white', BLUES[0]) # Foreground, Background (None, None) == System Default + OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR = ('white', BLUES[0]) # Colors should never be this long + +DEFAULT_ERROR_BUTTON_COLOR =("#FFFFFF", "#FF0000") +DEFAULT_BACKGROUND_COLOR = None +DEFAULT_ELEMENT_BACKGROUND_COLOR = None +DEFAULT_ELEMENT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT +DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = None +DEFAULT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT +DEFAULT_INPUT_ELEMENTS_COLOR = COLOR_SYSTEM_DEFAULT +DEFAULT_INPUT_TEXT_COLOR = COLOR_SYSTEM_DEFAULT +DEFAULT_SCROLLBAR_COLOR = None +# DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[0]) # (Text, Background) or (Color "on", Color) as a way to remember +# DEFAULT_BUTTON_COLOR = (GREENS[3], TANS[0]) # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = (YELLOWS[0], GREENS[4]) # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = ('white', 'black') # Foreground, Background (None, None) == System Default +# DEFAULT_BUTTON_COLOR = (YELLOWS[0], PURPLES[2]) # Foreground, Background (None, None) == System Default +# DEFAULT_PROGRESS_BAR_COLOR = (GREENS[2], GREENS[0]) # a nice green progress bar +# DEFAULT_PROGRESS_BAR_COLOR = (BLUES[1], BLUES[1]) # a nice green progress bar +# DEFAULT_PROGRESS_BAR_COLOR = (BLUES[0], BLUES[0]) # a nice green progress bar +# DEFAULT_PROGRESS_BAR_COLOR = (PURPLES[1],PURPLES[0]) # a nice purple progress bar + +# A transparent button is simply one that matches the background +TRANSPARENT_BUTTON = ('#F0F0F0', '#F0F0F0') +#-------------------------------------------------------------------------------- +# Progress Bar Relief Choices +RELIEF_RAISED = 'raised' +RELIEF_SUNKEN = 'sunken' +RELIEF_FLAT = 'flat' +RELIEF_RIDGE = 'ridge' +RELIEF_GROOVE = 'groove' +RELIEF_SOLID = 'solid' + +DEFAULT_PROGRESS_BAR_COLOR = (GREENS[0], '#D0D0D0') # a nice green progress bar +DEFAULT_PROGRESS_BAR_SIZE = (25,20) # Size of Progress Bar (characters for length, pixels for width) +DEFAULT_PROGRESS_BAR_BORDER_WIDTH=1 +DEFAULT_PROGRESS_BAR_RELIEF = RELIEF_GROOVE +PROGRESS_BAR_STYLES = ('default','winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative') +DEFAULT_PROGRESS_BAR_STYLE = 'default' +DEFAULT_METER_ORIENTATION = 'Horizontal' +DEFAULT_SLIDER_ORIENTATION = 'vertical' +DEFAULT_SLIDER_BORDER_WIDTH=1 +DEFAULT_SLIDER_RELIEF = tk.FLAT +DEFAULT_FRAME_RELIEF = tk.GROOVE + +DEFAULT_LISTBOX_SELECT_MODE = tk.SINGLE +SELECT_MODE_MULTIPLE = tk.MULTIPLE +LISTBOX_SELECT_MODE_MULTIPLE = 'multiple' +SELECT_MODE_BROWSE = tk.BROWSE +LISTBOX_SELECT_MODE_BROWSE = 'browse' +SELECT_MODE_EXTENDED = tk.EXTENDED +LISTBOX_SELECT_MODE_EXTENDED = 'extended' +SELECT_MODE_SINGLE = tk.SINGLE +LISTBOX_SELECT_MODE_SINGLE = 'single' + +TABLE_SELECT_MODE_NONE = tk.NONE +TABLE_SELECT_MODE_BROWSE = tk.BROWSE +TABLE_SELECT_MODE_EXTENDED = tk.EXTENDED +DEFAULT_TABLE_SECECT_MODE = TABLE_SELECT_MODE_EXTENDED + +TITLE_LOCATION_TOP = tk.N +TITLE_LOCATION_BOTTOM = tk.S +TITLE_LOCATION_LEFT = tk.W +TITLE_LOCATION_RIGHT = tk.E +TITLE_LOCATION_TOP_LEFT = tk.NW +TITLE_LOCATION_TOP_RIGHT = tk.NE +TITLE_LOCATION_BOTTOM_LEFT = tk.SW +TITLE_LOCATION_BOTTOM_RIGHT = tk.SE + + + + + +# DEFAULT_METER_ORIENTATION = 'Vertical' +# ----====----====----==== Constants the user should NOT f-with ====----====----====----# +ThisRow = 555666777 # magic number + + +# DEFAULT_WINDOW_ICON = '' +MESSAGE_BOX_LINE_WIDTH = 60 + +# a shameful global variable. This represents the top-level window information. Needed because opening a second window is different than opening the first. +class MyWindows(): + def __init__(self): + self.NumOpenWindows = 0 + self.user_defined_icon = None + + def Decrement(self): + self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0 + # print('---- DECREMENTING Num Open Windows = {} ---'.format(self.NumOpenWindows)) + + def Increment(self): + self.NumOpenWindows += 1 + # print('++++ INCREMENTING Num Open Windows = {} ++++'.format(self.NumOpenWindows)) + +_my_windows = MyWindows() # terrible hack using globals... means need a class for collecing windows + +# ====================================================================== # +# One-liner functions that are handy as f_ck # +# ====================================================================== # +def RGB(red,green,blue): return '#%02x%02x%02x' % (red,green,blue) + +# ====================================================================== # +# Enums for types # +# ====================================================================== # +# ------------------------- Button types ------------------------- # +#todo Consider removing the Submit, Cancel types... they are just 'RETURN' type in reality +#uncomment this line and indent to go back to using Enums +# class ButtonType(Enum): +BUTTON_TYPE_BROWSE_FOLDER = 1 +BUTTON_TYPE_BROWSE_FILE = 2 +BUTTON_TYPE_BROWSE_FILES = 21 +BUTTON_TYPE_SAVEAS_FILE = 3 +BUTTON_TYPE_CLOSES_WIN = 5 +BUTTON_TYPE_CLOSES_WIN_ONLY = 6 +BUTTON_TYPE_READ_FORM = 7 +BUTTON_TYPE_REALTIME = 9 +BUTTON_TYPE_CALENDAR_CHOOSER = 30 +BUTTON_TYPE_COLOR_CHOOSER = 40 + +# ------------------------- Element types ------------------------- # +# class ElementType(Enum): +ELEM_TYPE_TEXT = 1 +ELEM_TYPE_INPUT_TEXT = 20 +ELEM_TYPE_INPUT_COMBO = 21 +ELEM_TYPE_INPUT_OPTION_MENU = 22 +ELEM_TYPE_INPUT_RADIO = 5 +ELEM_TYPE_INPUT_MULTILINE = 7 +ELEM_TYPE_INPUT_CHECKBOX = 8 +ELEM_TYPE_INPUT_SPIN = 9 +ELEM_TYPE_BUTTON = 3 +ELEM_TYPE_IMAGE = 30 +ELEM_TYPE_CANVAS = 40 +ELEM_TYPE_FRAME = 41 +ELEM_TYPE_GRAPH = 42 +ELEM_TYPE_TAB = 50 +ELEM_TYPE_TAB_GROUP = 51 +ELEM_TYPE_INPUT_SLIDER = 10 +ELEM_TYPE_INPUT_LISTBOX = 11 +ELEM_TYPE_OUTPUT = 300 +ELEM_TYPE_COLUMN = 555 +ELEM_TYPE_MENUBAR = 600 +ELEM_TYPE_PROGRESS_BAR = 200 +ELEM_TYPE_BLANK = 100 +ELEM_TYPE_TABLE = 700 + +# ------------------------- Popup Buttons Types ------------------------- # +POPUP_BUTTONS_YES_NO = 1 +POPUP_BUTTONS_CANCELLED = 2 +POPUP_BUTTONS_ERROR = 3 +POPUP_BUTTONS_OK_CANCEL = 4 +POPUP_BUTTONS_OK = 0 +POPUP_BUTTONS_NO_BUTTONS = 5 + + +# ------------------------------------------------------------------------- # +# ToolTip used by the Elements # +# ------------------------------------------------------------------------- # + +class ToolTip: + """ Create a tooltip for a given widget + + (inspired by https://stackoverflow.com/a/36221216) + """ + + def __init__(self, widget, text, timeout=1000): + self.widget = widget + self.text = text + self.timeout = timeout + #self.wraplength = wraplength if wraplength else widget.winfo_screenwidth() // 2 + self.tipwindow = None + self.id = None + self.x = self.y = 0 + self.widget.bind("", self.enter) + self.widget.bind("", self.leave) + self.widget.bind("", self.leave) + + def enter(self, event=None): + self.schedule() + + def leave(self, event=None): + self.unschedule() + self.hidetip() + + def schedule(self): + self.unschedule() + self.id = self.widget.after(self.timeout, self.showtip) + + def unschedule(self): + if self.id: + self.widget.after_cancel(self.id) + self.id = None + + def showtip(self): + if self.tipwindow: + return + x = self.widget.winfo_rootx() + 20 + y = self.widget.winfo_rooty() + self.widget.winfo_height() + 1 + self.tipwindow = tk.Toplevel(self.widget) + self.tipwindow.wm_overrideredirect(True) + self.tipwindow.wm_geometry("+%d+%d" % (x, y)) + label = ttk.Label(self.tipwindow, text=self.text, justify=tk.LEFT, + background="#ffffe0", relief=tk.SOLID, borderwidth=1) + label.pack() + + def hidetip(self): + if self.tipwindow: + self.tipwindow.destroy() + self.tipwindow = None + + +# ---------------------------------------------------------------------- # +# Cascading structure.... Objects get larger # +# Button # +# Element # +# Row # +# Form # +# ---------------------------------------------------------------------- # +# ------------------------------------------------------------------------- # +# Element CLASS # +# ------------------------------------------------------------------------- # +class Element(): + def __init__(self, type, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + self.Size = size + self.Type = type + self.AutoSizeText = auto_size_text + self.Pad = DEFAULT_ELEMENT_PADDING if pad is None else pad + self.Font = font + + self.TKStringVar = None + self.TKIntVar = None + self.TKText = None + self.TKEntry = None + self.TKImage = None + + self.ParentForm=None + self.ParentContainer=None # will be a Form, Column, or Frame element + self.TextInputDefault = None + self.Position = (0,0) # Default position Row 0, Col 0 + self.BackgroundColor = background_color if background_color is not None else DEFAULT_ELEMENT_BACKGROUND_COLOR + self.TextColor = text_color if text_color is not None else DEFAULT_ELEMENT_TEXT_COLOR + self.Key = key # dictionary key for return values + self.Tooltip = tooltip + self.TooltipObject = None + + def FindReturnKeyBoundButton(self, form): + for row in form.Rows: + for element in row: + if element.Type == ELEM_TYPE_BUTTON: + if element.BindReturnKey: + return element + if element.Type == ELEM_TYPE_COLUMN: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + if element.Type == ELEM_TYPE_FRAME: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + if element.Type == ELEM_TYPE_TAB_GROUP: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + if element.Type == ELEM_TYPE_TAB: + rc = self.FindReturnKeyBoundButton(element) + if rc is not None: + return rc + return None + + def TextClickedHandler(self, event): + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.DisplayText + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + + def ReturnKeyHandler(self, event): + MyForm = self.ParentForm + button_element = self.FindReturnKeyBoundButton(MyForm) + if button_element is not None: + button_element.ButtonCallBack() + + + def ListboxSelectHandler(self, event): + MyForm = self.ParentForm + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def ComboboxSelectHandler(self, event): + MyForm = self.ParentForm + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def __del__(self): + try: + self.TKStringVar.__del__() + except: + pass + try: + self.TKIntVar.__del__() + except: + pass + try: + self.TKText.__del__() + except: + pass + try: + self.TKEntry.__del__() + except: + pass + +# ---------------------------------------------------------------------- # +# Input Class # +# ---------------------------------------------------------------------- # +class InputText(Element): + def __init__(self, default_text ='', size=(None, None), auto_size_text=None, password_char='', + justification=None, background_color=None, text_color=None, font=None, tooltip=None, do_not_clear=False, key=None, focus=False, pad=None): + ''' + Input a line of text Element + :param default_text: Default value to display + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param password_char: If non-blank, will display this character for every character typed + :param background_color: Color for Element. Text or RGB Hex + ''' + self.DefaultText = default_text + self.PasswordCharacter = password_char + bg = background_color if background_color is not None else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + self.Focus = focus + self.do_not_clear = do_not_clear + self.Justification = justification + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_TEXT, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad,font=font, tooltip=tooltip) + + + def Update(self, value=None, disabled=None): + if disabled is True: + self.TKEntry['state'] = 'disabled' + elif disabled is False: + self.TKEntry['state'] = 'normal' + if value is not None: + try: + self.TKStringVar.set(value) + except: pass + self.DefaultText = value + + def Get(self): + return self.TKStringVar.get() + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + +# ------------------------- INPUT TEXT Element lazy functions ------------------------- # +In = InputText +Input = InputText + +# ---------------------------------------------------------------------- # +# Combo # +# ---------------------------------------------------------------------- # +class InputCombo(Element): + def __init__(self, values, default_value=None, size=(None, None), auto_size_text=None, background_color=None, text_color=None, change_submits=False, disabled=False, key=None, pad=None, tooltip=None): + ''' + Input Combo Box Element (also called Dropdown box) + :param values: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + ''' + self.Values = values + self.DefaultValue = default_value + self.ChangeSubmits = change_submits + self.TKCombo = None + self.InitializeAsDisabled = disabled + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_COMBO, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) + + def Update(self, value=None, values=None, disabled=None): + if values is not None: + try: + self.TKCombo['values'] = values + self.TKCombo.current(0) + except: pass + self.Values = values + for index, v in enumerate(self.Values): + if v == value: + try: + self.TKCombo.current(index) + except: pass + self.DefaultValue = value + break + if disabled == True: + self.TKCombo['state'] = 'disable' + elif disabled == False: + self.TKCombo['state'] = 'enable' + + + def __del__(self): + try: + self.TKCombo.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + +# ------------------------- INPUT COMBO Element lazy functions ------------------------- # +Combo = InputCombo +DropDown = InputCombo +Drop = InputCombo + +# ---------------------------------------------------------------------- # +# Option Menu # +# ---------------------------------------------------------------------- # +class InputOptionMenu(Element): + def __init__(self, values, default_value=None, size=(None, None), auto_size_text=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + ''' + Input Combo Box Element (also called Dropdown box) + :param values: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + ''' + self.Values = values + self.DefaultValue = default_value + self.TKOptionMenu = None + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_OPTION_MENU, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) + + def Update(self, value=None, values=None, disabled=None): + if values is not None: + self.Values = values + if self.Values is not None: + for index, v in enumerate(self.Values): + if v == value: + try: + self.TKStringVar.set(value) + except: pass + self.DefaultValue = value + break + if disabled == True: + self.TKOptionMenu['state'] = 'disabled' + elif disabled == False: + self.TKOptionMenu['state'] = 'normal' + + + def __del__(self): + try: + self.TKOptionMenu.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + + +# ------------------------- OPTION MENU Element lazy functions ------------------------- # +OptionMenu = InputOptionMenu + +# ---------------------------------------------------------------------- # +# Listbox # +# ---------------------------------------------------------------------- # +class Listbox(Element): + def __init__(self, values, default_values=None, select_mode=None, change_submits=False, bind_return_key=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + ''' + Listbox Element + :param values: + :param select_mode: SELECT_MODE_BROWSE, SELECT_MODE_EXTENDED, SELECT_MODE_MULTIPLE, SELECT_MODE_SINGLE + :param font: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex ''' + self.Values = values + self.DefaultValues = default_values + self.TKListbox = None + self.ChangeSubmits = change_submits + self.BindReturnKey = bind_return_key + if select_mode == LISTBOX_SELECT_MODE_BROWSE: + self.SelectMode = SELECT_MODE_BROWSE + elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: + self.SelectMode = SELECT_MODE_EXTENDED + elif select_mode == LISTBOX_SELECT_MODE_MULTIPLE: + self.SelectMode = SELECT_MODE_MULTIPLE + elif select_mode == LISTBOX_SELECT_MODE_SINGLE: + self.SelectMode = SELECT_MODE_SINGLE + else: + self.SelectMode = DEFAULT_LISTBOX_SELECT_MODE + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_LISTBOX, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) + + def Update(self, values=None, disabled=None): + if disabled == True: + self.TKListbox.configure(state='disabled') + elif disabled == False: + self.TKListbox.configure(state='normal') + if values is not None: + self.TKListbox.delete(0, 'end') + for item in values: + self.TKListbox.insert(tk.END, item) + self.TKListbox.selection_set(0, 0) + self.Values = values + + + + def SetValue(self, values): + for index, item in enumerate(self.Values): + try: + if item in values: + self.TKListbox.selection_set(index) + else: + self.TKListbox.selection_clear(index) + except: pass + self.DefaultValues = values + + def __del__(self): + try: + self.TKListBox.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + + + +# ---------------------------------------------------------------------- # +# Radio # +# ---------------------------------------------------------------------- # +class Radio(Element): + def __init__(self, text, group_id, default=False, size=(None, None), auto_size_text=None, background_color=None, text_color=None, font=None, key=None, pad=None, tooltip=None): + ''' + Radio Button Element + :param text: + :param group_id: + :param default: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' + self.InitialState = default + self.Text = text + self.TKRadio = None + self.GroupID = group_id + self.Value = None + self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_RADIO, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad, tooltip=tooltip) + + def Update(self, value=None, disabled=None): + location = EncodeRadioRowCol(self.Position[0], self.Position[1]) + if value is not None: + try: + self.TKIntVar.set(location) + except: pass + self.InitialState = value + if disabled == True: + self.TKRadio['state'] = 'disabled' + elif disabled == False: + self.TKRadio['state'] = 'normal' + + def __del__(self): + try: + self.TKRadio.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + +# ---------------------------------------------------------------------- # +# Checkbox # +# ---------------------------------------------------------------------- # +class Checkbox(Element): + def __init__(self, text, default=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + ''' + Check Box Element + :param text: + :param default: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' + self.Text = text + self.InitialState = default + self.Value = None + self.TKCheckbutton = None + self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_CHECKBOX, size=size, auto_size_text=auto_size_text, font=font, + background_color=background_color, text_color=self.TextColor, key=key, pad=pad, tooltip=tooltip) + + def Get(self): + return self.TKIntVar.get() + + def Update(self, value=None, disabled=None): + if value is not None: + try: + self.TKIntVar.set(value) + self.InitialState = value + except: pass + if disabled == True: + self.TKCheckbutton.configure(state='disabled') + elif disabled == False: + self.TKCheckbutton.configure(state='normal') + + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + +# ------------------------- CHECKBOX Element lazy functions ------------------------- # +CB = Checkbox +CBox = Checkbox +Check = Checkbox + + +# ---------------------------------------------------------------------- # +# Spin # +# ---------------------------------------------------------------------- # + +class Spin(Element): + # Values = None + # TKSpinBox = None + def __init__(self, values, initial_value=None, change_submits=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + ''' + Spin Box Element + :param values: + :param initial_value: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + :param font: + ''' + self.Values = values + self.DefaultValue = initial_value + self.ChangeSubmits = change_submits + self.TKSpinBox = None + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_SPIN, size, auto_size_text, font=font,background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) + return + + def Update(self, value=None, values=None, disabled=None): + if values != None: + old_value = self.TKStringVar.get() + self.Values = values + self.TKSpinBox.configure(values=values) + self.TKStringVar.set(old_value) + if value is not None: + try: + self.TKStringVar.set(value) + except: pass + self.DefaultValue = value + if disabled == True: + self.TKSpinBox.configure(state='disabled') + elif disabled == False: + self.TKSpinBox.configure(state='normal') + + + def SpinChangedHandler(self, event): + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def __del__(self): + try: + self.TKSpinBox.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + +# ---------------------------------------------------------------------- # +# Multiline # +# ---------------------------------------------------------------------- # +class Multiline(Element): + def __init__(self, default_text='', enter_submits = False, autoscroll=False, size=(None, None), auto_size_text=None, background_color=None, text_color=None, do_not_clear=False, key=None, focus=False, pad=None, tooltip=None): + ''' + Input Multi-line Element + :param default_text: + :param enter_submits: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param background_color: Color for Element. Text or RGB Hex + ''' + self.DefaultText = default_text + self.EnterSubmits = enter_submits + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + self.Focus = focus + self.do_not_clear = do_not_clear + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + self.Autoscroll = autoscroll + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_MULTILINE, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) + return + + def Update(self, value=None, disabled=None, append=False): + if value is not None: + try: + if not append: + self.TKText.delete('1.0', tk.END) + self.TKText.insert(tk.END, value) + except: pass + self.DefaultText = value + if self.Autoscroll: + self.TKText.see(tk.END) + if disabled == True: + self.TKText.configure(state='disabled') + elif disabled == False: + self.TKText.configure(state='normal') + + def Get(self): + return self.TKText.get(1.0, tk.END) + + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + +# ---------------------------------------------------------------------- # +# Text # +# ---------------------------------------------------------------------- # +class Text(Element): + def __init__(self, text, size=(None, None), auto_size_text=None, click_submits=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None, tooltip=None): + ''' + Text Element - Displays text in your form. Can be updated in non-blocking forms + :param text: The text to display + :param size: Size of Element in Characters + :param auto_size_text: True if the field should shrink to fit the text + :param font: Font name and size ("name", size) + :param text_color: Text Color name or RGB hex value '#RRGGBB' + :param background_color: Background color for text (name or RGB Hex) + :param justification: 'left', 'right', 'center' + ''' + self.DisplayText = text + self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR + self.Justification = justification + self.Relief = relief + self.ClickSubmits = click_submits + if background_color is None: + bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR + else: + bg = background_color + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_TEXT, size, auto_size_text, background_color=bg, font=font if font else DEFAULT_FONT, text_color=self.TextColor, pad=pad, key=key, tooltip=tooltip) + return + + def Update(self, value = None, background_color=None, text_color=None, font=None): + if value is not None: + self.DisplayText=value + stringvar = self.TKStringVar + stringvar.set(value) + if background_color is not None: + self.TKText.configure(background=background_color) + if text_color is not None: + self.TKText.configure(fg=text_color) + if font is not None: + self.TKText.configure(font=font) + + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + +# ------------------------- Text Element lazy functions ------------------------- # +Txt = Text +T = Text + + +# ---------------------------------------------------------------------- # +# TKProgressBar # +# Emulate the TK ProgressBar using canvas and rectangles +# ---------------------------------------------------------------------- # + +class TKProgressBar(): + def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], style=DEFAULT_PROGRESS_BAR_STYLE, relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH, orientation='horizontal', BarColor=(None,None)): + self.Length = length + self.Width = width + self.Max = max + self.Orientation = orientation + self.Count = None + self.PriorCount = 0 + + if orientation[0].lower() == 'h': + s = ttk.Style() + s.theme_use(style) + if BarColor != COLOR_SYSTEM_DEFAULT: + s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + else: + s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", troughrelief=relief, borderwidth=border_width, thickness=width) + + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate') + else: + s = ttk.Style() + s.theme_use(style) + if BarColor != COLOR_SYSTEM_DEFAULT: + s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width) + else: + s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", troughrelief=relief, borderwidth=border_width, thickness=width) + self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate') + + def Update(self, count=None, max=None): + if max is not None: + self.Max = max + try: + self.TKProgressBarForReal.config(maximum=max) + except: + return False + if count is not None and count > self.Max: return False + if count is not None: + try: + self.TKProgressBarForReal['value'] = count + except: return False + return True + + def __del__(self): + try: + self.TKProgressBarForReal.__del__() + except: + pass + +# ---------------------------------------------------------------------- # +# TKOutput # +# New Type of TK Widget that's a Text Widget in disguise # +# Note that it's inherited from the TKFrame class so that the # +# Scroll bar will span the length of the frame # +# ---------------------------------------------------------------------- # +class TKOutput(tk.Frame): + def __init__(self, parent, width, height, bd, background_color=None, text_color=None, font=None, pad=None): + frame = tk.Frame(parent) + tk.Frame.__init__(self, frame) + self.output = tk.Text(frame, width=width, height=height, bd=bd, font=font) + if background_color and background_color != COLOR_SYSTEM_DEFAULT: + self.output.configure(background=background_color) + frame.configure(background=background_color) + if text_color and text_color != COLOR_SYSTEM_DEFAULT: + self.output.configure(fg=text_color) + self.vsb = tk.Scrollbar(frame, orient="vertical", command=self.output.yview) + self.output.configure(yscrollcommand=self.vsb.set) + self.output.pack(side="left", fill="both", expand=True) + self.vsb.pack(side="left", fill="y", expand=False) + frame.pack(side="left", padx=pad[0], pady=pad[1], expand=True, fill='y') + self.previous_stdout = sys.stdout + self.previous_stderr = sys.stderr + + sys.stdout = self + sys.stderr = self + self.pack() + + def write(self, txt): + try: + self.output.insert(tk.END, str(txt)) + self.output.see(tk.END) + except: + pass + + def Close(self): + sys.stdout = self.previous_stdout + sys.stderr = self.previous_stderr + + def flush(self): + sys.stdout = self.previous_stdout + sys.stderr = self.previous_stderr + + def __del__(self): + sys.stdout = self.previous_stdout + sys.stderr = self.previous_stderr + +# ---------------------------------------------------------------------- # +# Output # +# Routes stdout, stderr to a scrolled window # +# ---------------------------------------------------------------------- # +class Output(Element): + def __init__(self, size=(None, None), background_color=None, text_color=None, pad=None, font=None, tooltip=None, key=None): + ''' + Output Element - reroutes stdout, stderr to this window + :param size: Size of field in characters + :param background_color: Color for Element. Text or RGB Hex + ''' + self.TKOut = None + bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR + fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font, tooltip=tooltip, key=key) + + def __del__(self): + try: + self.TKOut.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + +# ---------------------------------------------------------------------- # +# Button Class # +# ---------------------------------------------------------------------- # +class Button(Element): + def __init__(self, button_text='', button_type=BUTTON_TYPE_CLOSES_WIN, target=(None, None), tooltip=None, file_types=(("ALL Files", "*.*"),), initial_folder=None, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None, size=(None, None), auto_size_button=None, button_color=None, default_value = None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + ''' + Button Element - Specifies all types of buttons + :param button_type: + :param target: + :param button_text: + :param file_types: + :param image_filename: + :param image_size: + :param image_subsample: + :param border_width: + :param size: Size of field in characters + :param auto_size_button: + :param button_color: + :param font: + ''' + self.AutoSizeButton = auto_size_button + self.BType = button_type + self.FileTypes = file_types + self.TKButton = None + self.Target = target + self.ButtonText = button_text + self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR + self.ImageFilename = image_filename + self.ImageSize = image_size + self.ImageSubsample = image_subsample + self.UserData = None + self.BorderWidth = border_width if border_width is not None else DEFAULT_BORDER_WIDTH + self.BindReturnKey = bind_return_key + self.Focus = focus + self.TKCal = None + self.DefaultValue = default_value + self.InitialFolder = initial_folder + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_BUTTON, size=size, font=font, pad=pad, key=key, tooltip=tooltip) + return + + # Realtime button release callback + def ButtonReleaseCallBack(self, parm): + self.LastButtonClickedWasRealtime = False + self.ParentForm.LastButtonClicked = None + + # Realtime button callback + def ButtonPressCallBack(self, parm): + self.ParentForm.LastButtonClickedWasRealtime = True + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.ButtonText + + # ------- Button Callback ------- # + def ButtonCallBack(self): + global _my_windows + # print(f'Parent = {self.ParentForm} Position = {self.Position}') + # Buttons modify targets or return from the form + # If modifying target, get the element object at the target and modify its StrVar + target = self.Target + target_element = None + if target[0] == ThisRow: + target = [self.Position[0], target[1]] + if target[1] < 0: + target[1] = self.Position[1] + target[1] + strvar = None + if target == (None, None): + strvar = self.TKStringVar + else: + if not isinstance(target, str): + if target[0] < 0: + target = [self.Position[0] + target[0], target[1]] + target_element = self.ParentContainer._GetElementAtLocation(target) + else: + target_element = self.ParentForm.FindElement(target) + try: + strvar = target_element.TKStringVar + 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 + 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 + 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 = 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) + 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 + if file_name != '': + strvar.set(file_name) + self.TKStringVar.set(file_name) + elif self.BType == BUTTON_TYPE_CLOSES_WIN: # this is a return type button so GET RESULTS and destroy window + # first, get the results table built + # modify the Results table in the parent FlexForm object + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.ButtonText + self.ParentForm.FormRemainedOpen = False + # if the form is tabbed, must collect all form's results and destroy all forms + if self.ParentForm.IsTabbedForm: + self.ParentForm.UberParent._Close() + else: + self.ParentForm._Close() + self.ParentForm.TKroot.quit() + if self.ParentForm.NonBlocking: + self.ParentForm.TKroot.destroy() + _my_windows.Decrement() + elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE + # first, get the results table built + # modify the Results table in the parent FlexForm object + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = self.ButtonText + self.ParentForm.FormRemainedOpen = True + if self.ParentForm.IsTabbedForm: + self.ParentForm.UberParent.FormStayedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + elif self.BType == BUTTON_TYPE_CLOSES_WIN_ONLY: # this is a return type button so GET RESULTS and destroy window + # if the form is tabbed, must collect all form's results and destroy all forms + if self.ParentForm.IsTabbedForm: + self.ParentForm.UberParent._Close() + else: + self.ParentForm._Close() + if self.ParentForm.NonBlocking: + self.ParentForm.TKroot.destroy() + _my_windows.Decrement() + elif self.BType == BUTTON_TYPE_CALENDAR_CHOOSER: # this is a return type button so GET RESULTS and destroy window + root = tk.Toplevel() + root.title('Calendar Chooser') + self.TKCal = TKCalendar(master=root, firstweekday=calendar.SUNDAY, target_element=target_element) + self.TKCal.pack(expand=1, fill='both') + # self.ParentForm.TKRroot.mainloop() + root.update() + # root.mainloop() + # root.update() + # strvar.set(ttkcal.selection) + + return + + def Update(self, value=None, text=None, button_color=(None, None), disabled=None): + try: + if text is not None: + self.TKButton.configure(text=text) + self.ButtonText = text + if button_color != (None, None): + self.TKButton.config(foreground=button_color[0], background=button_color[1]) + except: + return + if value is not None: + self.DefaultValue = value + if disabled == True: + self.TKButton['state'] = 'disabled' + elif disabled == False: + self.TKButton['state'] = 'normal' + + def GetText(self): + return self.ButtonText + + def __del__(self): + try: + self.TKButton.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + + +# ---------------------------------------------------------------------- # +# ProgreessBar # +# ---------------------------------------------------------------------- # +class ProgressBar(Element): + def __init__(self, max_value, orientation=None, size=(None, None), auto_size_text=None, bar_color=(None, None), style=None, border_width=None, relief=None, key=None, pad=None): + ''' + Progress Bar Element + :param max_value: + :param orientation: + :param size: Size of field in characters + :param auto_size_text: True if should shrink field to fit the default text + :param bar_color: + :param style: + :param border_width: + :param relief: + ''' + self.MaxValue = max_value + self.TKProgressBar = None + self.Cancelled = False + self.NotRunning = True + self.Orientation = orientation if orientation else DEFAULT_METER_ORIENTATION + self.BarColor = bar_color + self.BarStyle = style if style else DEFAULT_PROGRESS_BAR_STYLE + self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH + self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF + self.BarExpired = False + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_PROGRESS_BAR, size=size, auto_size_text=auto_size_text, key=key, pad=pad) + return + + # returns False if update failed + def UpdateBar(self, current_count, max=None): + if self.ParentForm.TKrootDestroyed: + return False + self.TKProgressBar.Update(current_count, max=max) + try: + self.ParentForm.TKroot.update() + except: + _my_windows.Decrement() + return False + return True + + def __del__(self): + try: + self.TKProgressBar.__del__() + except: + pass + super(*(fSuprArgs(self))).__del__() + +# ---------------------------------------------------------------------- # +# Image # +# ---------------------------------------------------------------------- # +class Image(Element): + def __init__(self, filename=None, data=None, size=(None, None), pad=None, key=None, tooltip=None): + ''' + Image Element + :param filename: + :param size: Size of field in characters + ''' + self.Filename = filename + self.Data = data + self.tktext_label = None + if data is None and filename is None: + print('* Warning... no image specified in Image Element! *') + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_IMAGE, size=size, pad=pad, key=key, tooltip=tooltip) + return + + def Update(self, filename=None, data=None): + if filename is not None: + image = tk.PhotoImage(file=filename) + elif data is not None: + if type(data) is bytes: + image = tk.PhotoImage(data=data) + else: + image = data + else: return + width, height = image.width(), image.height() + self.tktext_label.configure(image=image, width=width, height=height) + # self.tktext_label.configure(image=image) + self.tktext_label.image = image + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + +# ---------------------------------------------------------------------- # +# Canvas # +# ---------------------------------------------------------------------- # +class Canvas(Element): + def __init__(self, canvas=None, background_color=None, size=(None, None), pad=None, key=None, tooltip=None): + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self._TKCanvas = canvas + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_CANVAS, background_color=background_color, size=size, pad=pad, key=key, tooltip=tooltip) + return + + @property + def TKCanvas(self): + if self._TKCanvas is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') + return self._TKCanvas + + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + + + +# ---------------------------------------------------------------------- # +# Graph # +# ---------------------------------------------------------------------- # +class Graph(Element): + def __init__(self, canvas_size, graph_bottom_left, graph_top_right, background_color=None, pad=None, key=None, tooltip=None): + + self.CanvasSize = canvas_size + self.BottomLeft = graph_bottom_left + self.TopRight = graph_top_right + self._TKCanvas = None + self._TKCanvas2 = None + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_GRAPH, background_color=background_color, size=canvas_size, pad=pad, key=key, tooltip=tooltip) + return + + def _convert_xy_to_canvas_xy(self, x_in, y_in): + scale_x = (self.CanvasSize[0] - 0) / (self.TopRight[0] - self.BottomLeft[0]) + scale_y = (0 - self.CanvasSize[1]) / (self.TopRight[1] - self.BottomLeft[1]) + new_x = 0 + scale_x * (x_in - self.BottomLeft[0]) + new_y = self.CanvasSize[1] + scale_y * (y_in - self.BottomLeft[1]) + return new_x, new_y + + def DrawLine(self, point_from, point_to, color='black', width=1): + converted_point_from = self._convert_xy_to_canvas_xy(point_from[0], point_from[1]) + converted_point_to = self._convert_xy_to_canvas_xy(point_to[0], point_to[1]) + return self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color) + + def DrawPoint(self, point, size=2, color='black'): + converted_point = self._convert_xy_to_canvas_xy(point[0], point[1]) + return self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) + + def DrawCircle(self, center_location, radius, fill_color=None, line_color='black'): + converted_point = self._convert_xy_to_canvas_xy(center_location[0], center_location[1]) + return self._TKCanvas2.create_oval(converted_point[0]-radius, converted_point[1]-radius, converted_point[0]+radius, converted_point[1]+radius, fill=fill_color, outline=line_color) + + def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None): + converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1]) + converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0],bottom_right[1]) + return self._TKCanvas2.create_oval(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) + + + def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None): + converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1] ) + converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1]) + return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) + + def Erase(self): + self._TKCanvas2.delete('all') + + def Update(self, background_color): + self._TKCanvas2.configure(background=background_color) + + def Move(self, x_direction, y_direction): + zero_converted = self._convert_xy_to_canvas_xy(0,0) + shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) + shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) + self._TKCanvas2.move('all', shift_amount[0], shift_amount[1]) + + def MoveFigure(self, figure, x_direction, y_direction): + zero_converted = self._convert_xy_to_canvas_xy(0,0) + shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) + shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) + self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1]) + + @property + def TKCanvas(self): + if self._TKCanvas2 is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') + return self._TKCanvas2 + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + +# ---------------------------------------------------------------------- # +# Frame # +# ---------------------------------------------------------------------- # +class Frame(Element): + def __init__(self, title, layout, title_color=None, background_color=None, title_location=None , relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): + + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + # self.ParentForm = None + self.TKFrame = None + self.Title = title + self.Relief = relief + self.TitleLocation = title_location + self.BorderWidth = border_width + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + + self.Layout(layout) + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_FRAME, background_color=background_color, text_color=title_color, size=size, font=font, pad=pad, key=key, tooltip=tooltip) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + super(*(fSuprArgs(self))).__del__() + + + +# ---------------------------------------------------------------------- # +# Tab # +# ---------------------------------------------------------------------- # +class Tab(Element): + def __init__(self, title, layout, title_color=None, background_color=None, font=None, pad=None, border_width=None, key=None, tooltip=None): + + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + self.TKFrame = None + self.Title = title + self.BorderWidth = border_width + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + + self.Layout(layout) + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_TAB, background_color=background_color, text_color=title_color, font=font, pad=pad, key=key, tooltip=tooltip) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + super(*(fSuprArgs(self))).__del__() + + + +# ---------------------------------------------------------------------- # +# TabGroup # +# ---------------------------------------------------------------------- # +class TabGroup(Element): + def __init__(self, layout, title_color=None, background_color=None, font=None, pad=None, border_width=None, key=None, tooltip=None): + + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + self.TKNotebook = None + self.BorderWidth = border_width + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + + self.Layout(layout) + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_TAB_GROUP, background_color=background_color, text_color=title_color, font=font, pad=pad, key=key, tooltip=tooltip) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + super(*(fSuprArgs(self))).__del__() + + + + +# ---------------------------------------------------------------------- # +# Slider # +# ---------------------------------------------------------------------- # +class Slider(Element): + def __init__(self, range=(None,None), default_value=None, resolution=None, orientation=None, border_width=None, relief=None, change_submits=False, size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + ''' + Slider + :param range: + :param default_value: + :param resolution: + :param orientation: + :param border_width: + :param relief: + :param change_submits: + :param scale: + :param size: + :param font: + :param background_color: + :param text_color: + :param key: + :param pad: + ''' + self.TKScale = None + self.Range = (1,10) if range == (None, None) else range + self.DefaultValue = self.Range[0] if default_value is None else default_value + self.Orientation = orientation if orientation else DEFAULT_SLIDER_ORIENTATION + self.BorderWidth = border_width if border_width else DEFAULT_SLIDER_BORDER_WIDTH + self.Relief = relief if relief else DEFAULT_SLIDER_RELIEF + self.Resolution = 1 if resolution is None else resolution + self.ChangeSubmits = change_submits + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_INPUT_SLIDER, size=size, font=font, background_color=background_color, text_color=text_color, key=key, pad=pad, tooltip=tooltip) + return + + def Update(self, value=None, range=(None, None), disabled=None): + if value is not None: + try: + self.TKIntVar.set(value) + if range != (None, None): + self.TKScale.config(from_ = range[0], to_ = range[1]) + except: pass + self.DefaultValue = value + if disabled == True: + self.TKScale['state'] = 'disabled' + elif disabled == False: + self.TKScale['state'] = 'normal' + + def SliderChangedHandler(self, event): + # first, get the results table built + # modify the Results table in the parent FlexForm object + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + +# ---------------------------------------------------------------------- # +# TkScrollableFrame (Used by Column) # +# ---------------------------------------------------------------------- # +class TkScrollableFrame(tk.Frame): + def __init__(self, master, **kwargs): + tk.Frame.__init__(self, master, **kwargs) + + # create a canvas object and a vertical scrollbar for scrolling it + self.vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) + self.vscrollbar.pack(side='right', fill="y", expand="false") + + self.hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL) + self.hscrollbar.pack(side='bottom', fill="x", expand="false") + + self.canvas = tk.Canvas(self, yscrollcommand=self.vscrollbar.set, xscrollcommand=self.hscrollbar.set) + self.canvas.pack(side="left", fill="both", expand=True) + + self.vscrollbar.config(command=self.canvas.yview) + self.hscrollbar.config(command=self.canvas.xview) + + # reset the view + self.canvas.xview_moveto(0) + self.canvas.yview_moveto(0) + + # create a frame inside the canvas which will be scrolled with it + self.TKFrame = tk.Frame(self.canvas, **kwargs) + self.frame_id = self.canvas.create_window(0, 0, window=self.TKFrame, anchor="nw") + self.canvas.config(borderwidth=0, highlightthickness=0) + self.TKFrame.config(borderwidth=0, highlightthickness=0) + self.config(borderwidth=0, highlightthickness=0) + + self.bind('', self.set_scrollregion) + + self.bind_mouse_scroll(self.canvas, self.yscroll) + self.bind_mouse_scroll(self.hscrollbar, self.xscroll) + self.bind_mouse_scroll(self.vscrollbar, self.yscroll) + + def resize_frame(self, e): + self.canvas.itemconfig(self.frame_id, height=e.height, width=e.width) + + def yscroll(self, event): + if event.num == 5 or event.delta < 0: + self.canvas.yview_scroll(1, "unit") + elif event.num == 4 or event.delta > 0: + self.canvas.yview_scroll(-1, "unit") + + def xscroll(self, event): + if event.num == 5 or event.delta < 0: + self.canvas.xview_scroll(1, "unit") + elif event.num == 4 or event.delta > 0: + self.canvas.xview_scroll(-1, "unit") + + def bind_mouse_scroll(self, parent, mode): + # ~~ Windows only + parent.bind("", mode) + # ~~ Unix only + parent.bind("", mode) + parent.bind("", mode) + + def set_scrollregion(self, event=None): + """ Set the scroll region on the canvas""" + self.canvas.configure(scrollregion=self.canvas.bbox('all')) + + +# ---------------------------------------------------------------------- # +# Column # +# ---------------------------------------------------------------------- # +class Column(Element): + def __init__(self, layout, background_color = None, size=(None, None), pad=None, scrollable=False, key=None): + self.UseDictionary = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.ParentWindow = None + self.Rows = [] + # self.ParentForm = None + self.TKFrame = None + self.Scrollable = scrollable + bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + + self.Layout(layout) + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_COLUMN, background_color=background_color, size=size, pad=pad, key=key) + return + + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + if element.Key is not None: + self.UseDictionary = True + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + def Layout(self, rows): + for row in rows: + self.AddRow(*row) + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + try: + del(self.TKFrame) + except: + pass + super(*(fSuprArgs(self))).__del__() + + +# ---------------------------------------------------------------------- # +# Calendar # +# ---------------------------------------------------------------------- # +class TKCalendar(ttk.Frame): + """ + This code was shamelessly lifted from moshekaplan's repository - moshekaplan/tkinter_components + """ + # XXX ToDo: cget and configure + + datetime = calendar.datetime.datetime + timedelta = calendar.datetime.timedelta + + def __init__(self, master=None, target_element=None, **kw): + """ + WIDGET-SPECIFIC OPTIONS + + locale, firstweekday, year, month, selectbackground, + selectforeground + """ + self._TargetElement = target_element + # remove custom options from kw before initializating ttk.Frame + fwday = kw.pop('firstweekday', calendar.MONDAY) + year = kw.pop('year', self.datetime.now().year) + month = kw.pop('month', self.datetime.now().month) + locale = kw.pop('locale', None) + sel_bg = kw.pop('selectbackground', '#ecffc4') + sel_fg = kw.pop('selectforeground', '#05640e') + + self._date = self.datetime(year, month, 1) + self._selection = None # no date selected + ttk.Frame.__init__(self, master, **kw) + + # instantiate proper calendar class + if locale is None: + self._cal = calendar.TextCalendar(fwday) + else: + self._cal = calendar.LocaleTextCalendar(fwday, locale) + + self.__setup_styles() # creates custom styles + self.__place_widgets() # pack/grid used widgets + self.__config_calendar() # adjust calendar columns and setup tags + # configure a canvas, and proper bindings, for selecting dates + self.__setup_selection(sel_bg, sel_fg) + + # store items ids, used for insertion later + self._items = [self._calendar.insert('', 'end', values='') + for _ in range(6)] + # insert dates in the currently empty calendar + self._build_calendar() + + def __setitem__(self, item, value): + if item in ('year', 'month'): + raise AttributeError("attribute '%s' is not writeable" % item) + elif item == 'selectbackground': + self._canvas['background'] = value + elif item == 'selectforeground': + self._canvas.itemconfigure(self._canvas.text, item=value) + else: + ttk.Frame.__setitem__(self, item, value) + + def __getitem__(self, item): + if item in ('year', 'month'): + return getattr(self._date, item) + elif item == 'selectbackground': + return self._canvas['background'] + elif item == 'selectforeground': + return self._canvas.itemcget(self._canvas.text, 'fill') + else: + r = ttk.tclobjs_to_py({item: ttk.Frame.__getitem__(self, item)}) + return r[item] + + def __setup_styles(self): + # custom ttk styles + style = ttk.Style(self.master) + arrow_layout = lambda dir: ( + [('Button.focus', {'children': [('Button.%sarrow' % dir, None)]})] + ) + style.layout('L.TButton', arrow_layout('left')) + style.layout('R.TButton', arrow_layout('right')) + + def __place_widgets(self): + # header frame and its widgets + hframe = ttk.Frame(self) + lbtn = ttk.Button(hframe, style='L.TButton', command=self._prev_month) + rbtn = ttk.Button(hframe, style='R.TButton', command=self._next_month) + self._header = ttk.Label(hframe, width=15, anchor='center') + # the calendar + self._calendar = ttk.Treeview(self, show='', selectmode='none', height=7) + + # pack the widgets + hframe.pack(in_=self, side='top', pady=4, anchor='center') + lbtn.grid(in_=hframe) + self._header.grid(in_=hframe, column=1, row=0, padx=12) + rbtn.grid(in_=hframe, column=2, row=0) + self._calendar.pack(in_=self, expand=1, fill='both', side='bottom') + + def __config_calendar(self): + cols = self._cal.formatweekheader(3).split() + self._calendar['columns'] = cols + self._calendar.tag_configure('header', background='grey90') + self._calendar.insert('', 'end', values=cols, tag='header') + # adjust its columns width + font = tkinter.font.Font() + maxwidth = max(font.measure(col) for col in cols) + for col in cols: + self._calendar.column(col, width=maxwidth, minwidth=maxwidth, + anchor='e') + + def __setup_selection(self, sel_bg, sel_fg): + self._font = tkinter.font.Font() + self._canvas = canvas = tk.Canvas(self._calendar, + background=sel_bg, borderwidth=0, highlightthickness=0) + canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w') + + canvas.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', self._pressed) + + def __minsize(self, evt): + width, height = self._calendar.master.geometry().split('x') + height = height[:height.index('+')] + self._calendar.master.minsize(width, height) + + def _build_calendar(self): + year, month = self._date.year, self._date.month + + # update header text (Month, YEAR) + header = self._cal.formatmonthname(year, month, 0) + self._header['text'] = header.title() + + # update calendar shown dates + cal = self._cal.monthdayscalendar(year, month) + for indx, item in enumerate(self._items): + week = cal[indx] if indx < len(cal) else [] + fmt_week = [('%02d' % day) if day else '' for day in week] + self._calendar.item(item, values=fmt_week) + + def _show_selection(self, text, bbox): + """Configure canvas for a new selection.""" + x, y, width, height = bbox + + textw = self._font.measure(text) + + canvas = self._canvas + canvas.configure(width=width, height=height) + canvas.coords(canvas.text, width - textw, height / 2 - 1) + canvas.itemconfigure(canvas.text, text=text) + canvas.place(in_=self._calendar, x=x, y=y) + + # Callbacks + + def _pressed(self, evt): + """Clicked somewhere in the calendar.""" + x, y, widget = evt.x, evt.y, evt.widget + item = widget.identify_row(y) + column = widget.identify_column(x) + + if not column or not item in self._items: + # clicked in the weekdays row or just outside the columns + return + + item_values = widget.item(item)['values'] + if not len(item_values): # row is empty for this month + return + + text = item_values[int(column[1]) - 1] + if not text: # date is empty + return + + bbox = widget.bbox(item, column) + if not bbox: # calendar not visible yet + return + + # update and then show selection + text = '%02d' % text + self._selection = (text, item, column) + self._show_selection(text, bbox) + year, month = self._date.year, self._date.month + try: + self._TargetElement.Update(self.datetime(year, month, int(self._selection[0]))) + except: pass + + def _prev_month(self): + """Updated calendar to show the previous month.""" + self._canvas.place_forget() + + self._date = self._date - self.timedelta(days=1) + self._date = self.datetime(self._date.year, self._date.month, 1) + self._build_calendar() # reconstuct calendar + + def _next_month(self): + """Update calendar to show the next month.""" + self._canvas.place_forget() + + year, month = self._date.year, self._date.month + self._date = self._date + self.timedelta( + days=calendar.monthrange(year, month)[1] + 1) + self._date = self.datetime(self._date.year, self._date.month, 1) + self._build_calendar() # reconstruct calendar + + # Properties + + @property + def selection(self): + """Return a datetime representing the current selected date.""" + if not self._selection: + return None + + year, month = self._date.year, self._date.month + return self.datetime(year, month, int(self._selection[0])) + + +# ---------------------------------------------------------------------- # +# Canvas # +# ---------------------------------------------------------------------- # +class Menu(Element): + def __init__(self, menu_definition, background_color=None, size=(None, None), tearoff=True, pad=None, key=None): + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.MenuDefinition = menu_definition + self.TKMenu = None + self.Tearoff = tearoff + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_MENUBAR, background_color=background_color, size=size, pad=pad, key=key) + return + + def MenuItemChosenCallback(self, item_chosen): + # print('IN MENU ITEM CALLBACK', item_chosen) + self.ParentForm.LastButtonClicked = item_chosen + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() # kick the users out of the mainloop + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + + +# ---------------------------------------------------------------------- # +# Table # +# ---------------------------------------------------------------------- # +class Table(Element): + def __init__(self, values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=20, select_mode=None, display_row_numbers=False, scrollable=None, font=None, justification='right', text_color=None, background_color=None, size=(None, None), pad=None, key=None, tooltip=None): + self.Values = values + self.ColumnHeadings = headings + self.ColumnsToDisplay = visible_column_map + self.ColumnWidths = col_widths + self.MaxColumnWidth = max_col_width + self.DefaultColumnWidth = def_col_width + self.AutoSizeColumns = auto_size_columns + self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.TextColor = text_color + self.Justification = justification + self.Scrollable = scrollable + self.InitialState = None + self.SelectMode = select_mode + self.DisplayRowNumbers = display_row_numbers + self.TKTreeview = None + + super(*(fSuprArgs(self))).__init__(ELEM_TYPE_TABLE, text_color=text_color, background_color=background_color, font=font, size=size, pad=pad, key=key, tooltip=tooltip) + return + + + def __del__(self): + super(*(fSuprArgs(self))).__del__() + + + + + +# ------------------------------------------------------------------------- # +# Window CLASS # +# ------------------------------------------------------------------------- # +class Window: + ''' + Display a user defined for and return the filled in data + ''' + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=None, keep_on_top=False): + self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT + self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS + self.Title = title + self.Rows = [] # a list of ELEMENTS for this row + self.DefaultElementSize = default_element_size + self.DefaultButtonElementSize = default_button_element_size if default_button_element_size != (None, None) else DEFAULT_BUTTON_ELEMENT_SIZE + self.Location = location + self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR + self.BackgroundColor = background_color if background_color else DEFAULT_BACKGROUND_COLOR + self.IsTabbedForm = is_tabbed_form + self.ParentWindow = None + self.Font = font if font else DEFAULT_FONT + self.RadioDict = {} + self.BorderDepth = border_depth + self.WindowIcon = icon if icon is not None else _my_windows.user_defined_icon + self.AutoClose = auto_close + self.NonBlocking = False + self.TKroot = None + self.TKrootDestroyed = False + self.FormRemainedOpen = False + self.TKAfterID = None + self.ProgressBarColor = progress_bar_color + self.AutoCloseDuration = auto_close_duration + self.UberParent = None + self.RootNeedsDestroying = False + self.Shown = False + self.ReturnValues = None + self.ReturnValuesList = [] + self.ReturnValuesDictionary = {} + self.DictionaryKeyCounter = 0 + self.LastButtonClicked = None + self.LastButtonClickedWasRealtime = False + self.UseDictionary = False + self.UseDefaultFocus = use_default_focus + self.ReturnKeyboardEvents = return_keyboard_events + self.LastKeyboardEvent = None + self.TextJustification = text_justification + self.NoTitleBar = no_titlebar + self.GrabAnywhere = grab_anywhere + self.KeepOnTop = keep_on_top + + # ------------------------- Add ONE Row to Form ------------------------- # + def AddRow(self, *args): + ''' Parms are a variable number of Elements ''' + NumRows = len(self.Rows) # number of existing rows is our row number + CurrentRowNumber = NumRows # this row's number + CurrentRow = [] # start with a blank row and build up + # ------------------------- Add the elements to a row ------------------------- # + for i, element in enumerate(args): # Loop through list of elements and add them to the row + element.Position = (CurrentRowNumber, i) + element.ParentContainer = self + CurrentRow.append(element) + # ------------------------- Append the row to list of Rows ------------------------- # + self.Rows.append(CurrentRow) + + # ------------------------- Add Multiple Rows to Form ------------------------- # + def AddRows(self,rows): + for row in rows: + self.AddRow(*row) + + def Layout(self,rows): + self.AddRows(rows) + return self + + def LayoutAndRead(self,rows, non_blocking=False): + self.AddRows(rows) + self.Show(non_blocking=non_blocking) + return self.ReturnValues + + def LayoutAndShow(self, rows): + raise DeprecationWarning('LayoutAndShow is no longer supported... change your call to LayoutAndRead') + + # ------------------------- ShowForm THIS IS IT! ------------------------- # + def Show(self, non_blocking=False): + self.Shown = True + # Compute num rows & num cols (it'll come in handy debugging) + self.NumRows = len(self.Rows) + self.NumCols = max(len(row) for row in self.Rows) + self.NonBlocking=non_blocking + + # Search through entire form to see if any elements set the focus + # if not, then will set the focus to the first input element + found_focus = False + for row in self.Rows: + for element in row: + try: + if element.Focus: + found_focus = True + except: + pass + try: + if element.Key is not None: + self.UseDictionary = True + except: + pass + + if not found_focus and self.UseDefaultFocus: + self.UseDefaultFocus = True + else: + self.UseDefaultFocus = False + # -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ## + StartupTK(self) + # If a button or keyboard event happened but no results have been built, build the results + if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + return BuildResults(self, False, self) + return self.ReturnValues + + # ------------------------- SetIcon - set the window's fav icon ------------------------- # + def SetIcon(self, icon): + self.WindowIcon = icon + try: + self.TKroot.iconbitmap(icon) + except: pass + + def _GetElementAtLocation(self, location): + (row_num,col_num) = location + row = self.Rows[row_num] + element = row[col_num] + return element + + def _GetDefaultElementSize(self): + return self.DefaultElementSize + + def _AutoCloseAlarmCallback(self): + try: + if self.UberParent: + window = self.UberParent + else: + window = self + if window: + window._Close() + self.TKroot.quit() + self.RootNeedsDestroying = True + except: + pass + + def Read(self): + self.NonBlocking = False + if self.TKrootDestroyed: + return None, None + if not self.Shown: + self.Show() + else: + InitializeResults(self) + self.TKroot.mainloop() + if self.RootNeedsDestroying: + self.TKroot.destroy() + _my_windows.Decrement() + # if form was closed with X + if self.LastButtonClicked is None and self.LastKeyboardEvent is None and self.ReturnValues[0] is None: + _my_windows.Decrement() + if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: + return BuildResults(self, False, self) + else: + return self.ReturnValues + + def ReadNonBlocking(self, Message=''): + if self.TKrootDestroyed: + return None, None + if not self.Shown: + self.Show(non_blocking=True) + if Message: + print(Message) + try: + rc = self.TKroot.update() + except: + self.TKrootDestroyed = True + _my_windows.Decrement() + # return None, None + return BuildResults(self, False, self) + + + def Finalize(self): + if self.TKrootDestroyed: + return self + if not self.Shown: + self.Show(non_blocking=True) + try: + rc = self.TKroot.update() + except: + self.TKrootDestroyed = True + _my_windows.Decrement() + # return None, None + return self + + + + def Refresh(self): + if self.TKrootDestroyed: + return + try: + rc = self.TKroot.update() + except: + pass + + + def Fill(self, values_dict): + FillFormWithValues(self, values_dict) + + + def FindElement(self, key): + element = _FindElementFromKeyInSubForm(self, key) + if element is None: + print('*** WARNING = FindElement did not find the key. Please check your key\'s spelling ***') + return element + + + def UpdateElements(self, key_list, value_list): + for i, key in enumerate(key_list): + try: + self.FindElement(key).Update(value_list[i]) + except: + pass + + + def SaveToDisk(self, filename): + try: + results = BuildResults(self, False, self) + with open(filename, 'wb') as sf: + pickle.dump(results[1], sf) + except: + print('*** Error saving form to disk ***') + + + def LoadFromDisk(self, filename): + try: + with open(filename, 'rb') as df: + self.Fill(pickle.load(df)) + except: + print('*** Error loading form to disk ***') + + + + def GetScreenDimensions(self): + if self.TKrootDestroyed: + return None, None + screen_width = self.TKroot.winfo_screenwidth() # get window info to move to middle of screen + screen_height = self.TKroot.winfo_screenheight() + return screen_width, screen_height + + + def StartMove(self, event): + try: + self.TKroot.x = event.x + self.TKroot.y = event.y + except: pass + + def StopMove(self, event): + try: + self.TKroot.x = None + self.TKroot.y = None + except: pass + + def OnMotion(self, event): + try: + deltax = event.x - self.TKroot.x + deltay = event.y - self.TKroot.y + x = self.TKroot.winfo_x() + deltax + y = self.TKroot.winfo_y() + deltay + self.TKroot.geometry("+%s+%s" % (x, y)) + except: + pass + + + def _KeyboardCallback(self, event ): + self.LastButtonClicked = None + self.FormRemainedOpen = True + if event.char != '': + self.LastKeyboardEvent = event.char + else: + self.LastKeyboardEvent = str(event.keysym) + ':' + str(event.keycode) + if not self.NonBlocking: + BuildResults(self, False, self) + self.TKroot.quit() + + def _MouseWheelCallback(self, event ): + self.LastButtonClicked = None + self.FormRemainedOpen = True + self.LastKeyboardEvent = 'MouseWheel:Down' if event.delta < 0 else 'MouseWheel:Up' + if not self.NonBlocking: + BuildResults(self, False, self) + self.TKroot.quit() + + + def _Close(self): + try: + self.TKroot.update() + except: pass + if not self.NonBlocking: + BuildResults(self, False, self) + if self.TKrootDestroyed: + return None + self.TKrootDestroyed = True + self.RootNeedsDestroying = True + return None + + def CloseNonBlocking(self): + if self.TKrootDestroyed: + return + try: + self.TKroot.destroy() + _my_windows.Decrement() + except: pass + + CloseNonBlockingForm = CloseNonBlocking + + def OnClosingCallback(self): + return + + def __enter__(self): + return self + + def __exit__(self, *a): + self.__del__() + return False + + def __del__(self): + for row in self.Rows: + for element in row: + element.__del__() + # try: + # del(self.TKroot) + # except: + # pass + +FlexForm = Window + + +# ------------------------------------------------------------------------- # +# UberForm CLASS # +# Used to make forms into TABS (it's trick) # +# ------------------------------------------------------------------------- # +class UberForm(): + FormList = None # list of all the forms in this window + FormReturnValues = None + TKroot = None # tk root for the overall window + TKrootDestroyed = False + def __init__(self): + self.FormList = [] + self.FormReturnValues = [] + self.TKroot = None + self.TKrootDestroyed = False + self.FormStayedOpen = False + + def AddForm(self, form): + self.FormList.append(form) + + def _Close(self): + self.FormReturnValues = [] + for form in self.FormList: + form._Close() + self.FormReturnValues.append(form.ReturnValues) + if not self.TKrootDestroyed: + self.TKrootDestroyed = True + self.TKroot.destroy() + _my_windows.Decrement() + + def __del__(self): + return + +# =========================================================================== # +# Button Lazy Functions so the caller doesn't have to define a bunch of stuff # +# =========================================================================== # + + +# ------------------------- FOLDER BROWSE Element lazy function ------------------------- # +def FolderBrowse(button_text='Browse', target=(ThisRow, -1), initial_folder=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FOLDER, target=target, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) + +# ------------------------- FILE BROWSE Element lazy function ------------------------- # +def FileBrowse( button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILE, target=target, file_types=file_types,initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) + +# ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- # +def FilesBrowse(button_text='Browse',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_BROWSE_FILES, target=target, file_types=file_types, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) + +# ------------------------- FILE BROWSE Element lazy function ------------------------- # +def FileSaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), initial_folder=None, tooltip=None,size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) + +# ------------------------- SAVE AS Element lazy function ------------------------- # +def SaveAs(button_text='Save As...',target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),),initial_folder=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_SAVEAS_FILE, target=target, file_types=file_types, initial_folder=initial_folder, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key) + +# ------------------------- SAVE BUTTON Element lazy function ------------------------- # +def Save(button_text='Save', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- SUBMIT BUTTON Element lazy function ------------------------- # +def Submit(button_text='Submit', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None, focus=False, pad=None, key=None): + return Button( button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- OPEN BUTTON Element lazy function ------------------------- # +def Open(button_text='Open', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- OK BUTTON Element lazy function ------------------------- # +def OK(button_text='OK', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None,focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- YES BUTTON Element lazy function ------------------------- # +def Ok(button_text='Ok', size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, tooltip=None, font=None,focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- CANCEL BUTTON Element lazy function ------------------------- # +def Cancel(button_text='Cancel', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- QUIT BUTTON Element lazy function ------------------------- # +def Quit(button_text='Quit', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- Exit BUTTON Element lazy function ------------------------- # +def Exit(button_text='Exit', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- YES BUTTON Element lazy function ------------------------- # +def Yes(button_text='Yes', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=True, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- NO BUTTON Element lazy function ------------------------- # +def No(button_text='No', size=(None, None), auto_size_button=None, button_color=None, tooltip=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- NO BUTTON Element lazy function ------------------------- # +def Help(button_text='Help', size=(None, None), auto_size_button=None, button_color=None,font=None,tooltip=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +def SimpleButton(button_text, image_filename=None, image_size=(None, None), image_subsample=None, border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text,button_type=BUTTON_TYPE_CLOSES_WIN, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +# ------------------------- GENERIC BUTTON Element lazy function ------------------------- # +def ReadButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button( button_text=button_text, button_type=BUTTON_TYPE_READ_FORM, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +ReadFormButton = ReadButton +RButton = ReadFormButton + + +# ------------------------- Realtime BUTTON Element lazy function ------------------------- # +def RealtimeButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button( button_text=button_text,button_type=BUTTON_TYPE_REALTIME, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +# ------------------------- Dummy BUTTON Element lazy function ------------------------- # +def DummyButton(button_text, image_filename=None, image_size=(None, None),image_subsample=None,border_width=None,tooltip=None, size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None): + return Button(button_text=button_text, button_type= BUTTON_TYPE_CLOSES_WIN_ONLY, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +# ------------------------- Calendar Chooser Button lazy function ------------------------- # +def CalendarButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None,tooltip=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): + return Button(button_text=button_text, button_type=BUTTON_TYPE_CALENDAR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) + +# ------------------------- Calendar Chooser Button lazy function ------------------------- # +def ColorChooserButton(button_text, target=(None,None), image_filename=None, image_size=(None, None), image_subsample=None,tooltip=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): + return Button(button_text=button_text,button_type=BUTTON_TYPE_COLOR_CHOOSER, target=target, image_filename=image_filename, image_size=image_size, image_subsample=image_subsample, border_width=border_width, tooltip=tooltip, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key) +##################################### ----- RESULTS ------ ################################################## + +def AddToReturnDictionary(form, element, value): + if element.Key is None: + form.ReturnValuesDictionary[form.DictionaryKeyCounter] = value + element.Key = form.DictionaryKeyCounter + form.DictionaryKeyCounter += 1 + else: + form.ReturnValuesDictionary[element.Key] = value + +def AddToReturnList(form, value): + form.ReturnValuesList.append(value) + + +#----------------------------------------------------------------------------# +# ------- FUNCTION InitializeResults. Sets up form results matrix --------# +def InitializeResults(form): + BuildResults(form, True, form) + return + +#===== Radio Button RadVar encoding and decoding =====# +#===== The value is simply the row * 1000 + col =====# +def DecodeRadioRowCol(RadValue): + row = RadValue//1000 + col = RadValue%1000 + return row,col + +def EncodeRadioRowCol(row, col): + RadValue = row * 1000 + col + return RadValue + +# ------- FUNCTION BuildResults. Form exiting so build the results to pass back ------- # +# format of return values is +# (Button Pressed, input_values) +def BuildResults(form, initialize_only, top_level_form): + # Results for elements are: + # TEXT - Nothing + # INPUT - Read value from TK + # Button - Button Text and position as a Tuple + + # Get the initialized results so we don't have to rebuild + form.DictionaryKeyCounter = 0 + form.ReturnValuesDictionary = {} + form.ReturnValuesList = [] + BuildResultsForSubform(form, initialize_only, top_level_form) + if not top_level_form.LastButtonClickedWasRealtime: + top_level_form.LastButtonClicked = None + return form.ReturnValues + +def BuildResultsForSubform(form, initialize_only, top_level_form): + button_pressed_text = top_level_form.LastButtonClicked + for row_num,row in enumerate(form.Rows): + for col_num, element in enumerate(row): + value = None + if element.Type == ELEM_TYPE_COLUMN: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + + if element.Type == ELEM_TYPE_FRAME: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + + if element.Type == ELEM_TYPE_TAB_GROUP: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + + if element.Type == ELEM_TYPE_TAB: + element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter + element.ReturnValuesList = [] + element.ReturnValuesDictionary = {} + BuildResultsForSubform(element, initialize_only, top_level_form) + for item in element.ReturnValuesList: + AddToReturnList(top_level_form, item) + if element.UseDictionary: + top_level_form.UseDictionary = True + if element.ReturnValues[0] is not None: # if a button was clicked + button_pressed_text = element.ReturnValues[0] + + if not initialize_only: + if element.Type == ELEM_TYPE_INPUT_TEXT: + value=element.TKStringVar.get() + if not top_level_form.NonBlocking and not element.do_not_clear and not top_level_form.ReturnKeyboardEvents: + element.TKStringVar.set('') + elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: + value = element.TKIntVar.get() + value = (value != 0) + elif element.Type == ELEM_TYPE_INPUT_RADIO: + RadVar=element.TKIntVar.get() + this_rowcol = EncodeRadioRowCol(row_num,col_num) + value = RadVar == this_rowcol + elif element.Type == ELEM_TYPE_BUTTON: + if top_level_form.LastButtonClicked == element.ButtonText: + button_pressed_text = top_level_form.LastButtonClicked + if element.BType != BUTTON_TYPE_REALTIME: # Do not clear realtime buttons + top_level_form.LastButtonClicked = None + if element.BType == BUTTON_TYPE_CALENDAR_CHOOSER: + try: + value = element.TKCal.selection + except: + value = None + else: + try: + value = element.TKStringVar.get() + except: + value = None + elif element.Type == ELEM_TYPE_INPUT_COMBO: + value=element.TKStringVar.get() + elif element.Type == ELEM_TYPE_INPUT_OPTION_MENU: + value=element.TKStringVar.get() + elif element.Type == ELEM_TYPE_INPUT_LISTBOX: + try: + items=element.TKListbox.curselection() + value = [element.Values[int(item)] for item in items] + except: + value = '' + elif element.Type == ELEM_TYPE_INPUT_SPIN: + try: + value=element.TKStringVar.get() + except: + value = 0 + elif element.Type == ELEM_TYPE_INPUT_SLIDER: + try: + value=element.TKIntVar.get() + except: + value = 0 + elif element.Type == ELEM_TYPE_INPUT_MULTILINE: + try: + value=element.TKText.get(1.0, tk.END) + if not top_level_form.NonBlocking and not element.do_not_clear and not top_level_form.ReturnKeyboardEvents: + element.TKText.delete('1.0', tk.END) + except: + value = None + else: + value = None + + # if an input type element, update the results + if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ + element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and \ + element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME and element.Type != ELEM_TYPE_TAB_GROUP \ + and element.Type != ELEM_TYPE_TAB: + AddToReturnList(form, value) + AddToReturnDictionary(top_level_form, element, value) + elif (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_CALENDAR_CHOOSER and element.Target == (None,None)) or \ + (element.Type == ELEM_TYPE_BUTTON and element.BType == BUTTON_TYPE_COLOR_CHOOSER and element.Target == (None,None)) or \ + (element.Type == ELEM_TYPE_BUTTON and element.Key is not None and (element.BType in (BUTTON_TYPE_SAVEAS_FILE, BUTTON_TYPE_BROWSE_FILE, BUTTON_TYPE_BROWSE_FILES, BUTTON_TYPE_BROWSE_FOLDER))): + AddToReturnList(form, value) + AddToReturnDictionary(top_level_form, element, value) + + # if this is a column, then will fail so need to wrap with tr + try: + if form.ReturnKeyboardEvents and form.LastKeyboardEvent is not None: + button_pressed_text = form.LastKeyboardEvent + form.LastKeyboardEvent = None + except: pass + + try: + form.ReturnValuesDictionary.pop(None, None) # clean up dictionary include None was included + except: pass + + if not form.UseDictionary: + form.ReturnValues = button_pressed_text, form.ReturnValuesList + else: + form.ReturnValues = button_pressed_text, form.ReturnValuesDictionary + + return form.ReturnValues + +def FillFormWithValues(form, values_dict): + FillSubformWithValues(form, values_dict) + +def FillSubformWithValues(form, values_dict): + for row_num,row in enumerate(form.Rows): + for col_num, element in enumerate(row): + value = None + if element.Type == ELEM_TYPE_COLUMN: + FillSubformWithValues(element, values_dict) + if element.Type == ELEM_TYPE_FRAME: + FillSubformWithValues(element, values_dict) + if element.Type == ELEM_TYPE_TAB_GROUP: + FillSubformWithValues(element, values_dict) + if element.Type == ELEM_TYPE_TAB: + FillSubformWithValues(element, values_dict) + try: + value = values_dict[element.Key] + except: + continue + if element.Type == ELEM_TYPE_INPUT_TEXT: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_CHECKBOX: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_RADIO: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_COMBO: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_OPTION_MENU: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_LISTBOX: + element.SetValue(value) + elif element.Type == ELEM_TYPE_INPUT_SLIDER: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_MULTILINE: + element.Update(value) + elif element.Type == ELEM_TYPE_INPUT_SPIN: + element.Update(value) + elif element.Type == ELEM_TYPE_BUTTON: + element.Update(value) + +def _FindElementFromKeyInSubForm(form, key): + for row_num, row in enumerate(form.Rows): + for col_num, element in enumerate(row): + if element.Type == ELEM_TYPE_COLUMN: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem + if element.Type == ELEM_TYPE_FRAME: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem + if element.Type == ELEM_TYPE_TAB_GROUP: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem + if element.Type == ELEM_TYPE_TAB: + matching_elem = _FindElementFromKeyInSubForm(element, key) + if matching_elem is not None: + return matching_elem + if element.Key == key: + return element + + +def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False): + if type(sub_menu_info) is str: + if not is_sub_menu and not skip: + # print(f'Adding command {sub_menu_info}') + top_menu.add_command(label=sub_menu_info, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + else: + i = 0 + while i < (len(sub_menu_info)): + item = sub_menu_info[i] + if i != len(sub_menu_info) - 1: + if type(sub_menu_info[i+1]) == list: + new_menu = tk.Menu(top_menu, tearoff=element.Tearoff) + top_menu.add_cascade(label=sub_menu_info[i], menu=new_menu) + AddMenuItem(new_menu, sub_menu_info[i+1], element, is_sub_menu=True) + i += 1 # skip the next one + else: + AddMenuItem(top_menu, item, element) + else: + AddMenuItem(top_menu, item, element) + i += 1 + +# ------------------------------------------------------------------------------------------------------------------ # +# ===================================== TK CODE STARTS HERE ====================================================== # +# ------------------------------------------------------------------------------------------------------------------ # + +def PackFormIntoFrame(form, containing_frame, toplevel_form): + def CharWidthInPixels(): + return tkinter.font.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 + # --------------------------------------------------------------------------- # + # **************** Use FlexForm to build the tkinter window ********** ----- # + # Building is done row by row. # + # --------------------------------------------------------------------------- # + focus_set = False + ######################### LOOP THROUGH ROWS ######################### + # *********** ------- Loop through ROWS ------- ***********# + for row_num, flex_row in enumerate(form.Rows): + ######################### LOOP THROUGH ELEMENTS ON ROW ######################### + # *********** ------- Loop through ELEMENTS ------- ***********# + # *********** Make TK Row ***********# + tk_row_frame = tk.Frame(containing_frame) + for col_num, element in enumerate(flex_row): + element.ParentForm = toplevel_form # save the button's parent form object + if toplevel_form.Font and (element.Font == DEFAULT_FONT or not element.Font): + font = toplevel_form.Font + elif element.Font is not None: + font = element.Font + else: + font = DEFAULT_FONT + # ------- Determine Auto-Size setting on a cascading basis ------- # + if element.AutoSizeText is not None: # if element overide + auto_size_text = element.AutoSizeText + elif toplevel_form.AutoSizeText is not None: # if form override + auto_size_text = toplevel_form.AutoSizeText + else: + auto_size_text = DEFAULT_AUTOSIZE_TEXT + element_type = element.Type + # Set foreground color + text_color = element.TextColor + # Determine Element size + element_size = element.Size + if (element_size == (None, None) and element_type != ELEM_TYPE_BUTTON): # user did not specify a size + element_size = toplevel_form.DefaultElementSize + elif (element_size == (None, None) and element_type == ELEM_TYPE_BUTTON): + element_size = toplevel_form.DefaultButtonElementSize + else: auto_size_text = False # if user has specified a size then it shouldn't autosize + # ------------------------- COLUMN element ------------------------- # + if element_type == ELEM_TYPE_COLUMN: + if element.Scrollable: + col_frame = TkScrollableFrame(tk_row_frame) # do not use yet! not working + PackFormIntoFrame(element, col_frame.TKFrame, toplevel_form) + col_frame.TKFrame.update() + if element.Size == (None, None): # if no size specified, use column width x column height/2 + col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth(),height=col_frame.TKFrame.winfo_reqheight()/2) + else: + col_frame.canvas.config(width=element.Size[0],height=element.Size[1]) + + if not element.BackgroundColor in (None, COLOR_SYSTEM_DEFAULT): + col_frame.canvas.config(background=element.BackgroundColor) + col_frame.TKFrame.config(background=element.BackgroundColor, borderwidth =0, highlightthickness=0) + col_frame.config(background=element.BackgroundColor, borderwidth =0, highlightthickness=0) + else: + col_frame = tk.Frame(tk_row_frame) + PackFormIntoFrame(element, col_frame, toplevel_form) + + col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) + + # ------------------------- TEXT element ------------------------- # + elif element_type == ELEM_TYPE_TEXT: + # auto_size_text = element.AutoSizeText + display_text = element.DisplayText # text to display + if auto_size_text is False: + width, height=element_size + else: + lines = display_text.split('\n') + max_line_len = max([len(l) for l in lines]) + num_lines = len(lines) + if max_line_len > element_size[0]: # if text exceeds element size, the will have to wrap + width = element_size[0] + else: + width=max_line_len + height=num_lines + # ---===--- LABEL widget create and place --- # + stringvar = tk.StringVar() + element.TKStringVar = stringvar + stringvar.set(display_text) + if auto_size_text: + width = 0 + if element.Justification is not None: + justification = element.Justification + elif toplevel_form.TextJustification is not None: + justification = toplevel_form.TextJustification + else: + justification = DEFAULT_TEXT_JUSTIFICATION + justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT + anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE + tktext_label = tk.Label(tk_row_frame, textvariable=stringvar, width=width, height=height, justify=justify, bd=border_depth, font=font) + # Set wrap-length for text (in PIXELS) == PAIN IN THE ASS + wraplen = tktext_label.winfo_reqwidth()+40 # width of widget in Pixels + if not auto_size_text and height == 1: + wraplen = 0 + # print("wraplen, width, height", wraplen, width, height) + tktext_label.configure(anchor=anchor, wraplen=wraplen) # set wrap to width of widget + if element.Relief is not None: + tktext_label.configure(relief=element.Relief) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + tktext_label.configure(background=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + tktext_label.configure(fg=element.TextColor) + tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], expand=True) + element.TKText = tktext_label + if element.ClickSubmits: + tktext_label.bind('', element.TextClickedHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKText, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- BUTTON element ------------------------- # + elif element_type == ELEM_TYPE_BUTTON: + stringvar = tk.StringVar() + element.TKStringVar = stringvar + element.Location = (row_num, col_num) + btext = element.ButtonText + btype = element.BType + if element.AutoSizeButton is not None: + auto_size = element.AutoSizeButton + else: auto_size = toplevel_form.AutoSizeButtons + if auto_size is False or element.Size[0] is not None: + width, height = element_size + else: + width = 0 + height= toplevel_form.DefaultButtonElementSize[1] + if element.ButtonColor != (None, None)and element.ButtonColor != DEFAULT_BUTTON_COLOR: + bc = element.ButtonColor + elif toplevel_form.ButtonColor != (None, None) and toplevel_form.ButtonColor != DEFAULT_BUTTON_COLOR: + bc = toplevel_form.ButtonColor + else: + bc = DEFAULT_BUTTON_COLOR + border_depth = element.BorderWidth + if btype != BUTTON_TYPE_REALTIME: + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height,command=element.ButtonCallBack, justify=tk.LEFT, bd=border_depth, font=font) + else: + tkbutton = tk.Button(tk_row_frame, text=btext, width=width, height=height, justify=tk.LEFT, bd=border_depth, font=font) + tkbutton.bind('', element.ButtonReleaseCallBack) + tkbutton.bind('', element.ButtonPressCallBack) + if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: + tkbutton.config(foreground=bc[0], background=bc[1]) + element.TKButton = tkbutton # not used yet but save the TK button in case + wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels + if element.ImageFilename: # if button has an image on it + tkbutton.config(highlightthickness=0) + photo = tk.PhotoImage(file=element.ImageFilename) + if element.ImageSize != (None, None): + width, height = element.ImageSize + if element.ImageSubsample: + photo = photo.subsample(element.ImageSubsample) + else: + width, height = photo.width(), photo.height() + tkbutton.config(image=photo, width=width, height=height) + tkbutton.image = photo + if width != 0: + tkbutton.configure(wraplength=wraplen+10) # set wrap to width of widget + tkbutton.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.BindReturnKey: + element.TKButton.bind('', element.ReturnKeyHandler) + if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): + focus_set = True + element.TKButton.bind('', element.ReturnKeyHandler) + element.TKButton.focus_set() + toplevel_form.TKroot.focus_force() + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKButton, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- INPUT (Single Line) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_TEXT: + default_text = element.DefaultText + element.TKStringVar = tk.StringVar() + element.TKStringVar.set(default_text) + show = element.PasswordCharacter if element.PasswordCharacter else "" + if element.Justification is not None: + justification = element.Justification + else: + justification = DEFAULT_TEXT_JUSTIFICATION + justify = tk.LEFT if justification == 'left' else tk.CENTER if justification == 'center' else tk.RIGHT + # anchor = tk.NW if justification == 'left' else tk.N if justification == 'center' else tk.NE + element.TKEntry = tk.Entry(tk_row_frame, width=element_size[0], textvariable=element.TKStringVar, bd=border_depth, font=font, show=show, justify=justify) + element.TKEntry.bind('', element.ReturnKeyHandler) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKEntry.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKEntry.configure(fg=text_color) + element.TKEntry.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='x') + if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): + focus_set = True + element.TKEntry.focus_set() + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKEntry, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- COMBO BOX (Drop Down) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_COMBO: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + element.TKStringVar = tk.StringVar() + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + combostyle = ttk.Style() + try: + combostyle.theme_create('combostyle', + settings={'TCombobox': + {'configure': + {'selectbackground': element.BackgroundColor, + 'fieldbackground': element.BackgroundColor, + 'foreground': text_color, + 'background': element.BackgroundColor} + }}) + except: + try: + combostyle.theme_settings('combostyle', + settings={'TCombobox': + {'configure': + {'selectbackground': element.BackgroundColor, + 'fieldbackground': element.BackgroundColor, + 'foreground': text_color, + 'background': element.BackgroundColor} + }}) + except: pass + # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox + combostyle.theme_use('combostyle') + element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar,font=font ) + if element.Size[1] != 1 and element.Size[1] is not None: + element.TKCombo.configure(height=element.Size[1]) + # element.TKCombo['state']='readonly' + element.TKCombo['values'] = element.Values + if element.InitializeAsDisabled: + element.TKCombo['state'] = 'disabled' + # if element.BackgroundColor is not None: + # element.TKCombo.configure(background=element.BackgroundColor) + element.TKCombo.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.DefaultValue: + for i, v in enumerate(element.Values): + if v == element.DefaultValue: + element.TKCombo.current(i) + break + else: + element.TKCombo.current(0) + if element.ChangeSubmits: + element.TKCombo.bind('<>', element.ComboboxSelectHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKCombo, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- OPTION MENU (Like ComboBox but different) element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_OPTION_MENU: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + element.TKStringVar = tk.StringVar() + default = element.DefaultValue if element.DefaultValue else element.Values[0] + element.TKStringVar.set(default) + element.TKOptionMenu = tk.OptionMenu(tk_row_frame, element.TKStringVar ,*element.Values) + element.TKOptionMenu.config(highlightthickness=0, font=font, width=width ) + element.TKOptionMenu.config(borderwidth=border_depth) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKOptionMenu.configure(background=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + element.TKOptionMenu.configure(fg=element.TextColor) + element.TKOptionMenu.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKOptionMenu, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- LISTBOX element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_LISTBOX: + max_line_len = max([len(str(l)) for l in element.Values]) + if auto_size_text is False: width=element_size[0] + else: width = max_line_len + listbox_frame = tk.Frame(tk_row_frame) + element.TKStringVar = tk.StringVar() + element.TKListbox= tk.Listbox(listbox_frame, height=element_size[1], width=width, selectmode=element.SelectMode, font=font) + for index, item in enumerate(element.Values): + element.TKListbox.insert(tk.END, item) + if element.DefaultValues is not None and item in element.DefaultValues: + element.TKListbox.selection_set(index) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKListbox.configure(background=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKListbox.configure(fg=text_color) + if element.ChangeSubmits: + element.TKListbox.bind('<>', element.ListboxSelectHandler) + vsb = tk.Scrollbar(listbox_frame, orient="vertical", command=element.TKListbox.yview) + element.TKListbox.configure(yscrollcommand=vsb.set) + element.TKListbox.pack(side=tk.LEFT) + vsb.pack(side=tk.LEFT, fill='y') + listbox_frame.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.BindReturnKey: + element.TKListbox.bind('', element.ReturnKeyHandler) + element.TKListbox.bind('', element.ReturnKeyHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKListbox, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- INPUT MULTI LINE element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_MULTILINE: + default_text = element.DefaultText + width, height = element_size + element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) + element.TKText.insert(1.0, default_text) # set the default text + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKText.configure(background=element.BackgroundColor) + element.TKText.vbar.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) + element.TKText.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') + if element.EnterSubmits: + element.TKText.bind('', element.ReturnKeyHandler) + if element.Focus is True or (toplevel_form.UseDefaultFocus and not focus_set): + focus_set = True + element.TKText.focus_set() + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKText.configure(fg=text_color) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKText, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- INPUT CHECKBOX element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_CHECKBOX: + width = 0 if auto_size_text else element_size[0] + default_value = element.InitialState + element.TKIntVar = tk.IntVar() + element.TKIntVar.set(default_value if default_value is not None else 0) + element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) + if default_value is None: + element.TKCheckbutton.configure(state='disable') + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKCheckbutton.configure(background=element.BackgroundColor) + element.TKCheckbutton.configure(selectcolor=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKCheckbutton.configure(fg=text_color) + element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKCheckbutton, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- PROGRESS BAR element ------------------------- # + elif element_type == ELEM_TYPE_PROGRESS_BAR: + # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar + width = element_size[0] + fnt = tkinter.font.Font() + char_width = fnt.measure('A') # single character width + progress_length = width*char_width + progress_width = element_size[1] + direction = element.Orientation + if element.BarColor != (None, None): # if element has a bar color, use it + bar_color = element.BarColor + else: + bar_color = DEFAULT_PROGRESS_BAR_COLOR + element.TKProgressBar = TKProgressBar(tk_row_frame, element.MaxValue, progress_length, progress_width, orientation=direction, BarColor=bar_color, border_width=element.BorderWidth, relief=element.Relief, style=element.BarStyle ) + element.TKProgressBar.TKProgressBarForReal.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + # ------------------------- INPUT RADIO BUTTON element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_RADIO: + width = 0 if auto_size_text else element_size[0] + default_value = element.InitialState + ID = element.GroupID + # see if ID has already been placed + value = EncodeRadioRowCol(row_num, col_num) # value to set intvar to if this radio is selected + if ID in toplevel_form.RadioDict: + RadVar = toplevel_form.RadioDict[ID] + else: + RadVar = tk.IntVar() + toplevel_form.RadioDict[ID] = RadVar + element.TKIntVar = RadVar # store the RadVar in Radio object + if default_value: # if this radio is the one selected, set RadVar to match + element.TKIntVar.set(value) + element.TKRadio = tk.Radiobutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, + variable=element.TKIntVar, value=value, bd=border_depth, font=font) + if not element.BackgroundColor in (None, COLOR_SYSTEM_DEFAULT): + element.TKRadio.configure(background=element.BackgroundColor) + element.TKRadio.configure(selectcolor=element.BackgroundColor) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKRadio.configure(fg=text_color) + element.TKRadio.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKRadio, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- INPUT SPIN Box element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_SPIN: + width, height = element_size + width = 0 if auto_size_text else element_size[0] + element.TKStringVar = tk.StringVar() + element.TKSpinBox = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth) + element.TKStringVar.set(element.DefaultValue) + element.TKSpinBox.configure(font=font) # set wrap to width of widget + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKSpinBox.configure(background=element.BackgroundColor) + element.TKSpinBox.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + element.TKSpinBox.configure(fg=text_color) + if element.ChangeSubmits: + element.TKSpinBox.bind('', element.SpinChangedHandler) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKSpinBox, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- OUTPUT element ------------------------- # + elif element_type == ELEM_TYPE_OUTPUT: + width, height = element_size + element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font, pad=element.Pad) + element.TKOut.pack(side=tk.LEFT, expand=True, fill='both') + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKOut, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- IMAGE Box element ------------------------- # + elif element_type == ELEM_TYPE_IMAGE: + if element.Filename is not None: + photo = tk.PhotoImage(file=element.Filename) + elif element.Data is not None: + photo = tk.PhotoImage(data=element.Data) + else: + photo = None + print('*ERROR laying out form.... Image Element has no image specified*') + + if photo is not None: + if element_size == (None, None) or element_size == None or element_size == toplevel_form.DefaultElementSize: + width, height = photo.width(), photo.height() + else: + width, height = element_size + if photo is not None: + element.tktext_label = tk.Label(tk_row_frame, image=photo, width=width, height=height, bd=border_depth) + else: + element.tktext_label = tk.Label(tk_row_frame, width=width, height=height, bd=border_depth) + element.tktext_label.image = photo + # tktext_label.configure(anchor=tk.NW, image=photo) + element.tktext_label.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.tktext_label, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- Canvas element ------------------------- # + elif element_type == ELEM_TYPE_CANVAS: + width, height = element_size + if element._TKCanvas is None: + element._TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + else: + element._TKCanvas.master = tk_row_frame + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element._TKCanvas.configure(background=element.BackgroundColor, highlightthickness=0) + element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element._TKCanvas, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- Graph element ------------------------- # + elif element_type == ELEM_TYPE_GRAPH: + width, height = element_size + if element._TKCanvas is None: + element._TKCanvas = tk.Canvas(tk_row_frame, width=width, height=height, bd=border_depth) + else: + element._TKCanvas.master = tk_row_frame + element._TKCanvas2 = tk.Canvas(element._TKCanvas, width=width, height=height, bd=border_depth) + element._TKCanvas2.pack(side=tk.LEFT) + element._TKCanvas2.addtag_all('mytag') + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element._TKCanvas2.configure(background=element.BackgroundColor, highlightthickness=0) + element._TKCanvas.configure(background=element.BackgroundColor, highlightthickness=0) + element._TKCanvas.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element._TKCanvas, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- MENUBAR element ------------------------- # + elif element_type == ELEM_TYPE_MENUBAR: + menu_def = (('File', ('Open', 'Save')), + ('Help', 'About...'),) + # ('Help',)) + + menu_def = element.MenuDefinition + + element.TKMenu = tk.Menu(toplevel_form.TKroot, tearoff=element.Tearoff) # create the menubar + menubar = element.TKMenu + for menu_entry in menu_def: + # print(f'Adding a Menubar ENTRY') + baritem = tk.Menu(menubar, tearoff=element.Tearoff) + menubar.add_cascade(label=menu_entry[0], menu=baritem) + if len(menu_entry) > 1: + AddMenuItem(baritem, menu_entry[1], element) + + toplevel_form.TKroot.configure(menu=element.TKMenu) + # ------------------------- Frame element ------------------------- # + elif element_type == ELEM_TYPE_FRAME: + labeled_frame = tk.LabelFrame(tk_row_frame, text=element.Title, relief=element.Relief) + PackFormIntoFrame(element, labeled_frame, toplevel_form) + labeled_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + labeled_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor, highlightcolor=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + labeled_frame.configure(foreground=element.TextColor) + if font is not None: + labeled_frame.configure(font=font) + if element.TitleLocation is not None: + labeled_frame.configure(labelanchor=element.TitleLocation) + if element.BorderWidth is not None: + labeled_frame.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(labeled_frame, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- Tab element ------------------------- # + elif element_type == ELEM_TYPE_TAB: + element.TKFrame = tk.Frame(form.TKNotebook) + PackFormIntoFrame(element, element.TKFrame, toplevel_form) + form.TKNotebook.add(element.TKFrame, text=element.Title) + form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) + + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + element.TKFrame.configure(background=element.BackgroundColor, + highlightbackground=element.BackgroundColor, + highlightcolor=element.BackgroundColor) + # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + # element.TKFrame.configure(foreground=element.TextColor) + if element.BorderWidth is not None: + element.TKFrame.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, + timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- TabGroup element ------------------------- # + elif element_type == ELEM_TYPE_TAB_GROUP: + element.TKNotebook = ttk.Notebook(tk_row_frame) + PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form) + + # element.TKNotebook.pack(side=tk.LEFT) + # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + # element.TKNotebook.configure(background=element.BackgroundColor, + # highlightbackground=element.BackgroundColor, + # highlightcolor=element.BackgroundColor) + # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + # element.TKNotebook.configure(foreground=element.TextColor) + if element.BorderWidth is not None: + element.TKNotebook.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip, + timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- SLIDER Box element ------------------------- # + elif element_type == ELEM_TYPE_INPUT_SLIDER: + slider_length = element_size[0] * CharWidthInPixels() + slider_width = element_size[1] + element.TKIntVar = tk.IntVar() + element.TKIntVar.set(element.DefaultValue) + if element.Orientation[0] == 'v': + range_from = element.Range[1] + range_to = element.Range[0] + slider_length += DEFAULT_MARGINS[1]*(element_size[0]*2) # add in the padding + else: + range_from = element.Range[0] + range_to = element.Range[1] + if element.ChangeSubmits: + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font, command=element.SliderChangedHandler) + else: + tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar, from_=range_from, to_=range_to, resolution = element.Resolution, length=slider_length, width=slider_width , bd=element.BorderWidth, relief=element.Relief, font=font) + tkscale.config(highlightthickness=0) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + tkscale.configure(background=element.BackgroundColor) + if DEFAULT_SCROLLBAR_COLOR != COLOR_SYSTEM_DEFAULT: + tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR) + if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: + tkscale.configure(fg=text_color) + tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1]) + element.TKScale = tkscale + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKScale, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + # ------------------------- TABLE element ------------------------- # + elif element_type == ELEM_TYPE_TABLE: + width, height = element_size + if element.Justification == 'left': + anchor = tk.W + elif element.Justification == 'right': + anchor = tk.E + else: + anchor = tk.CENTER + column_widths = {} + for row in element.Values: + for i,col in enumerate(row): + col_width = min(len(str(col)), element.MaxColumnWidth) + try: + if col_width > column_widths[i]: + column_widths[i] = col_width + except: + column_widths[i] = col_width + if element.ColumnsToDisplay is None: + displaycolumns = element.ColumnHeadings + else: + displaycolumns = [] + for i, should_display in enumerate(element.ColumnsToDisplay): + if should_display: + displaycolumns.append(element.ColumnHeadings[i]) + column_headings= element.ColumnHeadings + if element.DisplayRowNumbers: # if display row number, tack on the numbers to front of columns + displaycolumns = ['Row',] + displaycolumns + column_headings = ['Row',] + element.ColumnHeadings + element.TKTreeview = ttk.Treeview(tk_row_frame, columns=column_headings, + displaycolumns=displaycolumns, show='headings', height=height, selectmode=element.SelectMode) + treeview = element.TKTreeview + if element.DisplayRowNumbers: + treeview.heading('Row', text='Row') # make a dummy heading + treeview.column('Row', width=50, anchor=anchor) + for i, heading in enumerate(element.ColumnHeadings): + treeview.heading(heading, text=heading) + if element.AutoSizeColumns: + width = max(column_widths[i], len(heading)) + else: + try: + width = element.ColumnWidths[i] + except: + width = element.DefaultColumnWidth + + treeview.column(heading, width=width*CharWidthInPixels(), anchor=anchor) + for i, value in enumerate(element.Values): + if element.DisplayRowNumbers: + value = [i] + value + id = treeview.insert('', 'end', text=value, values=value) + if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + element.TKTreeview.configure(background=element.BackgroundColor) + # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') + element.TKTreeview.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKTreeview, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + #............................DONE WITH ROW pack the row of widgets ..........................# + # done with row, pack the row of widgets + # tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0]) + tk_row_frame.pack(side=tk.TOP, anchor='nw', padx=DEFAULT_MARGINS[0], expand=True) + if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: + tk_row_frame.configure(background=form.BackgroundColor) + if not toplevel_form.IsTabbedForm: + toplevel_form.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + else: toplevel_form.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + return + + +def ConvertFlexToTK(MyFlexForm): + master = MyFlexForm.TKroot + # only set title on non-tabbed forms + if not MyFlexForm.IsTabbedForm: + master.title(MyFlexForm.Title) + InitializeResults(MyFlexForm) + try: + if MyFlexForm.NoTitleBar: + MyFlexForm.TKroot.wm_overrideredirect(True) + except: + pass + PackFormIntoFrame(MyFlexForm, master, MyFlexForm) + #....................................... DONE creating and laying out window ..........................# + if MyFlexForm.IsTabbedForm: + master = MyFlexForm.ParentWindow + screen_width = master.winfo_screenwidth() # get window info to move to middle of screen + screen_height = master.winfo_screenheight() + if MyFlexForm.Location != (None, None): + x,y = MyFlexForm.Location + elif DEFAULT_WINDOW_LOCATION != (None, None): + x,y = DEFAULT_WINDOW_LOCATION + else: + master.update_idletasks() # don't forget to do updates or values are bad + win_width = master.winfo_width() + win_height = master.winfo_height() + x = screen_width/2 -win_width/2 + y = screen_height/2 - win_height/2 + if y+win_height > screen_height: + y = screen_height-win_height + if x+win_width > screen_width: + x = screen_width-win_width + + move_string = '+%i+%i'%(int(x),int(y)) + master.geometry(move_string) + + master.update_idletasks() # don't forget + + return + + +# ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# +def StartupTK(my_flex_form): + global _my_windows + + ow = _my_windows.NumOpenWindows + # print('Starting TK open Windows = {}'.format(ow)) + root = tk.Tk() if not ow else tk.Toplevel() + try: + root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' + except: + pass + # root.wm_overrideredirect(True) + if my_flex_form.BackgroundColor is not None and my_flex_form.BackgroundColor != COLOR_SYSTEM_DEFAULT: + root.configure(background=my_flex_form.BackgroundColor) + _my_windows.Increment() + + my_flex_form.TKroot = root + # Make moveable window + if (my_flex_form.GrabAnywhere is not False and not (my_flex_form.NonBlocking and my_flex_form.GrabAnywhere is not True)): + root.bind("", my_flex_form.StartMove) + root.bind("", my_flex_form.StopMove) + root.bind("", my_flex_form.OnMotion) + + if my_flex_form.KeepOnTop: + root.wm_attributes("-topmost", 1) + + # root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback()) + # root.bind('', MyFlexForm.DestroyedCallback()) + ConvertFlexToTK(my_flex_form) + + my_flex_form.SetIcon(my_flex_form.WindowIcon) + + try: + root.attributes('-alpha', 255) # hide window while building it. makes for smoother 'paint' + except: + pass + + if my_flex_form.ReturnKeyboardEvents and not my_flex_form.NonBlocking: + root.bind("", my_flex_form._KeyboardCallback) + root.bind("", my_flex_form._MouseWheelCallback) + elif my_flex_form.ReturnKeyboardEvents: + root.bind("", my_flex_form._KeyboardCallback) + root.bind("", my_flex_form._MouseWheelCallback) + + if my_flex_form.AutoClose: + duration = DEFAULT_AUTOCLOSE_TIME if my_flex_form.AutoCloseDuration is None else my_flex_form.AutoCloseDuration + my_flex_form.TKAfterID = root.after(duration * 1000, my_flex_form._AutoCloseAlarmCallback) + if my_flex_form.NonBlocking: + my_flex_form.TKroot.protocol("WM_WINDOW_DESTROYED", my_flex_form.OnClosingCallback()) + else: # it's a blocking form + # print('..... CALLING MainLoop') + my_flex_form.TKroot.mainloop() + # print('..... BACK from MainLoop') + if not my_flex_form.FormRemainedOpen: + _my_windows.Decrement() + if my_flex_form.RootNeedsDestroying: + my_flex_form.TKroot.destroy() + my_flex_form.RootNeedsDestroying = False + return + +# ==============================_GetNumLinesNeeded ==# +# Helper function for determining how to wrap text # +# ===================================================# +def _GetNumLinesNeeded(text, max_line_width): + if max_line_width == 0: + return 1 + lines = text.split('\n') + num_lines = len(lines) # number of original lines of text + max_line_len = max([len(l) for l in lines]) # longest line + lines_used = [] + for L in lines: + lines_used.append(len(L)//max_line_width + (len(L) % max_line_width > 0)) # fancy math to round up + total_lines_needed = sum(lines_used) + return total_lines_needed + +# ============================== PROGRESS METER ========================================== # + +def ConvertArgsToSingleString(*args): + max_line_total, width_used , total_lines, = 0,0,0 + single_line_message = '' + # loop through args and built a SINGLE string from them + for message in args: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = max(longest_line_len, width_used) + max_line_total = max(max_line_total, width_used) + lines_needed = _GetNumLinesNeeded(message, width_used) + total_lines += lines_needed + single_line_message += message + '\n' + return single_line_message, width_used, total_lines + + +# ============================== ProgressMeter =====# +# ===================================================# +def _ProgressMeter(title, max_value, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True, *args): + ''' + Create and show a form on tbe caller's behalf. + :param title: + :param max_value: + :param args: ANY number of arguments the caller wants to display + :param orientation: + :param bar_color: + :param size: + :param Style: + :param StyleOffset: + :return: ProgressBar object that is in the form + ''' + local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation + local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width + bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) + form = FlexForm(title, auto_size_text=True, grab_anywhere=grab_anywhere) + + # Form using a horizontal bar + if local_orientation[0].lower() == 'h': + single_line_message, width, height = ConvertArgsToSingleString(*args) + bar2.TextToDisplay = single_line_message + bar2.MaxValue = max_value + bar2.CurrentValue = 0 + bar_text = Text(single_line_message, size=(width, height + 3), auto_size_text=True) + form.AddRow(bar_text) + form.AddRow((bar2)) + form.AddRow((Cancel(button_color=button_color))) + else: + single_line_message, width, height = ConvertArgsToSingleString(*args) + bar2.TextToDisplay = single_line_message + bar2.MaxValue = max_value + bar2.CurrentValue = 0 + bar_text = Text(single_line_message, size=(width, height + 3), auto_size_text=True) + form.AddRow(bar2, bar_text) + form.AddRow((Cancel(button_color=button_color))) + + form.NonBlocking = True + form.Show(non_blocking= True) + return bar2, bar_text + +# ============================== ProgressMeterUpdate =====# +def _ProgressMeterUpdate(bar, value, text_elem, *args): + ''' + Update the progress meter for a form + :param form: class ProgressBar + :param value: int + :return: True if not cancelled, OK....False if Error + ''' + global _my_windows + if bar == None: return False + if bar.BarExpired: return False + message, w, h = ConvertArgsToSingleString(*args) + text_elem.Update(message) + # bar.TextToDisplay = message + bar.CurrentValue = value + rc = bar.UpdateBar(value) + if value >= bar.MaxValue or not rc: + bar.BarExpired = True + bar.ParentForm._Close() + if rc: # if update was OK but bar expired, decrement num windows + _my_windows.Decrement() + if bar.ParentForm.RootNeedsDestroying: + try: + bar.ParentForm.TKroot.destroy() + # _my_windows.Decrement() + except: pass + bar.ParentForm.RootNeedsDestroying = False + bar.ParentForm.__del__() + return False + + return rc + +# ============================== EASY PROGRESS METER ========================================== # +# class to hold the easy meter info (a global variable essentialy) +class EasyProgressMeterDataClass(): + def __init__(self, title='', current_value=1, max_value=10, start_time=None, stat_messages=()): + self.Title = title + self.CurrentValue = current_value + self.MaxValue = max_value + self.StartTime = start_time + self.StatMessages = stat_messages + self.ParentForm = None + self.MeterID = None + self.MeterText = None + + # =========================== COMPUTE PROGRESS STATS ======================# + def ComputeProgressStats(self): + utc = datetime.datetime.utcnow() + time_delta = utc - self.StartTime + total_seconds = time_delta.total_seconds() + if not total_seconds: + total_seconds = 1 + try: + time_per_item = total_seconds / self.CurrentValue + except: + time_per_item = 1 + seconds_remaining = (self.MaxValue - self.CurrentValue) * time_per_item + time_remaining = str(datetime.timedelta(seconds=seconds_remaining)) + time_remaining_short = (time_remaining).split(".")[0] + time_delta_short = str(time_delta).split(".")[0] + total_time = time_delta + datetime.timedelta(seconds=seconds_remaining) + total_time_short = str(total_time).split(".")[0] + self.StatMessages = [ + '{} of {}'.format(self.CurrentValue, self.MaxValue), + '{} %'.format(100*self.CurrentValue//self.MaxValue), + '', + ' {:6.2f} Iterations per Second'.format(self.CurrentValue/total_seconds), + ' {:6.2f} Seconds per Iteration'.format(total_seconds/(self.CurrentValue if self.CurrentValue else 1)), + '', + '{} Elapsed Time'.format(time_delta_short), + '{} Time Remaining'.format(time_remaining_short), + '{} Estimated Total Time'.format(total_time_short)] + return + + +# ============================== EasyProgressMeter =====# +def EasyProgressMeter(title, current_value, max_value, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, *args): + ''' + A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second + function call before your loop. You've got enough code to write! + :param title: Title will be shown on the window + :param current_value: Current count of your items + :param max_value: Max value your count will ever reach. This indicates it should be closed + :param args: VARIABLE number of arguements... you request it, we'll print it no matter what the item! + :param orientation: + :param bar_color: + :param size: + :param Style: + :param StyleOffset: + :return: False if should stop the meter + ''' + local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if not border_width else border_width + # STATIC VARIABLE! + # This is a very clever form of static variable using a function attribute + # If the variable doesn't yet exist, then it will create it and initialize with the 3rd parameter + EasyProgressMeter.Data = getattr(EasyProgressMeter, 'Data', EasyProgressMeterDataClass()) + # if no meter currently running + if EasyProgressMeter.Data.MeterID is None: # Starting a new meter + print("Please change your call of EasyProgressMeter to use OneLineProgressMeter. EasyProgressMeter will be removed soon") + if int(current_value) >= int(max_value): + return False + del(EasyProgressMeter.Data) + EasyProgressMeter.Data = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) + EasyProgressMeter.Data.ComputeProgressStats() + message = "\n".join([line for line in EasyProgressMeter.Data.StatMessages]) + EasyProgressMeter.Data.MeterID, EasyProgressMeter.Data.MeterText= _ProgressMeter(title, int(max_value), message, *args, orientation=orientation, bar_color=bar_color, size=size, button_color=button_color, border_width=local_border_width) + EasyProgressMeter.Data.ParentForm = EasyProgressMeter.Data.MeterID.ParentForm + return True + # if exactly the same values as before, then ignore. + if EasyProgressMeter.Data.MaxValue == max_value and EasyProgressMeter.Data.CurrentValue == current_value: + return True + if EasyProgressMeter.Data.MaxValue != int(max_value): + EasyProgressMeter.Data.MeterID = None + EasyProgressMeter.Data.ParentForm = None + del(EasyProgressMeter.Data) + EasyProgressMeter.Data = EasyProgressMeterDataClass() # setup a new progress meter + return True # HAVE to return TRUE or else the new meter will thing IT is failing when it hasn't + EasyProgressMeter.Data.CurrentValue = int(current_value) + EasyProgressMeter.Data.MaxValue = int(max_value) + EasyProgressMeter.Data.ComputeProgressStats() + message = '' + for line in EasyProgressMeter.Data.StatMessages: + message = message + str(line) + '\n' + message = "\n".join(EasyProgressMeter.Data.StatMessages) + args= args + (message,) + rc = _ProgressMeterUpdate(EasyProgressMeter.Data.MeterID, current_value, + EasyProgressMeter.Data.MeterText, *args) + # if counter >= max then the progress meter is all done. Indicate none running + if current_value >= EasyProgressMeter.Data.MaxValue or not rc: + EasyProgressMeter.Data.MeterID = None + del(EasyProgressMeter.Data) + EasyProgressMeter.Data = EasyProgressMeterDataClass() # setup a new progress meter + return False # even though at the end, return True so don't cause error with the app + return rc # return whatever the update told us + + +def EasyProgressMeterCancel(title, *args): + EasyProgressMeter.EasyProgressMeterData = getattr(EasyProgressMeter, 'EasyProgressMeterData', EasyProgressMeterDataClass()) + if EasyProgressMeter.EasyProgressMeterData.MeterID is not None: + # tell the normal meter update that we're at max value which will close the meter + rc = EasyProgressMeter(title, EasyProgressMeter.EasyProgressMeterData.MaxValue, EasyProgressMeter.EasyProgressMeterData.MaxValue, ' *** CANCELLING ***', 'Caller requested a cancel', *args) + return rc + return True + + +# global variable containing dictionary will all currently running one-line progress meters. +_one_line_progress_meters = {} + +# ============================== OneLineProgressMeter =====# +def OneLineProgressMeter(title, current_value, max_value, key, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True, *args): + + global _one_line_progress_meters + + local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is not None else border_width + try: + meter_data = _one_line_progress_meters[key] + except: # a new meater is starting + if int(current_value) >= int(max_value): # if already expired then it's an old meter, ignore + return False + meter_data = EasyProgressMeterDataClass(title, 1, int(max_value), datetime.datetime.utcnow(), []) + _one_line_progress_meters[key] = meter_data + meter_data.ComputeProgressStats() + message = "\n".join([line for line in meter_data.StatMessages]) + meter_data.MeterID, meter_data.MeterText= _ProgressMeter(title, int(max_value), message, orientation=orientation, bar_color=bar_color, size=size, button_color=button_color, border_width=local_border_width, grab_anywhere=grab_anywhere,*args) + meter_data.ParentForm = meter_data.MeterID.ParentForm + return True + + # if exactly the same values as before, then ignore, return success. + if meter_data.MaxValue == max_value and meter_data.CurrentValue == current_value: + return True + meter_data.CurrentValue = int(current_value) + meter_data.MaxValue = int(max_value) + meter_data.ComputeProgressStats() + message = '' + for line in meter_data.StatMessages: + message = message + str(line) + '\n' + message = "\n".join(meter_data.StatMessages) + args= args + (message,) + rc = _ProgressMeterUpdate(meter_data.MeterID, current_value, + meter_data.MeterText, *args) + # if counter >= max then the progress meter is all done. Indicate none running + if current_value >= meter_data.MaxValue or not rc: + del _one_line_progress_meters[key] + return False + return rc # return whatever the update told us + + +def OneLineProgressMeterCancel(key): + global _one_line_progress_meters + + try: + meter_data = _one_line_progress_meters[key] + except: # meter is already deleted + return + OneLineProgressMeter('', meter_data.MaxValue, meter_data.MaxValue, key=key) + + + + +# input is #RRGGBB +# output is #RRGGBB +def GetComplimentaryHex(color): + # strip the # from the beginning + color = color[1:] + # convert the string into hex + color = int(color, 16) + # invert the three bytes + # as good as substracting each of RGB component by 255(FF) + comp_color = 0xFFFFFF ^ color + # convert the color back to hex by prefixing a # + comp_color = "#%06X" % comp_color + return comp_color + + + +# ======================== EasyPrint =====# +# ===================================================# +_easy_print_data = None # global variable... I'm cheating + +class DebugWin(): + def __init__(self, size=(None, None)): + # Show a form that's a running counter + win_size = size if size !=(None, None) else DEFAULT_DEBUG_WINDOW_SIZE + self.form = FlexForm('Debug Window', auto_size_text=True, font=('Courier New', 12)) + self.output_element = Output(size=win_size) + self.form_rows = [[Text('EasyPrint Output')], + [self.output_element], + [Quit()]] + self.form.AddRows(self.form_rows) + self.form.Show(non_blocking=True) # Show a ;non-blocking form, returns immediately + return + + def Print(self, end=None, sep=None, *args): + sepchar = sep if sep is not None else ' ' + endchar = end if end is not None else '\n' + # print(sep=sepchar, end=endchar, *args) + # for a in args: + # msg = str(a) + # print(msg, end="", sep=sepchar) + # print(1, 2, 3, sep='-') + # if end is None: + # print("") + self.form.ReadNonBlocking() + + def Close(self): + self.form.CloseNonBlockingForm() + self.form.__del__() + +def Print( size=(None,None), end=None, sep=None, *args): + EasyPrint(size=size, end=end, sep=sep, *args) + +def PrintClose(): + EasyPrintClose() + +def eprint(size=(None,None), end=None, sep=None, *args): + EasyPrint(size=size, end=end, sep=sep, *args) + +def EasyPrint(size=(None,None), end=None, sep=None, *args): + global _easy_print_data + + if _easy_print_data is None: + _easy_print_data = DebugWin(size=size) + _easy_print_data.Print(end=end, sep=sep, *args) + + + +def EasyPrintold(size=(None,None), end=None, sep=None, *args): + if 'easy_print_data' not in EasyPrint.__dict__: # use a function property to save DebugWin object (static variable) + EasyPrint.easy_print_data = DebugWin(size=size) + if EasyPrint.easy_print_data is None: + EasyPrint.easy_print_data = DebugWin(size=size) + EasyPrint.easy_print_data.Print( end=end, sep=sep,*args) + +def EasyPrintClose(): + if 'easy_print_data' in EasyPrint.__dict__: + if EasyPrint.easy_print_data is not None: + EasyPrint.easy_print_data._Close() + EasyPrint.easy_print_data = None + # del EasyPrint.easy_print_data + +# ======================== Scrolled Text Box =====# +# ===================================================# +def ScrolledTextBox(button_color=None, yes_no=False, auto_close=False, auto_close_duration=None, size=(None, None), *args): + if not args: return + width, height = size + width = width if width else MESSAGE_BOX_LINE_WIDTH + with FlexForm(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: + max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 + complete_output = '' + for message in args: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, width) + max_line_total = max(max_line_total, width_used) + max_line_width = width + lines_needed = _GetNumLinesNeeded(message, width_used) + height_computed += lines_needed + complete_output += message + '\n' + total_lines += lines_needed + height_computed = MAX_SCROLLED_TEXT_BOX_HEIGHT if height_computed > MAX_SCROLLED_TEXT_BOX_HEIGHT else height_computed + if height: + height_computed = height + form.AddRow(Multiline(complete_output, size=(max_line_width, height_computed))) + pad = max_line_total-15 if max_line_total > 15 else 1 + # show either an OK or Yes/No depending on paramater + if yes_no: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(), No()) + button, values = form.Read() + return button + else: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color)) + button, values = form.Read() + return button + + +PopupScrolled = ScrolledTextBox + +# ---------------------------------------------------------------------- # +# GetPathBox # +# Pre-made dialog that looks like this roughly # +# MESSAGE # +# __________________________ # +# |__________________________| (BROWSE) # +# (SUBMIT) (CANCEL) # +# RETURNS two values: # +# True/False, path # +# (True if Submit was pressed, false otherwise) # +# ---------------------------------------------------------------------- # + +def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None, None)): + """ + Display popup with text entry field and browse button. Browse for folder + :param message: + :param default_path: + :param no_window: + :param size: + :param button_color: + :param background_color: + :param text_color: + :param icon: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: Contents of text field. None if closed using X + """ + 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, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], + [InputText(default_text=default_path, size=size), FolderBrowse()], + [Ok(), Cancel()]] + + (button, input_values) = form.LayoutAndRead(layout) + if button != 'Ok': + return None + else: + path = input_values[0] + return path + +##################################### +# PopupGetFile # +##################################### +def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display popup with text entry field and browse button. Browse for file + + :param message: + :param default_path: + :param save_as: + :param file_types: + :param no_window: + :param size: + :param button_color: + :param background_color: + :param text_color: + :param icon: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + 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: + filename = tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box + else: + filename = tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box + root.destroy() + return filename + + browse_button = SaveAs(file_types=file_types) if save_as else FileBrowse(file_types=file_types) + + with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, + no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], + [InputText(default_text=default_path, size=size), browse_button], + [Ok(), Cancel()]] + + (button, input_values) = form.LayoutAndRead(layout) + if button != 'Ok': + return None + else: + path = input_values[0] + return path + +##################################### +# PopupGetText # +##################################### +def PopupGetText(message, default_text='', password_char='', size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): + """ + Display Popup with text entry field + :param message: + :param default_text: + :param password_char: + :param size: + :param button_color: + :param background_color: + :param text_color: + :param icon: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: Text entered or None if window was closed + """ + with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, + background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], + [InputText(default_text=default_text, size=size, password_char=password_char)], + [Ok(), Cancel()]] + + (button, input_values) = form.LayoutAndRead(layout) + if button != 'Ok': + return None + else: + return input_values[0] + + +# ============================== SetGlobalIcon ======# +# Sets the icon to be used by default # +# ===================================================# +def SetGlobalIcon(icon): + global _my_windows + + try: + with open(icon, 'r') as icon_file: + pass + except: + raise FileNotFoundError + _my_windows.user_defined_icon = icon + return True + + +# ============================== SetOptions =========# +# Sets the icon to be used by default # +# ===================================================# +def SetOptions(icon=None, button_color=None, element_size=(None,None), button_element_size=(None, None), margins=(None,None), + element_padding=(None,None),auto_size_text=None, auto_size_buttons=None, font=None, border_width=None, + slider_border_width=None, slider_relief=None, slider_orientation=None, + autoclose_time=None, message_box_line_width=None, + progress_meter_border_depth=None, progress_meter_style=None, + progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None, + text_justification=None, background_color=None, element_background_color=None, + text_element_background_color=None, input_elements_background_color=None, input_text_color=None, + scrollbar_color=None, text_color=None, element_text_color = None, debug_win_size=(None,None), window_location=(None,None), + tooltip_time=None): + + global DEFAULT_ELEMENT_SIZE + global DEFAULT_BUTTON_ELEMENT_SIZE + global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term + global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels + global DEFAULT_AUTOSIZE_TEXT + global DEFAULT_AUTOSIZE_BUTTONS + global DEFAULT_FONT + global DEFAULT_BORDER_WIDTH + global DEFAULT_AUTOCLOSE_TIME + global DEFAULT_BUTTON_COLOR + global MESSAGE_BOX_LINE_WIDTH + global DEFAULT_PROGRESS_BAR_BORDER_WIDTH + global DEFAULT_PROGRESS_BAR_STYLE + global DEFAULT_PROGRESS_BAR_RELIEF + global DEFAULT_PROGRESS_BAR_COLOR + global DEFAULT_PROGRESS_BAR_SIZE + global DEFAULT_TEXT_JUSTIFICATION + global DEFAULT_DEBUG_WINDOW_SIZE + global DEFAULT_SLIDER_BORDER_WIDTH + global DEFAULT_SLIDER_RELIEF + global DEFAULT_SLIDER_ORIENTATION + global DEFAULT_BACKGROUND_COLOR + global DEFAULT_INPUT_ELEMENTS_COLOR + global DEFAULT_ELEMENT_BACKGROUND_COLOR + global DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR + global DEFAULT_SCROLLBAR_COLOR + global DEFAULT_TEXT_COLOR + global DEFAULT_WINDOW_LOCATION + global DEFAULT_ELEMENT_TEXT_COLOR + global DEFAULT_INPUT_TEXT_COLOR + global DEFAULT_TOOLTIP_TIME + global _my_windows + + if icon: + try: + with open(icon, 'r') as icon_file: + pass + except: + raise FileNotFoundError + _my_windows.user_defined_icon = icon + + if button_color != None: + DEFAULT_BUTTON_COLOR = button_color + + if element_size != (None,None): + DEFAULT_ELEMENT_SIZE = element_size + + if button_element_size != (None,None): + DEFAULT_BUTTON_ELEMENT_SIZE = button_element_size + + if margins != (None,None): + DEFAULT_MARGINS = margins + + if element_padding != (None,None): + DEFAULT_ELEMENT_PADDING = element_padding + + if auto_size_text != None: + DEFAULT_AUTOSIZE_TEXT = auto_size_text + + if auto_size_buttons != None: + DEFAULT_AUTOSIZE_BUTTONS = auto_size_buttons + + if font !=None: + DEFAULT_FONT = font + + if border_width != None: + DEFAULT_BORDER_WIDTH = border_width + + if autoclose_time != None: + DEFAULT_AUTOCLOSE_TIME = autoclose_time + + if message_box_line_width != None: + MESSAGE_BOX_LINE_WIDTH = message_box_line_width + + if progress_meter_border_depth != None: + DEFAULT_PROGRESS_BAR_BORDER_WIDTH = progress_meter_border_depth + + if progress_meter_style != None: + DEFAULT_PROGRESS_BAR_STYLE = progress_meter_style + + if progress_meter_relief != None: + DEFAULT_PROGRESS_BAR_RELIEF = progress_meter_relief + + if progress_meter_color != None: + DEFAULT_PROGRESS_BAR_COLOR = progress_meter_color + + if progress_meter_size != None: + DEFAULT_PROGRESS_BAR_SIZE = progress_meter_size + + if slider_border_width != None: + DEFAULT_SLIDER_BORDER_WIDTH = slider_border_width + + if slider_orientation != None: + DEFAULT_SLIDER_ORIENTATION = slider_orientation + + if slider_relief != None: + DEFAULT_SLIDER_RELIEF = slider_relief + + if text_justification != None: + DEFAULT_TEXT_JUSTIFICATION = text_justification + + if background_color != None: + DEFAULT_BACKGROUND_COLOR = background_color + + if text_element_background_color != None: + DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = text_element_background_color + + if input_elements_background_color != None: + DEFAULT_INPUT_ELEMENTS_COLOR = input_elements_background_color + + if element_background_color != None: + DEFAULT_ELEMENT_BACKGROUND_COLOR = element_background_color + + if window_location != (None,None): + DEFAULT_WINDOW_LOCATION = window_location + + if debug_win_size != (None,None): + DEFAULT_DEBUG_WINDOW_SIZE = debug_win_size + + if text_color != None: + DEFAULT_TEXT_COLOR = text_color + + if scrollbar_color != None: + DEFAULT_SCROLLBAR_COLOR = scrollbar_color + + if element_text_color != None: + DEFAULT_ELEMENT_TEXT_COLOR = element_text_color + + if input_text_color is not None: + DEFAULT_INPUT_TEXT_COLOR = input_text_color + + if tooltip_time is not None: + DEFAULT_TOOLTIP_TIME = tooltip_time + + return True + + +#################### ChangeLookAndFeel ####################### +# Predefined settings that will change the colors and styles # +# of the elements. # +############################################################## +def ChangeLookAndFeel(index): + if sys.platform == 'darwin': + print('*** Changing look and feel is not supported on Mac platform ***') + return + + # look and feel table + look_and_feel = {'SystemDefault': {'BACKGROUND' : COLOR_SYSTEM_DEFAULT, 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT': COLOR_SYSTEM_DEFAULT,'TEXT_INPUT' : COLOR_SYSTEM_DEFAULT, 'SCROLL': COLOR_SYSTEM_DEFAULT, 'BUTTON': OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, 'PROGRESS': COLOR_SYSTEM_DEFAULT, 'BORDER': 1,'SLIDER_DEPTH':1, 'PROGRESS_DEPTH':0}, + + 'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC','TEXT_INPUT' : 'black','SCROLL': '#F7F3EC', 'BUTTON': ('white', '#475841'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'Dark': {'BACKGROUND': 'gray25', 'TEXT': 'white', 'INPUT': 'gray30', + 'TEXT_INPUT': 'white', 'SCROLL': 'gray44', 'BUTTON': ('white', '#004F00'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Dark2': {'BACKGROUND': 'gray25', 'TEXT': 'white', 'INPUT': 'white', + 'TEXT_INPUT': 'black', 'SCROLL': 'gray44', 'BUTTON': ('white', '#004F00'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Black': {'BACKGROUND': 'black', 'TEXT': 'white', 'INPUT': 'gray30', + 'TEXT_INPUT': 'white', 'SCROLL': 'gray44', 'BUTTON': ('black', 'white'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Tan': {'BACKGROUND': '#fdf6e3', 'TEXT': '#268bd1', 'INPUT': '#eee8d5', + 'TEXT_INPUT': '#6c71c3', 'SCROLL': '#eee8d5', 'BUTTON': ('white', '#063542'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'TanBlue': {'BACKGROUND': '#e5dece', 'TEXT': '#063289', 'INPUT': '#f9f8f4', + 'TEXT_INPUT': '#242834', 'SCROLL': '#eee8d5', 'BUTTON': ('white', '#063289'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'DarkTanBlue': {'BACKGROUND': '#242834', 'TEXT': '#dfe6f8', 'INPUT': '#97755c', + 'TEXT_INPUT': 'white', 'SCROLL': '#a9afbb', 'BUTTON': ('white', '#063289'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'DarkAmber': {'BACKGROUND': '#2c2825', 'TEXT': '#fdcb52', 'INPUT': '#705e52', + 'TEXT_INPUT': '#fdcb52', 'SCROLL': '#705e52', 'BUTTON': ('black', '#fdcb52'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'DarkBlue': {'BACKGROUND': '#1a2835', 'TEXT': '#d1ecff', 'INPUT': '#335267', + 'TEXT_INPUT': '#acc2d0', 'SCROLL': '#1b6497', 'BUTTON': ('black', '#fafaf8'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Reds': {'BACKGROUND': '#280001', 'TEXT': 'white', 'INPUT': '#d8d584', + 'TEXT_INPUT': 'black', 'SCROLL': '#763e00', 'BUTTON': ('black', '#daad28'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'Green': {'BACKGROUND': '#82a459', 'TEXT': 'black', 'INPUT': '#d8d584', + 'TEXT_INPUT': 'black', 'SCROLL': '#e3ecf3', 'BUTTON': ('white', '#517239'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1, 'SLIDER_DEPTH': 0, + 'PROGRESS_DEPTH': 0}, + + 'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7','TEXT_INPUT' : 'black', 'SCROLL': '#FDFFF7','BUTTON': ('white', '#658268'), 'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER':1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF','TEXT_INPUT' : 'black', 'SCROLL': '#E0F5FF','BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'Purple': {'BACKGROUND': '#B0AAC2', 'TEXT': 'black', 'INPUT': '#F2EFE8','SCROLL': '#F2EFE8','TEXT_INPUT' : 'black', + 'BUTTON': ('black', '#C2D4D8'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'BlueMono': {'BACKGROUND': '#AAB6D3', 'TEXT': 'black', 'INPUT': '#F1F4FC','SCROLL': '#F1F4FC','TEXT_INPUT' : 'black', + 'BUTTON': ('white', '#7186C7'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'GreenMono': {'BACKGROUND': '#A8C1B4', 'TEXT': 'black', 'INPUT': '#DDE0DE', 'SCROLL': '#E3E3E3','TEXT_INPUT' : 'black', + 'BUTTON': ('white', '#6D9F85'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'BrownBlue': {'BACKGROUND': '#64778d', 'TEXT': 'white', 'INPUT': '#f0f3f7', 'SCROLL': '#A6B2BE','TEXT_INPUT' : 'black', 'BUTTON': ('white', '#283b5b'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'BrightColors': {'BACKGROUND': '#b4ffb4', 'TEXT': 'black', 'INPUT': '#ffff64','SCROLL': '#ffb482','TEXT_INPUT' : 'black', 'BUTTON': ('black', '#ffa0dc'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'NeutralBlue': {'BACKGROUND': '#92aa9d', 'TEXT': 'black', 'INPUT': '#fcfff6', + 'SCROLL': '#fcfff6', 'TEXT_INPUT': 'black', 'BUTTON': ('black', '#d0dbbd'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'Kayak': {'BACKGROUND': '#a7ad7f', 'TEXT': 'black', 'INPUT': '#e6d3a8', + 'SCROLL': '#e6d3a8', 'TEXT_INPUT': 'black', 'BUTTON': ('white', '#5d907d'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'SandyBeach': {'BACKGROUND': '#efeccb', 'TEXT': '#012f2f', 'INPUT': '#e6d3a8', + 'SCROLL': '#e6d3a8', 'TEXT_INPUT': '#012f2f', 'BUTTON': ('white', '#046380'), + 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0}, + + 'TealMono': {'BACKGROUND': '#a8cfdd', 'TEXT': 'black', 'INPUT': '#dfedf2','SCROLL': '#dfedf2', 'TEXT_INPUT' : 'black', 'BUTTON': ('white', '#183440'), 'PROGRESS': DEFAULT_PROGRESS_BAR_COLOR, 'BORDER': 1,'SLIDER_DEPTH':0, 'PROGRESS_DEPTH':0} + } + try: + colors = look_and_feel[index] + + SetOptions(background_color=colors['BACKGROUND'], + text_element_background_color=colors['BACKGROUND'], + element_background_color=colors['BACKGROUND'], + text_color=colors['TEXT'], + input_elements_background_color=colors['INPUT'], + button_color=colors['BUTTON'], + progress_meter_color=colors['PROGRESS'], + border_width=colors['BORDER'], + slider_border_width=colors['SLIDER_DEPTH'], + progress_meter_border_depth=colors['PROGRESS_DEPTH'], + scrollbar_color=(colors['SCROLL']), + element_text_color=colors['TEXT'], + input_text_color=colors['TEXT_INPUT']) + except: # most likely an index out of range + pass + + + + +# ============================== sprint ======# +# Is identical to the Scrolled Text Box # +# Provides a crude 'print' mechanism but in a # +# GUI environment # +# ============================================# +sprint=ScrolledTextBox + +# Converts an object's contents into a nice printable string. Great for dumping debug data +def ObjToStringSingleObj(obj): + if obj is None: + return 'None' + return str(obj.__class__) + '\n' + '\n'.join( + (repr(item) + ' = ' + repr(obj.__dict__[item]) for item in sorted(obj.__dict__))) + +def ObjToString(obj, extra=' '): + if obj is None: + return 'None' + return str(obj.__class__) + '\n' + '\n'.join( + (extra + (str(item) + ' = ' + + (ObjToString(obj.__dict__[item], extra + ' ') if hasattr(obj.__dict__[item], '__dict__') else str( + obj.__dict__[item]))) + for item in sorted(obj.__dict__))) + + +# ------------------------------------------------------------------------------------------------------------------ # +# ===================================== Upper PySimpleGUI ======================================================== # +# Pre-built dialog boxes for all your needs These are the "high level API calls # +# ------------------------------------------------------------------------------------------------------------------ # + +# ----------------------------------- The mighty Popup! ------------------------------------------------------------ # + +def Popup(button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): + """ + Popup - Display a popup box with as many parms as you wish to include + :param args: + :param button_color: + :param background_color: + :param text_color: + :param button_type: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + if not args: + args_to_print = [''] + else: + args_to_print = args + if line_width != None: + local_line_width = line_width + else: + local_line_width = MESSAGE_BOX_LINE_WIDTH + title = args_to_print[0] if args_to_print[0] is not None else 'None' + with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: + max_line_total, total_lines = 0,0 + for message in args_to_print: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + if message.count('\n'): + message_wrapped = message + else: + message_wrapped = textwrap.fill(message, local_line_width) + message_wrapped_lines = message_wrapped.count('\n')+1 + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, local_line_width) + max_line_total = max(max_line_total, width_used) + # height = _GetNumLinesNeeded(message, width_used) + height = message_wrapped_lines + form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) + total_lines += height + + pad = max_line_total-15 if max_line_total > 15 else 1 + pad =1 + if non_blocking: + PopupButton = DummyButton + else: + PopupButton = SimpleButton + # show either an OK or Yes/No depending on paramater + if button_type is POPUP_BUTTONS_YES_NO: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) + elif button_type is POPUP_BUTTONS_CANCELLED: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is POPUP_BUTTONS_ERROR: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Error', size=(6, 1), button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is POPUP_BUTTONS_OK_CANCEL: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), + PopupButton('Cancel', size=(5, 1), button_color=button_color)) + elif button_type is POPUP_BUTTONS_NO_BUTTONS: + pass + else: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + + if non_blocking: + button, values = form.ReadNonBlocking() + else: + button, values = form.Show() + + return button + + + +# ============================== MsgBox============# +# Lazy function. Same as calling Popup with parms # +# This function WILL Disappear perhaps today # +# ==================================================# +# MsgBox is the legacy call and should not be used any longer +def MsgBox(*args): + raise DeprecationWarning('MsgBox is no longer supported... change your call to Popup') + + +# --------------------------- PopupNoButtons --------------------------- +def PopupNoButtons(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): + """ + Show a Popup but without any buttons + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=POPUP_BUTTONS_NO_BUTTONS, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location, *args) + + +# --------------------------- PopupNonBlocking --------------------------- +def PopupNonBlocking(button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): + """ + Show Popup box and immediately return (does not block) + :param args: + :param button_type: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location, *args) + + +PopupNoWait = PopupNonBlocking + + +# --------------------------- PopupNoTitlebar --------------------------- +def PopupNoTitlebar(button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Display a Popup without a titlebar. Enables grab anywhere so you can move it + :param args: + :param button_type: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=True, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) + +PopupNoFrame = PopupNoTitlebar +PopupNoBorder = PopupNoTitlebar +PopupAnnoying = PopupNoTitlebar + + +# --------------------------- PopupAutoClose --------------------------- +def PopupAutoClose(button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Popup that closes itself after some time period + :param args: + :param button_type: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, + auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) + +PopupTimed = PopupAutoClose + +# --------------------------- PopupError --------------------------- +def PopupError( button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Popup with colored button and 'Error' as button text + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(button_type=POPUP_BUTTONS_ERROR, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) + + +# --------------------------- PopupCancel --------------------------- +def PopupCancel(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Display Popup with "cancelled" button text + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup( button_type=POPUP_BUTTONS_CANCELLED, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location, *args) + +# --------------------------- PopupOK --------------------------- +def PopupOK( button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Display Popup with OK button only + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: + """ + Popup(button_type=POPUP_BUTTONS_OK, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) + +# --------------------------- PopupOKCancel --------------------------- +def PopupOKCancel(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Display popup with OK and Cancel buttons + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: OK, Cancel or None + """ + return Popup(button_type=POPUP_BUTTONS_OK_CANCEL, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) + +# --------------------------- PopupYesNo --------------------------- +def PopupYesNo(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): + """ + Display Popup with Yes and No buttons + :param args: + :param button_color: + :param background_color: + :param text_color: + :param auto_close: + :param auto_close_duration: + :param non_blocking: + :param icon: + :param line_width: + :param font: + :param no_titlebar: + :param grab_anywhere: + :param keep_on_top: + :param location: + :return: Yes, No or None + """ + return Popup(button_type=POPUP_BUTTONS_YES_NO, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) + + +def main(): + window = Window('Demo window..') + window_rows = [[Text('You are running the PySimpleGUI.py file itself')], + [Text('You should be importing it rather than running it', size=(50,2))], + [Text('Here is your sample input window....')], + [Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()], + [Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()], + [Ok(), Cancel()]] + + button, (source, dest) = window.LayoutAndRead(window_rows) + + +if __name__ == '__main__': + main() + exit(69) \ No newline at end of file From c3cc96534d6cbd59945d38c26d2c8dc26317832e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 11:26:41 -0400 Subject: [PATCH 467/521] More 2.7 work --- PySimpleGUI27.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index 7eec62443..bc8858eb7 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 468/521] More 2.7 work --- PySimpleGUI27.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index bc8858eb7..54674cf09 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -3,7 +3,8 @@ # 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 @@ def ButtonCallBack(self): 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 # --------------------------------------------------------------------------- # From eb9ed9f30091b68974565463e70653d8f736cc4e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 12:17:04 -0400 Subject: [PATCH 469/521] Getting close with 2.7! --- PySimpleGUI27.py | 417 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 363 insertions(+), 54 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index 54674cf09..05efe0f2b 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -1800,14 +1800,14 @@ def __config_calendar(self): self._calendar.tag_configure('header', background='grey90') self._calendar.insert('', 'end', values=cols, tag='header') # adjust its columns width - font = tkinter.font.Font() + font = tkFont.Font() maxwidth = max(font.measure(col) for col in cols) for col in cols: self._calendar.column(col, width=maxwidth, minwidth=maxwidth, anchor='e') def __setup_selection(self, sel_bg, sel_fg): - self._font = tkinter.font.Font() + self._font = tkFont.Font() self._canvas = canvas = tk.Canvas(self._calendar, background=sel_bg, borderwidth=0, highlightthickness=0) canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w') @@ -4261,7 +4261,7 @@ def ObjToString(obj, extra=' '): # ----------------------------------- The mighty Popup! ------------------------------------------------------------ # -def Popup(button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): +def Popup(*args, **kwargs): """ Popup - Display a popup box with as many parms as you wish to include :param args: @@ -4281,59 +4281,93 @@ def Popup(button_color=None, background_color=None, text_color=None, button_type :param location: :return: """ + + # , button_color=None, background_color=None, text_color=None, button_type=, auto_close=, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None) + if not args: args_to_print = [''] else: args_to_print = args + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: button_type = kwargs['button_type'] + except: button_type = POPUP_BUTTONS_OK + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + + if line_width != None: local_line_width = line_width else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: - max_line_total, total_lines = 0,0 - for message in args_to_print: - # fancy code to check if string and convert if not is not need. Just always convert to string :-) - # if not isinstance(message, str): message = str(message) - message = str(message) - if message.count('\n'): - message_wrapped = message - else: - message_wrapped = textwrap.fill(message, local_line_width) - message_wrapped_lines = message_wrapped.count('\n')+1 - longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, local_line_width) - max_line_total = max(max_line_total, width_used) - # height = _GetNumLinesNeeded(message, width_used) - height = message_wrapped_lines - form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) - total_lines += height - - pad = max_line_total-15 if max_line_total > 15 else 1 - pad =1 - if non_blocking: - PopupButton = DummyButton - else: - PopupButton = SimpleButton - # show either an OK or Yes/No depending on paramater - if button_type is POPUP_BUTTONS_YES_NO: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) - elif button_type is POPUP_BUTTONS_CANCELLED: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is POPUP_BUTTONS_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Error', size=(6, 1), button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is POPUP_BUTTONS_OK_CANCEL: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), - PopupButton('Cancel', size=(5, 1), button_color=button_color)) - elif button_type is POPUP_BUTTONS_NO_BUTTONS: - pass + form = FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) + max_line_total, total_lines = 0,0 + for message in args_to_print: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + if message.count('\n'): + message_wrapped = message else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + message_wrapped = textwrap.fill(message, local_line_width) + message_wrapped_lines = message_wrapped.count('\n')+1 + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, local_line_width) + max_line_total = max(max_line_total, width_used) + # height = _GetNumLinesNeeded(message, width_used) + height = message_wrapped_lines + form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) + total_lines += height + + pad = max_line_total-15 if max_line_total > 15 else 1 + pad =1 + if non_blocking: + PopupButton = DummyButton + else: + PopupButton = SimpleButton + # show either an OK or Yes/No depending on paramater + if button_type is POPUP_BUTTONS_YES_NO: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) + elif button_type is POPUP_BUTTONS_CANCELLED: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is POPUP_BUTTONS_ERROR: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Error', size=(6, 1), button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is POPUP_BUTTONS_OK_CANCEL: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), + PopupButton('Cancel', size=(5, 1), button_color=button_color)) + elif button_type is POPUP_BUTTONS_NO_BUTTONS: + pass + else: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) - if non_blocking: - button, values = form.ReadNonBlocking() - else: - button, values = form.Show() + if non_blocking: + button, values = form.ReadNonBlocking() + else: + button, values = form.Show() return button @@ -4349,7 +4383,7 @@ def MsgBox(*args): # --------------------------- PopupNoButtons --------------------------- -def PopupNoButtons(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): +def PopupNoButtons(*args, **kwargs): """ Show a Popup but without any buttons :param args: @@ -4368,13 +4402,42 @@ def PopupNoButtons(button_color=None, background_color=None, text_color=None, au :param location: :return: """ + # button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=POPUP_BUTTONS_NO_BUTTONS, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location, *args) # --------------------------- PopupNonBlocking --------------------------- -def PopupNonBlocking(button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), *args): +def PopupNonBlocking(*args, **kwargs): """ Show Popup box and immediately return (does not block) :param args: @@ -4394,6 +4457,38 @@ def PopupNonBlocking(button_type=POPUP_BUTTONS_OK, button_color=None, background :param location: :return: """ + + # button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: button_type = kwargs['button_type'] + except: button_type = POPUP_BUTTONS_OK + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = True + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location, *args) @@ -4403,7 +4498,7 @@ def PopupNonBlocking(button_type=POPUP_BUTTONS_OK, button_color=None, background # --------------------------- PopupNoTitlebar --------------------------- -def PopupNoTitlebar(button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupNoTitlebar(*args, **kwargs): """ Display a Popup without a titlebar. Enables grab anywhere so you can move it :param args: @@ -4422,6 +4517,36 @@ def PopupNoTitlebar(button_type=POPUP_BUTTONS_OK, button_color=None, background_ :param location: :return: """ + + # button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, grab_anywhere=True, keep_on_top=False, location=(None,None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: button_type = kwargs['button_type'] + except: button_type = POPUP_BUTTONS_OK + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, font=font, no_titlebar=True, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) @@ -4432,7 +4557,7 @@ def PopupNoTitlebar(button_type=POPUP_BUTTONS_OK, button_color=None, background_ # --------------------------- PopupAutoClose --------------------------- -def PopupAutoClose(button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupAutoClose(*args, **kwargs): """ Popup that closes itself after some time period :param args: @@ -4452,6 +4577,39 @@ def PopupAutoClose(button_type=POPUP_BUTTONS_OK, button_color=None, background_c :param location: :return: """ + + # button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), + + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: button_type = kwargs['button_type'] + except: button_type = POPUP_BUTTONS_OK + try: auto_close = kwargs['auto_close'] + except: auto_close = True + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + Popup(button_color=button_color, background_color=background_color, text_color=text_color, button_type=button_type, auto_close=auto_close, auto_close_duration=auto_close_duration, non_blocking=non_blocking, icon=icon, line_width=line_width, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) @@ -4459,7 +4617,7 @@ def PopupAutoClose(button_type=POPUP_BUTTONS_OK, button_color=None, background_c PopupTimed = PopupAutoClose # --------------------------- PopupError --------------------------- -def PopupError( button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupError(*args, **kwargs): """ Popup with colored button and 'Error' as button text :param args: @@ -4478,11 +4636,42 @@ def PopupError( button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, :param location: :return: """ + # button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = DEFAULT_ERROR_BUTTON_COLOR + try: text_color = kwargs['text_color'] + except: text_color = None + try: button_type = kwargs['button_type'] + except: button_type = POPUP_BUTTONS_OK + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + Popup(button_type=POPUP_BUTTONS_ERROR, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) # --------------------------- PopupCancel --------------------------- -def PopupCancel(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupCancel(*args, **kwargs): """ Display Popup with "cancelled" button text :param args: @@ -4501,10 +4690,40 @@ def PopupCancel(button_color=None, background_color=None, text_color=None, auto_ :param location: :return: """ + + # button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + Popup( button_type=POPUP_BUTTONS_CANCELLED, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location, *args) # --------------------------- PopupOK --------------------------- -def PopupOK( button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupOK(*args, **kwargs): """ Display Popup with OK button only :param args: @@ -4523,10 +4742,40 @@ def PopupOK( button_color=None, background_color=None, text_color=None, auto_clo :param location: :return: """ + + # button_color = None, background_color = None, text_color = None, auto_close = False, auto_close_duration = None, non_blocking = False, icon = DEFAULT_WINDOW_ICON, line_width = None, font = None, no_titlebar = False, grab_anywhere = True, keep_on_top = False, location = ( None, None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + Popup(button_type=POPUP_BUTTONS_OK, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) # --------------------------- PopupOKCancel --------------------------- -def PopupOKCancel(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupOKCancel(*args, **kwargs): """ Display popup with OK and Cancel buttons :param args: @@ -4545,10 +4794,40 @@ def PopupOKCancel(button_color=None, background_color=None, text_color=None, aut :param location: :return: OK, Cancel or None """ + + # button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + return Popup(button_type=POPUP_BUTTONS_OK_CANCEL, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) # --------------------------- PopupYesNo --------------------------- -def PopupYesNo(button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None),*args): +def PopupYesNo(*args, **kwargs): """ Display Popup with Yes and No buttons :param args: @@ -4567,6 +4846,36 @@ def PopupYesNo(button_color=None, background_color=None, text_color=None, auto_c :param location: :return: Yes, No or None """ + + # button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None), + + try: button_color = kwargs['button_color'] + except: button_color = None + try: background_color = kwargs['background_color'] + except: background_color = None + try: text_color = kwargs['text_color'] + except: text_color = None + try: auto_close = kwargs['auto_close'] + except: auto_close = False + try: auto_close_duration = kwargs['auto_close_duration'] + except: auto_close_duration = None + try: non_blocking = kwargs['non_blocking'] + except: non_blocking = False + try: icon = kwargs['icon'] + except: icon = DEFAULT_WINDOW_ICON + try: line_width = kwargs['line_width'] + except: line_width = None + try: font = kwargs['font'] + except: font = None + try: no_titlebar = kwargs['no_titlebar'] + except: no_titlebar = False + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = None + try: keep_on_top = kwargs['keep_on_top'] + except: keep_on_top = False + try: location = kwargs['location'] + except: location = (None, None) + return Popup(button_type=POPUP_BUTTONS_YES_NO, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location,*args) From 2de520967437e86d2a1b6212737e8fb7b5f26418 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 12:54:21 -0400 Subject: [PATCH 470/521] More 2.7 fun --- PySimpleGUI27.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index 05efe0f2b..b8f5d0cca 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -3034,7 +3034,7 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_PROGRESS_BAR: # save this form because it must be 'updated' (refreshed) solely for the purpose of updating bar width = element_size[0] - fnt = tkinter.font.Font() + fnt = tkFont.Font() char_width = fnt.measure('A') # single character width progress_length = width*char_width progress_width = element_size[1] @@ -3448,7 +3448,7 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def _ProgressMeter(title, max_value, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True, *args): +def _ProgressMeter(title, max_value, *args, **kwargs): ''' Create and show a form on tbe caller's behalf. :param title: @@ -3461,6 +3461,23 @@ def _ProgressMeter(title, max_value, orientation=None, bar_color=(None,None), bu :param StyleOffset: :return: ProgressBar object that is in the form ''' + + # title, max_value, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True, *args + + try: orientation = kwargs['orientation'] + except: orientation = None + try: bar_color = kwargs['bar_color'] + except: bar_color = (None, None) + try: button_color = kwargs['button_color'] + except: button_color = None + try: size = kwargs['size'] + except: size = DEFAULT_PROGRESS_BAR_SIZE + try: border_width = kwargs['border_width'] + except: border_width = None + try: grab_anywhere = kwargs['grab_anywhere'] + except: grab_anywhere = True + + local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) From 743873c5a2394fbc719471ef7ea24987f33e7394 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 13:43:36 -0400 Subject: [PATCH 471/521] RELEASE 1.0.0 for Python 2.7 --- docs/index.md | 45 +++++++++++++++++++++++++++++++++++---------- readme.md | 45 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 70 insertions(+), 20 deletions(-) diff --git a/docs/index.md b/docs/index.md index c81a74693..67474a730 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,8 +9,9 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -28,7 +29,11 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter -Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. +#### Note regarding Python versions +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is called PySimpleGUI. The Python 2.7 version is called PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. + + +--------------------------------- Looking for a GUI package to help with * Taking your Python code from the world of command lines and into the convenience of a GUI? * @@ -114,6 +119,7 @@ was the second. While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. Features of PySimpleGUI include: + Support for versions Python 2.7 and 3 Text Single Line Input Buttons including these types: @@ -238,7 +244,7 @@ Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Pyt ----- ## Getting Started with PySimpleGUI -### Installing +### Installing Python 3 pip install --upgrade PySimpleGUI @@ -261,13 +267,19 @@ If for some reason you are unable to install using `pip`, don't worry, you can s ImportError: No module named tkinter ``` then you need to install `tkinter`. Be sure and get the Python 3 version. -``` -sudo apt-get install python3-tk -``` -### Prerequisites +```sudo apt-get install python3-tk ``` + + +### Installing for Python 2.7 + + pip install --upgrade PySimpleGUI27 + +Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available -Python 3 + +### Prerequisites +Python 2.7 or Python 3 tkinter PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. @@ -277,7 +289,7 @@ PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe -## Using +## Using - Python 3 To use in your code, simply import.... `import PySimpleGUI as sg` @@ -291,6 +303,12 @@ Then use either "high level" API calls or build your own windows. Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +## Using - Python 2.7 + +Those using Python 2.7 will import a different module name + `import PySimpleGUI27 as sg` + + --- ## APIs @@ -2650,7 +2668,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes | 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window -| 03.08.00 | Sept 25, 2018 - Tab and TabGroup Elements +| 03.08.00 | Sept 25, 2018 - Tab and TabGroup Elements\ +| 01.01.00 for 2.7 | Sept 25, 2018 - First release for 2.7 ### Release Notes @@ -2745,6 +2764,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution #### 3.8.0 * Tab and TabGroup Elements - awesome new capabilities +#### 1.0.0 Python 2.7 +It's official. There is a 2.7 version of PySimpleGUI! + ### Upcoming Make suggestions people! Future release features @@ -2835,3 +2857,6 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + + + diff --git a/readme.md b/readme.md index c81a74693..67474a730 100644 --- a/readme.md +++ b/readme.md @@ -9,8 +9,9 @@ # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -28,7 +29,11 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter -Note - ***Python3*** is required to run PySimpleGUI. It takes advantage of some Python3 features that do not translate well into Python2. +#### Note regarding Python versions +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is called PySimpleGUI. The Python 2.7 version is called PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. + + +--------------------------------- Looking for a GUI package to help with * Taking your Python code from the world of command lines and into the convenience of a GUI? * @@ -114,6 +119,7 @@ was the second. While simple to use, PySimpleGUI has significant depth to be explored by more advanced programmers. The feature set goes way beyond the requirements of a beginner programmer, and into the required features needed for complex GUIs. Features of PySimpleGUI include: + Support for versions Python 2.7 and 3 Text Single Line Input Buttons including these types: @@ -238,7 +244,7 @@ Maybe there's no "there there". ***Or*** maybe a simple GUI API will enable Pyt ----- ## Getting Started with PySimpleGUI -### Installing +### Installing Python 3 pip install --upgrade PySimpleGUI @@ -261,13 +267,19 @@ If for some reason you are unable to install using `pip`, don't worry, you can s ImportError: No module named tkinter ``` then you need to install `tkinter`. Be sure and get the Python 3 version. -``` -sudo apt-get install python3-tk -``` -### Prerequisites +```sudo apt-get install python3-tk ``` + + +### Installing for Python 2.7 + + pip install --upgrade PySimpleGUI27 + +Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available -Python 3 + +### Prerequisites +Python 2.7 or Python 3 tkinter PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. @@ -277,7 +289,7 @@ PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It If you wish to create an EXE from your PySimpleGUI application, you will need to install `PyInstaller`. There are instructions on how to create an EXE at the bottom of this ReadMe -## Using +## Using - Python 3 To use in your code, simply import.... `import PySimpleGUI as sg` @@ -291,6 +303,12 @@ Then use either "high level" API calls or build your own windows. Yes, it's just that easy to have a window appear on the screen using Python. With PySimpleGUI, making a custom window appear isn't much more difficult. The goal is to get you running on your GUI within ***minutes***, not hours nor days. +## Using - Python 2.7 + +Those using Python 2.7 will import a different module name + `import PySimpleGUI27 as sg` + + --- ## APIs @@ -2650,7 +2668,8 @@ A MikeTheWatchGuy production... entirely responsible for this code.... unless it | 03.05.01 | Sept 22, 2018 - See release notes | 03.05.02 | Sept 23, 2018 - See release notes | 03.06.00 | Sept 23, 2018 - Goodbye FlexForm, hello Window -| 03.08.00 | Sept 25, 2018 - Tab and TabGroup Elements +| 03.08.00 | Sept 25, 2018 - Tab and TabGroup Elements\ +| 01.01.00 for 2.7 | Sept 25, 2018 - First release for 2.7 ### Release Notes @@ -2745,6 +2764,9 @@ OneLineProgressMeter function added which gives you not only a one-line solution #### 3.8.0 * Tab and TabGroup Elements - awesome new capabilities +#### 1.0.0 Python 2.7 +It's official. There is a 2.7 version of PySimpleGUI! + ### Upcoming Make suggestions people! Future release features @@ -2835,3 +2857,6 @@ For Python questions, I simply start my query with 'Python'. Let's say you forg In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my programming process. I'm not afraid of asking for help! You just have to be smart about using what you find. The PySimpleGUI window that the results are shown in is an 'input' field which means you can copy and paste the results right into your code. + + + From df5459b049f055ac5370696e4b18a62bc9923b4f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 13:45:12 -0400 Subject: [PATCH 472/521] Release 1.0.0 of PySimpleGUI27 --- PySimpleGUI27.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index b8f5d0cca..6f14e9cfe 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -5,6 +5,7 @@ import ttk import tkColorChooser import tkFont +import ScrolledText # from Tkinter import ttk # import Tkinter.scrolledtext as tkst # import Tkinter.font @@ -2998,7 +2999,7 @@ def CharWidthInPixels(): elif element_type == ELEM_TYPE_INPUT_MULTILINE: default_text = element.DefaultText width, height = element_size - element.TKText = tk.scrolledtext.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) + element.TKText = ScrolledText.ScrolledText(tk_row_frame, width=width, height=height, wrap='word', bd=border_depth,font=font) element.TKText.insert(1.0, default_text) # set the default text if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKText.configure(background=element.BackgroundColor) @@ -3909,9 +3910,9 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files except: pass if save_as: - filename = tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box + filename = tkFileDialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box else: - filename = tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box + filename = tkFileDialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box root.destroy() return filename From 820862a4e7a5368bf970e8538c9854c86993b5bc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 17:50:19 -0400 Subject: [PATCH 473/521] Removed old, bad, tabbed code. --- Demo_Tabbed_Form.py | 83 --------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 Demo_Tabbed_Form.py diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py deleted file mode 100644 index 60de7de6b..000000000 --- a/Demo_Tabbed_Form.py +++ /dev/null @@ -1,83 +0,0 @@ -import PySimpleGUI as sg - -# Drop Down list of options -configs = ('0 - Gruen - Started 2 days ago in Watches', - '1 - Gruen - Currently Active in Watches', - '2 - Alpina - Currently Active in Jewelry', - '3 - Gruen - Ends in 1 day in Watches', - '4 - Gruen - Completed in Watches', - '5 - Gruen - Advertising', - '6 - Gruen - Currently Active in Jewelry', - '7 - Gruen - Price Test', - '8 - Gruen - No brand name specified') - -us_categories = ('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 34', - ' Watch Ads - 165254' - ) - -german_categories =('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 1', - ' Watch Ads - 19823' - ) - - -# the form layout -window = sg.Window('EBay Super Searcher', auto_size_text=True) - -form2 = sg.Window('EBay Super Searcher', auto_size_text=False) - -layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], - [sg.Text('Choose base configuration to run')], - [sg.InputCombo(configs)], - [sg.Text('_'*100, size=(80,1))], - [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], - [sg.InputText(),sg.Text('Custom text to add to folder name')], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], - [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Time Filters')], - [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - -# First category is default (need to special case this) -layout_tab_2 = [[sg.Text('Choose Category')], - [sg.Text('US Categories'),sg.Text('German Categories')], - [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] - -for i,cat in enumerate(us_categories): - if i == 0: continue # skip first one - layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) - -layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) -layout_tab_2.append([sg.Text('US Search String Override')]) -layout_tab_2.append([sg.InputText(size=(100,1))]) -layout_tab_2.append([sg.Text('German Search String Override')]) -layout_tab_2.append([sg.InputText(size=(100,1))]) -layout_tab_2.append([sg.Text('Typical US Search String')]) -layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) -layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) -layout_tab_2.append([sg.ReadButton('Submit', button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) - -results = sg.ShowTabbedForm('eBay Super Searcher', (form,layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) - - - -sg.Popup('Results', results) \ No newline at end of file From 0c290058ddee384390ed2f910656c2f1506b980a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 17:51:44 -0400 Subject: [PATCH 474/521] Delete Demo_Tabbed_Form.py --- Demo_Tabbed_Form.py | 83 --------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 Demo_Tabbed_Form.py diff --git a/Demo_Tabbed_Form.py b/Demo_Tabbed_Form.py deleted file mode 100644 index f902152ac..000000000 --- a/Demo_Tabbed_Form.py +++ /dev/null @@ -1,83 +0,0 @@ -import PySimpleGUI as sg - -# Drop Down list of options -configs = ('0 - Gruen - Started 2 days ago in Watches', - '1 - Gruen - Currently Active in Watches', - '2 - Alpina - Currently Active in Jewelry', - '3 - Gruen - Ends in 1 day in Watches', - '4 - Gruen - Completed in Watches', - '5 - Gruen - Advertising', - '6 - Gruen - Currently Active in Jewelry', - '7 - Gruen - Price Test', - '8 - Gruen - No brand name specified') - -us_categories = ('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 34', - ' Watch Ads - 165254' - ) - -german_categories =('Use Default with no change', - 'All - 1', - 'Jewelry - 281', - ' Watches - 14324', - ' Wristwatches - 31387', - ' Pocket Watches - 3937', - 'Advertising - 1', - ' Watch Ads - 19823' - ) - - -# the form layout -window = sg.Window('EBay Super Searcher', auto_size_text=True) - -form2 = sg.Window('EBay Super Searcher', auto_size_text=False) - -layout_tab_1 = [[sg.Text('eBay Super Searcher!', size=(60,1), font=('helvetica', 15))], - [sg.Text('Choose base configuration to run')], - [sg.InputCombo(configs)], - [sg.Text('_'*100, size=(80,1))], - [sg.InputText(),sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow,0))], - [sg.InputText(),sg.Text('Custom text to add to folder name')], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox('German', size=(15, 1), default=True, )], - [sg.Radio('Active Listings','ActiveComplete', default = True,size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Checkbox('Save Images', size=(15,1)),sg.Checkbox('Save PDFs', size=(15,1)), sg.Checkbox('Extract PDFs', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Time Filters')], - [sg.Radio('No change','time', default=True),sg.Radio('ALL listings','time'),sg.Radio('Started 1 day ago','time', size=(15,1)),sg.Radio('Started 2 days ago','time', size=(15,1)), sg.Radio('Ends in 1 day','time', size=(15,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Text('Price Range'), sg.InputText(size=(10,1)),sg.Text('To'), sg.InputText(size=(10,1))], - [sg.Text('_'*100, size=(80,1))], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - -# First category is default (need to special case this) -layout_tab_2 = [[sg.Text('Choose Category')], - [sg.Text('US Categories'),sg.Text('German Categories')], - [sg.Radio(us_categories[0],'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True)]] - -for i,cat in enumerate(us_categories): - if i == 0: continue # skip first one - layout_tab_2.append([sg.Radio(cat,'CATUS'), sg.Radio(german_categories[i],'CATDE')]) - -layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) -layout_tab_2.append([sg.Text('US Search String Override')]) -layout_tab_2.append([sg.InputText(size=(100,1))]) -layout_tab_2.append([sg.Text('German Search String Override')]) -layout_tab_2.append([sg.InputText(size=(100,1))]) -layout_tab_2.append([sg.Text('Typical US Search String')]) -layout_tab_2.append([sg.InputText(size=(100,1), default_text='gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ')]) -layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) -layout_tab_2.append([sg.ReadButton('Submit', button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]) - -results = sg.ShowTabbedForm('eBay Super Searcher', (form2, layout_tab_1,'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) - - - -sg.Popup('Results', results) From 2501c150e5d21ebc94d40b5565f5b489ad0cd3c0 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 20:03:14 -0400 Subject: [PATCH 475/521] Doc updates to match Python 2.7 support --- docs/cookbook.md | 53 +++++++++++++++++++++++++++++++++++++++++++----- docs/index.md | 24 ++++++++++++++-------- docs/tutorial.md | 17 ++++++++++++++-- readme.md | 24 ++++++++++++++-------- 4 files changed, 95 insertions(+), 23 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index a171d06a9..cf7477ded 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -6,6 +6,17 @@ You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. Study them to get an idea of what design patterns to follow. +The Recipes in this Cookbook all assume you're running on a Python3 machine. If you are running Python 2.7 then your code will differ by 2 character. Replace the import statement: + + import PySimpleGUI as sg + +with + + import PySimpleGUI27 as sg + +There is a short section in the Readme with instruction on installing PySimpleGUI + + ## Simple Data Entry - Return Values As List Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. @@ -42,7 +53,7 @@ A simple GUI with default values. Results returned in a dictionary. [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] + [sg.Submit(), sg.Cancel()] ] window = sg.Window('Simple data entry GUI').Layout(layout) @@ -302,7 +313,7 @@ This recipe shows just how easy it is to add a progress meter to your code. import PySimpleGUI as sg for i in range(1000): - sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') + sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'key') ----- @@ -530,9 +541,10 @@ you can write this line of code for the exact same result (OK, two lines with th -------------------- ## Multiple Columns -Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. -This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. +A Column is required when you have a tall element to the left of smaller elements. + +In this example, there is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. @@ -1222,6 +1234,37 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th button, values = window.Read() +## Tabs + +Tabs bring not only an extra level of sophistication to your window layout, they give you extra room to add more elements. Tabs are one of the 3 container Elements, Elements that hold or contain other Elements. The other two are the Column and Frame Elements. + + +![tabs](https://user-images.githubusercontent.com/13696193/46049479-97732f00-c0fc-11e8-8015-5bbed8bd88bb.jpg) + + + +``` +import PySimpleGUI as sg + +tab1_layout = [[sg.T('This is inside tab 1')]] + +tab2_layout = [[sg.T('This is inside tab 2')], + [sg.In(key='in')]] + +layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, tooltip='tip'), sg.Tab('Tab 2', tab2_layout)]], tooltip='TIP2')], + [sg.RButton('Read')]] + +window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) + +while True: + button, v = window.Read() + print(button,values) + if button is None: # always, always give a way out! + break +``` + + + ## Creating a Windows .EXE File @@ -1244,4 +1287,4 @@ That's all... Run your `my_program.exe` file on the Windows machine of your choo > (famous last words that screw up just about anything being referenced) -Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. \ No newline at end of file +Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. diff --git a/docs/index.md b/docs/index.md index 67474a730..4aa63cf89 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,12 +4,21 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) + ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) + + + + # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) + +## Now supports both Python 2.7 & 3 + +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) @@ -21,8 +30,6 @@ [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) -[OpenSource Article](https://opensource.com/article/18/8/pysimplegui) - [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) Super-simple GUI to use... Powerfully customizable. @@ -30,16 +37,17 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter #### Note regarding Python versions -As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is called PySimpleGUI. The Python 2.7 version is called PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named PySimpleGUI. The Python 2.7 version is named PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. + +------------------------------------------------------------------------ ---------------------------------- -Looking for a GUI package to help with +Looking for a GUI package? * Taking your Python code from the world of command lines and into the convenience of a GUI? * * Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? * Into Machine Learning and are sick of the command line? -* How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? +* Would like to distribute your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. diff --git a/docs/tutorial.md b/docs/tutorial.md index 9526216fe..1d3e77292 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -2,7 +2,7 @@ # Add GUIs to your programs and scripts easily with PySimpleGUI -NOTE -- PySimpleGUI requires Python3. If you're running Python2, don't waste your time reading. +PySimpleGUI now supports BOTH Python 2.7 and Python 3 ## Introduction Few people run Python programs by double clicking the .py file as if it were a .exe file. When a typical user (non-programmer types) double clicks an exe file, they expect it to pop open with a window they can interact with. While GUIs, using tkinter, are possible using standard Python installations, it's unlikely many programs do this. @@ -46,7 +46,7 @@ There are more complex GUIs such as those that don't close after a button is cli When is PySimpleGUI useful? ***Immediately***, anytime you've got a GUI need. It will take under 5 minutes for you to create and try your GUI. With those kinds of times, what do you have to lose trying it? The best way to go about making your GUI in under 5 minutes is to copy one of the GUIs from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/). Follow these steps: -* Install PySimpleGUI +* Install PySimpleGUI (see short section in readme on installation) * Find a GUI that looks similar to what you want to create * Copy code from Cookbook * Paste into your IDE and run @@ -78,6 +78,19 @@ It's a reasonably sized window. If you only need to collect a few values and they're all basically strings, then you would copy this recipe and modify it to suit your needs. +### Python 2.7 Differences + +The only noticeable difference between PySimpleGUI code running under Python 2.7 and one running on Python 3 is the import statement. + +Python 3.x: + + import PySimpleGUI as sg + +Python 2.7: + + import PySimpleGUI27 as sg + + ## The 5-line GUI Not all GUIs take 5 minutes. Some take 5 lines of code. This is a GUI with a custom layout contained in 5 lines of code. diff --git a/readme.md b/readme.md index 67474a730..4aa63cf89 100644 --- a/readme.md +++ b/readme.md @@ -4,12 +4,21 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) + ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) + + + + # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) + +## Now supports both Python 2.7 & 3 + +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) @@ -21,8 +30,6 @@ [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) -[OpenSource Article](https://opensource.com/article/18/8/pysimplegui) - [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) Super-simple GUI to use... Powerfully customizable. @@ -30,16 +37,17 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter #### Note regarding Python versions -As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is called PySimpleGUI. The Python 2.7 version is called PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named PySimpleGUI. The Python 2.7 version is named PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. + +------------------------------------------------------------------------ ---------------------------------- -Looking for a GUI package to help with +Looking for a GUI package? * Taking your Python code from the world of command lines and into the convenience of a GUI? * * Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? * Into Machine Learning and are sick of the command line? -* How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? +* Would like to distribute your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. From 294d033ddf396160f410350cc468f7874c17c482 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 20:04:53 -0400 Subject: [PATCH 476/521] More 2.7 support --- docs/cookbook.md | 53 +++++++++++++++++++++++++++++++++++++++++++----- docs/index.md | 24 ++++++++++++++-------- docs/tutorial.md | 17 ++++++++++++++-- readme.md | 24 ++++++++++++++-------- 4 files changed, 95 insertions(+), 23 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index a171d06a9..cf7477ded 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -6,6 +6,17 @@ You'll find that starting with a Recipe will give you a big jump-start on creating your custom GUI. Copy and paste one of these Recipes and modify it to match your requirements. Study them to get an idea of what design patterns to follow. +The Recipes in this Cookbook all assume you're running on a Python3 machine. If you are running Python 2.7 then your code will differ by 2 character. Replace the import statement: + + import PySimpleGUI as sg + +with + + import PySimpleGUI27 as sg + +There is a short section in the Readme with instruction on installing PySimpleGUI + + ## Simple Data Entry - Return Values As List Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. @@ -42,7 +53,7 @@ A simple GUI with default values. Results returned in a dictionary. [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] + [sg.Submit(), sg.Cancel()] ] window = sg.Window('Simple data entry GUI').Layout(layout) @@ -302,7 +313,7 @@ This recipe shows just how easy it is to add a progress meter to your code. import PySimpleGUI as sg for i in range(1000): - sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'mymeter') + sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'key') ----- @@ -530,9 +541,10 @@ you can write this line of code for the exact same result (OK, two lines with th -------------------- ## Multiple Columns -Starting in version 2.9 you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. -This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. +A Column is required when you have a tall element to the left of smaller elements. + +In this example, there is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. @@ -1222,6 +1234,37 @@ In this example we're defining our graph to be from -100, -100 to +100,+100. Th button, values = window.Read() +## Tabs + +Tabs bring not only an extra level of sophistication to your window layout, they give you extra room to add more elements. Tabs are one of the 3 container Elements, Elements that hold or contain other Elements. The other two are the Column and Frame Elements. + + +![tabs](https://user-images.githubusercontent.com/13696193/46049479-97732f00-c0fc-11e8-8015-5bbed8bd88bb.jpg) + + + +``` +import PySimpleGUI as sg + +tab1_layout = [[sg.T('This is inside tab 1')]] + +tab2_layout = [[sg.T('This is inside tab 2')], + [sg.In(key='in')]] + +layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, tooltip='tip'), sg.Tab('Tab 2', tab2_layout)]], tooltip='TIP2')], + [sg.RButton('Read')]] + +window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) + +while True: + button, v = window.Read() + print(button,values) + if button is None: # always, always give a way out! + break +``` + + + ## Creating a Windows .EXE File @@ -1244,4 +1287,4 @@ That's all... Run your `my_program.exe` file on the Windows machine of your choo > (famous last words that screw up just about anything being referenced) -Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. \ No newline at end of file +Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. diff --git a/docs/index.md b/docs/index.md index 67474a730..4aa63cf89 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,12 +4,21 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) + ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) + + + + # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) + +## Now supports both Python 2.7 & 3 + +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) @@ -21,8 +30,6 @@ [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) -[OpenSource Article](https://opensource.com/article/18/8/pysimplegui) - [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) Super-simple GUI to use... Powerfully customizable. @@ -30,16 +37,17 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter #### Note regarding Python versions -As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is called PySimpleGUI. The Python 2.7 version is called PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named PySimpleGUI. The Python 2.7 version is named PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. + +------------------------------------------------------------------------ ---------------------------------- -Looking for a GUI package to help with +Looking for a GUI package? * Taking your Python code from the world of command lines and into the convenience of a GUI? * * Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? * Into Machine Learning and are sick of the command line? -* How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? +* Would like to distribute your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. diff --git a/docs/tutorial.md b/docs/tutorial.md index 9526216fe..1d3e77292 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -2,7 +2,7 @@ # Add GUIs to your programs and scripts easily with PySimpleGUI -NOTE -- PySimpleGUI requires Python3. If you're running Python2, don't waste your time reading. +PySimpleGUI now supports BOTH Python 2.7 and Python 3 ## Introduction Few people run Python programs by double clicking the .py file as if it were a .exe file. When a typical user (non-programmer types) double clicks an exe file, they expect it to pop open with a window they can interact with. While GUIs, using tkinter, are possible using standard Python installations, it's unlikely many programs do this. @@ -46,7 +46,7 @@ There are more complex GUIs such as those that don't close after a button is cli When is PySimpleGUI useful? ***Immediately***, anytime you've got a GUI need. It will take under 5 minutes for you to create and try your GUI. With those kinds of times, what do you have to lose trying it? The best way to go about making your GUI in under 5 minutes is to copy one of the GUIs from the [PySimpleGUI Cookbook](https://pysimplegui.readthedocs.io/en/latest/cookbook/). Follow these steps: -* Install PySimpleGUI +* Install PySimpleGUI (see short section in readme on installation) * Find a GUI that looks similar to what you want to create * Copy code from Cookbook * Paste into your IDE and run @@ -78,6 +78,19 @@ It's a reasonably sized window. If you only need to collect a few values and they're all basically strings, then you would copy this recipe and modify it to suit your needs. +### Python 2.7 Differences + +The only noticeable difference between PySimpleGUI code running under Python 2.7 and one running on Python 3 is the import statement. + +Python 3.x: + + import PySimpleGUI as sg + +Python 2.7: + + import PySimpleGUI27 as sg + + ## The 5-line GUI Not all GUIs take 5 minutes. Some take 5 lines of code. This is a GUI with a custom layout contained in 5 lines of code. diff --git a/readme.md b/readme.md index 67474a730..4aa63cf89 100644 --- a/readme.md +++ b/readme.md @@ -4,12 +4,21 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Python Version](https://img.shields.io/badge/Python-3-brightgreen.svg)](https://www.python.org/downloads/) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) + ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) + + + + # PySimpleGUI -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.0-red.svg?longCache=true&style=for-the-badge) + +## Now supports both Python 2.7 & 3 + +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) @@ -21,8 +30,6 @@ [Brief Tutorial](https://pysimplegui.readthedocs.io/en/latest/tutorial/) -[OpenSource Article](https://opensource.com/article/18/8/pysimplegui) - [Latest Demos and Master Branch on GitHub](https://github.com/MikeTheWatchGuy/PySimpleGUI) Super-simple GUI to use... Powerfully customizable. @@ -30,16 +37,17 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter #### Note regarding Python versions -As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is called PySimpleGUI. The Python 2.7 version is called PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named PySimpleGUI. The Python 2.7 version is named PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. + +------------------------------------------------------------------------ ---------------------------------- -Looking for a GUI package to help with +Looking for a GUI package? * Taking your Python code from the world of command lines and into the convenience of a GUI? * * Have a Raspberry **Pi** with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK? * Into Machine Learning and are sick of the command line? -* How about distributing your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? +* Would like to distribute your Python code to Windows users as a single .EXE file that launches straight into a GUI, much like a WinForms app? Look no further, **you've found your GUI package**. From 0a4f4db87105d1ba8d98acdf131b7991e9463530 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 20:18:42 -0400 Subject: [PATCH 477/521] Removed old Tab Recipe --- docs/cookbook.md | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/docs/cookbook.md b/docs/cookbook.md index cf7477ded..07aa7f5ab 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -53,7 +53,7 @@ A simple GUI with default values. Results returned in a dictionary. [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], - [sg.Submit(), sg.Cancel()] + [sg.Submit(), sg.Cancel()] ] window = sg.Window('Simple data entry GUI').Layout(layout) @@ -316,29 +316,6 @@ This recipe shows just how easy it is to add a progress meter to your code. sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'key') ------ -## Tabbed Window -Tabbed Windows are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single window. - - -![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg) - - import PySimpleGUI as sg - - layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], - [sg.InputText(), sg.Text('Enter some info')], - [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] - - window = sg.Window('') - form2 = sg.Window('') - - results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), - (form2, layout_tab_2, 'Second Tab')) - - sg.Popup(results) ----- ## Button Graphics (Media Player) From 7967bf851307be025e6613c588c00eb064e2feb2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 26 Sep 2018 13:47:15 -0400 Subject: [PATCH 478/521] Python 2.7 instructions --- docs/index.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++---- readme.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 124 insertions(+), 8 deletions(-) diff --git a/docs/index.md b/docs/index.md index 4aa63cf89..e4bd1d56d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,7 +5,7 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) -![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) + ![Awesome Meter](https://img.shields.io/badge/Awesome_meter-100-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) @@ -268,14 +268,18 @@ Some users have found that upgrading required using an extra flag on the pip `-- pip install --upgrade --no-cache-dir +On some versions of Linux you will need to first install pip. Need the Chicken before you can get the Egg (get it... Egg?) + +`sudo apt install python3-pip ` + If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: ``` ImportError: No module named tkinter ``` -then you need to install `tkinter`. Be sure and get the Python 3 version. - +then yosudou need to install `tkinter`. Be sure and get the Python 3 version. +` ```sudo apt-get install python3-tk ``` @@ -285,12 +289,44 @@ then you need to install `tkinter`. Be sure and get the Python 3 version. Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available +Like above, you may have to install either pip or tkinter. To do this on Python 2.7: + +`sudo apt install python-pip` + +`sudo apt install python-tkinter` + +### Testing your installation + +Once you have installed, or copied the .py file to your app folder, you can test the installation using python. At the command prompt start up Python. + +#### Instructions for Python 2.7: +``` +python +>>> import PySimpleGUI27 +>>> PySimpleGUI27.main() +``` + +#### Instructions for Python 3: + +``` +python3 +>>> import PySimpleGUI27 +>>> PySimpleGUI27.main() +``` + +You will see a sample window in the center of your screen. If it's not installed correctly you are likely to get an error message during one of those commands + +Here is the window you should see: + +![sample window](https://user-images.githubusercontent.com/13696193/46097669-79efa500-c190-11e8-885c-e5d4d5d09ea6.jpg) + + ### Prerequisites Python 2.7 or Python 3 tkinter -PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### EXE file creation @@ -316,6 +352,9 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi Those using Python 2.7 will import a different module name `import PySimpleGUI27 as sg` +## Code Samples Assume Python 3 + +While all of the code examples you will see in this Readme and the Cookbook assume Python 3 and thus have an `import PySimpleGUI` at the top, you can run ***all*** of this code on Python 2.7 by changing the import statement to `import PySimpleGUI27` --- ## APIs @@ -2478,6 +2517,16 @@ You can use Update to do things like: * Change the choices in a list * etc + ### Updating Multiple Elements + If you have a large number of Elements to update, you can call `Window.UpdateElements()`. + +` UpdateElements(key_list, + value_list)` + +`key_list` - list of keys for elements you wish to update +`value_list` - list of values, one for each key + + window.UpdateElements(('name', 'address', 'phone'), ('Fred Flintstone', '123 Rock Quarry Road', '555#')) ## Sample Applications @@ -2570,6 +2619,15 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. +If you get a crash with something like: +``` +ValueError: script '.......\src\tkinter' not found +``` + +Then try adding **`--hidden-import tkinter`** to your command + + + ## Fun Stuff Here are some things to try if you're bored or want to further customize diff --git a/readme.md b/readme.md index 4aa63cf89..e4bd1d56d 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) -![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) + ![Awesome Meter](https://img.shields.io/badge/Awesome_meter-100-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) @@ -268,14 +268,18 @@ Some users have found that upgrading required using an extra flag on the pip `-- pip install --upgrade --no-cache-dir +On some versions of Linux you will need to first install pip. Need the Chicken before you can get the Egg (get it... Egg?) + +`sudo apt install python3-pip ` + If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: ``` ImportError: No module named tkinter ``` -then you need to install `tkinter`. Be sure and get the Python 3 version. - +then yosudou need to install `tkinter`. Be sure and get the Python 3 version. +` ```sudo apt-get install python3-tk ``` @@ -285,12 +289,44 @@ then you need to install `tkinter`. Be sure and get the Python 3 version. Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available +Like above, you may have to install either pip or tkinter. To do this on Python 2.7: + +`sudo apt install python-pip` + +`sudo apt install python-tkinter` + +### Testing your installation + +Once you have installed, or copied the .py file to your app folder, you can test the installation using python. At the command prompt start up Python. + +#### Instructions for Python 2.7: +``` +python +>>> import PySimpleGUI27 +>>> PySimpleGUI27.main() +``` + +#### Instructions for Python 3: + +``` +python3 +>>> import PySimpleGUI27 +>>> PySimpleGUI27.main() +``` + +You will see a sample window in the center of your screen. If it's not installed correctly you are likely to get an error message during one of those commands + +Here is the window you should see: + +![sample window](https://user-images.githubusercontent.com/13696193/46097669-79efa500-c190-11e8-885c-e5d4d5d09ea6.jpg) + + ### Prerequisites Python 2.7 or Python 3 tkinter -PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. +PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. ### EXE file creation @@ -316,6 +352,9 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi Those using Python 2.7 will import a different module name `import PySimpleGUI27 as sg` +## Code Samples Assume Python 3 + +While all of the code examples you will see in this Readme and the Cookbook assume Python 3 and thus have an `import PySimpleGUI` at the top, you can run ***all*** of this code on Python 2.7 by changing the import statement to `import PySimpleGUI27` --- ## APIs @@ -2478,6 +2517,16 @@ You can use Update to do things like: * Change the choices in a list * etc + ### Updating Multiple Elements + If you have a large number of Elements to update, you can call `Window.UpdateElements()`. + +` UpdateElements(key_list, + value_list)` + +`key_list` - list of keys for elements you wish to update +`value_list` - list of values, one for each key + + window.UpdateElements(('name', 'address', 'phone'), ('Fred Flintstone', '123 Rock Quarry Road', '555#')) ## Sample Applications @@ -2570,6 +2619,15 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. +If you get a crash with something like: +``` +ValueError: script '.......\src\tkinter' not found +``` + +Then try adding **`--hidden-import tkinter`** to your command + + + ## Fun Stuff Here are some things to try if you're bored or want to further customize From 6bb1015c437a2fa0a36539544d792d2d898ace8b Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 26 Sep 2018 13:49:37 -0400 Subject: [PATCH 479/521] Typo --- docs/index.md | 4 ++-- readme.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index e4bd1d56d..b3b1d6bf2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -310,8 +310,8 @@ python ``` python3 ->>> import PySimpleGUI27 ->>> PySimpleGUI27.main() +>>> import PySimpleGUI +>>> PySimpleGUI.main() ``` You will see a sample window in the center of your screen. If it's not installed correctly you are likely to get an error message during one of those commands diff --git a/readme.md b/readme.md index e4bd1d56d..b3b1d6bf2 100644 --- a/readme.md +++ b/readme.md @@ -310,8 +310,8 @@ python ``` python3 ->>> import PySimpleGUI27 ->>> PySimpleGUI27.main() +>>> import PySimpleGUI +>>> PySimpleGUI.main() ``` You will see a sample window in the center of your screen. If it's not installed correctly you are likely to get an error message during one of those commands From 06b1f3a199eb604f55e113a2d5b60b7802941ce9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 26 Sep 2018 15:28:32 -0400 Subject: [PATCH 480/521] Version 1.0.3 update --- docs/index.md | 2 +- readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index b3b1d6bf2..8a158ff17 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) - ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.3-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) diff --git a/readme.md b/readme.md index b3b1d6bf2..8a158ff17 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) - ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.0-blue.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.3-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) From 42eb6e668a3991650566427e7e16fd0dceee7d60 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 26 Sep 2018 18:59:06 -0400 Subject: [PATCH 481/521] RELEASES 3.8.2, 1.0.4 --- PySimpleGUI.py | 53 ++++++++++++++++++++++++++---------------------- PySimpleGUI27.py | 36 ++++++++++++++++---------------- docs/index.md | 12 +++++++++-- readme.md | 12 +++++++++-- 4 files changed, 66 insertions(+), 47 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 8b2d13b9f..fe63bccb4 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -947,15 +947,24 @@ def __init__(self, size=(None, None), background_color=None, text_color=None, pa :param size: Size of field in characters :param background_color: Color for Element. Text or RGB Hex ''' - self.TKOut = None + self._TKOut = None bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR super().__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font, tooltip=tooltip, key=key) + + @property + def TKOut(self): + if self._TKOut is None: + print('*** Did you forget to call Finalize()? Your code should look something like: ***') + print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***') + return self._TKOut + + def __del__(self): try: - self.TKOut.__del__() + self._TKOut.__del__() except: pass super().__del__() @@ -1244,7 +1253,7 @@ def __init__(self, canvas=None, background_color=None, size=(None, None), pad=No def TKCanvas(self): if self._TKCanvas is None: print('*** Did you forget to call Finalize()? Your code should look something like: ***') - print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') + print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***') return self._TKCanvas @@ -1300,6 +1309,11 @@ def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1]) return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) + def DrawText(self, text, location, color='black', font=None): + converted_point = self._convert_xy_to_canvas_xy(location[0], location[1]) + return self._TKCanvas2.create_text(converted_point[0], converted_point[1], text=text, font=font, fill=color) + + def Erase(self): self._TKCanvas2.delete('all') @@ -1322,7 +1336,7 @@ def MoveFigure(self, figure, x_direction, y_direction): def TKCanvas(self): if self._TKCanvas2 is None: print('*** Did you forget to call Finalize()? Your code should look something like: ***') - print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') + print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***') return self._TKCanvas2 def __del__(self): @@ -1959,7 +1973,7 @@ class Window: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=None, keep_on_top=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -2166,15 +2180,6 @@ def FindElement(self, key): print('*** WARNING = FindElement did not find the key. Please check your key\'s spelling ***') return element - - def UpdateElements(self, key_list, value_list): - for i, key in enumerate(key_list): - try: - self.FindElement(key).Update(value_list[i]) - except: - pass - - def SaveToDisk(self, filename): try: results = BuildResults(self, False, self) @@ -3076,10 +3081,10 @@ def CharWidthInPixels(): # ------------------------- OUTPUT element ------------------------- # elif element_type == ELEM_TYPE_OUTPUT: width, height = element_size - element.TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font, pad=element.Pad) - element.TKOut.pack(side=tk.LEFT, expand=True, fill='both') + element._TKOut = TKOutput(tk_row_frame, width=width, height=height, bd=border_depth, background_color=element.BackgroundColor, text_color=text_color, font=font, pad=element.Pad) + element._TKOut.pack(side=tk.LEFT, expand=True, fill='both') if element.Tooltip is not None: - element.TooltipObject = ToolTip(element.TKOut, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) + element.TooltipObject = ToolTip(element._TKOut, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- IMAGE Box element ------------------------- # elif element_type == ELEM_TYPE_IMAGE: if element.Filename is not None: @@ -3533,7 +3538,7 @@ def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,No local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) - form = FlexForm(title, auto_size_text=True, grab_anywhere=grab_anywhere) + form = Window(title, auto_size_text=True, grab_anywhere=grab_anywhere) # Form using a horizontal bar if local_orientation[0].lower() == 'h': @@ -3781,7 +3786,7 @@ class DebugWin(): def __init__(self, size=(None, None)): # Show a form that's a running counter win_size = size if size !=(None, None) else DEFAULT_DEBUG_WINDOW_SIZE - self.form = FlexForm('Debug Window', auto_size_text=True, font=('Courier New', 12)) + self.form = Window('Debug Window', auto_size_text=True, font=('Courier New', 12)) self.output_element = Output(size=win_size) self.form_rows = [[Text('EasyPrint Output')], [self.output_element], @@ -3844,7 +3849,7 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au if not args: return width, height = size width = width if width else MESSAGE_BOX_LINE_WIDTH - with FlexForm(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: + with Window(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 complete_output = '' for message in args: @@ -3917,7 +3922,7 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), root.destroy() return folder_name - with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, + with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), FolderBrowse()], @@ -3969,7 +3974,7 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files browse_button = SaveAs(file_types=file_types) if save_as else FileBrowse(file_types=file_types) - with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, + with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), browse_button], @@ -4003,7 +4008,7 @@ def PopupGetText(message, default_text='', password_char='', size=(None,None), b :param location: :return: Text entered or None if window was closed """ - with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, + with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], [InputText(default_text=default_text, size=size, password_char=password_char)], @@ -4359,7 +4364,7 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: + with Window(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index 6f14e9cfe..56b00151f 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -1259,7 +1259,7 @@ def __init__(self, canvas=None, background_color=None, size=(None, None), pad=No def TKCanvas(self): if self._TKCanvas is None: print('*** Did you forget to call Finalize()? Your code should look something like: ***') - print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') + print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***') return self._TKCanvas @@ -1315,6 +1315,13 @@ def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1]) return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) + + + def DrawText(self, text, location, color='black', font=None): + converted_point = self._convert_xy_to_canvas_xy(location[0], location[1]) + return self._TKCanvas2.create_text(converted_point[0], converted_point[1], text=text, font=font, fill=color) + + def Erase(self): self._TKCanvas2.delete('all') @@ -1337,7 +1344,7 @@ def MoveFigure(self, figure, x_direction, y_direction): def TKCanvas(self): if self._TKCanvas2 is None: print('*** Did you forget to call Finalize()? Your code should look something like: ***') - print('*** form = sg.FlexForm("My Form").Layout(layout).Finalize() ***') + print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***') return self._TKCanvas2 def __del__(self): @@ -1974,7 +1981,7 @@ class Window: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=None, keep_on_top=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -2181,15 +2188,6 @@ def FindElement(self, key): print('*** WARNING = FindElement did not find the key. Please check your key\'s spelling ***') return element - - def UpdateElements(self, key_list, value_list): - for i, key in enumerate(key_list): - try: - self.FindElement(key).Update(value_list[i]) - except: - pass - - def SaveToDisk(self, filename): try: results = BuildResults(self, False, self) @@ -3482,7 +3480,7 @@ def _ProgressMeter(title, max_value, *args, **kwargs): local_orientation = DEFAULT_METER_ORIENTATION if orientation is None else orientation local_border_width = DEFAULT_PROGRESS_BAR_BORDER_WIDTH if border_width is None else border_width bar2 = ProgressBar(max_value, orientation=local_orientation, size=size, bar_color=bar_color, border_width=local_border_width, relief=DEFAULT_PROGRESS_BAR_RELIEF) - form = FlexForm(title, auto_size_text=True, grab_anywhere=grab_anywhere) + form = Window(title, auto_size_text=True, grab_anywhere=grab_anywhere) # Form using a horizontal bar if local_orientation[0].lower() == 'h': @@ -3730,7 +3728,7 @@ class DebugWin(): def __init__(self, size=(None, None)): # Show a form that's a running counter win_size = size if size !=(None, None) else DEFAULT_DEBUG_WINDOW_SIZE - self.form = FlexForm('Debug Window', auto_size_text=True, font=('Courier New', 12)) + self.form = Window('Debug Window', auto_size_text=True, font=('Courier New', 12)) self.output_element = Output(size=win_size) self.form_rows = [[Text('EasyPrint Output')], [self.output_element], @@ -3793,7 +3791,7 @@ def ScrolledTextBox(button_color=None, yes_no=False, auto_close=False, auto_clos if not args: return width, height = size width = width if width else MESSAGE_BOX_LINE_WIDTH - with FlexForm(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: + with Window(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 complete_output = '' for message in args: @@ -3866,7 +3864,7 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), root.destroy() return folder_name - with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, + with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), FolderBrowse()], @@ -3918,7 +3916,7 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files browse_button = SaveAs(file_types=file_types) if save_as else FileBrowse(file_types=file_types) - with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, + with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], [InputText(default_text=default_path, size=size), browse_button], @@ -3952,7 +3950,7 @@ def PopupGetText(message, default_text='', password_char='', size=(None,None), b :param location: :return: Text entered or None if window was closed """ - with FlexForm(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, + with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], [InputText(default_text=default_text, size=size, password_char=password_char)], @@ -4342,7 +4340,7 @@ def Popup(*args, **kwargs): else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - form = FlexForm(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) + form = Window(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) max_line_total, total_lines = 0,0 for message in args_to_print: # fancy code to check if string and convert if not is not need. Just always convert to string :-) diff --git a/docs/index.md b/docs/index.md index 8a158ff17..4b16d9cef 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,9 +18,9 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.2-red.svg?longCache=true&style=for-the-badge) - ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.3-blue.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -2833,6 +2833,14 @@ OneLineProgressMeter function added which gives you not only a one-line solution #### 1.0.0 Python 2.7 It's official. There is a 2.7 version of PySimpleGUI! +#### 3.8.2 +* Exposed `TKOut` in Output Element +* `DrawText` added to Graph Elements +* Removed `Window.UpdateElements` +* `Window.grab_anywere` defaults to False +* + + ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index 8a158ff17..4b16d9cef 100644 --- a/readme.md +++ b/readme.md @@ -18,9 +18,9 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.1-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.2-red.svg?longCache=true&style=for-the-badge) - ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.3-blue.svg?longCache=true&style=for-the-badge) + ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) @@ -2833,6 +2833,14 @@ OneLineProgressMeter function added which gives you not only a one-line solution #### 1.0.0 Python 2.7 It's official. There is a 2.7 version of PySimpleGUI! +#### 3.8.2 +* Exposed `TKOut` in Output Element +* `DrawText` added to Graph Elements +* Removed `Window.UpdateElements` +* `Window.grab_anywere` defaults to False +* + + ### Upcoming Make suggestions people! Future release features From 9c59d86d1c9ad54add0d20ff430a17e8ce84e3a9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 26 Sep 2018 22:41:49 -0400 Subject: [PATCH 482/521] Added making Axis --- Demo_Graph_Element_Sine_Wave.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py index 2609f6a89..bd69551e2 100644 --- a/Demo_Graph_Element_Sine_Wave.py +++ b/Demo_Graph_Element_Sine_Wave.py @@ -1,16 +1,28 @@ import math import PySimpleGUI as sg -layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-100,-100), graph_top_right=(100,100), background_color='white', key='graph', tooltip='This is a cool graph!')],] +layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-105,-105), graph_top_right=(105,105), background_color='white', key='graph', tooltip='This is a cool graph!')],] window = sg.Window('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize() graph = window.FindElement('graph') +# Draw axis graph.DrawLine((-100,0), (100,0)) graph.DrawLine((0,-100), (0,100)) +for x in range(-100, 101, 20): + graph.DrawLine((x,-3), (x,3)) + if x != 0: + graph.DrawText( x, (x,-10), color='green') + +for y in range(-100, 101, 20): + graph.DrawLine((-3,y), (3,y)) + if y != 0: + graph.DrawText( y, (-10,y), color='blue') + +# Draw Graph for x in range(-100,100): y = math.sin(x/20)*50 - graph.DrawPoint((x,y), color='red') + graph.DrawCircle((x,y), 1, line_color='red', fill_color='red') button, values = window.Read() From 4208d9d569ab8150a8d8a4d4b1f22dddbcf14679 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 26 Sep 2018 23:06:06 -0400 Subject: [PATCH 483/521] Warnings added to help people when they missed calling Finalize --- Demo_Graph_Drawing.py | 2 +- PySimpleGUI.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Demo_Graph_Drawing.py b/Demo_Graph_Drawing.py index ee812c523..886d4fa78 100644 --- a/Demo_Graph_Drawing.py +++ b/Demo_Graph_Drawing.py @@ -5,7 +5,7 @@ [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')] ] -window = sg.Window('Graph test').Layout(layout) +window = sg.Window('Graph test').Layout(layout).Finalize() graph = window.FindElement('graph') circle = graph.DrawCircle((75,75), 25, fill_color='black',line_color='white') diff --git a/PySimpleGUI.py b/PySimpleGUI.py index fe63bccb4..657799f6f 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1288,48 +1288,88 @@ def _convert_xy_to_canvas_xy(self, x_in, y_in): def DrawLine(self, point_from, point_to, color='black', width=1): converted_point_from = self._convert_xy_to_canvas_xy(point_from[0], point_from[1]) converted_point_to = self._convert_xy_to_canvas_xy(point_to[0], point_to[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None return self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color) def DrawPoint(self, point, size=2, color='black'): converted_point = self._convert_xy_to_canvas_xy(point[0], point[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None return self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color ) def DrawCircle(self, center_location, radius, fill_color=None, line_color='black'): converted_point = self._convert_xy_to_canvas_xy(center_location[0], center_location[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None return self._TKCanvas2.create_oval(converted_point[0]-radius, converted_point[1]-radius, converted_point[0]+radius, converted_point[1]+radius, fill=fill_color, outline=line_color) def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None): converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1]) converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0],bottom_right[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None return self._TKCanvas2.create_oval(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None): converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1] ) converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) def DrawText(self, text, location, color='black', font=None): converted_point = self._convert_xy_to_canvas_xy(location[0], location[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None return self._TKCanvas2.create_text(converted_point[0], converted_point[1], text=text, font=font, fill=color) def Erase(self): + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None self._TKCanvas2.delete('all') def Update(self, background_color): + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None self._TKCanvas2.configure(background=background_color) def Move(self, x_direction, y_direction): zero_converted = self._convert_xy_to_canvas_xy(0,0) shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) + if self._TKCanvas2 is None: + print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') + print('Call Window.Finalize() prior to this operation') + return None self._TKCanvas2.move('all', shift_amount[0], shift_amount[1]) def MoveFigure(self, figure, x_direction, y_direction): zero_converted = self._convert_xy_to_canvas_xy(0,0) shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1]) + if figure is None: + print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***') + print('Call Window.Finalize() prior to all graph operations') + return None self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1]) @property From 78c31358becdfaabf1bdf1d383faa3e45a34e561 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 01:17:09 -0400 Subject: [PATCH 484/521] New Window option - Force top level - forces the window to be a Toplevel tkinter window --- PySimpleGUI.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 657799f6f..4aff4c03a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2013,7 +2013,7 @@ class Window: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel = False, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -2054,6 +2054,7 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.NoTitleBar = no_titlebar self.GrabAnywhere = grab_anywhere self.KeepOnTop = keep_on_top + self.ForceTopLevel = force_toplevel # ------------------------- Add ONE Row to Form ------------------------- # def AddRow(self, *args): @@ -3471,8 +3472,13 @@ def StartupTK(my_flex_form): global _my_windows ow = _my_windows.NumOpenWindows + # print('Starting TK open Windows = {}'.format(ow)) - root = tk.Tk() if not ow else tk.Toplevel() + if not ow and not my_flex_form.ForceTopLevel: + root = tk.Tk() + else: + root = tk.Toplevel() + try: root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' except: From 8b4185988f7f7b3a742bc306ff259d42ecc95182 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 05:18:35 -0400 Subject: [PATCH 485/521] Programming course with PySimpleGUI lessons --- .../1a PSG (Entry and PopUp).py | 29 ++++ ProgrammingClassExamples/1b PSG (Format).py | 37 +++++ .../1c PSG (persistent form and bind key).py | 32 +++++ ...PSG (named input keys and catch errors).py | 35 +++++ .../1e PSG (validation and Look and Feel).py | 34 +++++ .../2a. PSG (checkbox and radiobuttons).py | 40 ++++++ .../2b_makewinexe_file.py | 36 +++++ .../3 PSG (multiline display).py | 40 ++++++ .../4a PSG (Sliders and combo).py | 43 ++++++ .../4b PSG (Spinner and combo) .py | 38 +++++ .../6 PSG sort and search .py | 130 ++++++++++++++++++ ProgrammingClassExamples/Text files.py | 88 ++++++++++++ 12 files changed, 582 insertions(+) create mode 100644 ProgrammingClassExamples/1a PSG (Entry and PopUp).py create mode 100644 ProgrammingClassExamples/1b PSG (Format).py create mode 100644 ProgrammingClassExamples/1c PSG (persistent form and bind key).py create mode 100644 ProgrammingClassExamples/1d PSG (named input keys and catch errors).py create mode 100644 ProgrammingClassExamples/1e PSG (validation and Look and Feel).py create mode 100644 ProgrammingClassExamples/2a. PSG (checkbox and radiobuttons).py create mode 100644 ProgrammingClassExamples/2b_makewinexe_file.py create mode 100644 ProgrammingClassExamples/3 PSG (multiline display).py create mode 100644 ProgrammingClassExamples/4a PSG (Sliders and combo).py create mode 100644 ProgrammingClassExamples/4b PSG (Spinner and combo) .py create mode 100644 ProgrammingClassExamples/6 PSG sort and search .py create mode 100644 ProgrammingClassExamples/Text files.py diff --git a/ProgrammingClassExamples/1a PSG (Entry and PopUp).py b/ProgrammingClassExamples/1a PSG (Entry and PopUp).py new file mode 100644 index 000000000..ed6600fcb --- /dev/null +++ b/ProgrammingClassExamples/1a PSG (Entry and PopUp).py @@ -0,0 +1,29 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +layout = [ + [sg.Text('Celcius'), sg.InputText()], #layout, Text, Input + [sg.Submit()], #button on line below + ] + +#setup window with Title +window = sg.Window('Temperature Converter').Layout(layout) + +button, value = window.Read() #get value (part of a list) + +fahrenheit = round(9/5*float(value[0]) +32, 1) #convert and create string +result = 'Temperature in Fahrenheit is: ' + str(fahrenheit) +sg.Popup('Result', result) #display in Popup + + + + + + + + + + diff --git a/ProgrammingClassExamples/1b PSG (Format).py b/ProgrammingClassExamples/1b PSG (Format).py new file mode 100644 index 000000000..218be4029 --- /dev/null +++ b/ProgrammingClassExamples/1b PSG (Format).py @@ -0,0 +1,37 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +#Set formatting options for all elements rather than individually. +sg.SetOptions (background_color = 'LightBlue', + element_background_color = 'LightBlue', + text_element_background_color = 'LightBlue', + font = ('Arial', 10, 'bold'), + text_color = 'Blue', + input_text_color ='Blue', + button_color = ('White', 'Blue') + ) +#adjust widths +layout = [ + [sg.Text('Celcius', size =(12,1)), sg.InputText(size = (8,1))], + [sg.Submit()], + ] + +window = sg.Window('Converter').Layout(layout) +button, value = window.Read() + +fahrenheit = round(9/5*float(value[0]) +32, 1) +result = 'Temperature in Fahrenheit is: ' + str(fahrenheit) +sg.Popup('Result',result) + + + + + + + + + + diff --git a/ProgrammingClassExamples/1c PSG (persistent form and bind key).py b/ProgrammingClassExamples/1c PSG (persistent form and bind key).py new file mode 100644 index 000000000..bae93423c --- /dev/null +++ b/ProgrammingClassExamples/1c PSG (persistent form and bind key).py @@ -0,0 +1,32 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (background_color = 'LightBlue', + element_background_color = 'LightBlue', + text_element_background_color = 'LightBlue', + font = ('Arial', 10, 'bold'), + text_color = 'Blue', + input_text_color ='Blue', + button_color = ('White', 'Blue') + ) +#update (via list) values and and display answers +#value[0] is celcius input, value[1] is input to place result. +#Use ReadButton with while true: - keeps window open. + +layout = [ [sg.Text('Enter a Temperature in Celcius')], + [sg.Text('Celcius', size =(8,1)), sg.InputText(size = (15,1))], + [sg.Text('Result', size =(8,1)), sg.InputText(size = (15,1))], + [sg.ReadButton('Submit', bind_return_key = True)]] #Return = button press + +window = sg.Window('Converter').Layout(layout) + +while True: + button, value = window.Read() #get result + if button is not None: #break out of loop is button not pressed. + fahrenheit = round(9/5*float(value[0]) +32, 1) + window.FindElement(1).Update(fahrenheit) #put result in 2nd input box + else: + break diff --git a/ProgrammingClassExamples/1d PSG (named input keys and catch errors).py b/ProgrammingClassExamples/1d PSG (named input keys and catch errors).py new file mode 100644 index 000000000..e62fae8d3 --- /dev/null +++ b/ProgrammingClassExamples/1d PSG (named input keys and catch errors).py @@ -0,0 +1,35 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (background_color = 'LightBlue', + element_background_color = 'LightBlue', + text_element_background_color = 'LightBlue', + font = ('Arial', 10, 'bold'), + text_color = 'Blue', + input_text_color ='Blue', + button_color = ('White', 'Blue') + ) +#name inputs (key) uses dictionary- easy to see updating of results +#value[input] first input value te c... +layout = [ [sg.Text('Enter a Temperature in Celcius')], + [sg.Text('Celcius', size =(8,1)), sg.InputText(size = (15,1),key = 'input')], + [sg.Text('Result', size =(8,1)), sg.InputText(size = (15,1),key = 'result')], + [sg.ReadButton('Submit', bind_return_key = True)]] + +window = sg.FlexForm('Temp Converter').Layout(layout) + +while True: + button, value = window.Read() + if button is not None: + #catch program errors for text or blank entry: + try: + fahrenheit = round(9/5*float(value['input']) +32, 1) + window.FindElement('result').Update(fahrenheit) #put result in text box + except ValueError: + sg.Popup('Error','Please try again') #display error + + else: + break diff --git a/ProgrammingClassExamples/1e PSG (validation and Look and Feel).py b/ProgrammingClassExamples/1e PSG (validation and Look and Feel).py new file mode 100644 index 000000000..e6b435a3e --- /dev/null +++ b/ProgrammingClassExamples/1e PSG (validation and Look and Feel).py @@ -0,0 +1,34 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +#Can use a variety of themes - plus individual options +sg.ChangeLookAndFeel('SandyBeach') +sg.SetOptions (font = ('Arial', 10, 'bold')) + + +layout = [ [sg.Text('Enter a Temperature in Celcius')], + [sg.Text('Celcius', size =(8,1)), sg.InputText(size = (15,1),key = 'input')], + [sg.Text('Result', size =(8,1)), sg.InputText(size = (15,1),key = 'result')], + [sg.ReadButton('Submit', bind_return_key = True)]] + +window = sg.FlexForm('Temp Converter').Layout(layout) + +while True: + button, value = window.Read() + if button is not None: + #catch program errors for text, floats or blank entry: + #Also validation for range [0, 50] + try: + if float(value['input']) > 50 or float(value['input']) <0: + sg.Popup('Error','Out of range') + else: + fahrenheit = round(9/5*int(value['input']) +32, 1) + window.FindElement('result').Update(fahrenheit) #put result in text box + except ValueError: + sg.Popup('Error','Please try again') #display error + + else: + break diff --git a/ProgrammingClassExamples/2a. PSG (checkbox and radiobuttons).py b/ProgrammingClassExamples/2a. PSG (checkbox and radiobuttons).py new file mode 100644 index 000000000..6c54f600d --- /dev/null +++ b/ProgrammingClassExamples/2a. PSG (checkbox and radiobuttons).py @@ -0,0 +1,40 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.ChangeLookAndFeel('GreenTan') #Set colour scheme +sg.SetOptions (font =('Calibri',12,'bold') ) #and font + + + +#One checkbox and three radio buttons (grouped as 'Radio1' +layout = [[sg.Text('Membership Calculator', font = ('Calibri', 16, 'bold'))], + [sg.Checkbox(' Student? 10% off', size = (25,1)), #value[0] + sg.ReadButton('Display Cost', size = (14,1))], + [sg.Radio('1 month $50', 'Radio1', default = True), #value[1] + sg.Radio('3 months $100', 'Radio1'), #value[2] + sg.Radio('1 year $300', 'Radio1')], #value[3] + [sg.Text('', size = (30,1), justification = 'center', font =('Calibri', 16, 'bold'), key = 'result')]] + +window = sg.Window('Gym Membership').Layout(layout) + +while True: + button, value = window.Read() + if button is not None: + if value[1]: + cost = 50 + elif value[2]: + cost = 100 + else: + cost = 300 + if value[0]: + cost = cost*0.9 #apply discount + + #format as currency $ symbol and 2 d.p. - make a string + result = str(' Cost: ' + '${:.2f}'.format(cost)) + window.FindElement('result').Update(result) #put the result in Textbox + + else: + break diff --git a/ProgrammingClassExamples/2b_makewinexe_file.py b/ProgrammingClassExamples/2b_makewinexe_file.py new file mode 100644 index 000000000..351f082d1 --- /dev/null +++ b/ProgrammingClassExamples/2b_makewinexe_file.py @@ -0,0 +1,36 @@ +import PySimpleGUI as sg +#pip install PyInstaller +#windows command prompt pyinstaller -wF 2b_makewinexe_file.py +#must CD to directory where py file is + +sg.ChangeLookAndFeel('GreenTan') #Set colour scheme +sg.SetOptions (font =('Calibri',12,'bold') ) #and font + +form = sg.FlexForm('Gym Membership') + + +layout = [[sg.Text('Membership Calculator', font = ('Calibri', 16, 'bold'))], + [sg.Checkbox('CGS student?', size = (22,1)), #value[0] + sg.ReadButton('Display Cost', size = (14,1))], + [sg.Radio('One Month', 'Radio1', default = True), #value[1] + sg.Radio('Three Month', 'Radio1'), #value[2] + sg.Radio('One Year', 'Radio1')], #value[3] + [sg.Text('', size = (30,1), justification = 'center', font =('Calibri', 16, 'bold'), key = 'result')]] + +form.Layout(layout) +while True: + button, value = form.Read() + if button is not None: + if value[1]: + cost = 50 + elif value[2]: + cost = 100 + else: + cost = 300 + if value[0]: + cost = cost*0.9 + result = str(' Cost: ' + '${:.2f}'.format(cost)) #format as currency - make a string + form.FindElement('result').Update(result) #put the result in Textbox + + else: + break diff --git a/ProgrammingClassExamples/3 PSG (multiline display).py b/ProgrammingClassExamples/3 PSG (multiline display).py new file mode 100644 index 000000000..91ac114a5 --- /dev/null +++ b/ProgrammingClassExamples/3 PSG (multiline display).py @@ -0,0 +1,40 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.ChangeLookAndFeel('GreenTan') + +sg.SetOptions(font = ('Courier New', 12)) + + + +layout = [ + [sg.Text('Enter and Add Data to Display', font = ('Calibri', 14,'bold'))], + [sg.Text('Race:', size = (5,1)), sg.InputText(size = (8,1)), + sg.Text('Club:', size = (5,1)), sg.InputText(size = (8,1))], + [sg.Text('Name:', size = (5,1)), sg.InputText(size = (8,1)), + sg.Text('Time:', size = (5,1)), sg.InputText(size = (8,1)),sg.Text(' '), + sg.ReadButton('Add Data', font = ('Calibri', 12, 'bold'))], + [sg.Text('_'*40)], + [sg.Text(' Race Club Name Time')], + [sg.Multiline(size =(40,6),key = 'Multiline')] + ] + +window = sg.Window('Enter & Display Data').Layout(layout) + +string = '' +S=[] +while True: + + button, value = window.Read() + if button is not None: + #use string formatting - best way? plus Courier New font - non-proportional font + S = S + ['{:^9s}{:<11s}{:<10s}{:>8s}'.format(value[0],value[1],value[2],value[3])] + for s in S: + string = string + s + '\n' + window.FindElement('Multiline').Update(string) + string ='' + else: + break diff --git a/ProgrammingClassExamples/4a PSG (Sliders and combo).py b/ProgrammingClassExamples/4a PSG (Sliders and combo).py new file mode 100644 index 000000000..67a930fdc --- /dev/null +++ b/ProgrammingClassExamples/4a PSG (Sliders and combo).py @@ -0,0 +1,43 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +column1 = [ + [sg.Text('Pick operation', size = (15,1), font = ('Calibri', 12, 'bold'))], +[sg.InputCombo(['Add','Subtract','Multiply','Divide'], size = (10,6))], + [sg.Text('', size =(1,4))]] +column2 = [ + [sg.ReadButton('Submit', font = ('Calibri', 12, 'bold'), button_color = ('White', 'Red'))], + [sg.Text('Result:', font = ('Calibri', 12, 'bold'))],[sg.InputText(size = (12,1), key = 'result')] + ] + + +layout = [ + [sg.Text('Slider and Combo box demo', font = ('Calibri', 14,'bold'))], + [sg.Slider(range = (-9, 9),orientation = 'v', size = (5,20), default_value = 0), + sg.Slider(range = (-9, 9),orientation = 'v', size = (5, 20), default_value = 0), + sg.Text(' '), sg.Column(column1), sg.Column(column2)]] + +window = sg.Window('Enter & Display Data', grab_anywhere=False).Layout(layout) + +while True: + button, value = window.Read() + if button is not None: + if value[2] == 'Add': + result = value[0] + value[1] + elif value[2] == 'Multiply': + result = value[0] * value[1] + elif value[2] == 'Subtract': + result = value[0] - value[1] + elif value[2] == 'Divide': + if value[1] ==0: + sg.Popup('Second value can\'t be zero') + if value[0] == 0: + result = 'NA' + else: + result = value[0] / value[1] + window.FindElement('result').Update(result) + else: + break diff --git a/ProgrammingClassExamples/4b PSG (Spinner and combo) .py b/ProgrammingClassExamples/4b PSG (Spinner and combo) .py new file mode 100644 index 000000000..b4b61fc03 --- /dev/null +++ b/ProgrammingClassExamples/4b PSG (Spinner and combo) .py @@ -0,0 +1,38 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg +sg.SetOptions(font= ('Calibri', 12, 'bold')) + +layout = [ + [sg.Text('Spinner and Combo box demo', font = ('Calibri', 14, 'bold'))], + [sg.Spin([sz for sz in range (-9,10)], initial_value = 0), + sg.Spin([sz for sz in range (-9,10)], initial_value = 0), + sg.Text('Pick operation', size = (13,1)), + sg.InputCombo(['Add','Subtract','Multiply','Divide'], size = (8,6))], + [sg.Text('Result: ')],[sg.InputText(size = (6,1), key = 'result'), + sg.ReadButton('Calculate', button_color = ('White', 'Red'))]] + +window = sg.Window('Enter & Display Data', grab_anywhere=False).Layout(layout) + +while True: + button, value = window.Read() + + if button is not None: + val = [int(value[0]), int(value[1])] + if value[2] == 'Add': + result = val[0] + val[1] + elif value[2] == 'Multiply': + result = val[0] * val[1] + elif value[2] == 'Subtract': + result = val[0] - val[1] + elif value[2] == 'Divide': + if val[1] ==0: + sg.Popup('Second value can\'t be zero') + result = 'NA' + else: + result = round( val[0] / val[1], 3) + window.FindElement('result').Update(result) + else: + break diff --git a/ProgrammingClassExamples/6 PSG sort and search .py b/ProgrammingClassExamples/6 PSG sort and search .py new file mode 100644 index 000000000..70541403d --- /dev/null +++ b/ProgrammingClassExamples/6 PSG sort and search .py @@ -0,0 +1,130 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (font =('Calibri',12,'bold')) + + +#setup column (called column1) of buttons to sue in layout + +column1 = [[sg.ReadButton('Original list', size = (13,1))], + [sg.ReadButton('Default sort', size = (13,1))], + [sg.ReadButton('Sort: selection',size = (13,1))], + [sg.ReadButton('Sort: quick', size = (13,1))]] + +layout =[[sg.Text('Search and Sort Demo', font =('Calibri', 20, 'bold'))], +[sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display'), sg.Column(column1)], + [sg.Text('_'*32,font = ('Calibri', 12))], + [sg.InputText(size = (13,1), key = 'linear'), sg.Text(' '), sg.InputText(size = (13,1), key = 'binary')], + [sg.ReadButton('Linear Search', size = (13,1)), sg.Text(' '), sg.ReadButton('Binary Search', size = (13,1))], + ] + +window = sg.Window('Search and Sort Demo').Layout(layout) + +#names for Demo, could be loaded from a file +Names= ['Roberta', 'Kylie', 'Jenny', 'Helen', + 'Andrea', 'Meredith','Deborah','Pauline', + 'Belinda', 'Wendy'] + +#function to display list +def displayList(List): + global ListDisplayed #store list in Multiline text globally + ListDisplayed = List + display = '' + for l in List: #add list elements with new line + display = display + l + '\n' + window.FindElement('display').Update(display) + +#use inbuilt python sort +def default(Names): + L = Names[:] + L.sort() #inbuilt sort + displayList(L) + +#Selection sort - See Janson Ch 7 +def selSort(Names): + L = Names[:] + for i in range(len(L)): + smallest = i + for j in range(i+1, len(L)): + if L[j] < L[smallest]: #find smallest value + smallest = j #swap it to front + L[smallest], L[i] = L[i], L[smallest] #repeat from next poistion + displayList(L) + +#Quick sort - See Janson Ch 7 +def qsortHolder(Names): + L = Names[:] #pass List, first and last + quick_sort(L, 0, len(L) -1) #Start process + displayList(L) + +def quick_sort(L, first, last): #Quicksort is a partition sort + if first >= last: + return L + pivot = L[first] + low = first + high = last + while low < high: + while L[high] > pivot: + high = high -1 + while L[low] < pivot: + low = low + 1 + if low <= high: + L[high], L[low] = L[low], L[high] + low = low + 1 + high = high -1 + quick_sort(L, first, low -1) #continue splitting - sort small lsist + quick_sort(L, low, last) + +#Linear Search - no need for Ordered list +def linearSearch(): + L = Names[:] + found = False + for l in L: + if l == value['linear']: #Check each value + found = True + window.FindElement('display').Update('Linear search\n' + l + ' found.') + break + if not found: + window.FindElement('display').Update(value['linear'] + ' was \nNot found') + +#Binary Search - only works fot ordered lists +def binarySearch(): + L = ListDisplayed[:] #get List currently in multiline display + lo = 0 + hi = len(L)-1 + found = False #Start with found is Flase + while lo <= hi: + mid = (lo + hi) //2 #Start in middle + if L[mid] == value['binary']: #get the value from the search box + window.FindElement('display').Update('Binary search\n' + L[mid] + ' found.') + found = True #If found display + break #and stop + elif L[mid] < value['binary']: + lo = mid + 1 #Search in top half + else: + hi = mid - 1 #Search in lower half + if not found: #If we get to end - display not found + window.FindElement('display').Update(value['binary'] + ' was \nNot found') + + +while True: + button, value = window.Read() + if button is not None: + if button == 'Original list': + displayList(Names) + if button == 'Default sort': + default(Names) + if button == 'Sort: selection': + selSort(Names) + if button == 'Sort: quick': + qsortHolder(Names) + if button == 'Linear Search': + linearSearch() + if button == 'Binary Search': + binarySearch() + else: + break + diff --git a/ProgrammingClassExamples/Text files.py b/ProgrammingClassExamples/Text files.py new file mode 100644 index 000000000..cc1d22332 --- /dev/null +++ b/ProgrammingClassExamples/Text files.py @@ -0,0 +1,88 @@ +# TCC +#20/1/18 Oz date + +from tkinter import * + +def callback(event): #used to allow Return key as well as + calculate() # button press for mark entry + + +def calculate(): + global i, total,name + name = entry_name.get() #get the name and prevent another + mark[i] = entry_mark.get() + label_name.configure(state = DISABLED) + entry_name.configure(state = DISABLED) + mark[i] = entry_mark.get() #get and store in mark list and clear entry + entry_mark.delete(0,END) + i = i + 1 #get total i - needs to be global + if i == 4: #if four marks - stop + button_done.configure(state = NORMAL) + button_calculate.configure(state = DISABLED) + +def done(): + total = 0 + for m in mark: #total marks - convery to integer + total += int(m) + average = total/4 #calculate average + f = open(pathname, 'w') + print(name, file= f) + print(total, file= f) #write to file + print(average, file= f) + f.close() + button_done.configure(state = DISABLED) #stop button being pressed again + button_display.configure(state = NORMAL) + + +def display(): + #create list of three valuesand combine elemnets into one string - use \n for new line + data = [line.strip() for line in open(pathname)] + s= 'Name: ' + data[0] +'\nTotal: ' + str(data[1]) + '\nAverage: ' + str(data[2]) + label_displayresults.configure(text = s) + + +root = Tk() +root.title('text files') + +#set up controls +label_instructs = Label(justify = LEFT, padx = 10, pady=10,width = 30, height =4, text = 'Enter a Name then a Mark then press\nCalculate, do this 4 times.Then press\nDone to Save Name, Total and Average.') +label_name = Label(text='Name: ', width = 8) +entry_name = Entry(width = 8) +label_mark = Label(text='Mark: ', width = 8) +entry_mark = Entry(width = 8) +button_calculate = Button(text = 'Calculate', command=calculate) +button_done= Button(pady = 8, text='Done', command = done, state = DISABLED) +button_display = Button(pady =8,text = 'Display', command=display, state = DISABLED) +label_displaytext = Label(justify = LEFT, text='Press display to\nretrieve recent\nTotal & Average') +label_displayresults=Label(justify = LEFT, padx = 10, height = 5,) + +#set up positioning of controls +label_instructs.grid(row = 0, columnspan = 3) +label_name.grid(row = 1, column = 0) +entry_name.grid(row = 1, column = 1) +label_mark.grid(row = 2, column = 0) +entry_mark.grid(row = 2, column = 1) + +entry_mark.bind('', callback) #create binding for Return key for mark entry box + +button_calculate.grid(row =3, column = 0) +button_done.grid(row = 3, column = 1) +button_display.grid(row = 4, column = 0) +label_displaytext.grid(row = 4, column = 1) +label_displayresults.grid(row = 5, columnspan = 2) + +#global variables when used in more than one function +global i +global mark +global total +global average +i=total=0 +mark = [0,0,0,0] +average = 0.0 +entry_name.focus() #set initial focus + +global pathname + +pathname = "C:\\Users\\tcrewe\\Dropbox\\01 Teaching folders\\07 TCC Python stuff\\TCC py files\\TCC sample files\wordlist.txt" + +mainloop() From ab98ea20eba784f16574f2ab2f9781d5b300060a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 16:24:09 -0400 Subject: [PATCH 486/521] Added import code for BOTH 2.,7 and 3 --- Demo_All_Widgets.py | 8 +- Demo_Borderless_Window.py | 7 +- Demo_Button_Click.py | 10 +- Demo_Button_States.py | 41 +- Demo_Calendar.py | 7 +- Demo_Canvas.py | 8 +- Demo_Chat.py | 6 +- Demo_Chat_With_History.py | 6 +- Demo_Chatterbot.py | 10 +- Demo_Color.py | 7 +- Demo_Color_Names.py | 7 +- Demo_Columns.py | 7 +- Demo_Compare_Files.py | 7 +- Demo_Cookbook_Browser.py | 793 ++++++++++++++++++ Demo_Design_Patterns.py | 21 +- Demo_Desktop_Floating_Toolbar.py | 10 +- Demo_Desktop_Widget_CPU_Graph.py | 7 +- Demo_Desktop_Widget_CPU_Utilization.py | 7 +- Demo_Desktop_Widget_CPU_Utilization_Simple.py | 8 +- Demo_Desktop_Widget_Timer.py | 7 +- Demo_Disable_Elements.py | 7 +- Demo_DuplicateFileFinder.py | 7 +- Demo_Fill_Form.py | 7 +- Demo_Func_Callback_Simulation.py | 7 +- Demo_GoodColors.py | 7 +- Demo_Graph_Drawing.py | 13 +- Demo_Graph_Element.py | 7 +- Demo_Graph_Element_Sine_Wave.py | 11 +- Demo_Graph_Noise.py | 8 +- Demo_HowDoI.py | 9 +- Demo_Img_Viewer.py | 7 +- Demo_Keyboard.py | 7 +- Demo_Keyboard_Realtime.py | 7 +- Demo_Keypad.py | 7 +- Demo_MIDI_Player.py | 61 +- Demo_Machine_Learning.py | 8 +- Demo_Matplotlib.py | 8 +- Demo_Matplotlib_Animated.py | 7 +- Demo_Matplotlib_Animated_Scatter.py | 6 + Demo_Matplotlib_Browser.py | 9 +- Demo_Matplotlib_Ping_Graph.py | 7 +- Demo_Matplotlib_Ping_Graph_Large.py | 7 +- Demo_Media_Player.py | 7 +- Demo_Menus.py | 7 +- Demo_NonBlocking_Form.py | 7 +- Demo_OpenCV.py | 7 +- Demo_PNG_Viewer.py | 7 +- Demo_Password_Login.py | 7 +- Demo_Pi_LEDs.py | 8 +- Demo_Pi_Robotics.py | 7 +- Demo_Ping_Line_Graph.py | 9 +- Demo_Pong.py | 7 +- Demo_Popups.py | 7 +- Demo_Progress_Meters.py | 7 +- Demo_Script_Launcher.py | 7 +- Demo_Script_Parameters.py | 7 +- Demo_Spinner_Compound_Element.py | 7 +- Demo_Super_Simple_Form.py | 7 +- Demo_Table_CSV.py | 7 +- Demo_Table_Element.py | 9 +- Demo_Table_Pandas.py | 9 +- Demo_Table_Simulation.py | 8 +- Demo_Tabs.py | 9 +- Demo_Tabs_Nested.py | 14 +- Demo_Template.py | 36 + Demo_Youtube-dl_Frontend.py | 7 +- 66 files changed, 1285 insertions(+), 137 deletions(-) create mode 100644 Demo_Cookbook_Browser.py create mode 100644 Demo_Template.py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index 6a176c8af..f983787ee 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -1,5 +1,9 @@ -#!/usr/bin/env Python3 -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg sg.ChangeLookAndFeel('GreenTan') diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py index 8e28a2c45..1d1f84790 100644 --- a/Demo_Borderless_Window.py +++ b/Demo_Borderless_Window.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg """ Turn off padding in order to get a really tight looking layout. diff --git a/Demo_Button_Click.py b/Demo_Button_Click.py index 2735e0fa0..6295b151d 100644 --- a/Demo_Button_Click.py +++ b/Demo_Button_Click.py @@ -1,6 +1,12 @@ -import PySimpleGUI as sg -import winsound +#!/usr/bin/env python import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + +import winsound + sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0,0)) diff --git a/Demo_Button_States.py b/Demo_Button_States.py index 3871760e6..9c481ffde 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -1,5 +1,10 @@ -import PySimpleGUI as sg +#!/usr/bin/env python import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + """ Demonstrates using a "tight" layout with a Dark theme. Shows how button states can be controlled by a user application. The program manages the disabled/enabled @@ -15,15 +20,15 @@ [sg.ReadButton('Start', button_color=('white', 'black'), key='Start'), sg.ReadButton('Stop', button_color=('white', 'black'), key='Stop'), sg.ReadButton('Reset', button_color=('white', 'firebrick3'), key='Reset'), - sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='Submit')] - ] + sg.ReadButton('Submit', button_color=('white', 'springgreen4'), key='Submit')]] window = sg.Window("Time Tracker", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, - default_button_element_size=(12,1)).Layout(layout) -window.Finalize() -window.FindElement('Stop').Update(disabled=True) -window.FindElement('Reset').Update(disabled=True) -window.FindElement('Submit').Update(disabled=True) + default_button_element_size=(12,1)).Layout(layout).Finalize() + + +for key, state in {'Start': False, 'Stop': True, 'Reset': True, 'Submit': True}.items(): + window.FindElement(key).Update(disabled=state) + recording = have_data = False while True: button, values = window.Read() @@ -31,27 +36,17 @@ if button is None: sys.exit(69) if button is 'Start': - window.FindElement('Start').Update(disabled=True) - window.FindElement('Stop').Update(disabled=False) - window.FindElement('Reset').Update(disabled=False) - window.FindElement('Submit').Update(disabled=True) + for key, state in {'Start':True, 'Stop':False, 'Reset':False, 'Submit':True}.items(): + window.FindElement(key).Update(disabled=state) recording = True elif button is 'Stop' and recording: - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Start').Update(disabled=False) - window.FindElement('Submit').Update(disabled=False) + [window.FindElement(key).Update(disabled=value) for key,value in {'Start':False, 'Stop':True, 'Reset':False, 'Submit':False}.items()] recording = False have_data = True elif button is 'Reset': - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Start').Update(disabled=False) - window.FindElement('Submit').Update(disabled=True) - window.FindElement('Reset').Update(disabled=False) + [window.FindElement(key).Update(disabled=value) for key,value in {'Start':False, 'Stop':True, 'Reset':True, 'Submit':True}.items()] recording = False have_data = False elif button is 'Submit' and have_data: - window.FindElement('Stop').Update(disabled=True) - window.FindElement('Start').Update(disabled=False) - window.FindElement('Submit').Update(disabled=True) - window.FindElement('Reset').Update(disabled=False) + [window.FindElement(key).Update(disabled=value) for key,value in {'Start':False, 'Stop':True, 'Reset':True, 'Submit':False}.items()] recording = False diff --git a/Demo_Calendar.py b/Demo_Calendar.py index b04376c3d..473e414b0 100644 --- a/Demo_Calendar.py +++ b/Demo_Calendar.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg layout = [[sg.T('Calendar Test')], [sg.In('', size=(20,1), key='input')], diff --git a/Demo_Canvas.py b/Demo_Canvas.py index 01e1952dc..81f1995ed 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -1,5 +1,9 @@ -import PySimpleGUI as sg - +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg layout = [ [sg.Canvas(size=(150, 150), background_color='red', key='canvas')], diff --git a/Demo_Chat.py b/Demo_Chat.py index 09f16fd63..5f6fc7a43 100644 --- a/Demo_Chat.py +++ b/Demo_Chat.py @@ -1,5 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg ''' A chat window. Add call to your send-routine, print the response and you're done diff --git a/Demo_Chat_With_History.py b/Demo_Chat_With_History.py index 5eda2b424..c9e14d33b 100644 --- a/Demo_Chat_With_History.py +++ b/Demo_Chat_With_History.py @@ -1,5 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg ''' A chatbot with history Scroll up and down through prior commands using the arrow keys diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index dec613c55..4a636aada 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -1,7 +1,13 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + from chatterbot import ChatBot import chatterbot.utils -import sys + ''' Demo_Chatterbot.py diff --git a/Demo_Color.py b/Demo_Color.py index ca2457160..9a0dd1881 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg MY_WINDOW_ICON = 'E:\\TheRealMyDocs\\Icons\\The Planets\\jupiter.ico' reverse = {} diff --git a/Demo_Color_Names.py b/Demo_Color_Names.py index 359bf8b8b..b880ff788 100644 --- a/Demo_Color_Names.py +++ b/Demo_Color_Names.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg """ Color names courtesy of Big Daddy's Wiki-Python http://www.wikipython.com/tkinter-ttk-tix/summary-information/colors/ diff --git a/Demo_Columns.py b/Demo_Columns.py index 822583166..1f15c63de 100644 --- a/Demo_Columns.py +++ b/Demo_Columns.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg sg.ChangeLookAndFeel('BlueMono') diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index 638a1c313..848fd10b7 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -1,6 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python import sys - +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) def GetFilesToCompare(): diff --git a/Demo_Cookbook_Browser.py b/Demo_Cookbook_Browser.py new file mode 100644 index 000000000..b346d5a0d --- /dev/null +++ b/Demo_Cookbook_Browser.py @@ -0,0 +1,793 @@ + + +# import PySimpleGUI as sg +import inspect + +def SimpleDataEntry(): + """Simple Data Entry - Return Values As List + Same GUI screen except the return values are in a list instead of a dictionary and doesn't have initial values. + """ + import PySimpleGUI as sg + # Very basic window. Return values as a list + window = sg.Window('Simple data entry form') # begin with a blank form + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText()], + [sg.Text('Address', size=(15, 1)), sg.InputText()], + [sg.Text('Phone', size=(15, 1)), sg.InputText()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + + print(button, values[0], values[1], values[2]) + +def SimpleReturnAsDict(): + """ + Simple data entry - Return Values As Dictionary + A simple form with default values. Results returned in a dictionary. Does not use a context manager + """ + import PySimpleGUI as sg + + # Very basic window. Return values as a dictionary + window = sg.Window('Simple data entry form') # begin with a blank form + + layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + + print(button, values['name'], values['address'], values['phone']) + +def FileBrowse(): + """ + Simple File Browse + Browse for a filename that is populated into the input field. + """ + import PySimpleGUI as sg + + with sg.Window('SHA-1 & 256 Hash') as form: + form_rows = [[sg.Text('SHA-1 and SHA-256 Hashes for the file')], + [sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + (button, (source_filename,)) = window.LayoutAndRead(form_rows) + + print(button, source_filename) + +def GUIAddOn(): + """ + Add GUI to Front-End of Script + Quickly add a GUI allowing the user to browse for a filename if a filename is not supplied on the command line using this 1-line GUI. It's the best of both worlds. + """ + import PySimpleGUI as sg + import sys + + if len(sys.argv) == 1: + button, (fname,) = sg.Window('My Script').LayoutAndRead([[sg.T('Document to open')], + [sg.In(), sg.FileBrowse()], + [sg.Open(), sg.Cancel()]]) + else: + fname = sys.argv[1] + + if not fname: + sg.Popup("Cancel", "No filename supplied") + # raise SystemExit("Cancelling: no filename supplied") + +def Compare2Files(): + """ + Compare 2 Files + Browse to get 2 file names that can be then compared. Uses a context manager + """ + import PySimpleGUI as sg + + with sg.Window('File Compare') as form: + form_rows = [[sg.Text('Enter 2 files to comare')], + [sg.Text('File 1', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Text('File 2', size=(8, 1)), sg.InputText(), sg.FileBrowse()], + [sg.Submit(), sg.Cancel()]] + + button, values = window.LayoutAndRead(form_rows) + + print(button, values) + +def AllWidgetsWithContext(): + """ + Nearly All Widgets with Green Color Theme with Context Manager + Example of nearly all of the widgets in a single window. Uses a customized color scheme. This recipe uses a context manager, the preferred method. + """ + import PySimpleGUI as sg + # Green & tan color scheme + sg.ChangeLookAndFeel('GreenTan') + + + # sg.ChangeLookAndFeel('GreenTan') + + with sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form: + + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + +def AllWidgetsNoContext(): + """ + All Widgets No Context Manager + """ + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('GreenTan') + + window = sg.Window('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) + + column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], + [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] + + layout = [ + [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))], + [sg.Text('Here is some text.... and a place to enter text')], + [sg.InputText('This is my text')], + [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")], + [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), + sg.Multiline(default_text='A second multi-line', size=(35, 3))], + [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)), + sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], + [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], + [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), + sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), + sg.Column(column1, background_color='#F7F3EC')], + [sg.Text('_' * 80)], + [sg.Text('Choose A Folder', size=(35, 1))], + [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), + sg.InputText('Default Folder'), sg.FolderBrowse()], + [sg.Submit(), sg.Cancel()] + ] + + button, values = window.LayoutAndRead(layout) + +def NonBlockingWithUpdates(): + """ + Non-Blocking Form With Periodic Update + An async form that has a button read loop. A Text Element is updated periodically with a running timer. There is no context manager for this recipe because the loop that reads the form is likely to be some distance away from where the form was initialized. + """ + import PySimpleGUI as sg + import time + + window = sg.Window('Running Timer') + # create a text element that will be updated periodically + + form_rows = [[sg.Text('Stopwatch', size=(20,2), justification='center')], + [ sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center', key='output')], + [sg.T(' ' * 5), sg.ReadButton('Start/Stop', focus=True), sg.Quit()]] + + window.LayoutAndRead(form_rows, non_blocking=True) + + timer_running = True + i = 0 + # loop to process user clicks + while True: + i += 1 * (timer_running is True) + button, values = window.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X or clicked Quit button + break + elif button == 'Start/Stop': + timer_running = not timer_running + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + + time.sleep(.01) + # if the loop finished then need to close the form for the user + window.CloseNonBlocking() + +def NonBlockingWithContext(): + """ + Async Form (Non-Blocking) with Context Manager + Like the previous recipe, this form is an async window. The difference is that this form uses a context manager. + """ + import PySimpleGUI as sg + import time + + with sg.Window('Running Timer') as form: + layout = [[sg.Text('Non blocking GUI with updates', justification='center')], + [sg.Text('', size=(10, 2), font=('Helvetica', 20), text_color='red', justification='center', key='output')], + [sg.T(' ' * 15), sg.Quit()]] + window.LayoutAndRead(layout, non_blocking=True) + + for i in range(1, 500): + window.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) + button, values = window.ReadNonBlocking() + if values is None or button == 'Quit': # if user closed the window using X + break + time.sleep(.01) + else: + # if the loop finished then need to close the form for the user + window.CloseNonBlocking() + +def CallbackSimulation(): + """ + Callback Function Simulation + The architecture of some programs works better with button callbacks instead of handling in-line. While button callbacks are part of the PySimpleGUI implementation, they are not directly exposed to the caller. The way to get the same result as callbacks is to simulate them with a recipe like this one. + """ + import PySimpleGUI as sg + + # This design pattern simulates button callbacks + # Note that callbacks are NOT a part of the package's interface to the + # caller intentionally. The underlying implementation actually does use + # tkinter callbacks. They are simply hidden from the user. + + # The callback functions + def button1(): + print('Button 1 callback') + + def button2(): + print('Button 2 callback') + + # Create a standard form + window = sg.Window('Button callback example') + # Layout the design of the GUI + layout = [[sg.Text('Please click a button')], + [sg.ReadButton('1'), sg.ReadButton('2'), sg.Quit()]] + # Show the form to the user + window.Layout(layout) + + # Event loop. Read buttons, make callbacks + while True: + # Read the form + button, value = window.Read() + # Take appropriate action based on button + if button == '1': + button1() + elif button == '2': + button2() + elif button =='Quit' or button is None: + break + + # All done! + sg.PopupOk('Done') + +def RealtimeButtons(): + """ + Realtime Buttons (Good For Raspberry Pi) + This recipe implements a remote control interface for a robot. There are 4 directions, forward, reverse, left, right. When a button is clicked, PySimpleGUI immediately returns button events for as long as the buttons is held down. When released, the button events stop. This is an async/non-blocking window. + """ + import PySimpleGUI as sg + + # Make a form, but don't use context manager + window = sg.Window('Robotics Remote Control') + + form_rows = [[sg.Text('Robotics Remote Control')], + [sg.T(' ' * 10), sg.RealtimeButton('Forward')], + [sg.RealtimeButton('Left'), sg.T(' ' * 15), sg.RealtimeButton('Right')], + [sg.T(' ' * 10), sg.RealtimeButton('Reverse')], + [sg.T('')], + [sg.Quit(button_color=('black', 'orange'))] + ] + + window.LayoutAndRead(form_rows, non_blocking=True) + + # + # Some place later in your code... + # You need to perform a ReadNonBlocking on your form every now and then or + # else it won't refresh. + # + # your program's main loop + while (True): + # This is the code that reads and updates your window + button, values = window.ReadNonBlocking() + if button is not None: + print(button) + if button is 'Quit' or values is None: + break + + window.CloseNonBlocking() + +def EasyProgressMeter(): + """ + Easy Progress Meter + This recipe shows just how easy it is to add a progress meter to your code. + """ + import PySimpleGUI as sg + + for i in range(1000): + sg.EasyProgressMeter('Easy Meter Example', i+1, 1000) + +def TabbedForm(): + """ + Tabbed Form + Tabbed forms are easy to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of LayoutAndRead you call ShowTabbedwindow. Results are returned as a list of form results. Each tab acts like a single window. + """ + import PySimpleGUI as sg + + with sg.Window('') as form: + with sg.Window('') as form2: + + layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))], + [sg.InputText(), sg.Text('Enter some info')], + [sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]] + + results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'), + (form2, layout_tab_2,'Second Tab')) + + sg.Popup(results) + +def MediaPlayer(): + """ + Button Graphics (Media Player) + Buttons can have PNG of GIF images on them. This Media Player recipe requires 4 images in order to function correctly. The background is set to the same color as the button background so that they blend together. + """ + import PySimpleGUI as sg + + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) + # Images are located in a subfolder in the Demo Media Player.py folder + image_pause = './ButtonGraphics/Pause.png' + image_restart = './ButtonGraphics/Restart.png' + image_next = './ButtonGraphics/Next.png' + image_exit = './ButtonGraphics/Exit.png' + + # Open a form, note that context manager can't be used generally speaking for async forms + window = sg.Window('Media File Player', default_element_size=(20, 1), + font=("Helvetica", 25)) + # define layout of the rows + layout = [[sg.Text('Media File Player', size=(17, 1), font=("Helvetica", 25))], + [sg.Text('', size=(15, 2), font=("Helvetica", 14), key='out')], + [sg.ReadButton('Restart Song', button_color=(background, background), + image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadButton('Pause', button_color=(background, background), + image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.ReadButton('Next', button_color=(background, background), + image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), + sg.Text(' ' * 2), + sg.Text(' ' * 2), sg.Button('Exit', button_color=(background, background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, + border_width=0)], + [sg.Text('_' * 20)], + [sg.Text(' ' * 30)], + [sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 2), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15)), + sg.Text(' ' * 8), + sg.Slider(range=(-10, 10), default_value=0, size=(10, 20), orientation='vertical', + font=("Helvetica", 15))], + [sg.Text('Bass', font=("Helvetica", 15), size=(6, 1)), + sg.Text('Treble', font=("Helvetica", 15), size=(10, 1)), + sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))] ] + + # Call the same LayoutAndRead but indicate the form is non-blocking + window.LayoutAndRead(layout, non_blocking=True) + # Our event loop + while (True): + # Read the form (this call will not block) + button, values = window.ReadNonBlocking() + if button == 'Exit' or values is None: + break + # If a button was pressed, display it on the GUI by updating the text element + if button: + window.FindElement('out').Update(button) + +def ScriptLauncher(): + """ + Script Launcher - Persistent Form + This form doesn't close after button clicks. To achieve this the buttons are specified as sg.ReadButton instead of sg.Button. The exception to this is the EXIT button. Clicking it will close the window. This program will run commands and display the output in the scrollable window. + """ + import PySimpleGUI as sg + import subprocess + + def Launcher(): + + window = sg.Window('Script launcher') + + layout = [ + [sg.Text('Script output....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [sg.ReadButton('script1'), sg.ReadButton('script2'), sg.Button('EXIT')], + [sg.Text('Manual command', size=(15,1)), sg.InputText(focus=True), sg.ReadButton('Run', bind_return_key=True)] + ] + + window.Layout(layout) + + # ---===--- Loop taking in user input and using it to query HowDoI --- # + while True: + (button, value) = window.Read() + if button == 'EXIT' or button is None: + break # exit button clicked + if button == 'script1': + ExecuteCommandSubprocess('pip','list') + elif button == 'script2': + ExecuteCommandSubprocess('python', '--version') + elif button == 'Run': + ExecuteCommandSubprocess(value[0]) + + + def ExecuteCommandSubprocess(command, *args): + try: + expanded_args = [] + for a in args: + expanded_args += a + sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = sp.communicate() + if out: + print(out.decode("utf-8")) + if err: + print(err.decode("utf-8")) + except: pass + + Launcher() + +def MachineLearning(): + """ + Machine Learning GUI + A standard non-blocking GUI with lots of inputs. + """ + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('LightGreen') + + sg.SetOptions(text_justification='right') + + window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + + button, values = window.LayoutAndRead(layout) + +def CustromProgressMeter(): + """" + Custom Progress Meter / Progress Bar + Perhaps you don't want all the statistics that the EasyProgressMeter provides and want to create your own progress bar. Use this recipe to do just that. + """ + import PySimpleGUI as sg + + def CustomMeter(): + # create the progress bar element + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + # layout the form + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + # create the form + window = sg.Window('Custom Progress Meter') + # display the form as a non-blocking form + window.LayoutAndRead(layout, non_blocking=True) + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = window.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + window.CloseNonBlocking() + + CustomMeter() + +def OneLineGUI(): + """ + The One-Line GUI + For those of you into super-compact code, a complete customized GUI can be specified, shown, and received the results using a single line of Python code. The way this is done is to combine the call to Window and the call to LayoutAndRead. Window returns a Window object which has the LayoutAndRead method. + """ + import PySimpleGUI as sg + + layout = [[sg.Text('Filename')], + [sg.Input(), sg.FileBrowse()], + [sg.OK(), sg.Cancel()] ] + + button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout) + + """ + you can write this line of code for the exact same result (OK, two lines with the import): + """ + # import PySimpleGUI as sg + + button, (filename,) = sg.Window('Get filename example'). LayoutAndRead([[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()] ]) + +def MultipleColumns(): + """ + Multiple Columns + Starting in version 2.9 (not yet released but you can get from current GitHub) you can use the Column Element. A Column is required when you have a tall element to the left of smaller elements. + + This example uses a Column. There is a Listbox on the left that is 3 rows high. To the right of it are 3 single rows of text and input. These 3 rows are in a Column Element. + + To make it easier to see the Column in the window, the Column background has been shaded blue. The code is wordier than normal due to the blue shading. Each element in the column needs to have the color set to match blue background. + """ + import PySimpleGUI as sg + + # Demo of how columns work + # Form has on row 1 a vertical slider followed by a COLUMN with 7 rows + # Prior to the Column element, this layout was not possible + # Columns layouts look identical to form layouts, they are a list of lists of elements. + + # sg.ChangeLookAndFeel('BlueMono') + + # Column layout + col = [[sg.Text('col Row 1', text_color='white', background_color='blue')], + [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')], + [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]] + + layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'), select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20,3)), sg.Column(col, background_color='blue')], + [sg.Input('Last input')], + [sg.OK()]] + + # Display the form and get values + # If you're willing to not use the "context manager" design pattern, then it's possible + # to collapse the form display and read down to a single line of code. + button, values = sg.Window('Compact 1-line form with column').LayoutAndRead(layout) + + sg.Popup(button, values, line_width=200) + +def PersistentForm(): + """ + Persistent Form With Text Element Updates + This simple program keep a form open, taking input values until the user terminates the program using the "X" button. + """ + import PySimpleGUI as sg + + window = sg.Window('Math') + + output = sg.Txt('', size=(8,1)) + + layout = [ [sg.Txt('Enter values to calculate')], + [sg.In(size=(8,1), key='numerator')], + [sg.Txt('_' * 10)], + [sg.In(size=(8,1), key='denominator')], + [output], + [sg.ReadButton('Calculate', bind_return_key=True)]] + + window.Layout(layout) + + while True: + button, values = window.Read() + + if button is not None: + try: + numerator = float(values['numerator']) + denominator = float(values['denominator']) + calc = numerator / denominator + except: + calc = 'Invalid' + + output.Update(calc) + else: + break + +def CanvasWidget(): + """ + tkinter Canvas Widget + The Canvas Element is one of the few tkinter objects that are directly accessible. The tkinter Canvas widget itself can be retrieved from a Canvas Element like this: + """ + + import PySimpleGUI as gui + + canvas = gui.Canvas(size=(100,100), background_color='red') + + layout = [ + [canvas], + [gui.T('Change circle color to:'), gui.ReadButton('Red'), gui.ReadButton('Blue')] + ] + + window = gui.Window('Canvas test', grab_anywhere=True) + window.Layout(layout) + window.ReadNonBlocking() + + cir = canvas.TKCanvas.create_oval(50, 50, 100, 100) + + while True: + button, values = window.Read() + if button is None: + break + if button is 'Blue': + canvas.TKCanvas.itemconfig(cir, fill = "Blue") + elif button is 'Red': + canvas.TKCanvas.itemconfig(cir, fill = "Red") + +def InputElementUpdate(): + """ + Input Element Update + This Recipe implements a Raspberry Pi touchscreen based keypad entry. As the digits are entered using the buttons, the Input Element above it is updated with the input digits. There are a number of features used in this Recipe including: Default Element Size auto_size_buttons ReadButton Dictionary Return values Update of Elements in form (Input, Text) do_not_clear of Input Elements + """ + import PySimpleGUI as g + + # Demonstrates a number of PySimpleGUI features including: + # Default element size + # auto_size_buttons + # ReadButton + # Dictionary return values + # Update of elements in form (Text, Input) + # do_not_clear of Input elements + + layout = [[g.Text('Enter Your Passcode')], + [g.Input(size=(10, 1), do_not_clear=True, key='input')], + [g.ReadButton('1'), g.ReadButton('2'), g.ReadButton('3')], + [g.ReadButton('4'), g.ReadButton('5'), g.ReadButton('6')], + [g.ReadButton('7'), g.ReadButton('8'), g.ReadButton('9')], + [g.ReadButton('Submit'), g.ReadButton('0'), g.ReadButton('Clear')], + [ g.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='output')], + ] + + window = g.Window('Keypad', default_element_size=(5, 2), auto_size_buttons=False) + window.Layout(layout) + + # Loop forever reading the form's values, updating the Input field + keys_entered = '' + while True: + button, values = window.Read() # read the form + if button is None: # if the X button clicked, just exit + break + if button is 'Clear': # clear keys if clear button + keys_entered = '' + elif button in '1234567890': + keys_entered = values['input'] # get what's been entered so far + keys_entered += button # add the new digit + elif button is 'Submit': + keys_entered = values['input'] + window.FindElement('output').Update(keys_entered) # output the final string + + window.FindElement('input').Update(keys_entered) # change the form to reflect current key string + + +def TableSimulation(): + """ + Display data in a table format + """ + import PySimpleGUI as sg + sg.ChangeLookAndFeel('Dark1') + + layout = [[sg.T('Table Test')]] + + for i in range(20): + layout.append([sg.T('{} {}'.format(i,j), size=(4, 1), background_color='black', pad=(1, 1)) for j in range(10)]) + + sg.Window('Table').LayoutAndRead(layout) + + +def TightLayout(): + """ + Turn off padding in order to get a really tight looking layout. + """ + import PySimpleGUI as sg + + sg.ChangeLookAndFeel('Dark') + sg.SetOptions(element_padding=(0, 0)) + 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('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 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.ReadButton('Start', button_color=('white', 'black')), + sg.ReadButton('Stop', button_color=('white', 'black')), + sg.ReadButton('Reset', button_color=('white', '#9B0023')), + sg.ReadButton('Submit', button_color=('white', 'springgreen4')), + sg.Button('Exit', button_color=('white', '#00406B')), + ] + ] + + window = sg.Window("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False, + auto_size_buttons=False, no_titlebar=True, + default_button_element_size=(12, 1)) + window.Layout(layout) + while True: + button, values = window.Read() + if button is None or button == 'Exit': + return + +# -------------------------------- GUI Starts Here -------------------------------# +# fig = your figure you want to display. Assumption is that 'fig' holds the # +# information to display. # +# --------------------------------------------------------------------------------# + + +import PySimpleGUI as sg + +fig_dict = {'Simple Data Entry':SimpleDataEntry, 'Simple Entry Return Data as Dict':SimpleReturnAsDict, 'File Browse' : FileBrowse, + 'GUI Add On':GUIAddOn, 'Compare 2 Files':Compare2Files, 'All Widgets With Context Manager':AllWidgetsWithContext, 'All Widgets No Context Manager':AllWidgetsNoContext, + 'Non-Blocking With Updates':NonBlockingWithUpdates, 'Non-Bocking With Context Manager':NonBlockingWithContext, 'Callback Simulation':CallbackSimulation, + 'Realtime Buttons':RealtimeButtons, 'Easy Progress Meter':EasyProgressMeter, 'Tabbed Form':TabbedForm, 'Media Player':MediaPlayer, 'Script Launcher':ScriptLauncher, + 'Machine Learning':MachineLearning, 'Custom Progress Meter':CustromProgressMeter, 'One Line GUI':OneLineGUI, 'Multiple Columns':MultipleColumns, + 'Persistent Form':PersistentForm, 'Canvas Widget':CanvasWidget, 'Input Element Update':InputElementUpdate, + 'Table Simulation':TableSimulation, 'Tight Layout':TightLayout} + + +# define the form layout +listbox_values = [key for key in fig_dict.keys()] + +while True: + sg.ChangeLookAndFeel('Dark') + # sg.SetOptions(element_padding=(0,0)) + + col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),min(len(listbox_values), 20)), change_submits=False, key='func')], + [sg.ReadButton('Run', pad=(0,0)), sg.ReadButton('Show Code', button_color=('white', 'gray25'), pad=(0,0)), sg.Exit(button_color=('white', 'firebrick4'), pad=(0,0))]] + + layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], + [sg.Column(col_listbox), sg.Multiline(size=(50,min(len(listbox_values), 20)), do_not_clear=True, key='multi')], + ] + +# create the form and show it without the plot +# window.Layout(layout) + + window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI', default_button_element_size=(9,1),auto_size_buttons=False, grab_anywhere=False) + window.Layout(layout) + # show it all again and get buttons + while True: + button, values = window.Read() + + if button is None or button == 'Exit': + exit(69) + try: + choice = values['func'][0] + func = fig_dict[choice] + except: + continue + + if button == 'Show Code' and values['multi']: + window.FindElement('multi').Update(inspect.getsource(func)) + elif button is 'Run' and values['func']: + # sg.ChangeLookAndFeel('SystemDefault') + window.CloseNonBlocking() + func() + break + else: + print('ILLEGAL values') + break + diff --git a/Demo_Design_Patterns.py b/Demo_Design_Patterns.py index 1f054245f..88ab2fc1e 100644 --- a/Demo_Design_Patterns.py +++ b/Demo_Design_Patterns.py @@ -1,4 +1,14 @@ -# DESIGN PATTERN 1 - Simple Window +""" +When creating a new PySimpleGUI program from scratch, start here. +These are the accepted design patterns that cover the two primary use cases + +1. A window that closes when a "submit" type button is clicked +2. A persistent window that stays open after button clicks (uses an event loop) +3. A persistent window that needs access to the elements' interface variables +""" +# ---------------------------------# +# DESIGN PATTERN 1 - Simple Window # +# ---------------------------------# import PySimpleGUI as sg layout = [[ sg.Text('My layout') ]] @@ -6,7 +16,10 @@ window = sg.Window('My window').Layout(layout) button, value = window.Read() -# DESIGN PATTERN 2 - Persistent Window + +# -------------------------------------# +# DESIGN PATTERN 2 - Persistent Window # +# -------------------------------------# import PySimpleGUI as sg layout = [[ sg.Text('My layout') ]] @@ -18,7 +31,9 @@ if button is None: break -# DESIGN PATTERN 3 - Persistent Window with "early update" required +# ------------------------------------------------------------------# +# DESIGN PATTERN 3 - Persistent Window with "early update" required # +# ------------------------------------------------------------------# import PySimpleGUI as sg layout = [[ sg.Text('My layout') ]] diff --git a/Demo_Desktop_Floating_Toolbar.py b/Demo_Desktop_Floating_Toolbar.py index 396308459..a34b4c10b 100644 --- a/Demo_Desktop_Floating_Toolbar.py +++ b/Demo_Desktop_Floating_Toolbar.py @@ -1,7 +1,13 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + import subprocess import os -import sys + """ Demo_Toolbar - A floating toolbar with quick launcher diff --git a/Demo_Desktop_Widget_CPU_Graph.py b/Demo_Desktop_Widget_CPU_Graph.py index e7653b4e5..528c336a7 100644 --- a/Demo_Desktop_Widget_CPU_Graph.py +++ b/Demo_Desktop_Widget_CPU_Graph.py @@ -1,8 +1,13 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import time import random import psutil from threading import Thread -import PySimpleGUI as sg STEP_SIZE=3 diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index 60bb1ebff..fedd62607 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import psutil import time from threading import Thread diff --git a/Demo_Desktop_Widget_CPU_Utilization_Simple.py b/Demo_Desktop_Widget_CPU_Utilization_Simple.py index 7e9aa653a..3ce7fb59e 100644 --- a/Demo_Desktop_Widget_CPU_Utilization_Simple.py +++ b/Demo_Desktop_Widget_CPU_Utilization_Simple.py @@ -1,4 +1,10 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + import psutil # ---------------- Create Form ---------------- diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 1c905a3f4..46a5b3fc5 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import time """ diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index 789011c57..ed0753e3d 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0, 0)) diff --git a/Demo_DuplicateFileFinder.py b/Demo_DuplicateFileFinder.py index 1725fb4f9..ef5c46b97 100644 --- a/Demo_DuplicateFileFinder.py +++ b/Demo_DuplicateFileFinder.py @@ -1,6 +1,11 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import hashlib import os -import PySimpleGUI as sg # ====____====____==== FUNCTION DeDuplicate_folder(path) ====____====____==== # diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index 30c20544d..d1a0daadd 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg def Everything(): sg.ChangeLookAndFeel('TanBlue') diff --git a/Demo_Func_Callback_Simulation.py b/Demo_Func_Callback_Simulation.py index 5b0ef2d0d..f99246866 100644 --- a/Demo_Func_Callback_Simulation.py +++ b/Demo_Func_Callback_Simulation.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg layout = [[sg.Text('Filename', )], [sg.Input(), sg.FileBrowse()], diff --git a/Demo_GoodColors.py b/Demo_GoodColors.py index 332898615..f9cf5154c 100644 --- a/Demo_GoodColors.py +++ b/Demo_GoodColors.py @@ -1,4 +1,9 @@ -import PySimpleGUI as gg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import time def main(): diff --git a/Demo_Graph_Drawing.py b/Demo_Graph_Drawing.py index 886d4fa78..a8b3246cc 100644 --- a/Demo_Graph_Drawing.py +++ b/Demo_Graph_Drawing.py @@ -1,9 +1,12 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg -layout = [ - [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], - [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')] - ] +layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], + [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')]] window = sg.Window('Graph test').Layout(layout).Finalize() diff --git a/Demo_Graph_Element.py b/Demo_Graph_Element.py index 9b8316909..9c047a5ec 100644 --- a/Demo_Graph_Element.py +++ b/Demo_Graph_Element.py @@ -1,7 +1,12 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import ping from threading import Thread import time -import PySimpleGUI as sg STEP_SIZE=1 diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py index bd69551e2..784347dd2 100644 --- a/Demo_Graph_Element_Sine_Wave.py +++ b/Demo_Graph_Element_Sine_Wave.py @@ -1,7 +1,14 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import math -import PySimpleGUI as sg -layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-105,-105), graph_top_right=(105,105), background_color='white', key='graph', tooltip='This is a cool graph!')],] + +layout = [[sg.T('Example of Using Math with a Graph', justification='center', size=(40,1), relief=sg.RELIEF_RAISED)], + [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-105,-105), graph_top_right=(105,105), background_color='white', key='graph', tooltip='This is a cool graph!')],] window = sg.Window('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize() graph = window.FindElement('graph') diff --git a/Demo_Graph_Noise.py b/Demo_Graph_Noise.py index 88b7c52b2..f290eb65c 100644 --- a/Demo_Graph_Noise.py +++ b/Demo_Graph_Noise.py @@ -1,6 +1,12 @@ +#!/usr/bin/env python +import sys + +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import time import random -import PySimpleGUI as sg import sys STEP_SIZE=1 diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index cb1c42cea..e9761acd7 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import subprocess @@ -30,7 +35,7 @@ def HowDoI(): sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] ] - window = sg.Window('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True, no_titlebar=True) + window = sg.Window('How Do I ??', default_element_size=(30, 2), icon=DEFAULT_ICON, font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True, no_titlebar=True, grab_anywhere=True) window.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # command_history = [] diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py index 0b257e55b..2c36376a2 100644 --- a/Demo_Img_Viewer.py +++ b/Demo_Img_Viewer.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import os from PIL import Image, ImageTk import io diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index e413ac4f2..030bdcd08 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" diff --git a/Demo_Keyboard_Realtime.py b/Demo_Keyboard_Realtime.py index ff94f29e7..5786b58be 100644 --- a/Demo_Keyboard_Realtime.py +++ b/Demo_Keyboard_Realtime.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg layout = [[sg.Text("Hold down a key")], [sg.Button("OK")]] diff --git a/Demo_Keypad.py b/Demo_Keypad.py index d51f32f58..65aa42f8a 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # Demonstrates a number of PySimpleGUI features including: # Default element size diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py index 87131a1fb..dd9f568f3 100644 --- a/Demo_MIDI_Player.py +++ b/Demo_MIDI_Player.py @@ -1,5 +1,10 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import os -import PySimpleGUI as g import mido import time import sys @@ -32,17 +37,17 @@ def PlayerChooseSongGUI(self): # ---------------------- DEFINION OF CHOOSE WHAT TO PLAY GUI ---------------------------- - layout = [[g.Text('MIDI File Player', font=("Helvetica", 15), size=(20, 1), text_color='green')], - [g.Text('File Selection', font=("Helvetica", 15), size=(20, 1))], - [g.Text('Single File Playback', justification='right'), g.InputText(size=(65, 1), key='midifile'), g.FileBrowse(size=(10, 1), file_types=(("MIDI files", "*.mid"),))], - [g.Text('Or Batch Play From This Folder', auto_size_text=False, justification='right'), g.InputText(size=(65, 1), key='folder'), g.FolderBrowse(size=(10, 1))], - [g.Text('_' * 250, auto_size_text=False, size=(100, 1))], - [g.Text('Choose MIDI Output Device', size=(22, 1)), - g.Listbox(values=self.PortList, size=(30, len(self.PortList) + 1), key='device')], - [g.Text('_' * 250, auto_size_text=False, size=(100, 1))], - [g.SimpleButton('PLAY', size=(12, 2), button_color=('red', 'white'), font=("Helvetica", 15), bind_return_key=True), g.Text(' ' * 2, size=(4, 1)), g.Cancel(size=(8, 2), font=("Helvetica", 15))]] - - window = g.Window('MIDI File Player', auto_size_text=False, default_element_size=(30, 1), font=("Helvetica", 12)).Layout(layout) + layout = [[sg.Text('MIDI File Player', font=("Helvetica", 15), size=(20, 1), text_color='green')], + [sg.Text('File Selection', font=("Helvetica", 15), size=(20, 1))], + [sg.Text('Single File Playback', justification='right'), sg.InputText(size=(65, 1), key='midifile'), sg.FileBrowse(size=(10, 1), file_types=(("MIDI files", "*.mid"),))], + [sg.Text('Or Batch Play From This Folder', auto_size_text=False, justification='right'), sg.InputText(size=(65, 1), key='folder'), sg.FolderBrowse(size=(10, 1))], + [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))], + [sg.Text('Choose MIDI Output Device', size=(22, 1)), + sg.Listbox(values=self.PortList, size=(30, len(self.PortList) + 1), key='device')], + [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))], + [sg.SimpleButton('PLAY', size=(12, 2), button_color=('red', 'white'), font=("Helvetica", 15), bind_return_key=True), sg.Text(' ' * 2, size=(4, 1)), sg.Cancel(size=(8, 2), font=("Helvetica", 15))]] + + window = sg.Window('MIDI File Player', auto_size_text=False, default_element_size=(30, 1), font=("Helvetica", 12)).Layout(layout) self.Window = window return window.Read() @@ -55,23 +60,23 @@ def PlayerPlaybackGUIStart(self, NumFiles=1): image_next = './ButtonGraphics/Next.png' image_exit = './ButtonGraphics/Exit.png' - self.TextElem = g.T('Song loading....', size=(70,5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) - self.SliderElem = g.Slider(range=(1,100), size=(50, 8), orientation='h', text_color='#f0f0f0') + self.TextElem = sg.T('Song loading....', size=(70, 5 + NumFiles), font=("Helvetica", 14), auto_size_text=False) + self.SliderElem = sg.Slider(range=(1, 100), size=(50, 8), orientation='h', text_color='#f0f0f0') layout = [ - [g.T('MIDI File Player', size=(30,1), font=("Helvetica", 25))], + [sg.T('MIDI File Player', size=(30, 1), font=("Helvetica", 25))], [self.TextElem], [self.SliderElem], - [g.ReadFormButton('PAUSE', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '), - g.ReadFormButton('NEXT', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_next, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '), - g.ReadFormButton('Restart Song', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_restart, image_size=(50,50), image_subsample=2, border_width=0), g.T(' '), - g.SimpleButton('EXIT', button_color=g.TRANSPARENT_BUTTON, - image_filename=image_exit, image_size=(50,50), image_subsample=2, border_width=0,)] + [sg.ReadFormButton('PAUSE', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_pause, image_size=(50,50), image_subsample=2, border_width=0), sg.T(' '), + sg.ReadFormButton('NEXT', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_next, image_size=(50,50), image_subsample=2, border_width=0), sg.T(' '), + sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_restart, image_size=(50,50), image_subsample=2, border_width=0), sg.T(' '), + sg.SimpleButton('EXIT', button_color=sg.TRANSPARENT_BUTTON, + image_filename=image_exit, image_size=(50,50), image_subsample=2, border_width=0, )] ] - window = g.FlexForm('MIDI File Player', default_element_size=(30,1),font=("Helvetica", 25)).Layout(layout).Finalize() + window = sg.FlexForm('MIDI File Player', default_element_size=(30, 1), font=("Helvetica", 25)).Layout(layout).Finalize() self.Window = window @@ -118,12 +123,12 @@ def GetCurrentTime(): button, values = pback.PlayerChooseSongGUI() if button != 'PLAY': - g.PopupCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) + sg.PopupCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) sys.exit(69) if values['device']: midi_port = values['device'][0] else: - g.PopupCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) + sg.PopupCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2) batch_folder = values['folder'] midi_filename = values['midifile'] @@ -136,7 +141,7 @@ def GetCurrentTime(): filelist = [midi_filename,] filetitles = [os.path.basename(midi_filename),] else: - g.PopupError('*** Error - No MIDI files specified ***') + sg.PopupError('*** Error - No MIDI files specified ***') sys.exit(666) # ------ LOOP THROUGH MULTIPLE FILES --------------------------------------------------------- # @@ -160,7 +165,7 @@ def GetCurrentTime(): mid = mido.MidiFile(filename=midi_filename) except: print('****** Exception trying to play MidiFile filename = {}***************'.format(midi_filename)) - g.PopupError('Exception trying to play MIDI file:', midi_filename, 'Skipping file') + sg.PopupError('Exception trying to play MIDI file:', midi_filename, 'Skipping file') continue # Build list of data contained in MIDI File using only track 0 diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index 4b7e7265d..aa0ce6386 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -1,5 +1,9 @@ -import PySimpleGUI as sg - +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg def MachineLearningGUI(): sg.SetOptions(text_justification='right') diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index e7cbb863c..6c97132c3 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -1,4 +1,10 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasAgg diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index e3b33b75a..de50ddc2e 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -1,5 +1,10 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg from random import randint -import PySimpleGUI as sg from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg from matplotlib.figure import Figure import matplotlib.backends.tkagg as tkagg diff --git a/Demo_Matplotlib_Animated_Scatter.py b/Demo_Matplotlib_Animated_Scatter.py index 26c2c7fcf..8461f2fda 100644 --- a/Demo_Matplotlib_Animated_Scatter.py +++ b/Demo_Matplotlib_Animated_Scatter.py @@ -1,3 +1,9 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg from random import randint import PySimpleGUI as sg from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg diff --git a/Demo_Matplotlib_Browser.py b/Demo_Matplotlib_Browser.py index a7c6ab5ea..79cbfdcf8 100644 --- a/Demo_Matplotlib_Browser.py +++ b/Demo_Matplotlib_Browser.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasAgg @@ -247,7 +252,7 @@ def PyplotLineStyles(): # For each line style, add a text annotation with a small offset from # the reference point (0 in Axes coords, y tick value in Data coords). - reference_transwindow = blended_transform_factory(ax.transAxes, ax.transData) + reference_transform = blended_transform_factory(ax.transAxes, ax.transData) for i, (name, linestyle) in enumerate(linestyles.items()): ax.annotate(str(linestyle), xy=(0.0, i), xycoords=reference_transform, xytext=(-6, -12), textcoords='offset points', color="blue", diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index a302d53c8..092a28987 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasAgg import matplotlib.backends.tkagg as tkagg diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/Demo_Matplotlib_Ping_Graph_Large.py index 380329970..024868998 100644 --- a/Demo_Matplotlib_Ping_Graph_Large.py +++ b/Demo_Matplotlib_Ping_Graph_Large.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import matplotlib.pyplot as plt import ping from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index aef039f61..47b753382 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # # An Async Demonstration of a media player diff --git a/Demo_Menus.py b/Demo_Menus.py index fe4634b0b..c0df56cbf 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg """ Demonstration of MENUS! diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 667b43e53..a016a197e 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import time # Window that doen't block diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index 078eff135..7909f6fb1 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -1,7 +1,12 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import cv2 as cv from PIL import Image import tempfile -import PySimpleGUI as sg import os from sys import exit as exit diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py index d90bb9b7a..60aa1d8c8 100644 --- a/Demo_PNG_Viewer.py +++ b/Demo_PNG_Viewer.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import os from sys import exit as exit diff --git a/Demo_Password_Login.py b/Demo_Password_Login.py index 84662b241..cc326fc39 100644 --- a/Demo_Password_Login.py +++ b/Demo_Password_Login.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import hashlib from sys import exit as exit diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py index 68db17131..fe29aadfd 100644 --- a/Demo_Pi_LEDs.py +++ b/Demo_Pi_LEDs.py @@ -1,5 +1,9 @@ -import PySimpleGUI as rg - +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # GUI for switching an LED on and off to GPIO14 # GPIO and time library: diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index 829f08be5..ed31ce75a 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # Robotics design pattern # Uses Realtime Buttons to simulate the controls for a robot diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py index 310089b1e..163f4dc95 100644 --- a/Demo_Ping_Line_Graph.py +++ b/Demo_Ping_Line_Graph.py @@ -1,6 +1,11 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg from threading import Thread import time -import PySimpleGUI as sg from sys import exit as exit # !/usr/bin/env python3 @@ -215,7 +220,7 @@ __description__ = 'A pure python ICMP ping implementation using raw sockets.' -if sys.platwindow == "win32": +if sys.platform == "win32": # On Windows, the best timer is time.clock() default_timer = time.clock else: diff --git a/Demo_Pong.py b/Demo_Pong.py index dbbaa0e51..1732aa975 100644 --- a/Demo_Pong.py +++ b/Demo_Pong.py @@ -1,5 +1,10 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import random -import PySimpleGUI as sg import time from sys import exit as exit diff --git a/Demo_Popups.py b/Demo_Popups.py index e5315ad11..2951bca17 100644 --- a/Demo_Popups.py +++ b/Demo_Popups.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg # Here, have some windows on me.... [sg.PopupNoWait(location=(10*x,0)) for x in range(10)] diff --git a/Demo_Progress_Meters.py b/Demo_Progress_Meters.py index 9a5945161..738b861ed 100644 --- a/Demo_Progress_Meters.py +++ b/Demo_Progress_Meters.py @@ -1,5 +1,10 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg from time import sleep -import PySimpleGUI as sg from sys import exit as exit diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index 4058bd0d0..cc4b6efd0 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import glob import ntpath import subprocess diff --git a/Demo_Script_Parameters.py b/Demo_Script_Parameters.py index 7409e126f..3ae20cdb8 100644 --- a/Demo_Script_Parameters.py +++ b/Demo_Script_Parameters.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import sys ''' diff --git a/Demo_Spinner_Compound_Element.py b/Demo_Spinner_Compound_Element.py index 575beec5f..fafb049a1 100644 --- a/Demo_Spinner_Compound_Element.py +++ b/Demo_Spinner_Compound_Element.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg """ Demo of how to combine elements into your own custom element diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index 068455c94..da8ec34f1 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg """ Simple Form showing how to use keys on your input fields diff --git a/Demo_Table_CSV.py b/Demo_Table_CSV.py index f8b30a22f..c50b9b2ba 100644 --- a/Demo_Table_CSV.py +++ b/Demo_Table_CSV.py @@ -1,5 +1,10 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import csv -import PySimpleGUI as sg import sys def table_example(): diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py index b0d44dd54..f810dfa80 100644 --- a/Demo_Table_Element.py +++ b/Demo_Table_Element.py @@ -1,6 +1,11 @@ -import csv -import PySimpleGUI as sg +#!/usr/bin/env python import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg +import csv + filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) # --- populate table with file contents --- # diff --git a/Demo_Table_Pandas.py b/Demo_Table_Pandas.py index 1a519ea1d..21c999235 100644 --- a/Demo_Table_Pandas.py +++ b/Demo_Table_Pandas.py @@ -1,6 +1,11 @@ -import pandas as pd -import PySimpleGUI as sg +#!/usr/bin/env python import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg +import pandas as pd + def table_example(): sg.SetOptions(auto_size_buttons=True) diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index a714de6af..87062ff9b 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -1,5 +1,11 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import csv -import PySimpleGUI as sg + def TableSimulation(): """ diff --git a/Demo_Tabs.py b/Demo_Tabs.py index 2f2b1639b..270bdc171 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -1,11 +1,16 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg tab1_layout = [[sg.T('This is inside tab 1')]] tab2_layout = [[sg.T('This is inside tab 2')], [sg.In(key='in')]] -layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, tooltip='tip'), sg.Tab('Tab 2', tab2_layout)]], tooltip='TIP2')], +layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]])], [sg.RButton('Read')]] window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) diff --git a/Demo_Tabs_Nested.py b/Demo_Tabs_Nested.py index 0879de10d..ff4bfa37c 100644 --- a/Demo_Tabs_Nested.py +++ b/Demo_Tabs_Nested.py @@ -1,8 +1,13 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + sg.ChangeLookAndFeel('GreenTan') tab2_layout = [[sg.T('This is inside tab 2')], - [sg.T('Tabs can be anywhere now!')] - ] + [sg.T('Tabs can be anywhere now!')]] tab1_layout = [[sg.T('Type something here and click button'), sg.In(key='in')]] @@ -21,8 +26,7 @@ [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Tab3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])]])], [sg.T('This text is on a row with a column'),sg.Column(layout=[[sg.T('In a column')], [sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], - [sg.RButton('Click me')]])], - ] + [sg.RButton('Click me')]])],] window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout).Finalize() diff --git a/Demo_Template.py b/Demo_Template.py new file mode 100644 index 000000000..4a3a508f4 --- /dev/null +++ b/Demo_Template.py @@ -0,0 +1,36 @@ +#choose one of these are your starting point + +# ---------------------------------# +# DESIGN PATTERN 1 - Simple Window # +# ---------------------------------# +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + +layout = [[ sg.Text('My layout') ]] + +window = sg.Window('My window').Layout(layout) +button, value = window.Read() + + +# -------------------------------------# +# DESIGN PATTERN 2 - Persistent Window # +# -------------------------------------# +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg + +layout = [[ sg.Text('My layout') ]] + +window = sg.Window('My new window').Layout(layout) + +while True: # Event Loop + button, value = window.Read() + if button is None: + break \ No newline at end of file diff --git a/Demo_Youtube-dl_Frontend.py b/Demo_Youtube-dl_Frontend.py index 83fd77e3f..6b7dba3c0 100644 --- a/Demo_Youtube-dl_Frontend.py +++ b/Demo_Youtube-dl_Frontend.py @@ -1,4 +1,9 @@ -import PySimpleGUI as sg +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg import subprocess """ From ce4b5b8a99326d8a55ac8946da4a67c7e9a4ee7f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 16:24:51 -0400 Subject: [PATCH 487/521] Added angle parameter to DrawText --- PySimpleGUI.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 4aff4c03a..092e6a741 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1329,13 +1329,14 @@ def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None return None return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color) - def DrawText(self, text, location, color='black', font=None): + def DrawText(self, text, location, color='black', font=None, angle=0): converted_point = self._convert_xy_to_canvas_xy(location[0], location[1]) if self._TKCanvas2 is None: print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***') print('Call Window.Finalize() prior to this operation') return None - return self._TKCanvas2.create_text(converted_point[0], converted_point[1], text=text, font=font, fill=color) + text_id = self._TKCanvas2.create_text(converted_point[0], converted_point[1], text=text, font=font, fill=color, angle=angle) + return text_id def Erase(self): From 3b125f76ab08aef703b1776587c0c144d4522647 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 16:34:01 -0400 Subject: [PATCH 488/521] Change to Spin, Slider, Listbox, Combobox - if changed submitted the window, return the KEY as the button --- PySimpleGUI.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 092e6a741..5b1e8f7c0 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -348,7 +348,10 @@ def ListboxSelectHandler(self, event): MyForm = self.ParentForm # first, get the results table built # modify the Results table in the parent FlexForm object - self.ParentForm.LastButtonClicked = '' + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = '' self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop @@ -356,7 +359,10 @@ def ComboboxSelectHandler(self, event): MyForm = self.ParentForm # first, get the results table built # modify the Results table in the parent FlexForm object - self.ParentForm.LastButtonClicked = '' + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = '' self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop @@ -731,7 +737,10 @@ def Update(self, value=None, values=None, disabled=None): def SpinChangedHandler(self, event): # first, get the results table built # modify the Results table in the parent FlexForm object - self.ParentForm.LastButtonClicked = '' + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = '' self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop @@ -1608,7 +1617,10 @@ def Update(self, value=None, range=(None, None), disabled=None): def SliderChangedHandler(self, event): # first, get the results table built # modify the Results table in the parent FlexForm object - self.ParentForm.LastButtonClicked = '' + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = '' self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop From 1fc244db83c86f81ff00e68b6e977f838beb237e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 18:58:19 -0400 Subject: [PATCH 489/521] change_submits added to Checkbox and TabGroup. Addition of underlines in menus (doesn't seem to work yet) --- PySimpleGUI.py | 64 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 5b1e8f7c0..d2904fe6b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -366,6 +366,24 @@ def ComboboxSelectHandler(self, event): self.ParentForm.FormRemainedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop + def CheckboxHandler(self): + MyForm = self.ParentForm + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() + + def TabGroupSelectHandler(self, event): + MyForm = self.ParentForm + if self.Key is not None: + self.ParentForm.LastButtonClicked = self.Key + else: + self.ParentForm.LastButtonClicked = '' + self.ParentForm.FormRemainedOpen = True + self.ParentForm.TKroot.quit() + def __del__(self): try: self.TKStringVar.__del__() @@ -646,7 +664,7 @@ def __del__(self): # Checkbox # # ---------------------------------------------------------------------- # class Checkbox(Element): - def __init__(self, text, default=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None): + def __init__(self, text, default=False, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, change_submits=False, key=None, pad=None, tooltip=None): ''' Check Box Element :param text: @@ -661,6 +679,7 @@ def __init__(self, text, default=False, size=(None, None), auto_size_text=None, self.Value = None self.TKCheckbutton = None self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR + self.ChangeSubmits = change_submits super().__init__(ELEM_TYPE_INPUT_CHECKBOX, size=size, auto_size_text=auto_size_text, font=font, background_color=background_color, text_color=self.TextColor, key=key, pad=pad, tooltip=tooltip) @@ -1514,7 +1533,7 @@ def __del__(self): # TabGroup # # ---------------------------------------------------------------------- # class TabGroup(Element): - def __init__(self, layout, title_color=None, background_color=None, font=None, pad=None, border_width=None, key=None, tooltip=None): + def __init__(self, layout, title_color=None, background_color=None, font=None, change_submits=False, pad=None, border_width=None, key=None, tooltip=None): self.UseDictionary = False self.ReturnValues = None @@ -1526,6 +1545,7 @@ def __init__(self, layout, title_color=None, background_color=None, font=None, p self.TKNotebook = None self.BorderWidth = border_width self.BackgroundColor = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR + self.ChangeSubmits = change_submits self.Layout(layout) @@ -2628,13 +2648,18 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): element.TKText.delete('1.0', tk.END) except: value = None + elif element.Type == ELEM_TYPE_TAB_GROUP: + try: + value=element.TKNotebook.tab(element.TKNotebook.index('current'))['text'] + except: + value = None else: value = None # if an input type element, update the results if element.Type != ELEM_TYPE_BUTTON and element.Type != ELEM_TYPE_TEXT and element.Type != ELEM_TYPE_IMAGE and\ element.Type != ELEM_TYPE_OUTPUT and element.Type != ELEM_TYPE_PROGRESS_BAR and \ - element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME and element.Type != ELEM_TYPE_TAB_GROUP \ + element.Type!= ELEM_TYPE_COLUMN and element.Type != ELEM_TYPE_FRAME \ and element.Type != ELEM_TYPE_TAB: AddToReturnList(form, value) AddToReturnDictionary(top_level_form, element, value) @@ -2729,7 +2754,15 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) if type(sub_menu_info) is str: if not is_sub_menu and not skip: # print(f'Adding command {sub_menu_info}') - top_menu.add_command(label=sub_menu_info, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + pos = sub_menu_info.find('_&') + if pos != -1: + _ = sub_menu_info[:pos] + try: + _ += sub_menu_info[pos+2:] + except Exception as e: + print(e) + sub_menu_info = _ + top_menu.add_command(label=sub_menu_info, underline=pos-1, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) else: i = 0 while i < (len(sub_menu_info)): @@ -2892,7 +2925,7 @@ def CharWidthInPixels(): tkbutton.bind('', element.ButtonReleaseCallBack) tkbutton.bind('', element.ButtonPressCallBack) if bc != (None, None) and bc != COLOR_SYSTEM_DEFAULT: - tkbutton.config(foreground=bc[0], background=bc[1]) + tkbutton.config(foreground=bc[0], background=bc[1], activebackground=bc[1]) element.TKButton = tkbutton # not used yet but save the TK button in case wraplen = tkbutton.winfo_reqwidth() # width of widget in Pixels if element.ImageFilename: # if button has an image on it @@ -3064,12 +3097,19 @@ def CharWidthInPixels(): default_value = element.InitialState element.TKIntVar = tk.IntVar() element.TKIntVar.set(default_value if default_value is not None else 0) - element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, variable=element.TKIntVar, bd=border_depth, font=font) + if element.ChangeSubmits: + element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, + variable=element.TKIntVar, bd=border_depth, font=font, + command=element.CheckboxHandler) + else: + element.TKCheckbutton = tk.Checkbutton(tk_row_frame, anchor=tk.NW, text=element.Text, width=width, + variable=element.TKIntVar, bd=border_depth, font=font) if default_value is None: element.TKCheckbutton.configure(state='disable') if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: element.TKCheckbutton.configure(background=element.BackgroundColor) element.TKCheckbutton.configure(selectcolor=element.BackgroundColor) + element.TKCheckbutton.configure(activebackground=element.BackgroundColor) if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT: element.TKCheckbutton.configure(fg=text_color) element.TKCheckbutton.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1]) @@ -3204,7 +3244,15 @@ def CharWidthInPixels(): for menu_entry in menu_def: # print(f'Adding a Menubar ENTRY') baritem = tk.Menu(menubar, tearoff=element.Tearoff) - menubar.add_cascade(label=menu_entry[0], menu=baritem) + pos = menu_entry[0].find('_&') + if pos != -1: + _ = menu_entry[0][:pos] + try: + _ += menu_entry[0][pos+2:] + except: + pass + menu_entry[0] = _ + menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos-1) if len(menu_entry) > 1: AddMenuItem(baritem, menu_entry[1], element) @@ -3256,6 +3304,8 @@ def CharWidthInPixels(): # highlightcolor=element.BackgroundColor) # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: # element.TKNotebook.configure(foreground=element.TextColor) + if element.ChangeSubmits: + element.TKNotebook.bind('<>', element.TabGroupSelectHandler) if element.BorderWidth is not None: element.TKNotebook.configure(borderwidth=element.BorderWidth) if element.Tooltip is not None: From 1c817fe419ebcbafdfd5dd4c4077e2254fe3edfc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 19:12:24 -0400 Subject: [PATCH 490/521] Added separator to menus. If a menu item is '---' then a separator will be added --- PySimpleGUI.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index d2904fe6b..09babe766 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2762,7 +2762,10 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) except Exception as e: print(e) sub_menu_info = _ - top_menu.add_command(label=sub_menu_info, underline=pos-1, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + if sub_menu_info == '---': + top_menu.add('separator') + else: + top_menu.add_command(label=sub_menu_info, underline=pos-1, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) else: i = 0 while i < (len(sub_menu_info)): @@ -3233,12 +3236,7 @@ def CharWidthInPixels(): element.TooltipObject = ToolTip(element._TKCanvas, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: - menu_def = (('File', ('Open', 'Save')), - ('Help', 'About...'),) - # ('Help',)) - menu_def = element.MenuDefinition - element.TKMenu = tk.Menu(toplevel_form.TKroot, tearoff=element.Tearoff) # create the menubar menubar = element.TKMenu for menu_entry in menu_def: @@ -3255,7 +3253,6 @@ def CharWidthInPixels(): menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos-1) if len(menu_entry) > 1: AddMenuItem(baritem, menu_entry[1], element) - toplevel_form.TKroot.configure(menu=element.TKMenu) # ------------------------- Frame element ------------------------- # elif element_type == ELEM_TYPE_FRAME: From 83e9c58904f557c3ac222fd7e282d351010b4e10 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 21:31:05 -0400 Subject: [PATCH 491/521] Changed tooltip location. New window Disable / Enable - experimental --- PySimpleGUI.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 09babe766..39e412095 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -224,7 +224,7 @@ class ToolTip: (inspired by https://stackoverflow.com/a/36221216) """ - def __init__(self, widget, text, timeout=1000): + def __init__(self, widget, text, timeout=DEFAULT_TOOLTIP_TIME): self.widget = widget self.text = text self.timeout = timeout @@ -256,7 +256,7 @@ def showtip(self): if self.tipwindow: return x = self.widget.winfo_rootx() + 20 - y = self.widget.winfo_rooty() + self.widget.winfo_height() + 1 + y = self.widget.winfo_rooty() + self.widget.winfo_height() - 20 self.tipwindow = tk.Toplevel(self.widget) self.tipwindow.wm_overrideredirect(True) self.tipwindow.wm_geometry("+%d+%d" % (x, y)) @@ -2348,6 +2348,14 @@ def CloseNonBlocking(self): def OnClosingCallback(self): return + + def Disable(self): + self.TKroot.grab_set_global() + + def Enable(self): + self.TKroot.grab_release() + + def __enter__(self): return self From b90bd859db961fe26bde03f3a0b90b72106b9629 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 21:52:10 -0400 Subject: [PATCH 492/521] Changed grab_anywhere default on popups to false --- PySimpleGUI.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 39e412095..5039bfbe5 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3636,7 +3636,7 @@ def ConvertArgsToSingleString(*args): # ============================== ProgressMeter =====# # ===================================================# -def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True): +def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False): ''' Create and show a form on tbe caller's behalf. :param title: @@ -3826,7 +3826,7 @@ def EasyProgressMeterCancel(title, *args): _one_line_progress_meters = {} # ============================== OneLineProgressMeter =====# -def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=True): +def OneLineProgressMeter(title, current_value, max_value, key, *args, orientation=None, bar_color=(None,None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False): global _one_line_progress_meters @@ -4008,7 +4008,7 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au # (True if Submit was pressed, false otherwise) # # ---------------------------------------------------------------------- # -def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None, None)): +def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None)): """ Display popup with text entry field and browse button. Browse for folder :param message: @@ -4052,7 +4052,7 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), ##################################### # PopupGetFile # ##################################### -def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display popup with text entry field and browse button. Browse for file @@ -4104,7 +4104,7 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files ##################################### # PopupGetText # ##################################### -def PopupGetText(message, default_text='', password_char='', size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupGetText(message, default_text='', password_char='', size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display Popup with text entry field :param message: @@ -4449,7 +4449,7 @@ def ObjToString(obj, extra=' '): # ----------------------------------- The mighty Popup! ------------------------------------------------------------ # -def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def Popup(*args, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Popup - Display a popup box with as many parms as you wish to include :param args: @@ -4537,7 +4537,7 @@ def MsgBox(*args): # --------------------------- PopupNoButtons --------------------------- -def PopupNoButtons(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupNoButtons(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Show a Popup but without any buttons :param args: @@ -4562,7 +4562,7 @@ def PopupNoButtons(*args, button_color=None, background_color=None, text_color=N # --------------------------- PopupNonBlocking --------------------------- -def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Show Popup box and immediately return (does not block) :param args: @@ -4620,7 +4620,7 @@ def PopupNoTitlebar(*args, button_type=POPUP_BUTTONS_OK, button_color=None, back # --------------------------- PopupAutoClose --------------------------- -def PopupAutoClose(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupAutoClose(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=True, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None,no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Popup that closes itself after some time period :param args: @@ -4647,7 +4647,7 @@ def PopupAutoClose(*args, button_type=POPUP_BUTTONS_OK, button_color=None, backg PopupTimed = PopupAutoClose # --------------------------- PopupError --------------------------- -def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Popup with colored button and 'Error' as button text :param args: @@ -4670,7 +4670,7 @@ def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color= # --------------------------- PopupCancel --------------------------- -def PopupCancel(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupCancel(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display Popup with "cancelled" button text :param args: @@ -4692,7 +4692,7 @@ def PopupCancel(*args, button_color=None, background_color=None, text_color=None Popup(*args, button_type=POPUP_BUTTONS_CANCELLED, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupOK --------------------------- -def PopupOK(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupOK(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display Popup with OK button only :param args: @@ -4714,7 +4714,7 @@ def PopupOK(*args, button_color=None, background_color=None, text_color=None, au Popup(*args, button_type=POPUP_BUTTONS_OK, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupOKCancel --------------------------- -def PopupOKCancel(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupOKCancel(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display popup with OK and Cancel buttons :param args: @@ -4736,7 +4736,7 @@ def PopupOKCancel(*args, button_color=None, background_color=None, text_color=No return Popup(*args, button_type=POPUP_BUTTONS_OK_CANCEL, background_color=background_color, text_color=text_color, non_blocking=non_blocking, icon=icon, line_width=line_width, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) # --------------------------- PopupYesNo --------------------------- -def PopupYesNo(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=True, keep_on_top=False, location=(None,None)): +def PopupYesNo(*args, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display Popup with Yes and No buttons :param args: From 670a772c5c474288cea4b66c1084d7eb21797ccf Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 27 Sep 2018 22:06:50 -0400 Subject: [PATCH 493/521] Another Colors Name demo with tooltips --- Demo_Color_Names.py | 749 +++++++++++++++++++++++++++---- Demo_Color_Names_Smaller_List.py | 112 +++++ 2 files changed, 776 insertions(+), 85 deletions(-) create mode 100644 Demo_Color_Names_Smaller_List.py diff --git a/Demo_Color_Names.py b/Demo_Color_Names.py index b880ff788..e7762c20c 100644 --- a/Demo_Color_Names.py +++ b/Demo_Color_Names.py @@ -5,98 +5,677 @@ else: import PySimpleGUI as sg """ - Color names courtesy of Big Daddy's Wiki-Python - http://www.wikipython.com/tkinter-ttk-tix/summary-information/colors/ - + Shows a big chart of colors... give it a few seconds to create it Once large window is shown, you can click on any color and another window will popup showing both white and black text on that color + You will find the list of tkinter colors here: + http://www.tcl.tk/man/tcl8.5/TkCmd/colors.htm + """ -COLORS = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', - 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', - 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', - 'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray', - 'light slate gray', 'gray', 'light gray', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue', - 'slate blue', 'medium slate blue', 'light slate blue', 'medium blue', 'royal blue', 'blue', - 'dodger blue', 'deep sky blue', 'sky blue', 'light sky blue', 'steel blue', 'light steel blue', - 'light blue', 'powder blue', 'pale turquoise', 'dark turquoise', 'medium turquoise', 'turquoise', - 'cyan', 'light cyan', 'cadet blue', 'medium aquamarine', 'aquamarine', 'dark green', 'dark olive green', - 'dark sea green', 'sea green', 'medium sea green', 'light sea green', 'pale green', 'spring green', - 'lawn green', 'medium spring green', 'green yellow', 'lime green', 'yellow green', - 'forest green', 'olive drab', 'dark khaki', 'khaki', 'pale goldenrod', 'light goldenrod yellow', - 'light yellow', 'yellow', 'gold', 'light goldenrod', 'goldenrod', 'dark goldenrod', 'rosy brown', - 'indian red', 'saddle brown', 'sandy brown', - 'dark salmon', 'salmon', 'light salmon', 'orange', 'dark orange', - 'coral', 'light coral', 'tomato', 'orange red', 'red', 'hot pink', 'deep pink', 'pink', 'light pink', - 'pale violet red', 'maroon', 'medium violet red', 'violet red', - 'medium orchid', 'dark orchid', 'dark violet', 'blue violet', 'purple', 'medium purple', - 'thistle', 'snow2', 'snow3', - 'snow4', 'seashell2', 'seashell3', 'seashell4', 'AntiqueWhite1', 'AntiqueWhite2', - 'AntiqueWhite3', 'AntiqueWhite4', 'bisque2', 'bisque3', 'bisque4', 'PeachPuff2', - 'PeachPuff3', 'PeachPuff4', 'NavajoWhite2', 'NavajoWhite3', 'NavajoWhite4', - 'LemonChiffon2', 'LemonChiffon3', 'LemonChiffon4', 'cornsilk2', 'cornsilk3', - 'cornsilk4', 'ivory2', 'ivory3', 'ivory4', 'honeydew2', 'honeydew3', 'honeydew4', - 'LavenderBlush2', 'LavenderBlush3', 'LavenderBlush4', 'MistyRose2', 'MistyRose3', - 'MistyRose4', 'azure2', 'azure3', 'azure4', 'SlateBlue1', 'SlateBlue2', 'SlateBlue3', - 'SlateBlue4', 'RoyalBlue1', 'RoyalBlue2', 'RoyalBlue3', 'RoyalBlue4', 'blue2', 'blue4', - 'DodgerBlue2', 'DodgerBlue3', 'DodgerBlue4', 'SteelBlue1', 'SteelBlue2', - 'SteelBlue3', 'SteelBlue4', 'DeepSkyBlue2', 'DeepSkyBlue3', 'DeepSkyBlue4', - 'SkyBlue1', 'SkyBlue2', 'SkyBlue3', 'SkyBlue4', 'LightSkyBlue1', 'LightSkyBlue2', - 'LightSkyBlue3', 'LightSkyBlue4', 'Slategray1', 'Slategray2', 'Slategray3', - 'Slategray4', 'LightSteelBlue1', 'LightSteelBlue2', 'LightSteelBlue3', - 'LightSteelBlue4', 'LightBlue1', 'LightBlue2', 'LightBlue3', 'LightBlue4', - 'LightCyan2', 'LightCyan3', 'LightCyan4', 'PaleTurquoise1', 'PaleTurquoise2', - 'PaleTurquoise3', 'PaleTurquoise4', 'CadetBlue1', 'CadetBlue2', 'CadetBlue3', - 'CadetBlue4', 'turquoise1', 'turquoise2', 'turquoise3', 'turquoise4', 'cyan2', 'cyan3', - 'cyan4', 'DarkSlategray1', 'DarkSlategray2', 'DarkSlategray3', 'DarkSlategray4', - 'aquamarine2', 'aquamarine4', 'DarkSeaGreen1', 'DarkSeaGreen2', 'DarkSeaGreen3', - 'DarkSeaGreen4', 'SeaGreen1', 'SeaGreen2', 'SeaGreen3', 'PaleGreen1', 'PaleGreen2', - 'PaleGreen3', 'PaleGreen4', 'SpringGreen2', 'SpringGreen3', 'SpringGreen4', - 'green2', 'green3', 'green4', 'chartreuse2', 'chartreuse3', 'chartreuse4', - 'OliveDrab1', 'OliveDrab2', 'OliveDrab4', 'DarkOliveGreen1', 'DarkOliveGreen2', - 'DarkOliveGreen3', 'DarkOliveGreen4', 'khaki1', 'khaki2', 'khaki3', 'khaki4', - 'LightGoldenrod1', 'LightGoldenrod2', 'LightGoldenrod3', 'LightGoldenrod4', - 'LightYellow2', 'LightYellow3', 'LightYellow4', 'yellow2', 'yellow3', 'yellow4', - 'gold2', 'gold3', 'gold4', 'goldenrod1', 'goldenrod2', 'goldenrod3', 'goldenrod4', - 'DarkGoldenrod1', 'DarkGoldenrod2', 'DarkGoldenrod3', 'DarkGoldenrod4', - 'RosyBrown1', 'RosyBrown2', 'RosyBrown3', 'RosyBrown4', 'IndianRed1', 'IndianRed2', - 'IndianRed3', 'IndianRed4', 'sienna1', 'sienna2', 'sienna3', 'sienna4', 'burlywood1', - 'burlywood2', 'burlywood3', 'burlywood4', 'wheat1', 'wheat2', 'wheat3', 'wheat4', 'tan1', - 'tan2', 'tan4', 'chocolate1', 'chocolate2', 'chocolate3', 'firebrick1', 'firebrick2', - 'firebrick3', 'firebrick4', 'brown1', 'brown2', 'brown3', 'brown4', 'salmon1', 'salmon2', - 'salmon3', 'salmon4', 'LightSalmon2', 'LightSalmon3', 'LightSalmon4', 'orange2', - 'orange3', 'orange4', 'DarkOrange1', 'DarkOrange2', 'DarkOrange3', 'DarkOrange4', - 'coral1', 'coral2', 'coral3', 'coral4', 'tomato2', 'tomato3', 'tomato4', 'OrangeRed2', - 'OrangeRed3', 'OrangeRed4', 'red2', 'red3', 'red4', 'DeepPink2', 'DeepPink3', 'DeepPink4', - 'HotPink1', 'HotPink2', 'HotPink3', 'HotPink4', 'pink1', 'pink2', 'pink3', 'pink4', - 'LightPink1', 'LightPink2', 'LightPink3', 'LightPink4', 'PaleVioletRed1', - 'PaleVioletRed2', 'PaleVioletRed3', 'PaleVioletRed4', 'maroon1', 'maroon2', - 'maroon3', 'maroon4', 'VioletRed1', 'VioletRed2', 'VioletRed3', 'VioletRed4', - 'magenta2', 'magenta3', 'magenta4', 'orchid1', 'orchid2', 'orchid3', 'orchid4', 'plum1', - 'plum2', 'plum3', 'plum4', 'MediumOrchid1', 'MediumOrchid2', 'MediumOrchid3', - 'MediumOrchid4', 'DarkOrchid1', 'DarkOrchid2', 'DarkOrchid3', 'DarkOrchid4', - 'purple1', 'purple2', 'purple3', 'purple4', 'MediumPurple1', 'MediumPurple2', - 'MediumPurple3', 'MediumPurple4', 'thistle1', 'thistle2', 'thistle3', 'thistle4', - 'grey1', 'grey2', 'grey3', 'grey4', 'grey5', 'grey6', 'grey7', 'grey8', 'grey9', 'grey10', - 'grey11', 'grey12', 'grey13', 'grey14', 'grey15', 'grey16', 'grey17', 'grey18', 'grey19', - 'grey20', 'grey21', 'grey22', 'grey23', 'grey24', 'grey25', 'grey26', 'grey27', 'grey28', - 'grey29', 'grey30', 'grey31', 'grey32', 'grey33', 'grey34', 'grey35', 'grey36', 'grey37', - 'grey38', 'grey39', 'grey40', 'grey42', 'grey43', 'grey44', 'grey45', 'grey46', 'grey47', - 'grey48', 'grey49', 'grey50', 'grey51', 'grey52', 'grey53', 'grey54', 'grey55', 'grey56', - 'grey57', 'grey58', 'grey59', 'grey60', 'grey61', 'grey62', 'grey63', 'grey64', 'grey65', - 'grey66', 'grey67', 'grey68', 'grey69', 'grey70', 'grey71', 'grey72', 'grey73', 'grey74', - 'grey75', 'grey76', 'grey77', 'grey78', 'grey79', 'grey80', 'grey81', 'grey82', 'grey83', - 'grey84', 'grey85', 'grey86', 'grey87', 'grey88', 'grey89', 'grey90', 'grey91', 'grey92', - 'grey93', 'grey94', 'grey95', 'grey97', 'grey98', 'grey99'] -sg.SetOptions(button_element_size=(12,1), element_padding=(0,0), auto_size_buttons=False, border_width=0) +color_map = { + 'alice blue': '#F0F8FF', + 'AliceBlue': '#F0F8FF', + 'antique white': '#FAEBD7', + 'AntiqueWhite': '#FAEBD7', + 'AntiqueWhite1': '#FFEFDB', + 'AntiqueWhite2': '#EEDFCC', + 'AntiqueWhite3': '#CDC0B0', + 'AntiqueWhite4': '#8B8378', + 'aquamarine': '#7FFFD4', + 'aquamarine1': '#7FFFD4', + 'aquamarine2': '#76EEC6', + 'aquamarine3': '#66CDAA', + 'aquamarine4': '#458B74', + 'azure': '#F0FFFF', + 'azure1': '#F0FFFF', + 'azure2': '#E0EEEE', + 'azure3': '#C1CDCD', + 'azure4': '#838B8B', + 'beige': '#F5F5DC', + 'bisque': '#FFE4C4', + 'bisque1': '#FFE4C4', + 'bisque2': '#EED5B7', + 'bisque3': '#CDB79E', + 'bisque4': '#8B7D6B', + 'black': '#000000', + 'blanched almond': '#FFEBCD', + 'BlanchedAlmond': '#FFEBCD', + 'blue': '#0000FF', + 'blue violet': '#8A2BE2', + 'blue1': '#0000FF', + 'blue2': '#0000EE', + 'blue3': '#0000CD', + 'blue4': '#00008B', + 'BlueViolet': '#8A2BE2', + 'brown': '#A52A2A', + 'brown1': '#FF4040', + 'brown2': '#EE3B3B', + 'brown3': '#CD3333', + 'brown4': '#8B2323', + 'burlywood': '#DEB887', + 'burlywood1': '#FFD39B', + 'burlywood2': '#EEC591', + 'burlywood3': '#CDAA7D', + 'burlywood4': '#8B7355', + 'cadet blue': '#5F9EA0', + 'CadetBlue': '#5F9EA0', + 'CadetBlue1': '#98F5FF', + 'CadetBlue2': '#8EE5EE', + 'CadetBlue3': '#7AC5CD', + 'CadetBlue4': '#53868B', + 'chartreuse': '#7FFF00', + 'chartreuse1': '#7FFF00', + 'chartreuse2': '#76EE00', + 'chartreuse3': '#66CD00', + 'chartreuse4': '#458B00', + 'chocolate': '#D2691E', + 'chocolate1': '#FF7F24', + 'chocolate2': '#EE7621', + 'chocolate3': '#CD661D', + 'chocolate4': '#8B4513', + 'coral': '#FF7F50', + 'coral1': '#FF7256', + 'coral2': '#EE6A50', + 'coral3': '#CD5B45', + 'coral4': '#8B3E2F', + 'cornflower blue': '#6495ED', + 'CornflowerBlue': '#6495ED', + 'cornsilk': '#FFF8DC', + 'cornsilk1': '#FFF8DC', + 'cornsilk2': '#EEE8CD', + 'cornsilk3': '#CDC8B1', + 'cornsilk4': '#8B8878', + 'cyan': '#00FFFF', + 'cyan1': '#00FFFF', + 'cyan2': '#00EEEE', + 'cyan3': '#00CDCD', + 'cyan4': '#008B8B', + 'dark blue': '#00008B', + 'dark cyan': '#008B8B', + 'dark goldenrod': '#B8860B', + 'dark gray': '#A9A9A9', + 'dark green': '#006400', + 'dark grey': '#A9A9A9', + 'dark khaki': '#BDB76B', + 'dark magenta': '#8B008B', + 'dark olive green': '#556B2F', + 'dark orange': '#FF8C00', + 'dark orchid': '#9932CC', + 'dark red': '#8B0000', + 'dark salmon': '#E9967A', + 'dark sea green': '#8FBC8F', + 'dark slate blue': '#483D8B', + 'dark slate gray': '#2F4F4F', + 'dark slate grey': '#2F4F4F', + 'dark turquoise': '#00CED1', + 'dark violet': '#9400D3', + 'DarkBlue': '#00008B', + 'DarkCyan': '#008B8B', + 'DarkGoldenrod': '#B8860B', + 'DarkGoldenrod1': '#FFB90F', + 'DarkGoldenrod2': '#EEAD0E', + 'DarkGoldenrod3': '#CD950C', + 'DarkGoldenrod4': '#8B6508', + 'DarkGray': '#A9A9A9', + 'DarkGreen': '#006400', + 'DarkGrey': '#A9A9A9', + 'DarkKhaki': '#BDB76B', + 'DarkMagenta': '#8B008B', + 'DarkOliveGreen': '#556B2F', + 'DarkOliveGreen1': '#CAFF70', + 'DarkOliveGreen2': '#BCEE68', + 'DarkOliveGreen3': '#A2CD5A', + 'DarkOliveGreen4': '#6E8B3D', + 'DarkOrange': '#FF8C00', + 'DarkOrange1': '#FF7F00', + 'DarkOrange2': '#EE7600', + 'DarkOrange3': '#CD6600', + 'DarkOrange4': '#8B4500', + 'DarkOrchid': '#9932CC', + 'DarkOrchid1': '#BF3EFF', + 'DarkOrchid2': '#B23AEE', + 'DarkOrchid3': '#9A32CD', + 'DarkOrchid4': '#68228B', + 'DarkRed': '#8B0000', + 'DarkSalmon': '#E9967A', + 'DarkSeaGreen': '#8FBC8F', + 'DarkSeaGreen1': '#C1FFC1', + 'DarkSeaGreen2': '#B4EEB4', + 'DarkSeaGreen3': '#9BCD9B', + 'DarkSeaGreen4': '#698B69', + 'DarkSlateBlue': '#483D8B', + 'DarkSlateGray': '#2F4F4F', + 'DarkSlateGray1': '#97FFFF', + 'DarkSlateGray2': '#8DEEEE', + 'DarkSlateGray3': '#79CDCD', + 'DarkSlateGray4': '#528B8B', + 'DarkSlateGrey': '#2F4F4F', + 'DarkTurquoise': '#00CED1', + 'DarkViolet': '#9400D3', + 'deep pink': '#FF1493', + 'deep sky blue': '#00BFFF', + 'DeepPink': '#FF1493', + 'DeepPink1': '#FF1493', + 'DeepPink2': '#EE1289', + 'DeepPink3': '#CD1076', + 'DeepPink4': '#8B0A50', + 'DeepSkyBlue': '#00BFFF', + 'DeepSkyBlue1': '#00BFFF', + 'DeepSkyBlue2': '#00B2EE', + 'DeepSkyBlue3': '#009ACD', + 'DeepSkyBlue4': '#00688B', + 'dim gray': '#696969', + 'dim grey': '#696969', + 'DimGray': '#696969', + 'DimGrey': '#696969', + 'dodger blue': '#1E90FF', + 'DodgerBlue': '#1E90FF', + 'DodgerBlue1': '#1E90FF', + 'DodgerBlue2': '#1C86EE', + 'DodgerBlue3': '#1874CD', + 'DodgerBlue4': '#104E8B', + 'firebrick': '#B22222', + 'firebrick1': '#FF3030', + 'firebrick2': '#EE2C2C', + 'firebrick3': '#CD2626', + 'firebrick4': '#8B1A1A', + 'floral white': '#FFFAF0', + 'FloralWhite': '#FFFAF0', + 'forest green': '#228B22', + 'ForestGreen': '#228B22', + 'gainsboro': '#DCDCDC', + 'ghost white': '#F8F8FF', + 'GhostWhite': '#F8F8FF', + 'gold': '#FFD700', + 'gold1': '#FFD700', + 'gold2': '#EEC900', + 'gold3': '#CDAD00', + 'gold4': '#8B7500', + 'goldenrod': '#DAA520', + 'goldenrod1': '#FFC125', + 'goldenrod2': '#EEB422', + 'goldenrod3': '#CD9B1D', + 'goldenrod4': '#8B6914', + 'green': '#00FF00', + 'green yellow': '#ADFF2F', + 'green1': '#00FF00', + 'green2': '#00EE00', + 'green3': '#00CD00', + 'green4': '#008B00', + 'GreenYellow': '#ADFF2F', + 'grey': '#BEBEBE', + 'grey0': '#000000', + 'grey1': '#030303', + 'grey2': '#050505', + 'grey3': '#080808', + 'grey4': '#0A0A0A', + 'grey5': '#0D0D0D', + 'grey6': '#0F0F0F', + 'grey7': '#121212', + 'grey8': '#141414', + 'grey9': '#171717', + 'grey10': '#1A1A1A', + 'grey11': '#1C1C1C', + 'grey12': '#1F1F1F', + 'grey13': '#212121', + 'grey14': '#242424', + 'grey15': '#262626', + 'grey16': '#292929', + 'grey17': '#2B2B2B', + 'grey18': '#2E2E2E', + 'grey19': '#303030', + 'grey20': '#333333', + 'grey21': '#363636', + 'grey22': '#383838', + 'grey23': '#3B3B3B', + 'grey24': '#3D3D3D', + 'grey25': '#404040', + 'grey26': '#424242', + 'grey27': '#454545', + 'grey28': '#474747', + 'grey29': '#4A4A4A', + 'grey30': '#4D4D4D', + 'grey31': '#4F4F4F', + 'grey32': '#525252', + 'grey33': '#545454', + 'grey34': '#575757', + 'grey35': '#595959', + 'grey36': '#5C5C5C', + 'grey37': '#5E5E5E', + 'grey38': '#616161', + 'grey39': '#636363', + 'grey40': '#666666', + 'grey41': '#696969', + 'grey42': '#6B6B6B', + 'grey43': '#6E6E6E', + 'grey44': '#707070', + 'grey45': '#737373', + 'grey46': '#757575', + 'grey47': '#787878', + 'grey48': '#7A7A7A', + 'grey49': '#7D7D7D', + 'grey50': '#7F7F7F', + 'grey51': '#828282', + 'grey52': '#858585', + 'grey53': '#878787', + 'grey54': '#8A8A8A', + 'grey55': '#8C8C8C', + 'grey56': '#8F8F8F', + 'grey57': '#919191', + 'grey58': '#949494', + 'grey59': '#969696', + 'grey60': '#999999', + 'grey61': '#9C9C9C', + 'grey62': '#9E9E9E', + 'grey63': '#A1A1A1', + 'grey64': '#A3A3A3', + 'grey65': '#A6A6A6', + 'grey66': '#A8A8A8', + 'grey67': '#ABABAB', + 'grey68': '#ADADAD', + 'grey69': '#B0B0B0', + 'grey70': '#B3B3B3', + 'grey71': '#B5B5B5', + 'grey72': '#B8B8B8', + 'grey73': '#BABABA', + 'grey74': '#BDBDBD', + 'grey75': '#BFBFBF', + 'grey76': '#C2C2C2', + 'grey77': '#C4C4C4', + 'grey78': '#C7C7C7', + 'grey79': '#C9C9C9', + 'grey80': '#CCCCCC', + 'grey81': '#CFCFCF', + 'grey82': '#D1D1D1', + 'grey83': '#D4D4D4', + 'grey84': '#D6D6D6', + 'grey85': '#D9D9D9', + 'grey86': '#DBDBDB', + 'grey87': '#DEDEDE', + 'grey88': '#E0E0E0', + 'grey89': '#E3E3E3', + 'grey90': '#E5E5E5', + 'grey91': '#E8E8E8', + 'grey92': '#EBEBEB', + 'grey93': '#EDEDED', + 'grey94': '#F0F0F0', + 'grey95': '#F2F2F2', + 'grey96': '#F5F5F5', + 'grey97': '#F7F7F7', + 'grey98': '#FAFAFA', + 'grey99': '#FCFCFC', + 'grey100': '#FFFFFF', + 'honeydew': '#F0FFF0', + 'honeydew1': '#F0FFF0', + 'honeydew2': '#E0EEE0', + 'honeydew3': '#C1CDC1', + 'honeydew4': '#838B83', + 'hot pink': '#FF69B4', + 'HotPink': '#FF69B4', + 'HotPink1': '#FF6EB4', + 'HotPink2': '#EE6AA7', + 'HotPink3': '#CD6090', + 'HotPink4': '#8B3A62', + 'indian red': '#CD5C5C', + 'IndianRed': '#CD5C5C', + 'IndianRed1': '#FF6A6A', + 'IndianRed2': '#EE6363', + 'IndianRed3': '#CD5555', + 'IndianRed4': '#8B3A3A', + 'ivory': '#FFFFF0', + 'ivory1': '#FFFFF0', + 'ivory2': '#EEEEE0', + 'ivory3': '#CDCDC1', + 'ivory4': '#8B8B83', + 'khaki': '#F0E68C', + 'khaki1': '#FFF68F', + 'khaki2': '#EEE685', + 'khaki3': '#CDC673', + 'khaki4': '#8B864E', + 'lavender': '#E6E6FA', + 'lavender blush': '#FFF0F5', + 'LavenderBlush': '#FFF0F5', + 'LavenderBlush1': '#FFF0F5', + 'LavenderBlush2': '#EEE0E5', + 'LavenderBlush3': '#CDC1C5', + 'LavenderBlush4': '#8B8386', + 'lawn green': '#7CFC00', + 'LawnGreen': '#7CFC00', + 'lemon chiffon': '#FFFACD', + 'LemonChiffon': '#FFFACD', + 'LemonChiffon1': '#FFFACD', + 'LemonChiffon2': '#EEE9BF', + 'LemonChiffon3': '#CDC9A5', + 'LemonChiffon4': '#8B8970', + 'light blue': '#ADD8E6', + 'light coral': '#F08080', + 'light cyan': '#E0FFFF', + 'light goldenrod': '#EEDD82', + 'light goldenrod yellow': '#FAFAD2', + 'light gray': '#D3D3D3', + 'light green': '#90EE90', + 'light grey': '#D3D3D3', + 'light pink': '#FFB6C1', + 'light salmon': '#FFA07A', + 'light sea green': '#20B2AA', + 'light sky blue': '#87CEFA', + 'light slate blue': '#8470FF', + 'light slate gray': '#778899', + 'light slate grey': '#778899', + 'light steel blue': '#B0C4DE', + 'light yellow': '#FFFFE0', + 'LightBlue': '#ADD8E6', + 'LightBlue1': '#BFEFFF', + 'LightBlue2': '#B2DFEE', + 'LightBlue3': '#9AC0CD', + 'LightBlue4': '#68838B', + 'LightCoral': '#F08080', + 'LightCyan': '#E0FFFF', + 'LightCyan1': '#E0FFFF', + 'LightCyan2': '#D1EEEE', + 'LightCyan3': '#B4CDCD', + 'LightCyan4': '#7A8B8B', + 'LightGoldenrod': '#EEDD82', + 'LightGoldenrod1': '#FFEC8B', + 'LightGoldenrod2': '#EEDC82', + 'LightGoldenrod3': '#CDBE70', + 'LightGoldenrod4': '#8B814C', + 'LightGoldenrodYellow': '#FAFAD2', + 'LightGray': '#D3D3D3', + 'LightGreen': '#90EE90', + 'LightGrey': '#D3D3D3', + 'LightPink': '#FFB6C1', + 'LightPink1': '#FFAEB9', + 'LightPink2': '#EEA2AD', + 'LightPink3': '#CD8C95', + 'LightPink4': '#8B5F65', + 'LightSalmon': '#FFA07A', + 'LightSalmon1': '#FFA07A', + 'LightSalmon2': '#EE9572', + 'LightSalmon3': '#CD8162', + 'LightSalmon4': '#8B5742', + 'LightSeaGreen': '#20B2AA', + 'LightSkyBlue': '#87CEFA', + 'LightSkyBlue1': '#B0E2FF', + 'LightSkyBlue2': '#A4D3EE', + 'LightSkyBlue3': '#8DB6CD', + 'LightSkyBlue4': '#607B8B', + 'LightSlateBlue': '#8470FF', + 'LightSlateGray': '#778899', + 'LightSlateGrey': '#778899', + 'LightSteelBlue': '#B0C4DE', + 'LightSteelBlue1': '#CAE1FF', + 'LightSteelBlue2': '#BCD2EE', + 'LightSteelBlue3': '#A2B5CD', + 'LightSteelBlue4': '#6E7B8B', + 'LightYellow': '#FFFFE0', + 'LightYellow1': '#FFFFE0', + 'LightYellow2': '#EEEED1', + 'LightYellow3': '#CDCDB4', + 'LightYellow4': '#8B8B7A', + 'lime green': '#32CD32', + 'LimeGreen': '#32CD32', + 'linen': '#FAF0E6', + 'magenta': '#FF00FF', + 'magenta1': '#FF00FF', + 'magenta2': '#EE00EE', + 'magenta3': '#CD00CD', + 'magenta4': '#8B008B', + 'maroon': '#B03060', + 'maroon1': '#FF34B3', + 'maroon2': '#EE30A7', + 'maroon3': '#CD2990', + 'maroon4': '#8B1C62', + 'medium aquamarine': '#66CDAA', + 'medium blue': '#0000CD', + 'medium orchid': '#BA55D3', + 'medium purple': '#9370DB', + 'medium sea green': '#3CB371', + 'medium slate blue': '#7B68EE', + 'medium spring green': '#00FA9A', + 'medium turquoise': '#48D1CC', + 'medium violet red': '#C71585', + 'MediumAquamarine': '#66CDAA', + 'MediumBlue': '#0000CD', + 'MediumOrchid': '#BA55D3', + 'MediumOrchid1': '#E066FF', + 'MediumOrchid2': '#D15FEE', + 'MediumOrchid3': '#B452CD', + 'MediumOrchid4': '#7A378B', + 'MediumPurple': '#9370DB', + 'MediumPurple1': '#AB82FF', + 'MediumPurple2': '#9F79EE', + 'MediumPurple3': '#8968CD', + 'MediumPurple4': '#5D478B', + 'MediumSeaGreen': '#3CB371', + 'MediumSlateBlue': '#7B68EE', + 'MediumSpringGreen': '#00FA9A', + 'MediumTurquoise': '#48D1CC', + 'MediumVioletRed': '#C71585', + 'midnight blue': '#191970', + 'MidnightBlue': '#191970', + 'mint cream': '#F5FFFA', + 'MintCream': '#F5FFFA', + 'misty rose': '#FFE4E1', + 'MistyRose': '#FFE4E1', + 'MistyRose1': '#FFE4E1', + 'MistyRose2': '#EED5D2', + 'MistyRose3': '#CDB7B5', + 'MistyRose4': '#8B7D7B', + 'moccasin': '#FFE4B5', + 'navajo white': '#FFDEAD', + 'NavajoWhite': '#FFDEAD', + 'NavajoWhite1': '#FFDEAD', + 'NavajoWhite2': '#EECFA1', + 'NavajoWhite3': '#CDB38B', + 'NavajoWhite4': '#8B795E', + 'navy': '#000080', + 'navy blue': '#000080', + 'NavyBlue': '#000080', + 'old lace': '#FDF5E6', + 'OldLace': '#FDF5E6', + 'olive drab': '#6B8E23', + 'OliveDrab': '#6B8E23', + 'OliveDrab1': '#C0FF3E', + 'OliveDrab2': '#B3EE3A', + 'OliveDrab3': '#9ACD32', + 'OliveDrab4': '#698B22', + 'orange': '#FFA500', + 'orange red': '#FF4500', + 'orange1': '#FFA500', + 'orange2': '#EE9A00', + 'orange3': '#CD8500', + 'orange4': '#8B5A00', + 'OrangeRed': '#FF4500', + 'OrangeRed1': '#FF4500', + 'OrangeRed2': '#EE4000', + 'OrangeRed3': '#CD3700', + 'OrangeRed4': '#8B2500', + 'orchid': '#DA70D6', + 'orchid1': '#FF83FA', + 'orchid2': '#EE7AE9', + 'orchid3': '#CD69C9', + 'orchid4': '#8B4789', + 'pale goldenrod': '#EEE8AA', + 'pale green': '#98FB98', + 'pale turquoise': '#AFEEEE', + 'pale violet red': '#DB7093', + 'PaleGoldenrod': '#EEE8AA', + 'PaleGreen': '#98FB98', + 'PaleGreen1': '#9AFF9A', + 'PaleGreen2': '#90EE90', + 'PaleGreen3': '#7CCD7C', + 'PaleGreen4': '#548B54', + 'PaleTurquoise': '#AFEEEE', + 'PaleTurquoise1': '#BBFFFF', + 'PaleTurquoise2': '#AEEEEE', + 'PaleTurquoise3': '#96CDCD', + 'PaleTurquoise4': '#668B8B', + 'PaleVioletRed': '#DB7093', + 'PaleVioletRed1': '#FF82AB', + 'PaleVioletRed2': '#EE799F', + 'PaleVioletRed3': '#CD687F', + 'PaleVioletRed4': '#8B475D', + 'papaya whip': '#FFEFD5', + 'PapayaWhip': '#FFEFD5', + 'peach puff': '#FFDAB9', + 'PeachPuff': '#FFDAB9', + 'PeachPuff1': '#FFDAB9', + 'PeachPuff2': '#EECBAD', + 'PeachPuff3': '#CDAF95', + 'PeachPuff4': '#8B7765', + 'peru': '#CD853F', + 'pink': '#FFC0CB', + 'pink1': '#FFB5C5', + 'pink2': '#EEA9B8', + 'pink3': '#CD919E', + 'pink4': '#8B636C', + 'plum': '#DDA0DD', + 'plum1': '#FFBBFF', + 'plum2': '#EEAEEE', + 'plum3': '#CD96CD', + 'plum4': '#8B668B', + 'powder blue': '#B0E0E6', + 'PowderBlue': '#B0E0E6', + 'purple': '#A020F0', + 'purple1': '#9B30FF', + 'purple2': '#912CEE', + 'purple3': '#7D26CD', + 'purple4': '#551A8B', + 'red': '#FF0000', + 'red1': '#FF0000', + 'red2': '#EE0000', + 'red3': '#CD0000', + 'red4': '#8B0000', + 'rosy brown': '#BC8F8F', + 'RosyBrown': '#BC8F8F', + 'RosyBrown1': '#FFC1C1', + 'RosyBrown2': '#EEB4B4', + 'RosyBrown3': '#CD9B9B', + 'RosyBrown4': '#8B6969', + 'royal blue': '#4169E1', + 'RoyalBlue': '#4169E1', + 'RoyalBlue1': '#4876FF', + 'RoyalBlue2': '#436EEE', + 'RoyalBlue3': '#3A5FCD', + 'RoyalBlue4': '#27408B', + 'saddle brown': '#8B4513', + 'SaddleBrown': '#8B4513', + 'salmon': '#FA8072', + 'salmon1': '#FF8C69', + 'salmon2': '#EE8262', + 'salmon3': '#CD7054', + 'salmon4': '#8B4C39', + 'sandy brown': '#F4A460', + 'SandyBrown': '#F4A460', + 'sea green': '#2E8B57', + 'SeaGreen': '#2E8B57', + 'SeaGreen1': '#54FF9F', + 'SeaGreen2': '#4EEE94', + 'SeaGreen3': '#43CD80', + 'SeaGreen4': '#2E8B57', + 'seashell': '#FFF5EE', + 'seashell1': '#FFF5EE', + 'seashell2': '#EEE5DE', + 'seashell3': '#CDC5BF', + 'seashell4': '#8B8682', + 'sienna': '#A0522D', + 'sienna1': '#FF8247', + 'sienna2': '#EE7942', + 'sienna3': '#CD6839', + 'sienna4': '#8B4726', + 'sky blue': '#87CEEB', + 'SkyBlue': '#87CEEB', + 'SkyBlue1': '#87CEFF', + 'SkyBlue2': '#7EC0EE', + 'SkyBlue3': '#6CA6CD', + 'SkyBlue4': '#4A708B', + 'slate blue': '#6A5ACD', + 'slate gray': '#708090', + 'slate grey': '#708090', + 'SlateBlue': '#6A5ACD', + 'SlateBlue1': '#836FFF', + 'SlateBlue2': '#7A67EE', + 'SlateBlue3': '#6959CD', + 'SlateBlue4': '#473C8B', + 'SlateGray': '#708090', + 'SlateGray1': '#C6E2FF', + 'SlateGray2': '#B9D3EE', + 'SlateGray3': '#9FB6CD', + 'SlateGray4': '#6C7B8B', + 'SlateGrey': '#708090', + 'snow': '#FFFAFA', + 'snow1': '#FFFAFA', + 'snow2': '#EEE9E9', + 'snow3': '#CDC9C9', + 'snow4': '#8B8989', + 'spring green': '#00FF7F', + 'SpringGreen': '#00FF7F', + 'SpringGreen1': '#00FF7F', + 'SpringGreen2': '#00EE76', + 'SpringGreen3': '#00CD66', + 'SpringGreen4': '#008B45', + 'steel blue': '#4682B4', + 'SteelBlue': '#4682B4', + 'SteelBlue1': '#63B8FF', + 'SteelBlue2': '#5CACEE', + 'SteelBlue3': '#4F94CD', + 'SteelBlue4': '#36648B', + 'tan': '#D2B48C', + 'tan1': '#FFA54F', + 'tan2': '#EE9A49', + 'tan3': '#CD853F', + 'tan4': '#8B5A2B', + 'thistle': '#D8BFD8', + 'thistle1': '#FFE1FF', + 'thistle2': '#EED2EE', + 'thistle3': '#CDB5CD', + 'thistle4': '#8B7B8B', + 'tomato': '#FF6347', + 'tomato1': '#FF6347', + 'tomato2': '#EE5C42', + 'tomato3': '#CD4F39', + 'tomato4': '#8B3626', + 'turquoise': '#40E0D0', + 'turquoise1': '#00F5FF', + 'turquoise2': '#00E5EE', + 'turquoise3': '#00C5CD', + 'turquoise4': '#00868B', + 'violet': '#EE82EE', + 'violet red': '#D02090', + 'VioletRed': '#D02090', + 'VioletRed1': '#FF3E96', + 'VioletRed2': '#EE3A8C', + 'VioletRed3': '#CD3278', + 'VioletRed4': '#8B2252', + 'wheat': '#F5DEB3', + 'wheat1': '#FFE7BA', + 'wheat2': '#EED8AE', + 'wheat3': '#CDBA96', + 'wheat4': '#8B7E66', + 'white': '#FFFFFF', + 'white smoke': '#F5F5F5', + 'WhiteSmoke': '#F5F5F5', + 'yellow': '#FFFF00', + 'yellow green': '#9ACD32', + 'yellow1': '#FFFF00', + 'yellow2': '#EEEE00', + 'yellow3': '#CDCD00', + 'yellow4': '#8B8B00', + 'YellowGreen': '#9ACD32', +} + + +sg.SetOptions(button_element_size=(12,1), element_padding=(0,0), auto_size_buttons=False, border_width=1) -layout = [[sg.Text('Click on a color square to see both white and black text on that color', text_color='blue', font='Any 15')]] +layout = [[sg.Text('Hover mouse to see RGB value, click for white & black text', text_color='blue', font='Any 15', relief=sg.RELIEF_SUNKEN, justification='center', size=(100,1), background_color='light green', pad=(0,(0,20))),]] row = [] # -- Create primary color viewer window -- -for i, color in enumerate(COLORS): - row.append(sg.RButton(color, button_color=('black', color), key=color)) - if (i+1) % 12 == 0: +for i, color in enumerate(color_map): + row.append(sg.RButton(color, button_color=('black', color), key=color, tooltip=color_map[color])) + if (i+1) % 15 == 0: layout.append(row) row = [] @@ -108,5 +687,5 @@ if b is None: break # -- Create a secondary window that shows white and black text on chosen color - layout2 =[[sg.Button(b, button_color=('white', b)), sg.Button(b, button_color=('black', b))] ] + layout2 =[[sg.Button(b, button_color=('white', b), tooltip=color_map[b]), sg.Button(b, button_color=('black', b), tooltip=color_map[b])] ] sg.Window('Buttons with white and black text', keep_on_top=True).Layout(layout2).Read() \ No newline at end of file diff --git a/Demo_Color_Names_Smaller_List.py b/Demo_Color_Names_Smaller_List.py new file mode 100644 index 000000000..b880ff788 --- /dev/null +++ b/Demo_Color_Names_Smaller_List.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] < 3: + import PySimpleGUI27 as sg +else: + import PySimpleGUI as sg +""" + Color names courtesy of Big Daddy's Wiki-Python + http://www.wikipython.com/tkinter-ttk-tix/summary-information/colors/ + + Shows a big chart of colors... give it a few seconds to create it + Once large window is shown, you can click on any color and another window will popup + showing both white and black text on that color +""" +COLORS = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', + 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', + 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', + 'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray', + 'light slate gray', 'gray', 'light gray', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue', + 'slate blue', 'medium slate blue', 'light slate blue', 'medium blue', 'royal blue', 'blue', + 'dodger blue', 'deep sky blue', 'sky blue', 'light sky blue', 'steel blue', 'light steel blue', + 'light blue', 'powder blue', 'pale turquoise', 'dark turquoise', 'medium turquoise', 'turquoise', + 'cyan', 'light cyan', 'cadet blue', 'medium aquamarine', 'aquamarine', 'dark green', 'dark olive green', + 'dark sea green', 'sea green', 'medium sea green', 'light sea green', 'pale green', 'spring green', + 'lawn green', 'medium spring green', 'green yellow', 'lime green', 'yellow green', + 'forest green', 'olive drab', 'dark khaki', 'khaki', 'pale goldenrod', 'light goldenrod yellow', + 'light yellow', 'yellow', 'gold', 'light goldenrod', 'goldenrod', 'dark goldenrod', 'rosy brown', + 'indian red', 'saddle brown', 'sandy brown', + 'dark salmon', 'salmon', 'light salmon', 'orange', 'dark orange', + 'coral', 'light coral', 'tomato', 'orange red', 'red', 'hot pink', 'deep pink', 'pink', 'light pink', + 'pale violet red', 'maroon', 'medium violet red', 'violet red', + 'medium orchid', 'dark orchid', 'dark violet', 'blue violet', 'purple', 'medium purple', + 'thistle', 'snow2', 'snow3', + 'snow4', 'seashell2', 'seashell3', 'seashell4', 'AntiqueWhite1', 'AntiqueWhite2', + 'AntiqueWhite3', 'AntiqueWhite4', 'bisque2', 'bisque3', 'bisque4', 'PeachPuff2', + 'PeachPuff3', 'PeachPuff4', 'NavajoWhite2', 'NavajoWhite3', 'NavajoWhite4', + 'LemonChiffon2', 'LemonChiffon3', 'LemonChiffon4', 'cornsilk2', 'cornsilk3', + 'cornsilk4', 'ivory2', 'ivory3', 'ivory4', 'honeydew2', 'honeydew3', 'honeydew4', + 'LavenderBlush2', 'LavenderBlush3', 'LavenderBlush4', 'MistyRose2', 'MistyRose3', + 'MistyRose4', 'azure2', 'azure3', 'azure4', 'SlateBlue1', 'SlateBlue2', 'SlateBlue3', + 'SlateBlue4', 'RoyalBlue1', 'RoyalBlue2', 'RoyalBlue3', 'RoyalBlue4', 'blue2', 'blue4', + 'DodgerBlue2', 'DodgerBlue3', 'DodgerBlue4', 'SteelBlue1', 'SteelBlue2', + 'SteelBlue3', 'SteelBlue4', 'DeepSkyBlue2', 'DeepSkyBlue3', 'DeepSkyBlue4', + 'SkyBlue1', 'SkyBlue2', 'SkyBlue3', 'SkyBlue4', 'LightSkyBlue1', 'LightSkyBlue2', + 'LightSkyBlue3', 'LightSkyBlue4', 'Slategray1', 'Slategray2', 'Slategray3', + 'Slategray4', 'LightSteelBlue1', 'LightSteelBlue2', 'LightSteelBlue3', + 'LightSteelBlue4', 'LightBlue1', 'LightBlue2', 'LightBlue3', 'LightBlue4', + 'LightCyan2', 'LightCyan3', 'LightCyan4', 'PaleTurquoise1', 'PaleTurquoise2', + 'PaleTurquoise3', 'PaleTurquoise4', 'CadetBlue1', 'CadetBlue2', 'CadetBlue3', + 'CadetBlue4', 'turquoise1', 'turquoise2', 'turquoise3', 'turquoise4', 'cyan2', 'cyan3', + 'cyan4', 'DarkSlategray1', 'DarkSlategray2', 'DarkSlategray3', 'DarkSlategray4', + 'aquamarine2', 'aquamarine4', 'DarkSeaGreen1', 'DarkSeaGreen2', 'DarkSeaGreen3', + 'DarkSeaGreen4', 'SeaGreen1', 'SeaGreen2', 'SeaGreen3', 'PaleGreen1', 'PaleGreen2', + 'PaleGreen3', 'PaleGreen4', 'SpringGreen2', 'SpringGreen3', 'SpringGreen4', + 'green2', 'green3', 'green4', 'chartreuse2', 'chartreuse3', 'chartreuse4', + 'OliveDrab1', 'OliveDrab2', 'OliveDrab4', 'DarkOliveGreen1', 'DarkOliveGreen2', + 'DarkOliveGreen3', 'DarkOliveGreen4', 'khaki1', 'khaki2', 'khaki3', 'khaki4', + 'LightGoldenrod1', 'LightGoldenrod2', 'LightGoldenrod3', 'LightGoldenrod4', + 'LightYellow2', 'LightYellow3', 'LightYellow4', 'yellow2', 'yellow3', 'yellow4', + 'gold2', 'gold3', 'gold4', 'goldenrod1', 'goldenrod2', 'goldenrod3', 'goldenrod4', + 'DarkGoldenrod1', 'DarkGoldenrod2', 'DarkGoldenrod3', 'DarkGoldenrod4', + 'RosyBrown1', 'RosyBrown2', 'RosyBrown3', 'RosyBrown4', 'IndianRed1', 'IndianRed2', + 'IndianRed3', 'IndianRed4', 'sienna1', 'sienna2', 'sienna3', 'sienna4', 'burlywood1', + 'burlywood2', 'burlywood3', 'burlywood4', 'wheat1', 'wheat2', 'wheat3', 'wheat4', 'tan1', + 'tan2', 'tan4', 'chocolate1', 'chocolate2', 'chocolate3', 'firebrick1', 'firebrick2', + 'firebrick3', 'firebrick4', 'brown1', 'brown2', 'brown3', 'brown4', 'salmon1', 'salmon2', + 'salmon3', 'salmon4', 'LightSalmon2', 'LightSalmon3', 'LightSalmon4', 'orange2', + 'orange3', 'orange4', 'DarkOrange1', 'DarkOrange2', 'DarkOrange3', 'DarkOrange4', + 'coral1', 'coral2', 'coral3', 'coral4', 'tomato2', 'tomato3', 'tomato4', 'OrangeRed2', + 'OrangeRed3', 'OrangeRed4', 'red2', 'red3', 'red4', 'DeepPink2', 'DeepPink3', 'DeepPink4', + 'HotPink1', 'HotPink2', 'HotPink3', 'HotPink4', 'pink1', 'pink2', 'pink3', 'pink4', + 'LightPink1', 'LightPink2', 'LightPink3', 'LightPink4', 'PaleVioletRed1', + 'PaleVioletRed2', 'PaleVioletRed3', 'PaleVioletRed4', 'maroon1', 'maroon2', + 'maroon3', 'maroon4', 'VioletRed1', 'VioletRed2', 'VioletRed3', 'VioletRed4', + 'magenta2', 'magenta3', 'magenta4', 'orchid1', 'orchid2', 'orchid3', 'orchid4', 'plum1', + 'plum2', 'plum3', 'plum4', 'MediumOrchid1', 'MediumOrchid2', 'MediumOrchid3', + 'MediumOrchid4', 'DarkOrchid1', 'DarkOrchid2', 'DarkOrchid3', 'DarkOrchid4', + 'purple1', 'purple2', 'purple3', 'purple4', 'MediumPurple1', 'MediumPurple2', + 'MediumPurple3', 'MediumPurple4', 'thistle1', 'thistle2', 'thistle3', 'thistle4', + 'grey1', 'grey2', 'grey3', 'grey4', 'grey5', 'grey6', 'grey7', 'grey8', 'grey9', 'grey10', + 'grey11', 'grey12', 'grey13', 'grey14', 'grey15', 'grey16', 'grey17', 'grey18', 'grey19', + 'grey20', 'grey21', 'grey22', 'grey23', 'grey24', 'grey25', 'grey26', 'grey27', 'grey28', + 'grey29', 'grey30', 'grey31', 'grey32', 'grey33', 'grey34', 'grey35', 'grey36', 'grey37', + 'grey38', 'grey39', 'grey40', 'grey42', 'grey43', 'grey44', 'grey45', 'grey46', 'grey47', + 'grey48', 'grey49', 'grey50', 'grey51', 'grey52', 'grey53', 'grey54', 'grey55', 'grey56', + 'grey57', 'grey58', 'grey59', 'grey60', 'grey61', 'grey62', 'grey63', 'grey64', 'grey65', + 'grey66', 'grey67', 'grey68', 'grey69', 'grey70', 'grey71', 'grey72', 'grey73', 'grey74', + 'grey75', 'grey76', 'grey77', 'grey78', 'grey79', 'grey80', 'grey81', 'grey82', 'grey83', + 'grey84', 'grey85', 'grey86', 'grey87', 'grey88', 'grey89', 'grey90', 'grey91', 'grey92', + 'grey93', 'grey94', 'grey95', 'grey97', 'grey98', 'grey99'] + +sg.SetOptions(button_element_size=(12,1), element_padding=(0,0), auto_size_buttons=False, border_width=0) + +layout = [[sg.Text('Click on a color square to see both white and black text on that color', text_color='blue', font='Any 15')]] +row = [] +# -- Create primary color viewer window -- +for i, color in enumerate(COLORS): + row.append(sg.RButton(color, button_color=('black', color), key=color)) + if (i+1) % 12 == 0: + layout.append(row) + row = [] + +window = sg.Window('Color Viewer', grab_anywhere=False, font=('any 9')).Layout(layout) + +# -- Event loop -- +while True: + b, v = window.Read() + if b is None: + break + # -- Create a secondary window that shows white and black text on chosen color + layout2 =[[sg.Button(b, button_color=('white', b)), sg.Button(b, button_color=('black', b))] ] + sg.Window('Buttons with white and black text', keep_on_top=True).Layout(layout2).Read() \ No newline at end of file From aeafdfeb19fcc828c99f1d9e24ddef634eb3472f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 28 Sep 2018 00:54:45 -0400 Subject: [PATCH 494/521] Added default_extension to PopupGetFile, fix for menu &_ stuff, new set_to_index parm for Update of Combobox Changes suggested by Venim --- PySimpleGUI.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 5039bfbe5..dfc793073 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -470,13 +470,14 @@ def __init__(self, values, default_value=None, size=(None, None), auto_size_text super().__init__(ELEM_TYPE_INPUT_COMBO, size=size, auto_size_text=auto_size_text, background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip) - def Update(self, value=None, values=None, disabled=None): + def Update(self, value=None, values=None, set_to_index=None, disabled=None): if values is not None: try: self.TKCombo['values'] = values self.TKCombo.current(0) except: pass self.Values = values + if value is not None: for index, v in enumerate(self.Values): if v == value: try: @@ -484,6 +485,12 @@ def Update(self, value=None, values=None, disabled=None): except: pass self.DefaultValue = value break + if set_to_index is not None: + try: + self.TKCombo.current(set_to_index) + self.DefaultValue = self.Values[set_to_index] + except: + pass if disabled == True: self.TKCombo['state'] = 'disable' elif disabled == False: @@ -2762,18 +2769,14 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) if type(sub_menu_info) is str: if not is_sub_menu and not skip: # print(f'Adding command {sub_menu_info}') - pos = sub_menu_info.find('_&') + pos = sub_menu_info.find('&') if pos != -1: - _ = sub_menu_info[:pos] - try: - _ += sub_menu_info[pos+2:] - except Exception as e: - print(e) - sub_menu_info = _ + if pos == 0 or sub_menu_info[pos-1] != "\\": + sub_menu_info = sub_menu_info[:pos] + sub_menu_info[pos+1:] if sub_menu_info == '---': top_menu.add('separator') else: - top_menu.add_command(label=sub_menu_info, underline=pos-1, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + top_menu.add_command(label=sub_menu_info, underline=pos, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) else: i = 0 while i < (len(sub_menu_info)): @@ -3250,15 +3253,11 @@ def CharWidthInPixels(): for menu_entry in menu_def: # print(f'Adding a Menubar ENTRY') baritem = tk.Menu(menubar, tearoff=element.Tearoff) - pos = menu_entry[0].find('_&') + pos = menu_entry[0].find('&') if pos != -1: - _ = menu_entry[0][:pos] - try: - _ += menu_entry[0][pos+2:] - except: - pass - menu_entry[0] = _ - menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos-1) + if pos == 0 or menu_entry[0][pos-1] != "\\": + menu_entry[0] = menu_entry[0][:pos] + menu_entry[0][pos+1:] + menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos) if len(menu_entry) > 1: AddMenuItem(baritem, menu_entry[1], element) toplevel_form.TKroot.configure(menu=element.TKMenu) @@ -4052,7 +4051,7 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), ##################################### # PopupGetFile # ##################################### -def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): +def PopupGetFile(message, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None,None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None,None)): """ Display popup with text entry field and browse button. Browse for file @@ -4080,9 +4079,9 @@ def PopupGetFile(message, default_path='',save_as=False, file_types=(("ALL Files except: pass if save_as: - filename = tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box + filename = tk.filedialog.asksaveasfilename(filetypes=file_types, defaultextension=default_extension) # show the 'get file' dialog box else: - filename = tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box + filename = tk.filedialog.askopenfilename(filetypes=file_types, defaultextension=default_extension) # show the 'get file' dialog box root.destroy() return filename From 4548b1dd9b2c9bc8d0516c127fdf18eb6f3420b2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 28 Sep 2018 14:57:37 -0400 Subject: [PATCH 495/521] New imports... switched order so that PyCharm will pick up with Python 3 import first --- Demo_All_Widgets.py | 6 +- Demo_Borderless_Window.py | 6 +- Demo_Button_Click.py | 6 +- Demo_Button_States.py | 7 +- Demo_Calendar.py | 6 +- Demo_Canvas.py | 6 +- Demo_Chat.py | 6 +- Demo_Chat_With_History.py | 7 +- Demo_Chatterbot.py | 6 +- Demo_Color.py | 18 ++- Demo_Color_Names.py | 8 +- Demo_Color_Names_Smaller_List.py | 7 +- Demo_Columns.py | 6 +- Demo_Compare_Files.py | 7 +- Demo_DOC_Viewer_PIL.py | 6 +- Demo_Design_Patterns.py | 18 ++- Demo_Desktop_Floating_Toolbar.py | 6 +- Demo_Desktop_Widget_CPU_Graph.py | 7 +- Demo_Desktop_Widget_CPU_Utilization.py | 7 +- Demo_Desktop_Widget_CPU_Utilization_Simple.py | 7 +- Demo_Desktop_Widget_Timer.py | 9 +- Demo_Disable_Elements.py | 7 +- Demo_DuplicateFileFinder.py | 7 +- Demo_Fill_Form.py | 7 +- Demo_Font_Sizer.py | 6 +- Demo_Func_Callback_Simulation.py | 6 +- Demo_GoodColors.py | 51 ++++--- Demo_Graph_Drawing.py | 6 +- Demo_Graph_Element.py | 7 +- Demo_Graph_Element_Sine_Wave.py | 19 ++- Demo_Graph_Noise.py | 10 +- Demo_HowDoI.py | 6 +- Demo_Img_Viewer.py | 6 +- Demo_Keyboard.py | 6 +- Demo_Keyboard_Realtime.py | 6 +- Demo_Keypad.py | 6 +- Demo_MIDI_Player.py | 6 +- Demo_Machine_Learning.py | 7 +- Demo_Matplotlib.py | 10 +- Demo_Matplotlib_Animated.py | 7 +- Demo_Matplotlib_Animated_Scatter.py | 7 +- Demo_Matplotlib_Browser.py | 6 +- Demo_Matplotlib_Ping_Graph.py | 6 +- Demo_Matplotlib_Ping_Graph_Large.py | 6 +- Demo_Media_Player.py | 6 +- Demo_Menus.py | 13 +- Demo_NonBlocking_Form.py | 6 +- Demo_OpenCV.py | 6 +- Demo_PDF_Viewer.py | 5 +- Demo_PNG_Viewer.py | 6 +- Demo_Password_Login.py | 6 +- Demo_Pi_LEDs.py | 20 +-- Demo_Pi_Robotics.py | 6 +- Demo_Ping_Line_Graph.py | 7 +- Demo_Pong.py | 6 +- Demo_Popups.py | 6 +- Demo_Progress_Meters.py | 6 +- Demo_Script_Launcher.py | 6 +- Demo_Script_Parameters.py | 8 +- Demo_Spinner_Compound_Element.py | 7 +- Demo_Super_Simple_Form.py | 6 +- Demo_Table_CSV.py | 8 +- Demo_Table_Element.py | 6 +- Demo_Table_Pandas.py | 6 +- Demo_Table_Simulation.py | 6 +- Demo_Tabs.py | 6 +- Demo_Tabs_Nested.py | 6 +- Demo_Template.py | 14 +- Demo_Youtube-dl_Frontend.py | 6 +- ProgrammingClassExamples/1b PSG (Format).py | 2 +- .../4a PSG (Sliders and combo).py | 13 +- .../4b PSG (Spinner and combo) .py | 11 +- .../5a PSG (listboxes add remove).py | 39 ++++++ ProgrammingClassExamples/6a PSG search.py | 78 +++++++++++ .../6b PSG search (disabled buttons).py | 82 +++++++++++ .../6c PSG search text preloaded.py | 79 +++++++++++ .../6d PSG sort and search.py | 130 ++++++++++++++++++ .../6e PSG sort and search (listbox) TODO.py | 130 ++++++++++++++++++ .../7a PSG Text file save and retrieve.py | 59 ++++++++ .../8a PSG Data to plot from csv file.py | 38 +++++ .../8b PSG Tables and calc from csv file.py | 41 ++++++ ...9a Plot Matplotlib numpy pyplot(y=sinx).py | 22 +++ .../9b Plot (axes moved).py | 27 ++++ .../9c Plot (axes pi format).py | 28 ++++ 84 files changed, 1071 insertions(+), 265 deletions(-) create mode 100644 ProgrammingClassExamples/5a PSG (listboxes add remove).py create mode 100644 ProgrammingClassExamples/6a PSG search.py create mode 100644 ProgrammingClassExamples/6b PSG search (disabled buttons).py create mode 100644 ProgrammingClassExamples/6c PSG search text preloaded.py create mode 100644 ProgrammingClassExamples/6d PSG sort and search.py create mode 100644 ProgrammingClassExamples/6e PSG sort and search (listbox) TODO.py create mode 100644 ProgrammingClassExamples/7a PSG Text file save and retrieve.py create mode 100644 ProgrammingClassExamples/8a PSG Data to plot from csv file.py create mode 100644 ProgrammingClassExamples/8b PSG Tables and calc from csv file.py create mode 100644 ProgrammingClassExamples/9a Plot Matplotlib numpy pyplot(y=sinx).py create mode 100644 ProgrammingClassExamples/9b Plot (axes moved).py create mode 100644 ProgrammingClassExamples/9c Plot (axes pi format).py diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index f983787ee..b1991ad58 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg sg.ChangeLookAndFeel('GreenTan') diff --git a/Demo_Borderless_Window.py b/Demo_Borderless_Window.py index 1d1f84790..f1e07b364 100644 --- a/Demo_Borderless_Window.py +++ b/Demo_Borderless_Window.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg """ Turn off padding in order to get a really tight looking layout. diff --git a/Demo_Button_Click.py b/Demo_Button_Click.py index 6295b151d..28528a467 100644 --- a/Demo_Button_Click.py +++ b/Demo_Button_Click.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import winsound diff --git a/Demo_Button_States.py b/Demo_Button_States.py index 9c481ffde..729fa5ba6 100644 --- a/Demo_Button_States.py +++ b/Demo_Button_States.py @@ -1,10 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg - +else: + import PySimpleGUI27 as sg """ Demonstrates using a "tight" layout with a Dark theme. Shows how button states can be controlled by a user application. The program manages the disabled/enabled diff --git a/Demo_Calendar.py b/Demo_Calendar.py index 473e414b0..0b2df6037 100644 --- a/Demo_Calendar.py +++ b/Demo_Calendar.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[sg.T('Calendar Test')], [sg.In('', size=(20,1), key='input')], diff --git a/Demo_Canvas.py b/Demo_Canvas.py index 81f1995ed..22d77b04b 100644 --- a/Demo_Canvas.py +++ b/Demo_Canvas.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [ [sg.Canvas(size=(150, 150), background_color='red', key='canvas')], diff --git a/Demo_Chat.py b/Demo_Chat.py index 5f6fc7a43..5b235c4c8 100644 --- a/Demo_Chat.py +++ b/Demo_Chat.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg ''' A chat window. Add call to your send-routine, print the response and you're done diff --git a/Demo_Chat_With_History.py b/Demo_Chat_With_History.py index c9e14d33b..652d4ca05 100644 --- a/Demo_Chat_With_History.py +++ b/Demo_Chat_With_History.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + ''' A chatbot with history Scroll up and down through prior commands using the arrow keys diff --git a/Demo_Chatterbot.py b/Demo_Chatterbot.py index 4a636aada..47ad334bc 100644 --- a/Demo_Chatterbot.py +++ b/Demo_Chatterbot.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg from chatterbot import ChatBot import chatterbot.utils diff --git a/Demo_Color.py b/Demo_Color.py index 9a0dd1881..5dcc23af7 100644 --- a/Demo_Color.py +++ b/Demo_Color.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg MY_WINDOW_ICON = 'E:\\TheRealMyDocs\\Icons\\The Planets\\jupiter.ico' reverse = {} @@ -1702,10 +1702,14 @@ def main(): if hex_input == '' and len(drop_down_value) == 0: continue - if hex_input is not '' and hex_input[0] == '#': - color_hex = hex_input.upper() - color_name = get_name_from_hex(hex_input) - elif drop_down_value is not None: + if len(hex_input) != 0: + if hex_input[0] == '#': + color_hex = hex_input.upper() + color_name = get_name_from_hex(hex_input) + else: + color_name = hex_input + color_hex = get_hex_from_name(color_name) + elif drop_down_value is not None and len(drop_down_value) != 0: color_name = drop_down_value[0] color_hex = get_hex_from_name(color_name) diff --git a/Demo_Color_Names.py b/Demo_Color_Names.py index e7762c20c..aeba15d0d 100644 --- a/Demo_Color_Names.py +++ b/Demo_Color_Names.py @@ -1,9 +1,11 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + + """ Shows a big chart of colors... give it a few seconds to create it diff --git a/Demo_Color_Names_Smaller_List.py b/Demo_Color_Names_Smaller_List.py index b880ff788..fac8fe5c0 100644 --- a/Demo_Color_Names_Smaller_List.py +++ b/Demo_Color_Names_Smaller_List.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + """ Color names courtesy of Big Daddy's Wiki-Python http://www.wikipython.com/tkinter-ttk-tix/summary-information/colors/ diff --git a/Demo_Columns.py b/Demo_Columns.py index 1f15c63de..dd68aa865 100644 --- a/Demo_Columns.py +++ b/Demo_Columns.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg sg.ChangeLookAndFeel('BlueMono') diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index 848fd10b7..a6a8c289d 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + # sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT) def GetFilesToCompare(): diff --git a/Demo_DOC_Viewer_PIL.py b/Demo_DOC_Viewer_PIL.py index 927027f16..0287cc902 100644 --- a/Demo_DOC_Viewer_PIL.py +++ b/Demo_DOC_Viewer_PIL.py @@ -31,7 +31,11 @@ """ import sys import fitz -import PySimpleGUI as sg +import sys +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import tkinter as tk from PIL import Image, ImageTk import time diff --git a/Demo_Design_Patterns.py b/Demo_Design_Patterns.py index 88ab2fc1e..aa56ddf08 100644 --- a/Demo_Design_Patterns.py +++ b/Demo_Design_Patterns.py @@ -9,7 +9,11 @@ # ---------------------------------# # DESIGN PATTERN 1 - Simple Window # # ---------------------------------# -import PySimpleGUI as sg +import sys +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[ sg.Text('My layout') ]] @@ -20,7 +24,11 @@ # -------------------------------------# # DESIGN PATTERN 2 - Persistent Window # # -------------------------------------# -import PySimpleGUI as sg +import sys +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[ sg.Text('My layout') ]] @@ -34,7 +42,11 @@ # ------------------------------------------------------------------# # DESIGN PATTERN 3 - Persistent Window with "early update" required # # ------------------------------------------------------------------# -import PySimpleGUI as sg +import sys +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[ sg.Text('My layout') ]] diff --git a/Demo_Desktop_Floating_Toolbar.py b/Demo_Desktop_Floating_Toolbar.py index a34b4c10b..c50d8a901 100644 --- a/Demo_Desktop_Floating_Toolbar.py +++ b/Demo_Desktop_Floating_Toolbar.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import subprocess import os diff --git a/Demo_Desktop_Widget_CPU_Graph.py b/Demo_Desktop_Widget_CPU_Graph.py index 528c336a7..9f2f8984f 100644 --- a/Demo_Desktop_Widget_CPU_Graph.py +++ b/Demo_Desktop_Widget_CPU_Graph.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import time import random import psutil diff --git a/Demo_Desktop_Widget_CPU_Utilization.py b/Demo_Desktop_Widget_CPU_Utilization.py index fedd62607..af970e62b 100644 --- a/Demo_Desktop_Widget_CPU_Utilization.py +++ b/Demo_Desktop_Widget_CPU_Utilization.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import psutil import time from threading import Thread diff --git a/Demo_Desktop_Widget_CPU_Utilization_Simple.py b/Demo_Desktop_Widget_CPU_Utilization_Simple.py index 3ce7fb59e..afb5efd48 100644 --- a/Demo_Desktop_Widget_CPU_Utilization_Simple.py +++ b/Demo_Desktop_Widget_CPU_Utilization_Simple.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import psutil diff --git a/Demo_Desktop_Widget_Timer.py b/Demo_Desktop_Widget_Timer.py index 46a5b3fc5..5d15f079f 100644 --- a/Demo_Desktop_Widget_Timer.py +++ b/Demo_Desktop_Widget_Timer.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import time """ @@ -22,7 +23,7 @@ sg.ReadButton('Reset', button_color=('white', '#007339'), key='Reset'), sg.Exit(button_color=('white', 'firebrick4'), key='Exit')]] -window = sg.Window('Running Timer', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) +window = sg.Window('Running Timer', no_titlebar=False, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout) # ---------------- main loop ---------------- current_time = 0 diff --git a/Demo_Disable_Elements.py b/Demo_Disable_Elements.py index ed0753e3d..d927d5a1c 100644 --- a/Demo_Disable_Elements.py +++ b/Demo_Disable_Elements.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg sg.ChangeLookAndFeel('Dark') sg.SetOptions(element_padding=(0, 0)) diff --git a/Demo_DuplicateFileFinder.py b/Demo_DuplicateFileFinder.py index ef5c46b97..eebe5ee10 100644 --- a/Demo_DuplicateFileFinder.py +++ b/Demo_DuplicateFileFinder.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import hashlib import os diff --git a/Demo_Fill_Form.py b/Demo_Fill_Form.py index d1a0daadd..cbfed70e0 100644 --- a/Demo_Fill_Form.py +++ b/Demo_Fill_Form.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +import sys +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg def Everything(): sg.ChangeLookAndFeel('TanBlue') diff --git a/Demo_Font_Sizer.py b/Demo_Font_Sizer.py index 861b0b8ec..56983819c 100644 --- a/Demo_Font_Sizer.py +++ b/Demo_Font_Sizer.py @@ -1,8 +1,12 @@ # Testing async form, see if can have a slider # that adjusts the size of text displayed +import sys +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg -import PySimpleGUI as sg fontSize = 12 layout = [[sg.Spin([sz for sz in range(6, 172)], font=('Helvetica 20'), initial_value=fontSize, change_submits=True, key='spin'), sg.Slider(range=(6,172), orientation='h', size=(10,20), change_submits=True, key='slider', font=('Helvetica 20')), sg.Text("Aa", size=(2, 1), font="Helvetica " + str(fontSize), key='text')]] diff --git a/Demo_Func_Callback_Simulation.py b/Demo_Func_Callback_Simulation.py index f99246866..a6bf00959 100644 --- a/Demo_Func_Callback_Simulation.py +++ b/Demo_Func_Callback_Simulation.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[sg.Text('Filename', )], [sg.Input(), sg.FileBrowse()], diff --git a/Demo_GoodColors.py b/Demo_GoodColors.py index f9cf5154c..8ec0fee77 100644 --- a/Demo_GoodColors.py +++ b/Demo_GoodColors.py @@ -1,53 +1,52 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg -import time - +else: + import PySimpleGUI27 as sg + def main(): # ------- Make a new Window ------- # - window = gg.Window('GoodColors', auto_size_text=True, default_element_size=(30,2)) - window.AddRow(gg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) - window.AddRow(gg.Text('Here come the good colors as defined by PySimpleGUI')) + window = sg.Window('GoodColors', auto_size_text=True, default_element_size=(30,2)) + window.AddRow(sg.Text('Having trouble picking good colors? Try one of the colors defined by PySimpleGUI')) + window.AddRow(sg.Text('Here come the good colors as defined by PySimpleGUI')) #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - text_color = gg.YELLOWS[0] - buttons = (gg.Button('BLUES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) - window.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) + text_color = sg.YELLOWS[0] + buttons = (sg.Button('BLUES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(sg.BLUES)) + window.AddRow(sg.T('Button Colors Using PySimpleGUI.BLUES')) window.AddRow(*buttons) - window.AddRow(gg.Text('_' * 100, size=(65, 1))) + window.AddRow(sg.Text('_' * 100, size=(65, 1))) #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.Button('PURPLES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) - window.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) + buttons = (sg.Button('PURPLES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(sg.PURPLES)) + window.AddRow(sg.T('Button Colors Using PySimpleGUI.PURPLES')) window.AddRow(*buttons) - window.AddRow(gg.Text('_' * 100, size=(65, 1))) + window.AddRow(sg.Text('_' * 100, size=(65, 1))) #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.Button('GREENS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) - window.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) + buttons = (sg.Button('GREENS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(sg.GREENS)) + window.AddRow(sg.T('Button Colors Using PySimpleGUI.GREENS')) window.AddRow(*buttons) - window.AddRow(gg.Text('_' * 100, size=(65, 1))) + window.AddRow(sg.Text('_' * 100, size=(65, 1))) #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - text_color = gg.GREENS[0] # let's use GREEN text on the tan - buttons = (gg.Button('TANS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) - window.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) + text_color = sg.GREENS[0] # let's use GREEN text on the tan + buttons = (sg.Button('TANS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(sg.TANS)) + window.AddRow(sg.T('Button Colors Using PySimpleGUI.TANS')) window.AddRow(*buttons) - window.AddRow(gg.Text('_' * 100, size=(65, 1))) + window.AddRow(sg.Text('_' * 100, size=(65, 1))) #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# text_color = 'black' # let's use black text on the tan - buttons = (gg.Button('YELLOWS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) - window.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) + buttons = (sg.Button('YELLOWS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(sg.YELLOWS)) + window.AddRow(sg.T('Button Colors Using PySimpleGUI.YELLOWS')) window.AddRow(*buttons) - window.AddRow(gg.Text('_' * 100, size=(65, 1))) + window.AddRow(sg.Text('_' * 100, size=(65, 1))) #===== Add a click me button for fun and SHOW the window ===== ===== ===== ===== ===== ===== =====# - window.AddRow(gg.Button('Click ME!')) + window.AddRow(sg.Button('Click ME!')) (button, value) = window.Show() # show it! diff --git a/Demo_Graph_Drawing.py b/Demo_Graph_Drawing.py index a8b3246cc..193da1197 100644 --- a/Demo_Graph_Drawing.py +++ b/Demo_Graph_Drawing.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(0,0), graph_top_right=(400, 400), background_color='red', key='graph')], [sg.T('Change circle color to:'), sg.ReadButton('Red'), sg.ReadButton('Blue'), sg.ReadButton('Move')]] diff --git a/Demo_Graph_Element.py b/Demo_Graph_Element.py index 9c047a5ec..e683f2791 100644 --- a/Demo_Graph_Element.py +++ b/Demo_Graph_Element.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + import ping from threading import Thread import time diff --git a/Demo_Graph_Element_Sine_Wave.py b/Demo_Graph_Element_Sine_Wave.py index 784347dd2..997d804b1 100644 --- a/Demo_Graph_Element_Sine_Wave.py +++ b/Demo_Graph_Element_Sine_Wave.py @@ -1,16 +1,20 @@ -#!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import math - -layout = [[sg.T('Example of Using Math with a Graph', justification='center', size=(40,1), relief=sg.RELIEF_RAISED)], - [sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-105,-105), graph_top_right=(105,105), background_color='white', key='graph', tooltip='This is a cool graph!')],] +layout = [[sg.T('Example of Using Math with a Graph', justification='center', + size=(50,1), relief=sg.RELIEF_SUNKEN)], + [sg.Graph(canvas_size=(400, 400), + graph_bottom_left=(-105,-105), + graph_top_right=(105,105), + background_color='white', + key='graph')],] window = sg.Window('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize() + graph = window.FindElement('graph') # Draw axis @@ -27,6 +31,7 @@ if y != 0: graph.DrawText( y, (-10,y), color='blue') + # Draw Graph for x in range(-100,100): y = math.sin(x/20)*50 diff --git a/Demo_Graph_Noise.py b/Demo_Graph_Noise.py index f290eb65c..8af8cf158 100644 --- a/Demo_Graph_Noise.py +++ b/Demo_Graph_Noise.py @@ -1,11 +1,10 @@ #!/usr/bin/env python import sys - -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg -import time +else: + import PySimpleGUI27 as sg + import random import sys @@ -47,6 +46,7 @@ def main(): while True: # time.sleep(.2) button, values = window.ReadNonBlocking() + print(button, values) if button == 'Quit' or values is None: break graph_offset = random.randint(-10, 10) diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index e9761acd7..e05db15bd 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import subprocess diff --git a/Demo_Img_Viewer.py b/Demo_Img_Viewer.py index 2c36376a2..0f279ff68 100644 --- a/Demo_Img_Viewer.py +++ b/Demo_Img_Viewer.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import os from PIL import Image, ImageTk import io diff --git a/Demo_Keyboard.py b/Demo_Keyboard.py index 030bdcd08..115106042 100644 --- a/Demo_Keyboard.py +++ b/Demo_Keyboard.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg # Recipe for getting keys, one at a time as they are released # If want to use the space bar, then be sure and disable the "default focus" diff --git a/Demo_Keyboard_Realtime.py b/Demo_Keyboard_Realtime.py index 5786b58be..460d79d18 100644 --- a/Demo_Keyboard_Realtime.py +++ b/Demo_Keyboard_Realtime.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[sg.Text("Hold down a key")], [sg.Button("OK")]] diff --git a/Demo_Keypad.py b/Demo_Keypad.py index 65aa42f8a..a66685c4e 100644 --- a/Demo_Keypad.py +++ b/Demo_Keypad.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg # Demonstrates a number of PySimpleGUI features including: # Default element size diff --git a/Demo_MIDI_Player.py b/Demo_MIDI_Player.py index dd9f568f3..fa4ea87ce 100644 --- a/Demo_MIDI_Player.py +++ b/Demo_MIDI_Player.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import os import mido import time diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py index aa0ce6386..42b1caa62 100644 --- a/Demo_Machine_Learning.py +++ b/Demo_Machine_Learning.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + def MachineLearningGUI(): sg.SetOptions(text_justification='right') diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 6c97132c3..32e47960d 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import matplotlib matplotlib.use('TkAgg') @@ -114,12 +114,12 @@ def draw_figure(canvas, figure, loc=(0, 0)): # --------------------------------------------------------------------------------# figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds # define the form layout -layout = [[sg.Text('Plot test')], +layout = [[sg.Text('Plot test', font='Any 18')], [sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]] # create the form and show it without the plot -window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize() +window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI', force_toplevel=True).Layout(layout).Finalize() # add the plot to the window fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig) diff --git a/Demo_Matplotlib_Animated.py b/Demo_Matplotlib_Animated.py index de50ddc2e..7ea716018 100644 --- a/Demo_Matplotlib_Animated.py +++ b/Demo_Matplotlib_Animated.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + from random import randint from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg from matplotlib.figure import Figure diff --git a/Demo_Matplotlib_Animated_Scatter.py b/Demo_Matplotlib_Animated_Scatter.py index 8461f2fda..49135aa8f 100644 --- a/Demo_Matplotlib_Animated_Scatter.py +++ b/Demo_Matplotlib_Animated_Scatter.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + from random import randint import PySimpleGUI as sg from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg diff --git a/Demo_Matplotlib_Browser.py b/Demo_Matplotlib_Browser.py index 79cbfdcf8..f30956786 100644 --- a/Demo_Matplotlib_Browser.py +++ b/Demo_Matplotlib_Browser.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasAgg diff --git a/Demo_Matplotlib_Ping_Graph.py b/Demo_Matplotlib_Ping_Graph.py index 092a28987..318297502 100644 --- a/Demo_Matplotlib_Ping_Graph.py +++ b/Demo_Matplotlib_Ping_Graph.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasAgg import matplotlib.backends.tkagg as tkagg diff --git a/Demo_Matplotlib_Ping_Graph_Large.py b/Demo_Matplotlib_Ping_Graph_Large.py index 024868998..a7328a702 100644 --- a/Demo_Matplotlib_Ping_Graph_Large.py +++ b/Demo_Matplotlib_Ping_Graph_Large.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import matplotlib.pyplot as plt import ping from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index 47b753382..1a4e0d5f2 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg # # An Async Demonstration of a media player diff --git a/Demo_Menus.py b/Demo_Menus.py index c0df56cbf..b57e26080 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -1,10 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg - +else: + import PySimpleGUI27 as sg """ Demonstration of MENUS! How do menus work? Like buttons is how. @@ -27,13 +26,13 @@ def TestMenus(): sg.SetOptions(element_padding=(0, 0)) # ------ Menu Definition ------ # - menu_def = [['File', ['Open', 'Save', 'Properties']], + menu_def = [['File', ['O_&pen', 'Save', '---', 'Properties']], ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] # ------ GUI Defintion ------ # layout = [ - [sg.Menu(menu_def, tearoff=True)], + [sg.Menu(menu_def, tearoff=False)], [sg.Output(size=(60,20))], [sg.In('Test', key='input', do_not_clear=True)] ] @@ -49,7 +48,9 @@ def TestMenus(): print('Button = ', button) # ------ Process menu choices ------ # if button == 'About...': + window.Disable() sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...') + window.Enable() elif button == 'Open': filename = sg.PopupGetFile('file to open', no_window=True) print(filename) diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index a016a197e..0c489c696 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import time # Window that doen't block diff --git a/Demo_OpenCV.py b/Demo_OpenCV.py index 7909f6fb1..84f8331c2 100644 --- a/Demo_OpenCV.py +++ b/Demo_OpenCV.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import cv2 as cv from PIL import Image import tempfile diff --git a/Demo_PDF_Viewer.py b/Demo_PDF_Viewer.py index 96e55fd0a..5d9b150c5 100644 --- a/Demo_PDF_Viewer.py +++ b/Demo_PDF_Viewer.py @@ -34,7 +34,10 @@ """ import sys import fitz -import PySimpleGUI as sg +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg from sys import exit as exit from binascii import hexlify diff --git a/Demo_PNG_Viewer.py b/Demo_PNG_Viewer.py index 60aa1d8c8..75aac14af 100644 --- a/Demo_PNG_Viewer.py +++ b/Demo_PNG_Viewer.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import os from sys import exit as exit diff --git a/Demo_Password_Login.py b/Demo_Password_Login.py index cc326fc39..16a4a840b 100644 --- a/Demo_Password_Login.py +++ b/Demo_Password_Login.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import hashlib from sys import exit as exit diff --git a/Demo_Pi_LEDs.py b/Demo_Pi_LEDs.py index fe29aadfd..bd8991e55 100644 --- a/Demo_Pi_LEDs.py +++ b/Demo_Pi_LEDs.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg # GUI for switching an LED on and off to GPIO14 # GPIO and time library: @@ -32,13 +32,13 @@ def FlashLED(): GPIO.output(14, GPIO.LOW) time.sleep(0.5) -layout = [[rg.T('Raspberry Pi LEDs')], - [rg.T('', size=(14, 1), key='output')], - [rg.ReadButton('Switch LED')], - [rg.ReadButton('Flash LED')], - [rg.Exit()]] +layout = [[sg.T('Raspberry Pi LEDs')], + [sg.T('', size=(14, 1), key='output')], + [sg.ReadButton('Switch LED')], + [sg.ReadButton('Flash LED')], + [sg.Exit()]] -window = rg.Window('Raspberry Pi GUI', grab_anywhere=False).Layout(layout) +window = sg.Window('Raspberry Pi GUI', grab_anywhere=False).Layout(layout) while True: button, values = window.Read() @@ -53,4 +53,4 @@ def FlashLED(): FlashLED() window.FindElement('output').Update('') -rg.Popup('Done... exiting') +sg.Popup('Done... exiting') diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index ed31ce75a..494dd2008 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg # Robotics design pattern # Uses Realtime Buttons to simulate the controls for a robot diff --git a/Demo_Ping_Line_Graph.py b/Demo_Ping_Line_Graph.py index 163f4dc95..2395f8857 100644 --- a/Demo_Ping_Line_Graph.py +++ b/Demo_Ping_Line_Graph.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + from threading import Thread import time from sys import exit as exit diff --git a/Demo_Pong.py b/Demo_Pong.py index 1732aa975..2e8b5cd2a 100644 --- a/Demo_Pong.py +++ b/Demo_Pong.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import random import time from sys import exit as exit diff --git a/Demo_Popups.py b/Demo_Popups.py index 2951bca17..cdac857d1 100644 --- a/Demo_Popups.py +++ b/Demo_Popups.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg # Here, have some windows on me.... [sg.PopupNoWait(location=(10*x,0)) for x in range(10)] diff --git a/Demo_Progress_Meters.py b/Demo_Progress_Meters.py index 738b861ed..8386a9d7a 100644 --- a/Demo_Progress_Meters.py +++ b/Demo_Progress_Meters.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg from time import sleep from sys import exit as exit diff --git a/Demo_Script_Launcher.py b/Demo_Script_Launcher.py index cc4b6efd0..088aa5fcd 100644 --- a/Demo_Script_Launcher.py +++ b/Demo_Script_Launcher.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import glob import ntpath import subprocess diff --git a/Demo_Script_Parameters.py b/Demo_Script_Parameters.py index 3ae20cdb8..93dfeb6b4 100644 --- a/Demo_Script_Parameters.py +++ b/Demo_Script_Parameters.py @@ -1,10 +1,10 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg -import sys +else: + import PySimpleGUI27 as sg + ''' Quickly add a GUI to your script! diff --git a/Demo_Spinner_Compound_Element.py b/Demo_Spinner_Compound_Element.py index fafb049a1..219149bd3 100644 --- a/Demo_Spinner_Compound_Element.py +++ b/Demo_Spinner_Compound_Element.py @@ -1,10 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg - +else: + import PySimpleGUI27 as sg """ Demo of how to combine elements into your own custom element """ diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index da8ec34f1..df7575a2e 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg """ Simple Form showing how to use keys on your input fields diff --git a/Demo_Table_CSV.py b/Demo_Table_CSV.py index c50b9b2ba..ae4e9423f 100644 --- a/Demo_Table_CSV.py +++ b/Demo_Table_CSV.py @@ -1,11 +1,11 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import csv -import sys + def table_example(): filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) diff --git a/Demo_Table_Element.py b/Demo_Table_Element.py index f810dfa80..237b575d5 100644 --- a/Demo_Table_Element.py +++ b/Demo_Table_Element.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import csv diff --git a/Demo_Table_Pandas.py b/Demo_Table_Pandas.py index 21c999235..022aa1bfa 100644 --- a/Demo_Table_Pandas.py +++ b/Demo_Table_Pandas.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import pandas as pd diff --git a/Demo_Table_Simulation.py b/Demo_Table_Simulation.py index 87062ff9b..0889ed4f8 100644 --- a/Demo_Table_Simulation.py +++ b/Demo_Table_Simulation.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import csv diff --git a/Demo_Tabs.py b/Demo_Tabs.py index 270bdc171..673c93076 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg tab1_layout = [[sg.T('This is inside tab 1')]] diff --git a/Demo_Tabs_Nested.py b/Demo_Tabs_Nested.py index ff4bfa37c..1c0b87b69 100644 --- a/Demo_Tabs_Nested.py +++ b/Demo_Tabs_Nested.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg sg.ChangeLookAndFeel('GreenTan') tab2_layout = [[sg.T('This is inside tab 2')], diff --git a/Demo_Template.py b/Demo_Template.py index 4a3a508f4..92a194d2c 100644 --- a/Demo_Template.py +++ b/Demo_Template.py @@ -1,14 +1,14 @@ -#choose one of these are your starting point +#choose one of these are your starting point. Copy, paste, have fun # ---------------------------------# # DESIGN PATTERN 1 - Simple Window # # ---------------------------------# #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[ sg.Text('My layout') ]] @@ -21,10 +21,10 @@ # -------------------------------------# #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg layout = [[ sg.Text('My layout') ]] diff --git a/Demo_Youtube-dl_Frontend.py b/Demo_Youtube-dl_Frontend.py index 6b7dba3c0..6e0f30e4e 100644 --- a/Demo_Youtube-dl_Frontend.py +++ b/Demo_Youtube-dl_Frontend.py @@ -1,9 +1,9 @@ #!/usr/bin/env python import sys -if sys.version_info[0] < 3: - import PySimpleGUI27 as sg -else: +if sys.version_info[0] >= 3: import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg import subprocess """ diff --git a/ProgrammingClassExamples/1b PSG (Format).py b/ProgrammingClassExamples/1b PSG (Format).py index 218be4029..d5b5540b5 100644 --- a/ProgrammingClassExamples/1b PSG (Format).py +++ b/ProgrammingClassExamples/1b PSG (Format).py @@ -16,7 +16,7 @@ #adjust widths layout = [ [sg.Text('Celcius', size =(12,1)), sg.InputText(size = (8,1))], - [sg.Submit()], + [sg.Submit()] ] window = sg.Window('Converter').Layout(layout) diff --git a/ProgrammingClassExamples/4a PSG (Sliders and combo).py b/ProgrammingClassExamples/4a PSG (Sliders and combo).py index 67a930fdc..f933a16d7 100644 --- a/ProgrammingClassExamples/4a PSG (Sliders and combo).py +++ b/ProgrammingClassExamples/4a PSG (Sliders and combo).py @@ -4,6 +4,8 @@ import PySimpleGUI as sg +#use of Column to help with layout - vertical sliders take up space + column1 = [ [sg.Text('Pick operation', size = (15,1), font = ('Calibri', 12, 'bold'))], [sg.InputCombo(['Add','Subtract','Multiply','Divide'], size = (10,6))], @@ -20,8 +22,12 @@ sg.Slider(range = (-9, 9),orientation = 'v', size = (5, 20), default_value = 0), sg.Text(' '), sg.Column(column1), sg.Column(column2)]] -window = sg.Window('Enter & Display Data', grab_anywhere=False).Layout(layout) +#added grab_anywhere to when moving slider, who window doesn't move. + +window = sg.Window('Enter & Display Data',grab_anywhere = False).Layout(layout) +#Get selection from combo: value[2] +#Slider values: value[0] and value[1] while True: button, value = window.Read() if button is not None: @@ -31,11 +37,10 @@ result = value[0] * value[1] elif value[2] == 'Subtract': result = value[0] - value[1] - elif value[2] == 'Divide': + elif value[2] == 'Divide': #check for zero if value[1] ==0: sg.Popup('Second value can\'t be zero') - if value[0] == 0: - result = 'NA' + result = 'NA' else: result = value[0] / value[1] window.FindElement('result').Update(result) diff --git a/ProgrammingClassExamples/4b PSG (Spinner and combo) .py b/ProgrammingClassExamples/4b PSG (Spinner and combo) .py index b4b61fc03..b41e8478a 100644 --- a/ProgrammingClassExamples/4b PSG (Spinner and combo) .py +++ b/ProgrammingClassExamples/4b PSG (Spinner and combo) .py @@ -7,19 +7,20 @@ layout = [ [sg.Text('Spinner and Combo box demo', font = ('Calibri', 14, 'bold'))], - [sg.Spin([sz for sz in range (-9,10)], initial_value = 0), - sg.Spin([sz for sz in range (-9,10)], initial_value = 0), - sg.Text('Pick operation', size = (13,1)), + [sg.Spin([sz for sz in range (-9,10)], size = (2,1),initial_value = 0), + sg.Spin([sz for sz in range (-9,10)], size = (2,1), initial_value = 0), + sg.Text('Pick operation ->', size = (15,1)), sg.InputCombo(['Add','Subtract','Multiply','Divide'], size = (8,6))], - [sg.Text('Result: ')],[sg.InputText(size = (6,1), key = 'result'), + [sg.Text('Result: ')],[sg.InputText(size = (5,1), key = 'result'), sg.ReadButton('Calculate', button_color = ('White', 'Red'))]] -window = sg.Window('Enter & Display Data', grab_anywhere=False).Layout(layout) +window = sg.Window('Enter & Display Data', grab_anywhere= False).Layout(layout) while True: button, value = window.Read() if button is not None: + #convert returned values to integers val = [int(value[0]), int(value[1])] if value[2] == 'Add': result = val[0] + val[1] diff --git a/ProgrammingClassExamples/5a PSG (listboxes add remove).py b/ProgrammingClassExamples/5a PSG (listboxes add remove).py new file mode 100644 index 000000000..7b60504e8 --- /dev/null +++ b/ProgrammingClassExamples/5a PSG (listboxes add remove).py @@ -0,0 +1,39 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.ChangeLookAndFeel('BlueMono') + +#use column feature with height listbox takes up +column1 = [ + [sg.Text('Add or Delete Items\nfrom a Listbox', font = ('Arial', 12, 'bold'))], + [sg.InputText( size = (15,1), key = 'add'), sg.ReadButton('Add')], + [sg.ReadButton('Delete selected entry')]] + +List = ['Austalia', 'Canada', 'Greece'] #initial listbox entries + +#add initial List to listbox +layout = [ + [sg.Listbox(values=[l for l in List], size = (30,8), key ='listbox'), + sg.Column(column1)]] + +window = sg.Window('Listbox').Layout(layout) + +while True: + button, value = window.Read() + if button is not None: + #value[listbox] returns a list + if button == 'Delete selected entry': #using value[listbox][0] give the string + if value['listbox'] == []: #ensure something is selected + sg.Popup('Error','You must select a Country') + else: + List.remove(value['listbox'][0]) #find and remove this + if button == 'Add': + List.append(value['add']) #add string in add box to list + List.sort() #sort + #update listbox + window.FindElement('listbox').Update(List) + else: + break diff --git a/ProgrammingClassExamples/6a PSG search.py b/ProgrammingClassExamples/6a PSG search.py new file mode 100644 index 000000000..090ba7b22 --- /dev/null +++ b/ProgrammingClassExamples/6a PSG search.py @@ -0,0 +1,78 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (font =('Calibri',12,'bold')) + +layout =[[sg.Text('Search Demo', font =('Calibri', 18, 'bold')), sg.ReadButton('Show Names')], +[sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display1'), + sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display2')], + [sg.Text('_'*32,font = ('Calibri', 12))], + [sg.InputText(size = (14,1), key = 'linear'), sg.InputText(size = (14,1), key = 'binary')], + [sg.ReadButton('Linear Search', size = (13,1)), sg.ReadButton('Binary Search', size = (14,1))], + ] +window = sg.Window('Search Demo').Layout(layout) + +#names for Demo, could be loaded from a file +Names = ['Roberta', 'Kylie', 'Jenny', 'Helen', + 'Andrea', 'Meredith','Deborah','Pauline', + 'Belinda', 'Wendy'] + +SortedNames = ['Andrea','Belinda','Deborah','Helen', + 'Jenny','Kylie','Meredith','Pauline', + 'Roberta','Wendy'] + +#function to display list +def displayList(List, display): + names = '' + for l in List: #add list elements with new line + names = names + l + '\n' + window.FindElement(display).Update(names) + +#Linear Search - no need for Ordered list +def linearSearch(): + L = Names[:] + found = False + for l in L: + if l == value['linear']: #Check each value + found = True + window.FindElement('display1').Update('Linear search\n' + l + ' found.') + break + if not found: + window.FindElement('display1').Update(value['linear'] + ' was \nNot found') + +#Binary Search - only works for ordered lists +def binarySearch(): + L = SortedNames[:] + lo = 0 + hi = len(L)-1 + found = False #Start with found is Flase + while lo <= hi: + mid = (lo + hi) //2 #Start in middle + if L[mid] == value['binary']: #get the value from the search box + window.FindElement('display2').Update('Binary search\n' + L[mid] + ' found.') + found = True #If found display + break #and stop + elif L[mid] < value['binary']: + lo = mid + 1 #Search in top half + else: + hi = mid - 1 #Search in lower half + if not found: #If we get to end - display not found + window.FindElement('display2').Update(value['binary'] + ' was \nNot found') + +while True: + button, value = window.Read() + + if button is not None: + if button == 'Show Names': #show names - unordered and sorted + displayList(Names,'display1') + displayList(SortedNames, 'display2') + if button == 'Linear Search': #Find and display + linearSearch() + if button == 'Binary Search': #Find and display + binarySearch() + else: + break + diff --git a/ProgrammingClassExamples/6b PSG search (disabled buttons).py b/ProgrammingClassExamples/6b PSG search (disabled buttons).py new file mode 100644 index 000000000..2e1dfd83e --- /dev/null +++ b/ProgrammingClassExamples/6b PSG search (disabled buttons).py @@ -0,0 +1,82 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (font =('Calibri',12,'bold')) + +layout =[[sg.Text('Search Demo', font =('Calibri', 18, 'bold')), sg.ReadButton('Show Names')], +[sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display1'), + sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display2')], + [sg.Text('_'*32,font = ('Calibri', 12))], + [sg.InputText(size = (14,1), key = 'linear'), sg.InputText(size = (14,1), key = 'binary')], + [sg.ReadButton('Linear Search', size = (13,1),key = 'ls'), sg.ReadButton('Binary Search', size = (14,1),key='bs')], + ] +window = sg.Window('Search Demo').Layout(layout) +window.Finalize() #finalize allows the disabling +window.FindElement('ls').Update(disabled=True) #of the two buttons +window.FindElement('bs').Update(disabled=True) + +#names for Demo, could be loaded from a file +Names = ['Roberta', 'Kylie', 'Jenny', 'Helen', + 'Andrea', 'Meredith','Deborah','Pauline', + 'Belinda', 'Wendy'] + +SortedNames = ['Andrea','Belinda','Deborah','Helen', + 'Jenny','Kylie','Meredith','Pauline', + 'Roberta','Wendy'] + +#function to display list +def displayList(List, display): + names = '' + for l in List: #add list elements with new line + names = names + l + '\n' + window.FindElement(display).Update(names) + window.FindElement('ls').Update(disabled=False) #enable buttons now + window.FindElement('bs').Update(disabled=False) #now data loaded + +#Linear Search - no need for Ordered list +def linearSearch(): + L = Names[:] + found = False + for l in L: + if l == value['linear']: #Check each value + found = True + window.FindElement('display1').Update('Linear search\n' + l + ' found.') + break + if not found: + window.FindElement('display1').Update(value['linear'] + ' was \nNot found') + +#Binary Search - only works for ordered lists +def binarySearch(): + L = SortedNames[:] + lo = 0 + hi = len(L)-1 + found = False #Start with found is Flase + while lo <= hi: + mid = (lo + hi) //2 #Start in middle + if L[mid] == value['binary']: #get the value from the search box + window.FindElement('display2').Update('Binary search\n' + L[mid] + ' found.') + found = True #If found display + break #and stop + elif L[mid] < value['binary']: + lo = mid + 1 #Search in top half + else: + hi = mid - 1 #Search in lower half + if not found: #If we get to end - display not found + window.FindElement('display2').Update(value['binary'] + ' was \nNot found') + +while True: + button, value = window.Read() + if button is not None: + if button == 'Show Names': #show names - unordered and sorted + displayList(Names,'display1') + displayList(SortedNames, 'display2') + if button == 'ls': #Find and display + linearSearch() + if button == 'bs': #Find and display + binarySearch() + else: + break + diff --git a/ProgrammingClassExamples/6c PSG search text preloaded.py b/ProgrammingClassExamples/6c PSG search text preloaded.py new file mode 100644 index 000000000..cbc6832c8 --- /dev/null +++ b/ProgrammingClassExamples/6c PSG search text preloaded.py @@ -0,0 +1,79 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (font =('Calibri',12,'bold')) + +#names for Demo, could be loaded from a file + +Names = ['Roberta', 'Kylie', 'Jenny', 'Helen', + 'Andrea', 'Meredith','Deborah','Pauline', + 'Belinda', 'Wendy'] +names = '' +for l in Names: + names = names + l + '\n' + +SortedNames = ['Andrea','Belinda','Deborah','Helen', + 'Jenny','Kylie','Meredith','Pauline', + 'Roberta','Wendy'] + +sortnames = '' +for l in SortedNames: + sortnames = sortnames + l +'\n' + +layout =[[sg.Text('Search Demo', font =('Calibri', 18, 'bold'))], +[sg.Text(names,size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display1'), + sg.Text(sortnames,size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display2')], + [sg.Text('_'*32,font = ('Calibri', 12))], + [sg.InputText(size = (14,1), key = 'linear'), sg.InputText(size = (14,1), key = 'binary')], + [sg.ReadButton('Linear Search', bind_return_key=True, size = (13,1)), sg.ReadButton('Binary Search', size = (14,1))], + ] +window = sg.Window('Search Demo').Layout(layout) + +#Linear Search - no need for Ordered list +def linearSearch(): + L = Names[:] + found = False + for l in L: + if l == value['linear']: #Check each value + found = True + sg.Popup('Linear search\n' + l + ' found.') + break + if not found: + sg.Popup('Linear search\n' +(value['linear'] + ' was not found')) + +#Binary Search - only works for ordered lists +def binarySearch(): + L = SortedNames[:] + lo = 0 + hi = len(L)-1 + found = False #Start with found is Flase + while lo <= hi: + mid = (lo + hi) //2 #Start in middle + if L[mid] == value['binary']: #get the value from the search box + sg.Popup('Binary search\n' + L[mid] + ' found.') + found = True #If found display + break #and stop + elif L[mid] < value['binary']: + lo = mid + 1 #Search in top half + else: + hi = mid - 1 #Search in lower half + if not found: #If we get to end - display not found + sg.Popup('Binary search\n' +(value['binary'] + ' was not found')) + +while True: + button, value = window.Read() + + if button is not None: + if button == 'Show Names': #show names - unordered and sorted + displayList(Names,'display1') + displayList(SortedNames, 'display2') + if button == 'Linear Search': #Find and display + linearSearch() + if button == 'Binary Search': #Find and display + binarySearch() + else: + break + diff --git a/ProgrammingClassExamples/6d PSG sort and search.py b/ProgrammingClassExamples/6d PSG sort and search.py new file mode 100644 index 000000000..68d84be4e --- /dev/null +++ b/ProgrammingClassExamples/6d PSG sort and search.py @@ -0,0 +1,130 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (font =('Calibri',12,'bold')) + + +#setup column (called column1) of buttons to sue in layout + +column1 = [[sg.ReadButton('Original list', size = (13,1))], + [sg.ReadButton('Default sort', size = (13,1))], + [sg.ReadButton('Sort: selection',size = (13,1))], + [sg.ReadButton('Sort: quick', size = (13,1))]] + +layout =[[sg.Text('Search and Sort Demo', font =('Calibri', 20, 'bold'))], +[sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display'), sg.Column(column1)], + [sg.Text('_'*32,font = ('Calibri', 12))], + [sg.InputText(size = (13,1), key = 'linear'), sg.Text(' '), sg.InputText(size = (13,1), key = 'binary')], + [sg.ReadButton('Linear Search', size = (13,1)), sg.Text(' '), sg.ReadButton('Binary Search', size = (13,1))], + ] + +window = sg.Window('Search and Sort Demo').Layout(layout) + +#names for Demo, could be loaded from a file +Names= ['Roberta', 'Kylie', 'Jenny', 'Helen', + 'Andrea', 'Meredith','Deborah','Pauline', + 'Belinda', 'Wendy'] + +#function to display list +def displayList(List): + global ListDisplayed #store list in Multiline text globally + ListDisplayed = List + display = '' + for l in List: #add list elements with new line + display = display + l + '\n' + window.FindElement('display').Update(display) + +#use inbuilt python sort +def default(Names): + L = Names[:] + L.sort() #inbuilt sort + displayList(L) + +#Selection sort - See Janson Ch 7 +def selSort(Names): + L = Names[:] + for i in range(len(L)): + smallest = i + for j in range(i+1, len(L)): + if L[j] < L[smallest]: #find smallest value + smallest = j #swap it to front + L[smallest], L[i] = L[i], L[smallest] #repeat from next poistion + displayList(L) + +#Quick sort - See Janson Ch 7 +def qsortHolder(Names): + L = Names[:] #pass List, first and last + quick_sort(L, 0, len(L) -1) #Start process + displayList(L) + +def quick_sort(L, first, last): #Quicksort is a partition sort + if first >= last: + return L + pivot = L[first] + low = first + high = last + while low < high: + while L[high] > pivot: + high = high -1 + while L[low] < pivot: + low = low + 1 + if low <= high: + L[high], L[low] = L[low], L[high] + low = low + 1 + high = high -1 + quick_sort(L, first, low -1) #continue splitting - sort small lsist + quick_sort(L, low, last) + +#Linear Search - no need for Ordered list +def linearSearch(): + L = Names[:] + found = False + for l in L: + if l == value['linear']: #Check each value + found = True + window.FindElement('display').Update('Linear search\n' + l + ' found.') + break + if not found: + window.FindElement('display').Update(value['linear'] + ' was \nNot found') + +#Binary Search - only works for ordered lists +def binarySearch(): + L = ListDisplayed[:] #get List currently in multiline display + lo = 0 + hi = len(L)-1 + found = False #Start with found is Flase + while lo <= hi: + mid = (lo + hi) //2 #Start in middle + if L[mid] == value['binary']: #get the value from the search box + window.FindElement('display').Update('Binary search\n' + L[mid] + ' found.') + found = True #If found display + break #and stop + elif L[mid] < value['binary']: + lo = mid + 1 #Search in top half + else: + hi = mid - 1 #Search in lower half + if not found: #If we get to end - display not found + window.FindElement('display').Update(value['binary'] + ' was \nNot found') + + +while True: + button, value = window.Read() + if button is not None: + if button == 'Original list': + displayList(Names) + if button == 'Default sort': + default(Names) + if button == 'Sort: selection': + selSort(Names) + if button == 'Sort: quick': + qsortHolder(Names) + if button == 'Linear Search': + linearSearch() + if button == 'Binary Search': + binarySearch() + else: + break + diff --git a/ProgrammingClassExamples/6e PSG sort and search (listbox) TODO.py b/ProgrammingClassExamples/6e PSG sort and search (listbox) TODO.py new file mode 100644 index 000000000..68d84be4e --- /dev/null +++ b/ProgrammingClassExamples/6e PSG sort and search (listbox) TODO.py @@ -0,0 +1,130 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg + +sg.SetOptions (font =('Calibri',12,'bold')) + + +#setup column (called column1) of buttons to sue in layout + +column1 = [[sg.ReadButton('Original list', size = (13,1))], + [sg.ReadButton('Default sort', size = (13,1))], + [sg.ReadButton('Sort: selection',size = (13,1))], + [sg.ReadButton('Sort: quick', size = (13,1))]] + +layout =[[sg.Text('Search and Sort Demo', font =('Calibri', 20, 'bold'))], +[sg.Text('',size = (14, 11),relief=sg.RELIEF_SOLID,font = ('Calibri', 12), background_color ='White',key = 'display'), sg.Column(column1)], + [sg.Text('_'*32,font = ('Calibri', 12))], + [sg.InputText(size = (13,1), key = 'linear'), sg.Text(' '), sg.InputText(size = (13,1), key = 'binary')], + [sg.ReadButton('Linear Search', size = (13,1)), sg.Text(' '), sg.ReadButton('Binary Search', size = (13,1))], + ] + +window = sg.Window('Search and Sort Demo').Layout(layout) + +#names for Demo, could be loaded from a file +Names= ['Roberta', 'Kylie', 'Jenny', 'Helen', + 'Andrea', 'Meredith','Deborah','Pauline', + 'Belinda', 'Wendy'] + +#function to display list +def displayList(List): + global ListDisplayed #store list in Multiline text globally + ListDisplayed = List + display = '' + for l in List: #add list elements with new line + display = display + l + '\n' + window.FindElement('display').Update(display) + +#use inbuilt python sort +def default(Names): + L = Names[:] + L.sort() #inbuilt sort + displayList(L) + +#Selection sort - See Janson Ch 7 +def selSort(Names): + L = Names[:] + for i in range(len(L)): + smallest = i + for j in range(i+1, len(L)): + if L[j] < L[smallest]: #find smallest value + smallest = j #swap it to front + L[smallest], L[i] = L[i], L[smallest] #repeat from next poistion + displayList(L) + +#Quick sort - See Janson Ch 7 +def qsortHolder(Names): + L = Names[:] #pass List, first and last + quick_sort(L, 0, len(L) -1) #Start process + displayList(L) + +def quick_sort(L, first, last): #Quicksort is a partition sort + if first >= last: + return L + pivot = L[first] + low = first + high = last + while low < high: + while L[high] > pivot: + high = high -1 + while L[low] < pivot: + low = low + 1 + if low <= high: + L[high], L[low] = L[low], L[high] + low = low + 1 + high = high -1 + quick_sort(L, first, low -1) #continue splitting - sort small lsist + quick_sort(L, low, last) + +#Linear Search - no need for Ordered list +def linearSearch(): + L = Names[:] + found = False + for l in L: + if l == value['linear']: #Check each value + found = True + window.FindElement('display').Update('Linear search\n' + l + ' found.') + break + if not found: + window.FindElement('display').Update(value['linear'] + ' was \nNot found') + +#Binary Search - only works for ordered lists +def binarySearch(): + L = ListDisplayed[:] #get List currently in multiline display + lo = 0 + hi = len(L)-1 + found = False #Start with found is Flase + while lo <= hi: + mid = (lo + hi) //2 #Start in middle + if L[mid] == value['binary']: #get the value from the search box + window.FindElement('display').Update('Binary search\n' + L[mid] + ' found.') + found = True #If found display + break #and stop + elif L[mid] < value['binary']: + lo = mid + 1 #Search in top half + else: + hi = mid - 1 #Search in lower half + if not found: #If we get to end - display not found + window.FindElement('display').Update(value['binary'] + ' was \nNot found') + + +while True: + button, value = window.Read() + if button is not None: + if button == 'Original list': + displayList(Names) + if button == 'Default sort': + default(Names) + if button == 'Sort: selection': + selSort(Names) + if button == 'Sort: quick': + qsortHolder(Names) + if button == 'Linear Search': + linearSearch() + if button == 'Binary Search': + binarySearch() + else: + break + diff --git a/ProgrammingClassExamples/7a PSG Text file save and retrieve.py b/ProgrammingClassExamples/7a PSG Text file save and retrieve.py new file mode 100644 index 000000000..eea4bf0fa --- /dev/null +++ b/ProgrammingClassExamples/7a PSG Text file save and retrieve.py @@ -0,0 +1,59 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +import PySimpleGUI as sg +import os #to work with windows OS + +sg.ChangeLookAndFeel('GreenTan') +sg.SetOptions(font = ('Calibri', 12, 'bold')) + +layout = [ + [sg.Text('Enter a Name and four Marks')], + [sg.Text('Name:', size =(10,1)), sg.InputText(size = (12,1), key = 'name')], + [sg.Text('Mark1:', size =(10,1)), sg.InputText(size = (6,1), key = 'm1')], + [sg.Text('Mark2:', size =(10,1)), sg.InputText(size = (6,1), key = 'm2')], + [sg.Text('Mark3:', size =(10,1)), sg.InputText(size = (6,1), key = 'm3')], + [sg.Text('Mark4:', size =(10,1)), sg.InputText(size = (6,1), key = 'm4')], + [sg.ReadButton('Save', size = (8,1),key = 'save'), sg.Text('Press to Save to file')], + [sg.ReadButton('Display',size = (8,1), key = 'display'), sg.Text('To retrieve and Display')], + [sg.Multiline(size = (28,4), key = 'multiline')]] + +window = sg.Window('Simple Average Finder').Layout(layout) + + +while True: + button, value = window.Read() #value is a dictionary holding name and marks (4) + if button is not None: + #initialise variables + total = 0.0 + index = '' + Name = value['name'] #get name + dirname, filename = os.path.split(os.path.abspath(__file__)) #get pathname to current file + pathname = dirname + '\\results.txt' #add desired file name for saving to path + + #needs validation and try/catch error checking, will crash if blank or text entry for marks + + if button == 'save': + for i in range (1,5): + index = 'm' + str(i) #create dictionary index m1 ... m4 + total += float(value[index]) + average = total/4 + f = open(pathname, 'w') #open file and save + print (Name, file = f) + print (total, file = f) + print (average, file = f) + f.close() + + #some error checking for missing file needed here + + if button == 'display': + #This loads the file line by line into a list called data. + #the strip() removes whitespaces from beginning and end of each line. + data = [line.strip() for line in open(pathname)] + #create single string to display in multiline object. + string = 'Name: ' + data[0] +'\nTotal: ' + str(data[1]) + '\nAverage: ' + str(data[2]) + window.FindElement('multiline').Update(string) + else: + break + diff --git a/ProgrammingClassExamples/8a PSG Data to plot from csv file.py b/ProgrammingClassExamples/8a PSG Data to plot from csv file.py new file mode 100644 index 000000000..99d3a3203 --- /dev/null +++ b/ProgrammingClassExamples/8a PSG Data to plot from csv file.py @@ -0,0 +1,38 @@ +#Matplotlib, pyplt and csv +#Tony Crewe +#Sep 2017 - updated Sep 2018 + +import matplotlib.pyplot as plt +import csv +from matplotlib.ticker import MaxNLocator + + +x=[] +y=[] + +with open('weight 20182.csv', 'r', encoding = 'utf-8-sig') as csvfile: + plots = csv.reader(csvfile) + for data in plots: + var1 = (data[0]) #get heading for x and y axes + var2 = (data[1]) + break + for data in plots: #get values - add to x list and y list + x.append(data[0]) + y.append(float(data[1])) + + +ax = plt.subplot(1,1,1) +ax.set_ylim([82, 96]) +ax.xaxis.set_major_locator(MaxNLocator(10)) +ax.spines['right'].set_color('none') +ax.spines['top'].set_color('none') + +plt.plot(x,y, label = 'data loaded\nfrom csv file') +plt.axhline(y = 85.5, color = 'orange', linestyle = '--', label = 'target') +plt.xlabel(var1) +plt.ylabel(var2) +plt.title('weight loss from\n first quarter 2018') + + +plt.legend() +plt.show() diff --git a/ProgrammingClassExamples/8b PSG Tables and calc from csv file.py b/ProgrammingClassExamples/8b PSG Tables and calc from csv file.py new file mode 100644 index 000000000..442e15f85 --- /dev/null +++ b/ProgrammingClassExamples/8b PSG Tables and calc from csv file.py @@ -0,0 +1,41 @@ +#PySimple examples (v 3.8) +#Tony Crewe +#Sep 2018 + +#Based of Example program from MikeTheWatchGuy +#https://gitlab.com/lotspaih/PySimpleGUI + +import sys +import PySimpleGUI as sg +import csv + +def table_example(): + filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),)) + #populate table with file contents + #Assume we know csv has haeding in row 1 + #assume we know 7 columns of data - relevenat to AFL w/o Pts or % shown + #data will be data[0] = team, data [1] P, data [2] W, data[3] L + #data [4] D, data[5] F, data[6] A + #no error checking or validation used. + + data = [] + header_list = [] + with open(filename, "r") as infile: + reader = csv.reader(infile) + for i in range (1): #get headings + header = next(reader) + data = list(reader) # read everything else into a list of rows + + + col_layout = [[sg.Table(values=data, headings=header, max_col_width=25, + auto_size_columns=True, justification='right', size=(None, len(data)))]] + + canvas_size = (13*10*len(header), 600) # estimate canvas size - 13 pixels per char * 10 char per column * num columns + layout = [[sg.Column(col_layout, size=canvas_size, scrollable=True)],] + + window = sg.Window('Table', grab_anywhere=False).Layout(layout) + b, v = window.Read() + + sys.exit(69) + +table_example() diff --git a/ProgrammingClassExamples/9a Plot Matplotlib numpy pyplot(y=sinx).py b/ProgrammingClassExamples/9a Plot Matplotlib numpy pyplot(y=sinx).py new file mode 100644 index 000000000..792408a70 --- /dev/null +++ b/ProgrammingClassExamples/9a Plot Matplotlib numpy pyplot(y=sinx).py @@ -0,0 +1,22 @@ +#matplotlib, numpy, pyplot +#Tony Crewe +#Sep 2017 - updated Sep 2018 + +import matplotlib.pyplot as plt +import numpy as np + + +fig=plt.figure() +ax = fig.add_subplot(111) +x = np.linspace(-np.pi*2, np.pi*2, 100) +y= np.sin(x) +ax.plot(x,y) + +ax.set_title('sin(x)') + + +plt.show() + + + + diff --git a/ProgrammingClassExamples/9b Plot (axes moved).py b/ProgrammingClassExamples/9b Plot (axes moved).py new file mode 100644 index 000000000..7dfba0529 --- /dev/null +++ b/ProgrammingClassExamples/9b Plot (axes moved).py @@ -0,0 +1,27 @@ +#matplotlib, numpy, pyplot +#Tony Crewe +#Sep 2017 - updated Sep 2018import matplotlib.pyplot as plt +import numpy as np +import matplotlib.pyplot as plt + + +fig=plt.figure() +ax = fig.add_subplot(111) +x = np.linspace(-np.pi*2, np.pi*2, 100) +y= np.sin(x) +ax.plot(x,y) + +ax.set_title('sin(x)') +#centre bottom and keft axes to zero + +ax.spines['left'].set_position('zero') +ax.spines['right'].set_color('none') +ax.spines['bottom'].set_position('zero') +ax.spines['top'].set_color('none') + + +plt.show() + + + + diff --git a/ProgrammingClassExamples/9c Plot (axes pi format).py b/ProgrammingClassExamples/9c Plot (axes pi format).py new file mode 100644 index 000000000..75c882372 --- /dev/null +++ b/ProgrammingClassExamples/9c Plot (axes pi format).py @@ -0,0 +1,28 @@ +#Plt using matplylib, plotly and numpy +#Tony Crewe +#Sep 2017 updated Sep 2018 + +import matplotlib.pyplot as plt +import numpy as np +import matplotlib.ticker as ticker + +fig=plt.figure() +ax = fig.add_subplot(111) +x = np.linspace(-np.pi*2, np.pi*2, 100) +y= np.sin(x) +ax.plot(x/np.pi,y) + +ax.set_title('sin(x)') +ax.spines['left'].set_position('zero') +ax.spines['right'].set_color('none') +ax.spines['bottom'].set_position('zero') +ax.spines['top'].set_color('none') + +#Format axes - nicer eh! +ax.xaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) + +plt.show() + + + + From 6cc8ed1ad1fbec5e4cc4eb913f0c0669a60a6845 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 28 Sep 2018 15:59:18 -0400 Subject: [PATCH 496/521] Complete removal of old-style Tabs (ShowTabbedForm), updated readme with all the latest changes --- PySimpleGUI.py | 106 +++---------------------------------------------- docs/index.md | 86 ++++++++++++++++++++++++++++++--------- readme.md | 86 ++++++++++++++++++++++++++++++--------- 3 files changed, 141 insertions(+), 137 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index dfc793073..222aa690e 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1121,10 +1121,7 @@ def ButtonCallBack(self): self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = False # if the form is tabbed, must collect all form's results and destroy all forms - if self.ParentForm.IsTabbedForm: - self.ParentForm.UberParent._Close() - else: - self.ParentForm._Close() + self.ParentForm._Close() self.ParentForm.TKroot.quit() if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() @@ -1137,15 +1134,10 @@ def ButtonCallBack(self): else: self.ParentForm.LastButtonClicked = self.ButtonText self.ParentForm.FormRemainedOpen = True - if self.ParentForm.IsTabbedForm: - self.ParentForm.UberParent.FormStayedOpen = True self.ParentForm.TKroot.quit() # kick the users out of the mainloop elif self.BType == BUTTON_TYPE_CLOSES_WIN_ONLY: # this is a return type button so GET RESULTS and destroy window # if the form is tabbed, must collect all form's results and destroy all forms - if self.ParentForm.IsTabbedForm: - self.ParentForm.UberParent._Close() - else: - self.ParentForm._Close() + self.ParentForm._Close() if self.ParentForm.NonBlocking: self.ParentForm.TKroot.destroy() _my_windows.Decrement() @@ -2053,7 +2045,7 @@ class Window: ''' Display a user defined for and return the filled in data ''' - def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel = False, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False): + def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel = False, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False): self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS self.Title = title @@ -2063,7 +2055,6 @@ def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_but self.Location = location self.ButtonColor = button_color if button_color else DEFAULT_BUTTON_COLOR self.BackgroundColor = background_color if background_color else DEFAULT_BACKGROUND_COLOR - self.IsTabbedForm = is_tabbed_form self.ParentWindow = None self.Font = font if font else DEFAULT_FONT self.RadioDict = {} @@ -3405,17 +3396,14 @@ def CharWidthInPixels(): tk_row_frame.pack(side=tk.TOP, anchor='nw', padx=DEFAULT_MARGINS[0], expand=True) if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: tk_row_frame.configure(background=form.BackgroundColor) - if not toplevel_form.IsTabbedForm: - toplevel_form.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) - else: toplevel_form.ParentWindow.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) + toplevel_form.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1]) return def ConvertFlexToTK(MyFlexForm): master = MyFlexForm.TKroot # only set title on non-tabbed forms - if not MyFlexForm.IsTabbedForm: - master.title(MyFlexForm.Title) + master.title(MyFlexForm.Title) InitializeResults(MyFlexForm) try: if MyFlexForm.NoTitleBar: @@ -3424,8 +3412,6 @@ def ConvertFlexToTK(MyFlexForm): pass PackFormIntoFrame(MyFlexForm, master, MyFlexForm) #....................................... DONE creating and laying out window ..........................# - if MyFlexForm.IsTabbedForm: - master = MyFlexForm.ParentWindow screen_width = master.winfo_screenwidth() # get window info to move to middle of screen screen_height = master.winfo_screenheight() if MyFlexForm.Location != (None, None): @@ -3451,88 +3437,6 @@ def ConvertFlexToTK(MyFlexForm): return -# ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# -def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, fav_icon=DEFAULT_WINDOW_ICON, no_titlebar=False): - # takes as input (form, rows, tab name) for each tab - global _my_windows - - uber = UberForm() - root = tk.Tk() - uber.TKroot = root - if title is not None: - root.title(title) - try: - root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' - except: - pass - - _my_windows.Increment() - - if not len(args): - print('******************* SHOW TABBED FORMS ERROR .... no arguments') - return - if DEFAULT_BACKGROUND_COLOR: - framestyle = ttk.Style() - try: - framestyle.theme_create('framestyle', parent='alt', - settings={'TFrame': - {'configure': - {'background': DEFAULT_BACKGROUND_COLOR, - }}}) - except: pass - # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox - # framestyle.theme_use('framestyle') - tab_control = ttk.Notebook(root) - - for num,x in enumerate(args): - form, rows, tab_name = x - form.AddRows(rows) - form.UseDictionary = True - - if DEFAULT_BACKGROUND_COLOR: - framestyle.theme_use('framestyle') - tab = ttk.Frame(tab_control) # Create tab 1 - # s.configure("my.Frame.TFrame", background=DEFAULT_BACKGROUND_COLOR) - tab_control.add(tab, text=tab_name) # Add tab 1 - # tab_control.configure(text='new text') - tab_control.grid(row=0, sticky=tk.W) - form.TKTabControl = tab_control - form.TKroot = tab - form.IsTabbedForm = True - form.ParentWindow = root - ConvertFlexToTK(form) - form.UberParent = uber - uber.AddForm(form) - uber.FormReturnValues.append(form.ReturnValues) - - # dangerous?? or clever? use the final form as a callback for autoclose - id = root.after(auto_close_duration * 1000, form._AutoCloseAlarmCallback) if auto_close else 0 - icon = fav_icon if not _my_windows.user_defined_icon else _my_windows.user_defined_icon - try: uber.TKroot.iconbitmap(icon) - except: pass - try: - if no_titlebar: - uber.TKroot.wm_overrideredirect(True) - except: - pass - - try: - root.attributes('-alpha', 255) # hide window while building it. makes for smoother 'paint' - except: - pass - root.mainloop() - - if uber.FormStayedOpen: - FormReturnValues = [] - for form in uber.FormList: - BuildResults(form, False, form) - FormReturnValues.append(form.ReturnValues) - uber.FormReturnValues = FormReturnValues - # if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None: - # return BuildResults(self, False, self) - if id: root.after_cancel(id) - uber.TKrootDestroyed = True - return uber.FormReturnValues # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# def StartupTK(my_flex_form): diff --git a/docs/index.md b/docs/index.md index 4b16d9cef..c4ef1b504 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,9 +4,11 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) +[![Downloads ](https://pepy.tech/badge/pysimplegui27)](https://pepy.tech/project/pysimplegui27) +![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) ![Awesome Meter](https://img.shields.io/badge/Awesome_meter-100-yellow.svg) - ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) + ![Python Version](https://img.shields.io/badge/Python-2.7_3.x-yellow.svg) @@ -18,7 +20,7 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.2-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.3-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) @@ -37,7 +39,7 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter #### Note regarding Python versions -As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named PySimpleGUI. The Python 2.7 version is named PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named `PySimpleGUI`. The Python 2.7 version is `PySimpleGUI27`. They are installed separately and the imports are different. See instructions in Installation section for more info. ------------------------------------------------------------------------ @@ -68,7 +70,7 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste, run within minutes. This is the process PySimpleGUI was designed to facilitate. ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) @@ -1029,16 +1031,16 @@ This is the definition of the Window object: button_color=None,Font=None, progress_bar_color=(None,None), background_color=None - is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, + force_toplevel=False return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, - grab_anywhere=True + grab_anywhere=False keep_on_top=False): @@ -1053,11 +1055,11 @@ Parameter Descriptions. You will find these same parameters specified for each button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background - is_tabbed_form - Bool. If True then window is a tabbed window border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. auto_close - Bool. If True window will autoclose auto_close_duration - Duration in seconds before window closes icon - .ICO file that will appear on the Task Bar and end of Title Bar + force_top_level - Bool. If set causes a tk.Tk window to be used as primary window rather than tk.TopLevel. Used to get around Matplotlib problem return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this window @@ -1102,6 +1104,24 @@ It is turned off for non-blocking because there is a warning message printed out To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +### Window Methods (things you can do with a Window object) + +There are a few methods (functions) that you will see in this document that act on Windows. The ones you will primarily be calling are: + + window.Layout(layout) - Turns your definition of the Window into Window + window.Finalize() - creates the tkinter objects for the Window. Normally you do not call this + window.Read() - Read the Windows values and get the button / key that caused the Read to return + window.ReadNonBlocking() - Same as Read but will return right away + window.Refresh() - Use if updating elements and want to show the updates prior to the nex Read + window.Fill(values_dict) - Fill each Element with entry from the dictionary passed in + window.SaveToDisk(filename) - Save the Window's values to disk + window.LoadFromDisk(filename) - Load the Window's values from disk + window.CloseNonBlocking() - When done, for good, reading a non-blocking window + window.Disable() - Use to disable the window inpurt when opening another window on top of the primnary Window + window.Enable() - Re-enable a Disabled window + window.FindElement(key) - Returns the element that has a matching key value + + ## Elements "Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. @@ -1130,6 +1150,7 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Graph Image Table + Tab, TabGroup Async/Non-Blocking Windows Tabbed windows Persistent Windows @@ -1269,7 +1290,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. do_not_clear=False, key=None, focus=False - ) + . default_text - Text initially shown in the input box @@ -1299,19 +1320,29 @@ Also known as a drop-down list. Only required parameter is the list of choices. ![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) InputCombo(values, , - size=(None, None), - auto_size_text=None, - background_color = None, - text_color = None, - key = None) + default_value=None + size=(None, None) + auto_size_text=None + background_color=None + text_color=None + change_submits=False + disabled=False + key=None + pad=None + tooltip=None . values - Choices to be displayed. List of strings + default_value - which value should be initially chosen size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background text_color - color to use for the typed text - key = Dictionary key to use for return values + change_submits - Bool. If set causes Read to immediately return if the selected value changes + disabled - Bool. If set will disable changes + key - Dictionary key to use for return values + pad - (x,y) Amount of padding to put around element in pixels + tooltip - Text string. If set, hovering over field will popup the text #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). @@ -1382,6 +1413,7 @@ Sliders have a couple of slider-specific settings as well as appearance settings size=(None, None), font=None, background_color = None, + change_submits = False, text_color = None, key = None) ): . @@ -1401,6 +1433,7 @@ Sliders have a couple of slider-specific settings as well as appearance settings auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background text_color - color to use for the typed text + change_submits - causes window read to immediately return if the checkbox value changes key = Dictionary key to use for return values #### Radio Button Element @@ -1450,6 +1483,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating font=None, background_color = None, text_color = None, + change_submits = False key = None): . @@ -1460,6 +1494,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating font- Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text + change_submits - causes window read to immediately return if the checkbox value changes key = Dictionary key to use for return values @@ -1488,6 +1523,7 @@ An up/down spinner control. The valid values are passed in as a list. font - Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text + change_submits - causes window read to immediately return if the spinner value changes key = Dictionary key to use for return values ### Button Element @@ -2095,6 +2131,7 @@ The definition of a TabGroup is font=None pad=None border_width=None + change_submits = False key=None tooltip=None) @@ -2107,6 +2144,7 @@ The definition of a Tab Element is size=(None, None),font=None, pad=None border_width=None + change_submits=False key=None tooltip=None) @@ -2838,8 +2876,19 @@ It's official. There is a 2.7 version of PySimpleGUI! * `DrawText` added to Graph Elements * Removed `Window.UpdateElements` * `Window.grab_anywere` defaults to False -* +#### 3.8.3 +* Listbox, Slider, Combobox, Checkbox, Spin, Tab Group - if change_submits is set, will return the Element's key rather than '' +* Added change_submits capability to Checkbox, Tab Group +* Combobox - Can set value to an Index into the Values table rather than the Value itself +* Warnings added to Drawing routines for Graph element (rather than crashing) +* Window - can "force top level" window to be used rather than a normal window. Means that instead of calling Tk to get a window, will call TopLevel to get the window +* Window Disable / Enable - Disables events (button clicks, etc) for a Window. Use this when you open a second window and want to disable the first window from doing anything. This will simulate a 'dialog box' +* Tab Group returns a value with Window is Read. Return value is the string of the selected tab +* Turned off grab_anywhere for Popups +* New parameter, default_extension, for PopupGetFile +* Keyboard shortcuts for menu items. Can hold ALT key to select items in men +* Removed old-style Tabs - Risky change because it hit fundamental window packing and creation. Will also break any old code using this style tab (sorry folks this is how progress happens) ### Upcoming @@ -2902,8 +2951,9 @@ GNU Lesser General Public License (LGPL 3) + * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help * [agjunyent](https://github.com/agjunyent) figured out how to properly make tabs and wrote prototype code that demonstrated how to do it -* [jfongattw](https://github.com/jfongattw) huge suggestion... dictionaries. turned out to be one of the most critical constructs in PySimpleGUI - +* [jfongattw](https://github.com/jfongattw) huge suggestion... dictionaries. turned out to be +* one of the most critical constructs in PySimpleGUI +* [venim](https://github.com/venim) code to doing Alt-Selections in menus, updating Combobox using index, request to disable windows (a really good idea), checkbox and tab submits on change, returning keys for elements that have change_submits set, ... ## How Do I diff --git a/readme.md b/readme.md index 4b16d9cef..c4ef1b504 100644 --- a/readme.md +++ b/readme.md @@ -4,9 +4,11 @@ ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) -[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) +[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) +[![Downloads ](https://pepy.tech/badge/pysimplegui27)](https://pepy.tech/project/pysimplegui27) +![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) ![Awesome Meter](https://img.shields.io/badge/Awesome_meter-100-yellow.svg) - ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) + ![Python Version](https://img.shields.io/badge/Python-2.7_3.x-yellow.svg) @@ -18,7 +20,7 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.2-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.3-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) @@ -37,7 +39,7 @@ Super-simple GUI to use... Powerfully customizable. Home of the 1-line custom GUI and 1-line progress meter #### Note regarding Python versions -As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named PySimpleGUI. The Python 2.7 version is named PySimpleGUI27. They are installed separately and the imports are different. See instructions in Installation section for more info. +As of 9/25/2018 **both Python 3 and Python 2.7 are supported**! The Python 3 version is named `PySimpleGUI`. The Python 2.7 version is `PySimpleGUI27`. They are installed separately and the imports are different. See instructions in Installation section for more info. ------------------------------------------------------------------------ @@ -68,7 +70,7 @@ Or how about a ***custom GUI*** in 1 line of code? ![get filename](https://user-images.githubusercontent.com/13696193/44960039-f1018880-aec5-11e8-8a43-3d7f8ff93b67.jpg) - Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste and be up and running with a GUI in minutes. This is the process PySimpleGUI was designed to work within. + Build beautiful customized windows that fit your specific problem. Let PySimpleGUI solve your GUI problem while you solve your real problems. Look through the Cookbook, find a matching recipe, copy, paste, run within minutes. This is the process PySimpleGUI was designed to facilitate. ![borderless grayed buttons](https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg) @@ -1029,16 +1031,16 @@ This is the definition of the Window object: button_color=None,Font=None, progress_bar_color=(None,None), background_color=None - is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, + force_toplevel=False return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, - grab_anywhere=True + grab_anywhere=False keep_on_top=False): @@ -1053,11 +1055,11 @@ Parameter Descriptions. You will find these same parameters specified for each button_color - Default color for buttons (foreground, background). Can be text or hex progress_bar_color - Foreground and background colors for progress bars background_color - Color of the window background - is_tabbed_form - Bool. If True then window is a tabbed window border_depth - Amount of 'bezel' to put on input boxes, buttons, etc. auto_close - Bool. If True window will autoclose auto_close_duration - Duration in seconds before window closes icon - .ICO file that will appear on the Task Bar and end of Title Bar + force_top_level - Bool. If set causes a tk.Tk window to be used as primary window rather than tk.TopLevel. Used to get around Matplotlib problem return_keyboard_events - if True key presses are returned as buttons use_default_focus - if True and no focus set, then automatically set a focus text_justification - Justification to use for Text Elements in this window @@ -1102,6 +1104,24 @@ It is turned off for non-blocking because there is a warning message printed out To keep a window on top of all other windows on the screen, set keep_on_top = True when the window is created. This feature makes for floating toolbars that are very helpful and always visible on your desktop. +### Window Methods (things you can do with a Window object) + +There are a few methods (functions) that you will see in this document that act on Windows. The ones you will primarily be calling are: + + window.Layout(layout) - Turns your definition of the Window into Window + window.Finalize() - creates the tkinter objects for the Window. Normally you do not call this + window.Read() - Read the Windows values and get the button / key that caused the Read to return + window.ReadNonBlocking() - Same as Read but will return right away + window.Refresh() - Use if updating elements and want to show the updates prior to the nex Read + window.Fill(values_dict) - Fill each Element with entry from the dictionary passed in + window.SaveToDisk(filename) - Save the Window's values to disk + window.LoadFromDisk(filename) - Load the Window's values from disk + window.CloseNonBlocking() - When done, for good, reading a non-blocking window + window.Disable() - Use to disable the window inpurt when opening another window on top of the primnary Window + window.Enable() - Re-enable a Disabled window + window.FindElement(key) - Returns the element that has a matching key value + + ## Elements "Elements" are the building blocks used to create windows. Some GUI APIs use the term "Widget" to describe these graphic elements. @@ -1130,6 +1150,7 @@ To keep a window on top of all other windows on the screen, set keep_on_top = Tr Graph Image Table + Tab, TabGroup Async/Non-Blocking Windows Tabbed windows Persistent Windows @@ -1269,7 +1290,7 @@ Output re-routes `Stdout` to a scrolled text box. It's used with Async windows. do_not_clear=False, key=None, focus=False - ) + . default_text - Text initially shown in the input box @@ -1299,19 +1320,29 @@ Also known as a drop-down list. Only required parameter is the list of choices. ![combobox](https://user-images.githubusercontent.com/13696193/44959860-b565bf00-aec3-11e8-82fe-dbe41252458b.jpg) InputCombo(values, , - size=(None, None), - auto_size_text=None, - background_color = None, - text_color = None, - key = None) + default_value=None + size=(None, None) + auto_size_text=None + background_color=None + text_color=None + change_submits=False + disabled=False + key=None + pad=None + tooltip=None . values - Choices to be displayed. List of strings + default_value - which value should be initially chosen size - (width, height) of element in characters auto_size_text - Bool. True if size should fit the text length background_color - color to use for the input field background text_color - color to use for the typed text - key = Dictionary key to use for return values + change_submits - Bool. If set causes Read to immediately return if the selected value changes + disabled - Bool. If set will disable changes + key - Dictionary key to use for return values + pad - (x,y) Amount of padding to put around element in pixels + tooltip - Text string. If set, hovering over field will popup the text #### Listbox Element The standard listbox like you'll find in most GUIs. Note that the return values from this element will be a ***list of results, not a single result***. This is because the user can select more than 1 item from the list (if you set the right mode). @@ -1382,6 +1413,7 @@ Sliders have a couple of slider-specific settings as well as appearance settings size=(None, None), font=None, background_color = None, + change_submits = False, text_color = None, key = None) ): . @@ -1401,6 +1433,7 @@ Sliders have a couple of slider-specific settings as well as appearance settings auto_size_text - Bool. True if size should fit the text background_color - color to use for the input field background text_color - color to use for the typed text + change_submits - causes window read to immediately return if the checkbox value changes key = Dictionary key to use for return values #### Radio Button Element @@ -1450,6 +1483,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating font=None, background_color = None, text_color = None, + change_submits = False key = None): . @@ -1460,6 +1494,7 @@ Checkbox elements are like Radio Button elements. They return a bool indicating font- Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text + change_submits - causes window read to immediately return if the checkbox value changes key = Dictionary key to use for return values @@ -1488,6 +1523,7 @@ An up/down spinner control. The valid values are passed in as a list. font - Font type and size for text display background_color - color to use for the background text_color - color to use for the typed text + change_submits - causes window read to immediately return if the spinner value changes key = Dictionary key to use for return values ### Button Element @@ -2095,6 +2131,7 @@ The definition of a TabGroup is font=None pad=None border_width=None + change_submits = False key=None tooltip=None) @@ -2107,6 +2144,7 @@ The definition of a Tab Element is size=(None, None),font=None, pad=None border_width=None + change_submits=False key=None tooltip=None) @@ -2838,8 +2876,19 @@ It's official. There is a 2.7 version of PySimpleGUI! * `DrawText` added to Graph Elements * Removed `Window.UpdateElements` * `Window.grab_anywere` defaults to False -* +#### 3.8.3 +* Listbox, Slider, Combobox, Checkbox, Spin, Tab Group - if change_submits is set, will return the Element's key rather than '' +* Added change_submits capability to Checkbox, Tab Group +* Combobox - Can set value to an Index into the Values table rather than the Value itself +* Warnings added to Drawing routines for Graph element (rather than crashing) +* Window - can "force top level" window to be used rather than a normal window. Means that instead of calling Tk to get a window, will call TopLevel to get the window +* Window Disable / Enable - Disables events (button clicks, etc) for a Window. Use this when you open a second window and want to disable the first window from doing anything. This will simulate a 'dialog box' +* Tab Group returns a value with Window is Read. Return value is the string of the selected tab +* Turned off grab_anywhere for Popups +* New parameter, default_extension, for PopupGetFile +* Keyboard shortcuts for menu items. Can hold ALT key to select items in men +* Removed old-style Tabs - Risky change because it hit fundamental window packing and creation. Will also break any old code using this style tab (sorry folks this is how progress happens) ### Upcoming @@ -2902,8 +2951,9 @@ GNU Lesser General Public License (LGPL 3) + * [Bryan Oakley](https://stackoverflow.com/users/7432/bryan-oakley) for the code that enables the `grab_anywhere` feature. * [Otherion](https://github.com/Otherion) for help with Tables, being a sounding board for new features, naming functions, ..., all around great help * [agjunyent](https://github.com/agjunyent) figured out how to properly make tabs and wrote prototype code that demonstrated how to do it -* [jfongattw](https://github.com/jfongattw) huge suggestion... dictionaries. turned out to be one of the most critical constructs in PySimpleGUI - +* [jfongattw](https://github.com/jfongattw) huge suggestion... dictionaries. turned out to be +* one of the most critical constructs in PySimpleGUI +* [venim](https://github.com/venim) code to doing Alt-Selections in menus, updating Combobox using index, request to disable windows (a really good idea), checkbox and tab submits on change, returning keys for elements that have change_submits set, ... ## How Do I From 509c8fd7ec243cd82cad7b155dfb195bed66f1d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 28 Sep 2018 19:21:44 -0400 Subject: [PATCH 497/521] Created a custoim progress meter example --- Demo_Matplotlib.py | 22 +--------- Demo_Progress_Meters.py | 90 +++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/Demo_Matplotlib.py b/Demo_Matplotlib.py index 32e47960d..8cf6eb01c 100644 --- a/Demo_Matplotlib.py +++ b/Demo_Matplotlib.py @@ -35,15 +35,8 @@ def draw_figure(canvas, figure, loc=(0, 0)): figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds figure_w, figure_h = int(figure_w), int(figure_h) photo = Tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - # Position: convert from top-left anchor to center anchor canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo) - - # Unfortunately, there's no accessor for the pointer to the native renderer tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - - # Return a handle which contains a reference to the photo object - # which must be kept live or else the picture disappears return photo #------------------------------- PASTE YOUR MATPLOTLIB CODE HERE ------------------------------- @@ -94,25 +87,14 @@ def draw_figure(canvas, figure, loc=(0, 0)): plt.yscale('logit') plt.title('logit') plt.grid(True) -# Format the minor tick labels of the y-axis into empty strings with -# `NullFormatter`, to avoid cumbering the axis with too many labels. plt.gca().yaxis.set_minor_formatter(NullFormatter()) -# Adjust the subplot layout, because the logit one may take more space -# than usual, due to y-tick labels like "1 - 10^{-3}" plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, wspace=0.35) - +fig = plt.gcf() # if using Pyplot then get the figure from the plot +figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds #------------------------------- END OF YOUR MATPLOTLIB CODE ------------------------------- -# ****** Comment out this line if not using Pyplot ****** -fig = plt.gcf() # if using Pyplot then get the figure from the plot - -# -------------------------------- GUI Starts Here -------------------------------# -# fig = your figure you want to display. Assumption is that 'fig' holds the # -# information to display. # -# --------------------------------------------------------------------------------# -figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds # define the form layout layout = [[sg.Text('Plot test', font='Any 18')], [sg.Canvas(size=(figure_w, figure_h), key='canvas')], diff --git a/Demo_Progress_Meters.py b/Demo_Progress_Meters.py index 8386a9d7a..0fd70e241 100644 --- a/Demo_Progress_Meters.py +++ b/Demo_Progress_Meters.py @@ -24,44 +24,66 @@ The simple case is that you want to add a single meter to your code. The one-line solution """ +def DemoOneLineProgressMeter(): + # Display a progress meter. Allow user to break out of loop using cancel button + for i in range(1000): + if not sg.OneLineProgressMeter('My 1-line progress meter', i+1, 1000, 'meter key' ): + break -# Display a progress meter in work loop. User is not allowed to break out of the loop -for i in range(10000): - if i % 5 == 0: sg.OneLineProgressMeter('My 1-line progress meter', i+1, 10000, 'single') -# Display a progress meter. Allow user to break out of loop using cancel button -for i in range(10000): - if not sg.OneLineProgressMeter('My 1-line progress meter', i+1, 10000, 'single'): - break + layout = [ + [sg.T('One-Line Progress Meter Demo', font=('Any 18'))], + [sg.T('Outer Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountOuter', do_not_clear=True), + sg.T('Delay'), sg.In(default_text='10', key='TimeOuter', size=(5,1), do_not_clear=True), sg.T('ms')], + [sg.T('Inner Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountInner', do_not_clear=True) , + sg.T('Delay'), sg.In(default_text='10', key='TimeInner', size=(5,1), do_not_clear=True), sg.T('ms')], + [sg.Button('Show', pad=((0,0), 3), bind_return_key=True), sg.T('me the meters!')] + ] + window = sg.Window('One-Line Progress Meter Demo').Layout(layout) -layout = [ - [sg.T('One-Line Progress Meter Demo', font=('Any 18'))], - [sg.T('Outer Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountOuter', do_not_clear=True), - sg.T('Delay'), sg.In(default_text='10', key='TimeOuter', size=(5,1), do_not_clear=True), sg.T('ms')], - [sg.T('Inner Loop Count', size=(15,1), justification='r'), sg.In(default_text='100', size=(5,1), key='CountInner', do_not_clear=True) , - sg.T('Delay'), sg.In(default_text='10', key='TimeInner', size=(5,1), do_not_clear=True), sg.T('ms')], - [sg.Button('Show', pad=((0,0), 3), bind_return_key=True), sg.T('me the meters!')] - ] + while True: + button, values = window.Read() + if button is None: + break + if button == 'Show': + max_outer = int(values['CountOuter']) + max_inner = int(values['CountInner']) + delay_inner = int(values['TimeInner']) + delay_outer = int(values['TimeOuter']) + for i in range(max_outer): + if not sg.OneLineProgressMeter('Outer Loop', i+1, max_outer, 'outer'): + break + sleep(delay_outer/1000) + for j in range(max_inner): + if not sg.OneLineProgressMeter('Inner Loop', j+1, max_inner, 'inner'): + break + sleep(delay_inner/1000) -window = sg.Window('One-Line Progress Meter Demo').Layout(layout) +''' + Make your own progress meter! + Embed the meter right into your window +''' -while True: - button, values = window.Read() - if button is None: - break - if button == 'Show': - max_outer = int(values['CountOuter']) - max_inner = int(values['CountInner']) - delay_inner = int(values['TimeInner']) - delay_outer = int(values['TimeOuter']) - for i in range(max_outer): - if not sg.OneLineProgressMeter('Outer Loop', i+1, max_outer, 'outer'): - break - sleep(delay_outer/1000) - for j in range(max_inner): - if not sg.OneLineProgressMeter('Inner Loop', j+1, max_inner, 'inner'): - break - sleep(delay_inner/1000) +def CustomMeter(): + # layout the form + layout = [[sg.Text('A custom progress meter')], + [sg.ProgressBar(10000, orientation='h', size=(20,20), key='progress')], + [sg.Cancel()]] + + # create the form` + window = sg.Window('Custom Progress Meter').Layout(layout) + progress_bar = window.FindElement('progress') + # loop that would normally do something useful + for i in range(10000): + # check to see if the cancel button was clicked and exit loop if clicked + button, values = window.ReadNonBlocking() + if button == 'Cancel' or values == None: + break + # update bar with loop value +1 so that bar eventually reaches the maximum + progress_bar.UpdateBar(i+1) + # done with loop... need to destroy the window as it's still open + window.CloseNonBlocking() -exit(69) +CustomMeter() +DemoOneLineProgressMeter() \ No newline at end of file From 76e2bc96dcd5e8a454036e459a5230a435770762 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 28 Sep 2018 19:48:08 -0400 Subject: [PATCH 498/521] Backed out menu code.... had broken menus --- PySimpleGUI.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 222aa690e..172b588c8 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2760,14 +2760,18 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) if type(sub_menu_info) is str: if not is_sub_menu and not skip: # print(f'Adding command {sub_menu_info}') - pos = sub_menu_info.find('&') + pos = sub_menu_info.find('_&') if pos != -1: - if pos == 0 or sub_menu_info[pos-1] != "\\": - sub_menu_info = sub_menu_info[:pos] + sub_menu_info[pos+1:] + _ = sub_menu_info[:pos] + try: + _ += sub_menu_info[pos+2:] + except Exception as e: + print(e) + sub_menu_info = _ if sub_menu_info == '---': top_menu.add('separator') else: - top_menu.add_command(label=sub_menu_info, underline=pos, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + top_menu.add_command(label=sub_menu_info, underline=pos-1, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) else: i = 0 while i < (len(sub_menu_info)): @@ -3244,11 +3248,15 @@ def CharWidthInPixels(): for menu_entry in menu_def: # print(f'Adding a Menubar ENTRY') baritem = tk.Menu(menubar, tearoff=element.Tearoff) - pos = menu_entry[0].find('&') + pos = menu_entry[0].find('_&') if pos != -1: - if pos == 0 or menu_entry[0][pos-1] != "\\": - menu_entry[0] = menu_entry[0][:pos] + menu_entry[0][pos+1:] - menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos) + _ = menu_entry[0][:pos] + try: + _ += menu_entry[0][pos+2:] + except: + pass + menu_entry[0] = _ + menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos-1) if len(menu_entry) > 1: AddMenuItem(baritem, menu_entry[1], element) toplevel_form.TKroot.configure(menu=element.TKMenu) From 784e3e52dc6d7d62e425b794db3aa77931a14f44 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 29 Sep 2018 01:54:30 -0400 Subject: [PATCH 499/521] 3.8.4 --- docs/index.md | 2 +- readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index c4ef1b504..9bf329997 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.3-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.4-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) diff --git a/readme.md b/readme.md index c4ef1b504..9bf329997 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.3-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.4-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) From 96635ef5a29c9d1f38d7f4ce74b66a0be6de3fb9 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 29 Sep 2018 02:03:07 -0400 Subject: [PATCH 500/521] New window methods - Hide, UnHide! Fix for menu letter underlining, Removed manager from Popups --- PySimpleGUI.py | 189 +++++++++++++++++++++++++------------------------ 1 file changed, 97 insertions(+), 92 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 172b588c8..c538e8e7a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2353,6 +2353,12 @@ def Disable(self): def Enable(self): self.TKroot.grab_release() + def Hide(self): + self.TKroot.withdraw() + + def UnHide(self): + self.TKroot.deiconify() + def __enter__(self): return self @@ -2760,18 +2766,14 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) if type(sub_menu_info) is str: if not is_sub_menu and not skip: # print(f'Adding command {sub_menu_info}') - pos = sub_menu_info.find('_&') + pos = sub_menu_info.find('&') if pos != -1: - _ = sub_menu_info[:pos] - try: - _ += sub_menu_info[pos+2:] - except Exception as e: - print(e) - sub_menu_info = _ + if pos == 0 or sub_menu_info[pos-1] != "\\": + sub_menu_info = sub_menu_info[:pos] + sub_menu_info[pos+1:] if sub_menu_info == '---': top_menu.add('separator') else: - top_menu.add_command(label=sub_menu_info, underline=pos-1, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) + top_menu.add_command(label=sub_menu_info, underline=pos, command=lambda: Menu.MenuItemChosenCallback(element, sub_menu_info)) else: i = 0 while i < (len(sub_menu_info)): @@ -3246,17 +3248,14 @@ def CharWidthInPixels(): element.TKMenu = tk.Menu(toplevel_form.TKroot, tearoff=element.Tearoff) # create the menubar menubar = element.TKMenu for menu_entry in menu_def: - # print(f'Adding a Menubar ENTRY') + # print(f'Adding a Menubar ENTRY {menu_entry}') baritem = tk.Menu(menubar, tearoff=element.Tearoff) - pos = menu_entry[0].find('_&') + pos = menu_entry[0].find('&') + # print(pos) if pos != -1: - _ = menu_entry[0][:pos] - try: - _ += menu_entry[0][pos+2:] - except: - pass - menu_entry[0] = _ - menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos-1) + if pos == 0 or menu_entry[0][pos-1] != "\\": + menu_entry[0] = menu_entry[0][:pos] + menu_entry[0][pos+1:] + menubar.add_cascade(label=menu_entry[0], menu=baritem, underline = pos) if len(menu_entry) > 1: AddMenuItem(baritem, menu_entry[1], element) toplevel_form.TKroot.configure(menu=element.TKMenu) @@ -3947,18 +3946,20 @@ def PopupGetFolder(message, default_path='', no_window=False, size=(None,None), root.destroy() return folder_name - with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, - font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: - layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], - [InputText(default_text=default_path, size=size), FolderBrowse()], - [Ok(), Cancel()]] + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], + [InputText(default_text=default_path, size=size), FolderBrowse()], + [Ok(), Cancel()]] - (button, input_values) = form.LayoutAndRead(layout) - if button != 'Ok': - return None - else: - path = input_values[0] - return path + window = Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, background_color=background_color, + font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) + + (button, input_values) = window.LayoutAndRead(layout) + + if button != 'Ok': + return None + else: + path = input_values[0] + return path ##################################### # PopupGetFile # @@ -3999,18 +4000,19 @@ def PopupGetFile(message, default_path='', default_extension='', save_as=False, browse_button = SaveAs(file_types=file_types) if save_as else FileBrowse(file_types=file_types) - with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, - no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: - layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], - [InputText(default_text=default_path, size=size), browse_button], - [Ok(), Cancel()]] + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color)], + [InputText(default_text=default_path, size=size), browse_button], + [Ok(), Cancel()]] - (button, input_values) = form.LayoutAndRead(layout) - if button != 'Ok': - return None - else: - path = input_values[0] - return path + window = Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, font=font, background_color=background_color, + no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) + + (button, input_values) = window.Layout(layout).Read() + if button != 'Ok': + return None + else: + path = input_values[0] + return path ##################################### # PopupGetText # @@ -4033,17 +4035,20 @@ def PopupGetText(message, default_text='', password_char='', size=(None,None), b :param location: :return: Text entered or None if window was closed """ - with Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, - background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: - layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], - [InputText(default_text=default_text, size=size, password_char=password_char)], - [Ok(), Cancel()]] - - (button, input_values) = form.LayoutAndRead(layout) - if button != 'Ok': - return None - else: - return input_values[0] + + layout = [[Text(message, auto_size_text=True, text_color=text_color, background_color=background_color, font=font)], + [InputText(default_text=default_text, size=size, password_char=password_char)], + [Ok(), Cancel()]] + + window = Window(title=message, icon=icon, auto_size_text=True, button_color=button_color, no_titlebar=no_titlebar, + background_color=background_color, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) + + (button, input_values) = window.Layout(layout).Read() + + if button != 'Ok': + return None + else: + return input_values[0] # ============================== SetGlobalIcon ======# @@ -4389,50 +4394,50 @@ def Popup(*args, button_color=None, background_color=None, text_color=None, butt else: local_line_width = MESSAGE_BOX_LINE_WIDTH title = args_to_print[0] if args_to_print[0] is not None else 'None' - with Window(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) as form: - max_line_total, total_lines = 0,0 - for message in args_to_print: - # fancy code to check if string and convert if not is not need. Just always convert to string :-) - # if not isinstance(message, str): message = str(message) - message = str(message) - if message.count('\n'): - message_wrapped = message - else: - message_wrapped = textwrap.fill(message, local_line_width) - message_wrapped_lines = message_wrapped.count('\n')+1 - longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, local_line_width) - max_line_total = max(max_line_total, width_used) - # height = _GetNumLinesNeeded(message, width_used) - height = message_wrapped_lines - form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) - total_lines += height - - pad = max_line_total-15 if max_line_total > 15 else 1 - pad =1 - if non_blocking: - PopupButton = DummyButton - else: - PopupButton = SimpleButton - # show either an OK or Yes/No depending on paramater - if button_type is POPUP_BUTTONS_YES_NO: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) - elif button_type is POPUP_BUTTONS_CANCELLED: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is POPUP_BUTTONS_ERROR: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Error', size=(6, 1), button_color=button_color, focus=True, bind_return_key=True)) - elif button_type is POPUP_BUTTONS_OK_CANCEL: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), - PopupButton('Cancel', size=(5, 1), button_color=button_color)) - elif button_type is POPUP_BUTTONS_NO_BUTTONS: - pass + form = Window(title, auto_size_text=True, background_color=background_color, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location) + max_line_total, total_lines = 0,0 + for message in args_to_print: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + if message.count('\n'): + message_wrapped = message else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) + message_wrapped = textwrap.fill(message, local_line_width) + message_wrapped_lines = message_wrapped.count('\n')+1 + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, local_line_width) + max_line_total = max(max_line_total, width_used) + # height = _GetNumLinesNeeded(message, width_used) + height = message_wrapped_lines + form.AddRow(Text(message_wrapped, auto_size_text=True, text_color=text_color, background_color=background_color)) + total_lines += height + + pad = max_line_total-15 if max_line_total > 15 else 1 + pad =1 + if non_blocking: + PopupButton = DummyButton + else: + PopupButton = SimpleButton + # show either an OK or Yes/No depending on paramater + if button_type is POPUP_BUTTONS_YES_NO: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Yes', button_color=button_color, focus=True, bind_return_key=True), PopupButton('No', button_color=button_color)) + elif button_type is POPUP_BUTTONS_CANCELLED: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Cancelled', button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is POPUP_BUTTONS_ERROR: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('Error', size=(6, 1), button_color=button_color, focus=True, bind_return_key=True)) + elif button_type is POPUP_BUTTONS_OK_CANCEL: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, text_color=text_color, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True), + PopupButton('Cancel', size=(5, 1), button_color=button_color)) + elif button_type is POPUP_BUTTONS_NO_BUTTONS: + pass + else: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False, background_color=background_color), PopupButton('OK', size=(5, 1), button_color=button_color, focus=True, bind_return_key=True)) - if non_blocking: - button, values = form.ReadNonBlocking() - else: - button, values = form.Show() + if non_blocking: + button, values = form.ReadNonBlocking() + else: + button, values = form.Show() return button From d1773e64473e660ba1d10d3b6802a2d9417959d1 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 29 Sep 2018 13:48:48 -0400 Subject: [PATCH 501/521] Removed last of Context Manager from Popups. Added Underscore to Menu Examples, Updated Templates, Better Popup examples --- Demo_All_Widgets.py | 6 ++--- Demo_Menus.py | 15 +++++++------ Demo_Popups.py | 17 +++++++++----- Demo_Template.py | 9 +++++--- PySimpleGUI.py | 54 ++++++++++++++++++++++----------------------- 5 files changed, 55 insertions(+), 46 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index b1991ad58..939a1ad69 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -8,9 +8,9 @@ sg.ChangeLookAndFeel('GreenTan') # ------ Menu Definition ------ # -menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], - ['Help', 'About...'], ] +menu_def = [['&File', ['&Open', '&Save', 'E&xit', 'Properties']], + ['&Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['&Help', '&About...'], ] # ------ Column Definition ------ # column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], diff --git a/Demo_Menus.py b/Demo_Menus.py index b57e26080..e88cbe36b 100644 --- a/Demo_Menus.py +++ b/Demo_Menus.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys if sys.version_info[0] >= 3: - import PySimpleGUI as sg + import PySimpleGUI_mod as sg else: import PySimpleGUI27 as sg """ @@ -26,9 +26,10 @@ def TestMenus(): sg.SetOptions(element_padding=(0, 0)) # ------ Menu Definition ------ # - menu_def = [['File', ['O_&pen', 'Save', '---', 'Properties']], - ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], - ['Help', 'About...'],] + menu_def = [['&File', ['&Open', '&Save', '---', 'Properties', 'E&xit' ]], + ['&Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['' + '&Help', '&About...'],] # ------ GUI Defintion ------ # layout = [ @@ -48,9 +49,9 @@ def TestMenus(): print('Button = ', button) # ------ Process menu choices ------ # if button == 'About...': - window.Disable() - sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...') - window.Enable() + window.Hide() + sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...', grab_anywhere=True) + window.UnHide() elif button == 'Open': filename = sg.PopupGetFile('file to open', no_window=True) print(filename) diff --git a/Demo_Popups.py b/Demo_Popups.py index cdac857d1..c55a55cd7 100644 --- a/Demo_Popups.py +++ b/Demo_Popups.py @@ -6,18 +6,23 @@ import PySimpleGUI27 as sg # Here, have some windows on me.... -[sg.PopupNoWait(location=(10*x,0)) for x in range(10)] +[sg.PopupNoWait(location=(500+100*x,500)) for x in range(10)] -print (sg.PopupYesNo('Yes No')) +answer = sg.PopupYesNo('Do not worry about all those open windows... they will disappear at the end', 'Are you OK with that?') -print(sg.PopupGetText('Get text', location=(1000,200))) -print(sg.PopupGetFile('Get file')) -print(sg.PopupGetFolder('Get folder')) +if answer == 'No': + sg.PopupCancel('OK, we will destroy those windows as soon as you close this window') + sys.exit() + +sg.PopupNonBlocking('Your answer was',answer, location=(1000,600)) + +text = sg.PopupGetText('This is a call to PopopGetText', location=(1000,200)) +sg.PopupGetFile('Get file') +sg.PopupGetFolder('Get folder') sg.Popup('Simple popup') -sg.PopupNonBlocking('Non Blocking', location=(500,500)) sg.PopupNoTitlebar('No titlebar') sg.PopupNoBorder('No border') sg.PopupNoFrame('No frame') diff --git a/Demo_Template.py b/Demo_Template.py index 92a194d2c..286c6fa48 100644 --- a/Demo_Template.py +++ b/Demo_Template.py @@ -10,7 +10,8 @@ else: import PySimpleGUI27 as sg -layout = [[ sg.Text('My layout') ]] +layout = [[ sg.Text('My layout') ], + [ sg.Button('Next Window')]] window = sg.Window('My window').Layout(layout) button, value = window.Read() @@ -26,11 +27,13 @@ else: import PySimpleGUI27 as sg -layout = [[ sg.Text('My layout') ]] +layout = [[ sg.Text('My layout') ], + [ sg.RButton('Read The Window')]] window = sg.Window('My new window').Layout(layout) while True: # Event Loop button, value = window.Read() if button is None: - break \ No newline at end of file + break + print(button, value) \ No newline at end of file diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c538e8e7a..bf75e4ac2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3873,35 +3873,35 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au if not args: return width, height = size width = width if width else MESSAGE_BOX_LINE_WIDTH - with Window(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form: - max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 - complete_output = '' - for message in args: - # fancy code to check if string and convert if not is not need. Just always convert to string :-) - # if not isinstance(message, str): message = str(message) - message = str(message) - longest_line_len = max([len(l) for l in message.split('\n')]) - width_used = min(longest_line_len, width) - max_line_total = max(max_line_total, width_used) - max_line_width = width - lines_needed = _GetNumLinesNeeded(message, width_used) - height_computed += lines_needed - complete_output += message + '\n' - total_lines += lines_needed - height_computed = MAX_SCROLLED_TEXT_BOX_HEIGHT if height_computed > MAX_SCROLLED_TEXT_BOX_HEIGHT else height_computed - if height: - height_computed = height - form.AddRow(Multiline(complete_output, size=(max_line_width, height_computed))) - pad = max_line_total-15 if max_line_total > 15 else 1 - # show either an OK or Yes/No depending on paramater - if yes_no: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(), No()) - button, values = form.Read() - return button - else: - form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color)) + form = Window(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) + max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0 + complete_output = '' + for message in args: + # fancy code to check if string and convert if not is not need. Just always convert to string :-) + # if not isinstance(message, str): message = str(message) + message = str(message) + longest_line_len = max([len(l) for l in message.split('\n')]) + width_used = min(longest_line_len, width) + max_line_total = max(max_line_total, width_used) + max_line_width = width + lines_needed = _GetNumLinesNeeded(message, width_used) + height_computed += lines_needed + complete_output += message + '\n' + total_lines += lines_needed + height_computed = MAX_SCROLLED_TEXT_BOX_HEIGHT if height_computed > MAX_SCROLLED_TEXT_BOX_HEIGHT else height_computed + if height: + height_computed = height + form.AddRow(Multiline(complete_output, size=(max_line_width, height_computed))) + pad = max_line_total-15 if max_line_total > 15 else 1 + # show either an OK or Yes/No depending on paramater + if yes_no: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Yes(), No()) button, values = form.Read() return button + else: + form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Button('OK', size=(5, 1), button_color=button_color)) + button, values = form.Read() + return button PopupScrolled = ScrolledTextBox From f1a2c7c3c2f65ac428ad9fd0bc7d9a412d926ca2 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 29 Sep 2018 22:58:38 -0400 Subject: [PATCH 502/521] Fix for returning tab KEY when returning results for tab group --- PySimpleGUI.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index bf75e4ac2..7108579a2 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1576,6 +1576,12 @@ def _GetElementAtLocation(self, location): element = row[col_num] return element + def FindKeyFromTabName(self, tab_name): + for row in self.Rows: + for element in row: + if element.Title == tab_name: + return element.Key + return None def __del__(self): for row in self.Rows: @@ -2663,6 +2669,9 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): elif element.Type == ELEM_TYPE_TAB_GROUP: try: value=element.TKNotebook.tab(element.TKNotebook.index('current'))['text'] + tab_key = element.FindKeyFromTabName(value) + if tab_key is not None: + value = tab_key except: value = None else: From b976bf61f2ec7d28e68d09e0ce92c59afbd02965 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 29 Sep 2018 23:25:07 -0400 Subject: [PATCH 503/521] Fix for background and text color in Tables --- PySimpleGUI.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 7108579a2..bf41a8c50 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3401,7 +3401,9 @@ def CharWidthInPixels(): value = [i] + value id = treeview.insert('', 'end', text=value, values=value) if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: - element.TKTreeview.configure(background=element.BackgroundColor) + ttk.Style().configure("Treeview", background=element.BackgroundColor, fieldbackground=element.BackgroundColor) + if element.TextColor is not None and element.TextColor != COLOR_SYSTEM_DEFAULT: + ttk.Style().configure("Treeview", foreground=element.TextColor) # scrollable_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both') element.TKTreeview.pack(side=tk.LEFT,expand=True, padx=0, pady=0, fill='both') if element.Tooltip is not None: From bffdb1d9023c193b565b25679eb63bdf20709e3c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 30 Sep 2018 00:46:14 -0400 Subject: [PATCH 504/521] Info on reading TabGroups. Menu underlining --- docs/index.md | 36 ++++++++++++++++++++++++++++++++---- readme.md | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9bf329997..b615c0040 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.4-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.3-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) @@ -176,7 +176,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Save / Load window to/from disk Borderless (no titlebar) windows Always on top windows - Menus + Menus with ALT-hotkey Tooltips Clickable links No async programming required (no callbacks to worry about) @@ -2141,14 +2141,18 @@ The definition of a Tab Element is layout, title_color=None, background_color=None, - size=(None, None),font=None, + font=None, pad=None border_width=None - change_submits=False key=None tooltip=None) +### Reading Tab Groups + +Tab Groups now return a value when a Read returns. They return which tab is currently selected. There is also a change_submits parameter that can be set that causes a Read to return if a Tab in that group is selected / changed. The key or title belonging to the Tab that was switched to will be returned as the value + + ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. @@ -2523,6 +2527,24 @@ They menu_def layout produced this window: ![menu](https://user-images.githubusercontent.com/13696193/45306723-56b7cb00-b4eb-11e8-8cbd-faef0c90f8b4.jpg) +You have used ALT-key in other Windows programs to navigate menus. For example Alt-F+X exits the program. The Alt-F pulls down the File menu. The X selects the entry marked Exit. + +The good news is that PySimpleGUI allows you to create the same kind of menus! Your program can play with the big-boys. And, it's trivial to do. + +All that's required is for your to add an "&" in front of the letter you want to appear with an underscore. When you hold the Alt key down you will see the menu with underlines that you marked. + +One other little bit of polish you can add are separators in your list. To add a line in your list of menu choices, create a menu entry that looks like this: ` '---'` + +This is an example Menu with underlines and a separator. + +``` +# ------ Menu Definition ------ # +menu_def = [['&File', ['&Open', '&Save', '---', 'Properties', 'E&xit' ]], + ['&Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['&Help', '&About...'],] +``` + And this is the spiffy menu it produced: + ![menus with shortcuts](https://user-images.githubusercontent.com/13696193/46251674-f5b74f00-c427-11e8-95c6-547adc59041b.jpg) ## Updating Elements @@ -2890,6 +2912,12 @@ It's official. There is a 2.7 version of PySimpleGUI! * Keyboard shortcuts for menu items. Can hold ALT key to select items in men * Removed old-style Tabs - Risky change because it hit fundamental window packing and creation. Will also break any old code using this style tab (sorry folks this is how progress happens) +#### 3.8.3 + +* Fix for Menus. +* Fixed tabled colors. Now they work +* Fixed returning keys for tabs +* ### Upcoming Make suggestions people! Future release features diff --git a/readme.md b/readme.md index 9bf329997..b615c0040 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ ## Now supports both Python 2.7 & 3 -![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.4-red.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3_Version-3.8.3-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.0.4-blue.svg?longCache=true&style=for-the-badge) @@ -176,7 +176,7 @@ While simple to use, PySimpleGUI has significant depth to be explored by more ad Save / Load window to/from disk Borderless (no titlebar) windows Always on top windows - Menus + Menus with ALT-hotkey Tooltips Clickable links No async programming required (no callbacks to worry about) @@ -2141,14 +2141,18 @@ The definition of a Tab Element is layout, title_color=None, background_color=None, - size=(None, None),font=None, + font=None, pad=None border_width=None - change_submits=False key=None tooltip=None) +### Reading Tab Groups + +Tab Groups now return a value when a Read returns. They return which tab is currently selected. There is also a change_submits parameter that can be set that causes a Read to return if a Tab in that group is selected / changed. The key or title belonging to the Tab that was switched to will be returned as the value + + ## Colors ## Starting in version 2.5 you can change the background colors for the window and the Elements. @@ -2523,6 +2527,24 @@ They menu_def layout produced this window: ![menu](https://user-images.githubusercontent.com/13696193/45306723-56b7cb00-b4eb-11e8-8cbd-faef0c90f8b4.jpg) +You have used ALT-key in other Windows programs to navigate menus. For example Alt-F+X exits the program. The Alt-F pulls down the File menu. The X selects the entry marked Exit. + +The good news is that PySimpleGUI allows you to create the same kind of menus! Your program can play with the big-boys. And, it's trivial to do. + +All that's required is for your to add an "&" in front of the letter you want to appear with an underscore. When you hold the Alt key down you will see the menu with underlines that you marked. + +One other little bit of polish you can add are separators in your list. To add a line in your list of menu choices, create a menu entry that looks like this: ` '---'` + +This is an example Menu with underlines and a separator. + +``` +# ------ Menu Definition ------ # +menu_def = [['&File', ['&Open', '&Save', '---', 'Properties', 'E&xit' ]], + ['&Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], + ['&Help', '&About...'],] +``` + And this is the spiffy menu it produced: + ![menus with shortcuts](https://user-images.githubusercontent.com/13696193/46251674-f5b74f00-c427-11e8-95c6-547adc59041b.jpg) ## Updating Elements @@ -2890,6 +2912,12 @@ It's official. There is a 2.7 version of PySimpleGUI! * Keyboard shortcuts for menu items. Can hold ALT key to select items in men * Removed old-style Tabs - Risky change because it hit fundamental window packing and creation. Will also break any old code using this style tab (sorry folks this is how progress happens) +#### 3.8.3 + +* Fix for Menus. +* Fixed tabled colors. Now they work +* Fixed returning keys for tabs +* ### Upcoming Make suggestions people! Future release features From d000cfe85d18e933773b2dbde1917276af318247 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sun, 30 Sep 2018 01:23:04 -0400 Subject: [PATCH 505/521] Coobook in PDF format --- docs/The PySimpleGUI Cookbook 09-30.pdf | Bin 0 -> 1180250 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/The PySimpleGUI Cookbook 09-30.pdf diff --git a/docs/The PySimpleGUI Cookbook 09-30.pdf b/docs/The PySimpleGUI Cookbook 09-30.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c8d3bb5b64bc4d016a462dc5fa64c30dda2e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xZHlk)BIcCptm1B11dLd@u2|A=At7Nv@U{cm;fgCxAyWn)hs;U{lo1vYzO~@{*wh* zx|T(!Pez)O7=poIXqcEH^ErUdPlWv-|LTU+L*Lt0ZhtQH`#=l;OX%4`FcaW2E~8$3 zO<^!*v**@$4#nAbK34ZDcp40#n0tp3jw)%7%sy{QUg>o1BdL^XE12AIXnI$`S*> zdjg#j>f|4=@remRNy!+{mdLK9{M9TtmQoQ)L5U3%{t*ZZZk&PVC_TDx295^P)zuX| z4l+!BNXE|-VIR_uSuw=~ZjGiO$pLo)p5xa8!^8)W#BkhnbzBqzd&!mNz=r{a$hQgP z)xf!)fl)xJL}g`f(;mCb|9u^_n0+5uvB2NmsNfpo@=ENg?Lu$fKaiS-nEa;%@-FkU zvdybW9gas+j;95(HwOv9tw7W_EKEvQi#!Hy9bH+uC$FsBI|NhxW6`;cWy05AIP|i? zFI9-ul&1{tp!5TQ5V zHQZz1k{1l9UxL?R{@M8ZZns#?#&ya4t8UBS^;Em5vGL{3&!0ctLXV7^*?EVMIX@3Gqg{z_8E^i(Jn3=gHIrYcR0j~g6b zv@|V%WV=lWx!=8YA^}r9d<=(w`8u~7GUvSKWN$By(-FyUuA!3bu%0XyLX%@7ei=Tw;on-ZyfY{En;pD#g{UfOA}Zu9-u@4Z$ixf) literal 0 HcmV?d00001 diff --git a/ButtonGraphics/Restart.png b/ButtonGraphics/Restart.png new file mode 100644 index 0000000000000000000000000000000000000000..8f30e7cb62104fd585793cdb22699acffb689f8a GIT binary patch literal 8013 zcmV-TAF|+yP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc9^y$vK~#8N&7FO) zmQ}gNA2)`gppby{ZTX8jOD4R$xcV- zbf!E`ozh`SZ2Zd4k|fYjL*hgEP(#?TK~XjVTIjidi}!lH_TqWo{j%8`yk@Sw*0Y}V ztaab_^{lm?kN17|LB)F*Lxv0)aL_>qwGACQv~|#+LE{cR^w5)9TU$?vT}KB883zWz zwqU1mV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