2022年1月7日 星期五

Python Tkinter Widget

Python Tkinter Widget

Widget Classes 

Tkinter supports the below mentioned core widgets –

WidgetsDescription
LabelIt is used to display text or image on the screen
ButtonIt is used to add buttons to your application
CanvasIt is used to draw pictures and others layouts like texts, graphics etc.
ComboBoxIt contains a down arrow to select from list of available options
CheckButtonIt displays a number of options to the user as toggle buttons from which user can select any number of options.
RadiButtonIt is used to implement one-of-many selection as it allows only one option to be selected
EntryIt is used to input single line text entry from user
FrameIt is used as container to hold and organize the widgets
MessageIt works same as that of label and refers to multi-line and non-editable text
ScaleIt is used to provide a graphical slider which allows to select any value from that scale
ScrollbarIt is used to scroll down the contents. It provides a slide controller.
SpinBoxIt is allows user to select from given set of values
TextIt allows user to edit multiline text and format the way it has to be displayed
MenuIt is used to create all kinds of menu used by an application

Geometry Management

Creating a new widget doesn’t mean that it will appear on the screen. To display it, we need to call a special method: either gridpack(example above), or place. 

MethodDescription
pack()The Pack geometry manager packs widgets in rows or columns.
grid()The Grid geometry manager puts the widgets in a 2-dimensional table. 
The master widget is split into a number of rows and columns, and each “cell” in the resulting table can hold a widget.
place()The Place geometry manager is the simplest of the three general geometry managers provided in Tkinter. 
It allows you explicitly set the position and size of a window, either in absolute terms, or relative to another window.

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...