Tkinter - Butona nasıl fonksiyon ekleriz
Gönderilme zamanı: Cum Eyl 16, 2022 1:25 am
Aşağıda tkinter ile oluşturulan bir butona nasıl fonksiyon ekleyebileceğimize dair örneği görebilirsiniz.
from tkinter import *
root = Tk()
def btnf1():
Label(text='save py prgrammng', fg='blue', bg='yellow',font=12).pack()
def btnf2():
Label(text='open btn in py', fg='blue', bg='yellow',font=12).pack()
root.title('Deneme')
root.geometry('900x900+100+100')
mylabel = Label(text='First Text', fg='blue', bg='yellow',font=12).pack()
mylabel2 = Label(text='Second Text', fg='black', bg='brown',font=12).pack()
#burada command komutuna dikkat !!
Btn1 = Button(text='Submit', fg='red' , bg='yellow', command=btnf1,font=12).pack()
Btn2 = Button (text='open',fg='blue',bg='white', command=btnf2,font=12).pack()
root.mainloop()
İyi Çalışmalar
from tkinter import *
root = Tk()
def btnf1():
Label(text='save py prgrammng', fg='blue', bg='yellow',font=12).pack()
def btnf2():
Label(text='open btn in py', fg='blue', bg='yellow',font=12).pack()
root.title('Deneme')
root.geometry('900x900+100+100')
mylabel = Label(text='First Text', fg='blue', bg='yellow',font=12).pack()
mylabel2 = Label(text='Second Text', fg='black', bg='brown',font=12).pack()
#burada command komutuna dikkat !!
Btn1 = Button(text='Submit', fg='red' , bg='yellow', command=btnf1,font=12).pack()
Btn2 = Button (text='open',fg='blue',bg='white', command=btnf2,font=12).pack()
root.mainloop()
İyi Çalışmalar