en:tkinter
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
en:tkinter [2022/03/04 09:42] – [Listbox] roehner | en:tkinter [2022/08/21 18:06] (aktuell) – [Tkinter] roehner | ||
---|---|---|---|
Zeile 2: | Zeile 2: | ||
A GUI form is built with the help of widgets. These are the graphical components available in the Tkinter toolbar. The basics for using widgets are given below, which is sufficient in many cases. More detailed information can be found e.g. in the [[https:// | A GUI form is built with the help of widgets. These are the graphical components available in the Tkinter toolbar. The basics for using widgets are given below, which is sufficient in many cases. More detailed information can be found e.g. in the [[https:// | ||
- | A GUI program is created using the {{:tkinter.png}} icon for new Tk/TTK application on the //Program// tab. Widgets can be placed by drag and drop or by clicking on a widget and then clicking in the GUI form. Only absolute layout is supported. This is sufficient for school purposes. Designing a GUI surface with layout managers is much more difficult. | + | A GUI program is created using the {{:tkapp.png}} icon for new Tk/TTK application on the //Program// tab. Widgets can be placed by drag and drop or by clicking on a widget and then clicking in the GUI form. Only absolute layout is supported. This is sufficient for school purposes. Designing a GUI surface with layout managers is much more difficult. |
Attributes and events of a widget are configured in the object inspector. Initially, only the most important attributes and events are displayed. This filtering simplifies working with the object inspector. You can display more or all attributes and methods in two further stages. | Attributes and events of a widget are configured in the object inspector. Initially, only the most important attributes and events are displayed. This filtering simplifies working with the object inspector. You can display more or all attributes and methods in two further stages. | ||
Zeile 114: | Zeile 114: | ||
print(self.spinbox1CV.get()) | print(self.spinbox1CV.get()) | ||
</ | </ | ||
- | \\ | + | ---- |
==== Scrollbar ==== | ==== Scrollbar ==== | ||
{{: | {{: | ||
A Scrollbar can be used to scroll, in which the visible section of a displayed text or graphic is moved. Some widgets such as Entry, Text, Listbox or Canvas can easily be provided with horizontal or vertical scrollbars using the // | A Scrollbar can be used to scroll, in which the visible section of a displayed text or graphic is moved. Some widgets such as Entry, Text, Listbox or Canvas can easily be provided with horizontal or vertical scrollbars using the // | ||
- | |||
- | \\ | ||
---- | ---- | ||
==== Message==== | ==== Message==== | ||
Zeile 127: | Zeile 124: | ||
The Message widget is similar to the Label widget, but is intended for displaying multiple lines of text. | The Message widget is similar to the Label widget, but is intended for displaying multiple lines of text. | ||
- | |||
- | \\ | ||
---- | ---- | ||
==== Canvas==== | ==== Canvas==== | ||
Zeile 142: | Zeile 137: | ||
A documentation of the drawing commands can be found under [[https:// | A documentation of the drawing commands can be found under [[https:// | ||
- | |||
- | \\ | ||
---- | ---- | ||
==== Frame ==== | ==== Frame ==== | ||
{{: | {{: | ||
- | A Frame is a container for other widgets. For example, the RadiobuttonGroup is a Frame that contains Radiobuttons. Frames are a good way to structure | + | A Frame is a container for other widgets. For example, the RadiobuttonGroup is a Frame that contains Radiobuttons. Frames are a good way to structure |
To place a widget in a Frame, click on it in the Tkinter toolbar and then click in the Frame. | To place a widget in a Frame, click on it in the Tkinter toolbar and then click in the Frame. | ||
- | \\ | ||
---- | ---- | ||
==== LabelFrame ==== | ==== LabelFrame ==== | ||
{{: | {{: | ||
- | A LabelFrame is a Frame that also has a border with an integrated label. | + | A LabelFrame is a Frame that also has an additional |
- | \\ | + | |
---- | ---- | ||
+ | |||
==== Scale ==== | ==== Scale ==== | ||
{{: | {{: | ||
Zeile 211: | Zeile 203: | ||
pass | pass | ||
</ | </ | ||
- | \\ | ||
---- | ---- | ||
==== PopupMenu ==== | ==== PopupMenu ==== | ||
Zeile 228: | Zeile 219: | ||
pass | pass | ||
</ | </ | ||
- | \\ | + | ---- |
- | --- | + | |
==== Menubutton ==== | ==== Menubutton ==== | ||
{{: | {{: | ||
The PopupMenu must also be created and then entered in the //Menu// attribute of the Menubutton. | The PopupMenu must also be created and then entered in the //Menu// attribute of the Menubutton. | ||
- | \\ | + | ---- |
+ | ==== OptionMenu ==== | ||
+ | {{: | ||
+ | |||
+ | The selected option is accessed via the CV control variable. | ||
+ | |||
+ | <code python> | ||
+ | print(self.optionMenu1CV.get()) | ||
+ | </ | ||
---- | ---- | ||
en/tkinter.1646383364.txt.gz · Zuletzt geändert: 2022/03/04 09:42 von roehner