The tkinter combobox and spinbox widgets

  Рет қаралды 4,958

Atlas

Atlas

Күн бұрын

This tutorial covers the combobox and the spinbox widgets of tkinter. Both cover drop-down menus, just in slightly different ways.

Пікірлер: 3
@cocogswy
@cocogswy 9 ай бұрын
for CTk the event for comboboxes doesn't work.. I fixed this by creating this callback function and putting it in the "command=callback" of the combobox def callback(choice): food_string.set(choice) combolabel.configure(text = f"Selected value: {food_string.get()}") Just for people that are following this tutorial but are using customtkinter. Love your content tho! verry helpfull
@garmrdmr
@garmrdmr 11 ай бұрын
um.. this is the first time i dont quite agree... we are not Done.... on the spinbox when you press down it prints the value it WAS, but the spinbox changes to a different value for example... it shows a 'C'.. press down The spin box changes to 'B' but it Prints 'C' it is printing the value it is changing from - you can see this on your screen example too but, because yo do it so quick it is not obvious this only seems to happen when using the events - the event is triggering, it seems, when the down is pressed - BEFORE the box chanegs value - after processing the event . THEN the spinbox make sthe change to eth variable... OUCH if i just use command=... then the function gets processed, apparently, AFTER the spin box value is changed - and so the screen and print statement align this code shows it VERY clearly - the command label always shows the same as the spinbox. But the event label is always "one behind" import tkinter as tk from tkinter import ttk window = tk.Tk() window.geometry('800x600') def sLabelUpdate(): commandLabel.configure(text=f'command triggers : {spin_string.get()}') spin_string = tk.StringVar() values = ['A', 'B', 'C', 'D', 'E'] commandLabel = ttk.Label(window, text="...") commandLabel.pack() spin = ttk.Spinbox( window, textvariable=spin_string, values=values, command = sLabelUpdate ) spin.pack() spinEventLabel = ttk.Label(window, text='...') spinEventLabel.pack() spin.bind('', lambda event: spinEventLabel.configure(text=f'event triggers : {spin_string.get()}')) spin.bind('', lambda event: spinEventLabel.configure(text=f'event triggers : {spin_string.get()}')) tk.mainloop()
@mokasurvey
@mokasurvey Жыл бұрын
the code plssss🙏🙏🙏
creating tables in tkinter with the treeview widget
14:44
An overview of tkinter layouts
18:02
Atlas
Рет қаралды 13 М.
Женская драка в Кызылорде
00:53
AIRAN
Рет қаралды 493 М.
No empty
00:35
Mamasoboliha
Рет қаралды 8 МЛН
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 6 МЛН
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 11 МЛН
Using tkinter with classes
28:23
Atlas
Рет қаралды 57 М.
Tkinter tutorial for beginners #5: Combobox, Listbox
21:36
Code First with Hala
Рет қаралды 10 М.
Using menus in tkinter
19:00
Atlas
Рет қаралды 12 М.
The pack layout method in tkinter
23:50
Atlas
Рет қаралды 13 М.
Understanding parenting and frames in tkinter
11:42
Atlas
Рет қаралды 12 М.
List Comprehension - BEST Python feature !!! Fast and Efficient
14:51
Python Simplified
Рет қаралды 190 М.
Understanding tkinter variables
11:48
Atlas
Рет қаралды 10 М.
Женская драка в Кызылорде
00:53
AIRAN
Рет қаралды 493 М.