Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import *
- class uLabel():
- def __init__(self, win):
- self.counter = -1
- self.lab_tx = tk.StringVar()
- self.lab_tx.set("yest")
- tk.Label(win, textvariable = self.lab_tx, bg="yellow").grid(row=0, column=0)
- self.increase_counter()
- tk.Button(win, text="Increase\n Counter",
- command = self.increase_counter, bg="lightblue"
- ).grid(row=1, column=0)
- def increase_counter(self):
- self.counter += 1
- self.lab_tx.set("counter = %d" % (self.counter))
- maping = ["M","M","P","M","T","F","P","E","F"]
- w = Label(root, text=maping[self.counter])
- w.grid(row=1, column=1)
- root = tk.Tk()
- #maping = ["M","M","P","M","T","F","P","E","F"]
- #w = Label(root, text=maping[self.counter])
- #w.grid(row=1, column=1)
- root.geometry("350x400")
- ul=uLabel(root)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement