code button trong python

Solutions on MaxInterview for code button trong python by the best coders in the world

showing results for - "code button trong python"
Luca
16 Nov 2018
1from tkinter import *
2from tkinter import messagebox
3 
4top = Tk()
5top.geometry("200x100")
6 
7def clickRedButton():
8    messagebox.showinfo("Hello", "Red Button clicked")
9 
10def clickBlueButton():
11    messagebox.showinfo("Hello", "Blue Button clicked")
12 
13b1 = Button(top, text = "Red", command = clickRedButton, activeforeground = "red", activebackground = "pink", pady = 10)
14b2 = Button(top, text = "Blue", command = clickBlueButton, activeforeground = "blue", activebackground = "pink", pady = 10)
15b3 = Button(top, text = "Green", activeforeground = "green", activebackground = "pink", pady = 10)
16b4 = Button(top, text = "Yellow", activeforeground = "yellow", activebackground = "pink", pady = 10)
17b1.pack(side = LEFT)
18b2.pack(side = RIGHT)
19b3.pack(side = TOP)
20b4.pack(side = BOTTOM)
21top.mainloop()
22
similar questions
queries leading to this page
code button trong python