Dec-09-2020, 11:57 PM
One way is to use textvariables in your label's the main methods are set and get.
I would make a list of the dice and set them all to ''. here's an example with the 4d only
I would make a list of the dice and set them all to ''. here's an example with the 4d only
from tkinter import * from random import randint def rollD4(): number= str(randint(1,4)) dice_1.set(number) def on_clear(): dice_1.set('') root = Tk() root.title("Table Top Pal (beta)") root.geometry("500x592") # This is how to resize your root box. (width x height) menubar = Menu(root) root.config(menu=menubar) fileMenu = Menu(menubar,tearoff=0) menubar.add_cascade(label="File",menu=fileMenu) fileMenu.add_command(label="Exit",command=root.destroy) dice_1= StringVar() button1 = Button(root, text="D4", command=rollD4, width=10, height=3) button1.grid(row=0, column=0) clear_btn= Button(root, text='Clear All', command= on_clear) clear_btn.grid(row=2,column=0) label_1 = Label(root, textvariable=dice_1, font=(None, 12), height=2, width=2).grid(row=0, column=2) root.mainloop()