alright well i am not good at writing programs at all. actually im really bad at it but im trying. alright right now im tring to figure out how to change the color of a button when you click on it. for example if i have a button that says "a" and its blue, when you click on it, it will change to red.
this is what i have written so far.
from Tkinter import *
c1 = "blue"
class App:
def __init__(self, master, c1):
frame = Frame(master)
frame.pack()
self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
self.button.pack(side=LEFT)
self.there = Button(frame, text="Hello", fg=c1, command=self.clr)
self.there.pack(side=LEFT)
def clr(self):
c1 = "red"
root = Tk()
app = App(root)
root.mainloop()
the only problem with that is c1 is not in parameters for __init__. i guess there can only be 2 parameters for __init__ and using the class app is the only way i learned how to make a frame. so any help?
this is what i have written so far.
from Tkinter import *
c1 = "blue"
class App:
def __init__(self, master, c1):
frame = Frame(master)
frame.pack()
self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
self.button.pack(side=LEFT)
self.there = Button(frame, text="Hello", fg=c1, command=self.clr)
self.there.pack(side=LEFT)
def clr(self):
c1 = "red"
root = Tk()
app = App(root)
root.mainloop()
the only problem with that is c1 is not in parameters for __init__. i guess there can only be 2 parameters for __init__ and using the class app is the only way i learned how to make a frame. so any help?