I want to achieve the exact appearance of this image
I want to learn how to position the tickboxes, checkbox, dropdown menu, and menu list that exactly looks like the image that I have inserted. I do not know the syntax on how to write the positioning of each
from tkinter import *
import ttk
windows = Tk()
gender = ["male", "female"]
sport = ["Cricket", "Tennis"]
numbers = ['one', 'two', 'three', 'four']
windows.title("Hello Python")
windows.geometry("350x300")
x = IntVar(windows)
for index in range(len(gender)):
radiobutton = Radiobutton(windows,
text=gender[index],
variable=x,
value=index,)
radiobutton.pack(side=LEFT,ipadx=10,ipady=10)
for index in range(len(sport)):
checkboxgui = Checkbutton(windows,
text=sport[index], onvalue=1,
offvalue=0)
checkboxgui.pack(side=LEFT, anchor=CENTER, ipadx=10, ipady=10)
clicked = StringVar(windows)
clicked.set("one")
drop = ttk.Combobox(windows, textvariable=clicked,values=numbers)
drop.pack()
listbox = Listbox(windows,selectmode=MULTIPLE)
listbox.pack()
listbox.insert(1,"one")
listbox.insert(2,"two")
listbox.insert(3,"three")
listbox.insert(4,"four")
listbox.config(height=listbox.size())
windows.mainloop()
Aucun commentaire:
Enregistrer un commentaire