Advertisement
virtualideaz

Change Window Background Event in Python 3

Oct 6th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. from tkinter import messagebox
  4.  
  5. root = Tk()
  6.  
  7.  
  8. #add an event to the button
  9. def changeBGcolor():
  10.     root.config(background="green")
  11. #add a button
  12. Button1 = Button(root, text="CHANGE BACKGROUND", height=2, width=20,
  13.                  command = changeBGcolor)
  14. Button1.place(x=50,y=50)
  15.  
  16. root.geometry("300x200")
  17. root.mainloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement