+ 1

How to change the color of a frame after pressing some button in python

I want to change the color of a frame when a event means when a button is pressed and the button is placed in the same frame

25th Apr 2019, 11:27 AM
Aksfh
1 ответ
0
from tkinter import * master = Tk() frame = Frame(master, height = "200", width = "200", bg="red") frame.pack() def change(): if frame.bg == "red": frame.bg = "green" else: frame.bg = "red" button = Button(frame, text="Change", command=change) button.pack() mainloop() >>> I am pretty sure it works, if it doesnt just mention me and Ill see if I can fix it
30th Apr 2019, 9:47 AM
Trigger
Trigger - avatar