-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtkinterexample.py
65 lines (48 loc) · 1.55 KB
/
tkinterexample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from tkinter import *
window = Tk()
window.title("Tkinter Python")
window.minsize(width=600, height=600)
Label = Label(text="my label")
Label.config(bg="black")
Label.config(fg="white")
#button
def button_clicked():
print("button_clicked")
print(my_entry.get("1.0", END)) # buraya 2 deseydik eğer o zaman text'in içinde ki ilk satırı almazdı ama 1.3 deseydik eğer o zaman text'in içinde ki ilk satırın ilk 3 karakterini almazdı
my_button = Button(text="button", command=button_clicked)
my_button.configure(padx=10, pady=10)
my_button.pack()
#entry
my_entry = Entry(width=20)
my_entry.pack()
#multiline
#text
my_text = Text(width=30, height=5)
my_text.pack()
#scale
my_scale = Scale(from_=0, to_=50)
my_scale.pack()
#spinbox
my_spinbox = Spinbox(from_=0, to_=50)
my_spinbox.pack()
#checkbutton
def checkbutton_selected():
print(check_stated.get())
check_stated = IntVar()
my_checkbutton = Checkbutton(text="Check", variable=check_stated, command=checkbutton_selected)
my_checkbutton.pack()
#radio button
def radio_selected():
print(radio_checked_stated.get())
radio_checked_stated = IntVar()
my_radiobutton = Radiobutton(text="1. Option", value=10, variable=radio_checked_stated, command=radio_selected)
my_radiobutton_2 = Radiobutton(text="1. Option", value=20, variable=radio_checked_stated, command=radio_selected)
my_radiobutton.pack()
my_radiobutton_2.pack()
#listbox
my_listbox = Listbox()
my_list = ["Atil", "Cem", "Ali", "Veli", "Erdal"]
for i in range(len(my_list)):
my_listbox.insert(i, my_list[i])
my_listbox.pack()
window.mainloop()