Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from random import *
- def roll():
- dice1 = randint(1, 6)
- dice2 = randint(1, 6)
- dise_label.config(text=f"{dice1} {dice2}\nВсего: {dice1 + dice2}")
- window = Tk()
- window.title("Симулятор броска игральных костей")
- window.geometry(f"400x400+{(window.winfo_screenwidth() // 2) - 200}+{(window.winfo_screenheight() // 2) - 200}")
- dise_label = Label(window, text="", font=("Helvetica", 14))
- dise_label.grid(padx=20, pady=50, sticky="nsew")
- roll_button = Button(window, text="Бросить", command=roll)
- roll_button.grid(padx=175, pady=175, sticky="nsew")
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement