138
Endi siz hech qanday matn kirita olmaysiz.
8. Combobox vidjetini qo'shish
Ochiladigan qutiga vidjet qo'shish uchun
ttk dan Combobox sinfidan
quyidagicha foydalaning:
from tkinter.ttk import Combobox
combo = Combobox(window)
Keyin o'z qiymatlaringizni ochiladigan maydonga qo'shing.
from tkinter import *
from tkinter.ttk Combobox *
window =Tk()
window.title(“Mening birinchi grafik oyman”)
window.geometry(‘350x150’)
combo=Combobox(window)
combo[‘values’]=(1, 2, 3, 4, 5, ‘Matn’)
combo.current(1)
combo.grid(column=1, row=0)
window.mainloop()
9. Checkbutton tugmachasi vidjetini qo'shish
Tekshirish tugmachalari vidjetini yaratish
uchun Checkbutton sinfidan
foydalaning:
from tkinter.ttk import Checkbutton
139
chk = Checkbutton(window, text='Tanlash')
Shu
bilan bir qatorda, standart qiymatni
Tekshirish tugmasidagi var
parametriga o'tkazib belgilashingiz mumkin:
from tkinter import *
from tkinter.ttk Combobox *
window =Tk()
window.title(“Mening birinchi grafik oyman”)
window.geometry(‘350x150’)
chk_state=BooleanVar()
chk_state.set(True)
chk=Checkbutton(window, text= ‘Tanlash’, var=chk_state)
chk.grid(column=0, row=0)
window.mainloop()
Dostları ilə paylaş: