Title - the name of this widget in the code. To access a button in the code - to edit it or retrieve from it - it is referenced by
<gui name>.<buttonName>. For a GUI named gui, and a button named button1, this would be gui.button1.
This title therefore must be unique to the widget.
Text - the default text displayed by the button. Multi-line text can be displayed through the \n character.
Colour - the background colour of the widget, as a 6 digit hex code
Text Colour - the colour of the text as a 6 digit hex code
Font Size - the size of the text
Event name - the name of the event run when the button is clicked.
The event called by a button must be located in the parent script. It is a standard python function with one parameter - a string, holding the name of the button that was called. An example is as follows:
def event1(buttonName):
print(buttonName)
This event must be defined below module import statements, but above the run() statement.
Set widget text value - <guiName>.<buttonName>.config(text = <string to display>)
E.g gui.Button1.config(text = "Hello World!")
Get widget text value - <guiName>.<buttonName>.cget("text")
E.g gui.Button1.cget("text")
NOTE - "text" is not a string supplied by you - it is the field you are retrieving.
Set other widget value - <guiName>.<buttonName>.config(<Tkinter field>= <value>)
E.g gui.Button1.config(bg = "#FFFFFF")
Get other widget value - <guiName>.<buttonName>.cget(<Tkinter field>)
E.g gui.Button1.cget("bg")
Hide button- <guiName>.<buttonName>.grid_remove()
E.g gui.Button1.grid_remove()
Show button- <guiName>.<buttonName>.grid()
E.g gui.Button1.grid()
Other - Above are the most commonly used methods. However, any of the tkinter button methods are just as valid. Find the full list here
In MacOS, Tkinter has a few restrictions imposed by Apple. These include the inability to change the background colour of a button or remove its border, when used in a grid layout system.
This is unfortunate and annoying.