en:tkinter
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungLetzte ÜberarbeitungBeide Seiten der Revision | ||
en:tkinter [2022/03/04 09:27] – [Entry] roehner | en:tkinter [2022/03/04 13:29] – [Menubutton] roehner | ||
---|---|---|---|
Zeile 41: | Zeile 41: | ||
==== Text ==== | ==== Text ==== | ||
{{: | {{: | ||
- | In contrast to the Entry widget, a text widget represents a multi-line text. You can enter the text in the object inspector. At runtime, you can use the method shown in the example to output line by line to a text widget named Output. The lines are separated from each other by the control character " | + | In contrast to the Entry widget, a Text widget represents a multi-line text. You can enter the text in the object inspector. At runtime, you can use the method shown in the example to output line by line to a Text widget named Output. The lines are separated from each other by the control character " |
Beispiel: | Beispiel: | ||
Zeile 68: | Zeile 68: | ||
{{: | {{: | ||
<code python> | <code python> | ||
- | \\ | ||
- | \\ | ||
---- | ---- | ||
==== RadiobuttonGroup ==== | ==== RadiobuttonGroup ==== | ||
{{: | {{: | ||
- | A RadiobuttonGroup offers several selection possibilities from which you can select an option. A newly created RadiobuttonGroup automatically has the three options " | + | A RadiobuttonGroup offers several selection possibilities from which you can select an option. A newly created RadiobuttonGroup automatically has the three options " |
The RadiobuttonGroup has a control variable CV that can be used to input or output the selected option: | The RadiobuttonGroup has a control variable CV that can be used to input or output the selected option: | ||
Zeile 83: | Zeile 81: | ||
self.rbgContinentCV.set(' | self.rbgContinentCV.set(' | ||
</ | </ | ||
- | |||
- | |||
- | \\ | ||
---- | ---- | ||
==== Listbox ==== | ==== Listbox ==== | ||
Zeile 93: | Zeile 88: | ||
The list box has a control variable CV that gives access to all strings. For accessing the // | The list box has a control variable CV that gives access to all strings. For accessing the // | ||
- | |||
Examples: | Examples: | ||
Zeile 120: | 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 133: | 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 148: | 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 217: | Zeile 203: | ||
pass | pass | ||
</ | </ | ||
- | \\ | ||
---- | ---- | ||
==== PopupMenu ==== | ==== PopupMenu ==== | ||
Zeile 234: | 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.txt · Zuletzt geändert: 2022/08/21 18:06 von roehner