Config button properties : Button « GUI Tk « Python






Config button properties

Config button properties

from Tkinter import *
widget = Button(text='Spam', padx=10, pady=10)
widget.pack(padx=20, pady=20)
widget.config(cursor='gumby')
widget.config(bd=8, relief=RAISED)
widget.config(bg='dark green', fg='white')
widget.config(font=('helvetica', 20, 'underline italic'))
mainloop()

           
       








Related examples in the same category

1.Add a button to frameAdd a button to frame
2.Simple Button ActionSimple Button Action
3.Disable a buttonDisable a button
4.Enable a buttonEnable a button
5.Set Button to get focusSet Button to get focus
6.Button Border stylesButton Border styles
7.Button action to set Button backgroundButton action to set Button background
8.Button event binding: without passing the event as an argument Button event binding: without passing the event as an argument
9.Button focusButton focus
10.create a button, and put it into a Containercreate a button, and put it into a Container
11.Set Button background by property nameSet Button background by property name
12.Specify the button's propertiesSpecify the button's properties
13.Button action inside a classButton action inside a class
14.Button widthButton width
15.Buttons on a toolbarButtons on a toolbar
16.Button foreground colorButton foreground color
17.Creating buttonsCreating buttons
18.Button single click and double clickButton single click and double click
19.Use lambda to generate a call back function for a buttonUse lambda to generate a call back function for a button
20.adds user-defined callbacks as button actionadds user-defined callbacks as button action
21.Subclasses buttonSubclasses button
22.Subclass HelloButton: redefine press-handler methodSubclass HelloButton: redefine press-handler method
23.Sub class button: add callback method and pack myselfSub class button: add callback method and pack myself
24.Sub class button: add callback method and use a dictionarySub class button: add callback method and use a dictionary
25.Button BorderButton Border
26.Button border size Button border size
27.Button border effects: RAISEDButton border effects: RAISED
28.Button background, foreground and fontButton background, foreground and font
29.Button width and heightButton width and height
30.Add gif image to a buttonAdd gif image to a button
31.Bind mouse single click and double click to a buttonBind mouse single click and double click to a button