Bu python örneğinde ekrana bir tane button ve bir tane de label nesnesi ekledik. Button nesnesine tıkladığımızda clicked fonksiyonu ile Label’in text değerini değiştirdik.
Python Kodu:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from tkinter import * root = Tk() root.title("www.tasarimkodlama.com") root.geometry("200x100") def clicked(): label["text"]= "clicked" button = Button( text="Click!", command=clicked ).pack() label = Label() label.pack() root.mainloop() |
Ekran Çıktısı:










1 Yorum