Button action to set Button background : Button : GUI Tk PYTHON examples


PYTHON examples » GUI Tk » Button »

 

Button action to set Button background


Button action to set Button background


from Tkinter import *

class App:
    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
        self.button.pack(side=LEFT)

        self.hi_there = Button(frame, text="Hello", command=self.say_hi)
        self.hi_there.pack(side=LEFT)

    def say_hi(self):
    if self.hi_there["background"== "green":  
      self.hi_there["background""yellow"
    else:
      self.hi_there["background""green"

root = Tk()

app = App(root)

root.mainloop()

           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo GUI Tk
» Button


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0