I'm trying to learn how to program im python, so i tryed to make this
is basically a number selector, that print a number between 1 and the number that you set..
I make it just to 'traine' and for my friends that play RPG..
Here's the code btw :)
from tkinter import *
from random import randint
#Dice system
def idice():
tfaces=ETFaces.get()
n=int(tfaces)
result=randint(1,n)
LBResult['text']=f'Your roll resulted in: {result}'
#Configs of Window
wind=Tk()
wind.geometry('380x34+200+200')
wind.resizable(False,False)
wind.title('Dice roller')
#Entrys
ETFaces=Entry(wind,width=10)
ETFaces.grid(column=1,row=0,padx=2,pady=5)
#Labels
LBInsert1=Label(wind,text='Number of faces:',relief=GROOVE)
LBInsert1.grid(column=0,row=0,padx=2,pady=5)
LBResult=Label(wind,text='Your roll resulted in: ',relief=GROOVE)
LBResult.grid(column=3,row=0,padx=2,pady=5)
#Buttons
BTRoll=Button(wind,text='Roll',command=idice,relief=GROOVE)
BTRoll.grid(column=2,row=0,padx=2,pady=5)
#End of Window
wind.mainloop()
Comments
Displaying 0 of 0 comments ( View all | Add Comment )