Dec-07-2020, 09:28 PM
from tkinter import * from random import randint def rollD4(): label = Label(root, text=randint(1, 4), font=(None, 12), height=2, width=2).grid(row=0, column=2) def rollD6(): label = Label(root, text=randint(1, 6), font=(None, 12), height=2, width=2).grid(row=1, column=2) def rollD8(): label = Label(root, text=randint(1, 8), font=(None, 12), height=2, width=2).grid(row=2, column=2) def rollD10(): label = Label(root, text=randint(1, 10), font=(None, 12), height=2, width=2).grid(row=3, column=2) def rollD12(): label = Label(root, text=randint(1, 12), font=(None, 12), height=2, width=2).grid(row=4, column=2) def rollD20(): label = Label(root, text=randint(1, 20), font=(None, 12), height=2, width=2).grid(row=5, column=2) def rollD100(): label = Label(root, text=randint(1, 100), font=(None, 12), height=2, width=2).grid(row=6, column=2) root = Tk() root.title("Table Top Pal (beta)") root.geometry("500x392") # 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) button1 = Button(root, text="D4", command=rollD4, width=10, height=3) button1.grid(row=0, column=0) button2 = Button(root, text="D6", command=rollD6, width=10, height=3) button2.grid(row=1, column=0) button3 = Button(root, text="D8", command=rollD8, width=10, height=3) button3.grid(row=2, column=0) button4 = Button(root, text="D10", command=rollD10, width=10, height=3) button4.grid(row=3, column=0) button5 = Button(root, text="D12", command=rollD12, width=10, height=3) button5.grid(row=4, column=0) button6 = Button(root, text="D20", command=rollD20, width=10, height=3) button6.grid(row=5, column=0) button7 = Button(root, text="D100", command=rollD100, width=10, height=3) button7.grid(row=6, column=0) root.mainloop()I am just trying to make a button that clears all of the dice roller outputs.