From c698e5029b0c597b7749ff7bccf5aec87d551354 Mon Sep 17 00:00:00 2001 From: Varun JP <92174003+Varun-JP@users.noreply.github.com> Date: Thu, 27 Oct 2022 13:33:37 +0530 Subject: [PATCH] Dice in python Dice using gui --- DiceGui.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 DiceGui.py diff --git a/DiceGui.py b/DiceGui.py new file mode 100644 index 0000000..fc5a2e9 --- /dev/null +++ b/DiceGui.py @@ -0,0 +1,37 @@ +# Importing tkinter and random modules +from tkinter import * +import random + + +window = Tk() +window.configure(bg="#080808") + +window.geometry("550x350") + +window.title("virtual dice ") + + + +# Creating function to roll the dices +def roll_dices(): + #dot codes + dice_dots = ['\u2680', '\u2681', + '\u2682', '\u2683', + '\u2684', '\u2685'] + + label.configure( + text=f'{random.choice(dice_dots)}') + label.pack() + + +#button for rolling +roll_button = Button(window, text="GENERATE",width=30, height=1,font=15, bg="#08b106",bd=3, command=roll_dices) + +#position +roll_button.pack(padx=2, pady=10) + +#Label +label = Label(window, font=("Helvetica", 200), + bg="#080808", fg="#00CC66") + +window.mainloop()