-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This virtual game emulates the real-world dice-rolling mechanics and offers players an engaging platform to enjoy various dice games without the need for physical dice. Whether you're a seasoned board gamer or someone looking for a casual pastime, the Virtual Dice Rolling Game is designed to provide hours of fun and excitement.
- Loading branch information
0 parents
commit 2136295
Showing
7 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import tkinter as tk #here we are importing the tkinter which is a standard GUI library for python used for crating Graphic User Interface . | ||
from PIL import Image , ImageTk # we are using Pillow library which is an imaging library . | ||
import random | ||
|
||
window = tk.Tk() | ||
window.geometry("1000x720") | ||
window.title("Roll-a-Dice: Your Virtual dice Rolling Companion") | ||
|
||
|
||
|
||
dice= ["D1.png","D2.png","D3.png","D4.png","D5.png","D6.png"] | ||
|
||
image1 = ImageTk.PhotoImage(Image.open(random.choice(dice))) | ||
image2 = ImageTk.PhotoImage(Image.open(random.choice(dice))) | ||
|
||
label1 = tk.Label(window, image = image1) | ||
label2 = tk.Label(window, image = image2) | ||
|
||
|
||
label1.image=image1 | ||
label2.image=image2 | ||
|
||
label1.place(x=20 , y=200) | ||
label2.place(x=570,y=200) | ||
|
||
#givng the command to the ROLL button | ||
|
||
def dice_roll(): | ||
image1= ImageTk.PhotoImage(Image.open(random.choice(dice))) | ||
label1.configure(image=image1) | ||
label1.image=image1 | ||
|
||
image2= ImageTk.PhotoImage(Image.open(random.choice(dice))) | ||
label2.configure(image=image2) | ||
label2.image=image2 | ||
|
||
button = tk.Button(window, text='ROLL' , bg='green', fg='yellow', font="Times 20 bold", command=dice_roll) | ||
button.place(x=450 , y=0) | ||
|
||
window.mainloop() |