按钮组件是用来添加一个Python应用程序中的按钮。这些按钮可以显示文字或图像,表达按钮的目的。当你按一下按钮时,您可以附加到一个按钮的函数或方法,该方法自动调用.
语法:
这里是一个简单的语法来创建这个widget:
w = Button ( master, option=value, ... )
参数:
master: 这代表了父窗口.
options: 下面是这个小工具最常用的选项列表。这些选项可以作为键 - 值对以逗号分隔.
OptionDescription
activebackground
Background color when the button is under the cursor.
activeforeground
Foreground color when the button is under the cursor.
bd
Border width in pixels. Default is 2.
bg
Normal background color.
command
Function or method to be called when the button is clicked.
fg
Normal foreground (text) color.
font
Text font to be used for the button‘s label.
height
Height of the button in text lines (for textual buttons) or pixels (for images).
highlightcolor
The col