0% found this document useful (0 votes)
10 views6 pages

Simple Roulette

The document contains a Python script that implements a shopping application using the Tkinter library. It allows users to buy items, track quantities, and apply vouchers obtained from a roulette game. The application features a user interface for item selection, purchasing, and checkout, along with a separate roulette window for obtaining discounts.

Uploaded by

figaroladanielle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Simple Roulette

The document contains a Python script that implements a shopping application using the Tkinter library. It allows users to buy items, track quantities, and apply vouchers obtained from a roulette game. The application features a user interface for item selection, purchasing, and checkout, along with a separate roulette window for obtaining discounts.

Uploaded by

figaroladanielle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

‭mport‬‭

i tkinter‬‭
as‬‭
tk‬
import‬‭
‭ random‬
import‬‭
‭ time‬
import‬‭
‭ math‬
import‬‭
‭ tkinter.messagebox‬‭
as‬‭
messagebox‬

class‬‭
‭ Shop:‬
def‬‭
‭ __init__‬
(‬
‭self‬
‭ , root):‬

self‬
‭ .root = root‬

self‬
‭ .root.title(‬
‭ "Shop"‬
‭ )‬‭
‭ #title‬
self‬
‭ .items = [‬
‭ f"Item‬‭
‭ {‭
i‬ +‬‭1‬
}‭
‭"
‬‬‭
for‬‭i‬‭
in‬‭
range‬
(‬
‭8‭
‭)
‬]‬‭
# range ng items 1 - 8‬
self‬
‭ .prices = [‬
‭ 500‬
‭ ,‬‭
‭ 550‬,‬‭
‭ 570‬,‬‭
‭ 400‬
,‬‭
‭ 600‬
,‬‭
‭ 650‬
,‬‭
‭ 620‬
,‬‭
‭ 520‬
]‬‭
‭ # sample prices‬
self‬
‭ .voucher =‬‭
‭ None‬‭
#declare muna as no voucher‬
self‬
‭ .item_quantities = [‬
‭ 0‬
‭] *‬‭
‭ len‬
(‭
‭s‬elf‬
.items)‬‭
‭ #declare pang track ng‬
quantity‬

‭elf‬
s .item_labels = []‬‭
‭ # labels items‬
self‬
‭ .item_buttons = []‬‭
‭ # buttons‬
self‬
‭ .quantity_labels = []‬‭
‭ #quantity labels‬

for‬‭
‭ i, (item, price)‬‭
in‬‭
enumerate‬(‬
‭zip‬
‭ (‭
‭s‬elf‬
.items,‬‭
‭ self‬
.prices)):‬

label = tk.Label(‬
‭ self‬
‭ .root,‬‭
‭ text‬
=‬
‭f"‬
‭ {‬
‭item‬
‭ }‬
‭:‬‭
‭ $‬{‭
‭p
‬rice‬
}‬
‭ "‬
‭ ,‬

font‬
‭ =(‬
‭ "Arial"‬
‭ ,‬‭
‭ 14‬
))‬‭
‭ # new label widget‬
label.pack()‬

self‬
‭ .item_labels.append(label)‬

‭utton = tk.Button(‬
b self‬
‭ .root,‬‭
‭ text‬
=‬
‭"Buy"‬
‭ ,‬‭
‭ command‬
=‭
‭l‬ambda‬‭
i=i:‬
self‬
‭ .buy_item(i))‬

button.pack()‬‭
‭ # buttons for buying items‬
self‬
‭ .item_buttons.append(button)‬

quantity_label = tk.Label(‬
‭ self‬
‭ .root,‬‭
‭ text‬
=‭
‭"
‬Quantity:‬‭
0"‬
,‬

font‬
‭ =(‬
‭ "Arial"‬
‭ ,‬‭
‭ 12‬
))‬

quantity_label.pack()‬‭
‭ # label for quantity‬
self‬
‭ .quantity_labels.append(quantity_label)‬

self‬
‭ .voucher_button = tk.Button(‬
‭ self‬
‭ .root,‬‭
‭ text‬
=‬
‭ "Get Voucher from‬

Roulette"‬
‭ ,‬‭
‭ command‬
=‭
‭s
‬elf‬
.get_voucher)‬

self‬
‭ .voucher_button.pack(‬
‭ pady‬
‭ =‬
‭10‬
‭ )‬‭
‭ # button‬‭
for getting voucher by‬
roulette‬

self‬
‭ .checkout_button = tk.Button(‬
‭ self‬
‭ .root,‬‭
‭ text‬
=‭
‭"‬Checkout"‬
,‬

command‬
‭ =‭
‭s
‬elf‬
.checkout)‬

self‬
‭ .checkout_button.pack(‬
‭ pady‬
‭ =‬
‭10‬
‭ )‬‭
‭ # checkout‬‭
button‬

def‬‭
‭ buy_item‬
(‬
‭self‬
‭ , index):‬

self‬
‭ .item_quantities[index] +=‬‭
‭ 1‬‭
# sa quantities‬‭
plus 1 if click‬
self‬
‭ .quantity_labels[index].config(‬
‭ text‬
‭ =‬
‭f"Quantity:‬

{‭
‭s
‬elf‬
.item_quantities[index]‬
‭ }‭
‭"‬‬
)‬

def‬‭
‭ get_voucher‬
(‭
‭s‬elf‬
):‬

self‬
‭ .roulette_window = tk.Toplevel(‬
‭ self‬
‭ .root)‬

self‬
‭ .roulette = Roulette(‬
‭ self‬
‭ .roulette_window)‬‭
‭ # getting voucher frim‬
roullete in another window‬

self‬
‭ .roulette.on_voucher_win =‬‭
‭ self‬
.apply_voucher‬

def‬‭
‭ apply_voucher‬(‬
‭self‬
‭ , voucher):‬

self‬
‭ .voucher = voucher‬‭
‭ # to apply voucher in‬‭
a item‬
tk.messagebox.showinfo(‬
‭ "Voucher Obtained"‬
‭ ,‬‭
‭ f"You received a voucher:‬
{‭
‭v
‬oucher[‬
1‬
‭]‬
‭ }‬
‭"‬
‭ )‬

def‬‭
‭ checkout‬
(‬
‭self‬
‭ ):‬

total =‬‭
‭ 0‬
checkout_details = []‬ ‭
‭ # List to hold details‬‭
of items purchased‬

for‬‭
‭ i‬‭
in‬‭
range‬
(‬
‭len‬
‭ (‬
‭self‬
‭ .items)):‬

price =‬‭
‭ self‬.prices[i]‬

quantity =‬‭
‭ self‬.item_quantities[i]‬

‭ Check if the voucher applies to the current‬‭


# item‬
if‬‭
‭ self‬
.voucher‬‭
‭ and‬‭
self‬
.voucher[‬
‭ 0‭
‭]‬ ==‬‭
i +‬‭
1‬:‬ ‭
‭ # Assuming‬
voucher[0] is the item index (1-based)‬

price -=‬‭
‭ 10‬ ‭
# Apply voucher discount‬‭kasi $10 off lahat‬

if‬‭
‭ quantity >‬‭
0‬
:‬ ‭
‭ # Only include items‬‭
that were purchased‬
item_total = price * quantity‬‭
‭ # multiply‬‭the price to how many‬
items purchased‬

total += item_total‬‭
‭ # total of items‬‭
bought‬
checkout_details.append(‬
‭ f"‬
‭ {‬
‭self‬
‭ .items[i]‬
‭ }‬‭
‭ (Quantity:‬
{‭
‭q
‬uantity‬
}‬
‭) - $‬
‭ {‬
‭item_total‬
‭ }‬
‭ "‬
‭)‬‭
‭ #details nung mga binili‬

‭ Create a message to display the items bought and the total‬


#
if‬‭
‭ checkout_details:‬
details_message =‬‭
‭ "‬
\n‬
‭ "‬
‭ .join(checkout_details)‬‭
‭ +‬‭
f"‬
\n\n‬
‭ Total amount‬

due: $‬
‭ {‭
‭t
‬otal‬}‬
‭"‬

tk.messagebox.showinfo(‬
‭ "Checkout"‬
‭ , details_message)‬‭
‭ # magshoshow if‬
click yung checkout then details‬

else‬
‭ :‬

tk.messagebox.showwarning(‬
‭ "Checkout"‬
‭ ,‬‭
‭ "No‬‭
items selected for‬
purchase."‬
‭ )‬

class‬‭
‭ Roulette:‬
def‬‭
‭ __init__‬
(‬
‭self‬
‭ , root):‬

self‬
‭ .root = root‬

self‬
‭ .root.title(‬
‭ "Roulette"‬
‭ )‬‭
‭ #title of roulette‬

# Create the roulette wheel yung size‬



‭elf‬
s .canvas = tk.Canvas(‬
‭ self‬
‭ .root,‬‭
‭ width‬
=‬
‭500‬
‭ ,‬‭
‭ height‬
=‭
‭ 5
‬00‬
)‬

self‬
‭ .canvas.pack()‬

‭ Yung roulette wheel outline‬


#
self‬
‭ .canvas.create_oval(‬
‭ 50‬
‭ ,‬‭
‭ 50‬
,‬‭
‭ 450‬
,‬‭
‭ 450‬
,‬‭
‭ fill‬
=‬
‭ "white"‬
‭ )‬

‭ numbers and their labels‬


#
self‬
‭ .numbers = [i‬‭
‭ for‬‭
i‬‭
in‬‭ range‬
(‭
‭1‬‬
,‬‭
‭ 9‬
)]‬‭
‭ # numbers‬‭
1 - 8‬
self‬
‭ .number_labels = []‬

self‬
‭ .number_rects = []‬

angle_increment =‬‭
‭ 360‬‭
/‬‭
len‬ (‭
‭s
‬elf‬
.numbers)‬‭
‭ #‬‭
divide 360 to number of‬
items in self.numbers which is 8 para magawa yung 8 slice‬

for‬‭
‭ i, number‬‭
in‬‭
enumerate‬(‬
‭ self‬
‭ .numbers):‬

angle = i * angle_increment‬

x =‬‭
‭ 250‬‭
+‬‭
220‬‭
* math.cos(math.radians(angle))‬‭ # coords ng numbers 1‬
- 8 the x and y location‬

y =‬‭
‭ 250‬‭
+‬‭
220‬‭
* math.sin(math.radians(angle))‬
self‬
‭ .number_labels.append(‬
‭ self‬
‭ .canvas.create_text(x,‬‭
‭ y,‬
text‬
‭ =‭
‭s
‬tr‬
(number),‬‭
‭ font‬
=(‬
‭ "Arial"‬
‭ ,‬‭
‭ 16‬,‬‭
‭ "bold"‬)))‬‭
‭ #size‬‭
of num 1 - 8‬
self‬
‭ .number_rects.append(‬
‭ self‬
‭ .canvas.create_arc(‬
‭ 50‬
‭ ,‬‭
‭ 50‬
,‬‭
‭ 452‬
,‬‭
‭ 450‬
,‬

start‬
‭ =angle - angle_increment /‬‭
‭ 2‬
,‬‭
‭ extent‬=angle_increment,‬‭
‭ fill‬=‭
‭"
‬blue"‬))‬

#outline nung roulette‬

‭ spin button‬
#
self‬
‭ .spin_button = tk.Button(‬
‭ self‬
‭ .root,‬‭
‭ text‬
=‬
‭"Spin"‬
‭ ,‬‭
‭ command‬
=‭
‭s‬elf‬
.spin)‬

self‬
‭ .spin_button.pack()‬

‭ label to display the winning number‬


#
self‬
‭ .result_label = tk.Label(‬
‭ self‬
‭ .root,‬‭
‭ text‬
=‬
‭""‬
‭ ,‬‭
‭ font‬
=(‬
‭ "Arial"‬
‭ ,‬‭
‭ 16‬
))‬

self‬
‭ .result_label.pack()‬

‭ discount na makukuha‬
#
self‬
‭ .items = [‬
‭ ‭$10 off item 1"‬
" ,‬‭
‭ "$10 off item‬‭
2"‬,‬‭
‭ "$10 off item 3"‬,‬

"$10 off item 4"‬
‭ ,‬‭
‭ "$10 off item‬‭5"‬
,‬‭
‭ "$10 off item 6"‬,‬

"$10 off item 7"‬
‭ ,‬‭
‭ "$10 off item‬‭8"‬
]‬

‭ Create the winnings box frame‬


#
self‬
‭ .winnings_frame = tk.Frame(‬
‭ self‬
‭ .root,‬‭
‭ width‬
=‬
‭ 150‬
‭ ,‬‭
‭ height‬
=‬
‭ 30‬
‭ ,‬‭
‭ bd‬
=‬
‭ 2‬
‭ ,‬

relief‬
‭ =tk.SUNKEN)‬

self‬
‭ .winnings_frame.pack(‬
‭ side‬
‭ =tk.TOP,‬‭
‭ anchor‬
=tk.NW,‬‭
‭ padx‬
=‭
‭1
‬0‬
,‬‭
‭ pady‬
=‭
‭1
‬0‬ )‬

‭ Create a label to display the winnings (initially‬‭


# hidden)‬
self‬
‭ .winnings_label = tk.Label(‬
‭ self‬
‭ .winnings_frame,‬‭
‭ text‬
=‭
‭"
‬"‬
,‬

font‬
‭ =(‬
‭ "Arial"‬
‭ ,‬‭
‭ 12‬
),‬‭
‭ fg‬
=‬
‭ "green"‬
‭ )‬

self‬
‭ .winnings_label.pack(‬
‭ fill‬
‭ =tk.X)‬

self‬
‭ .winnings_label.bind(‬
‭ "<Button-1>"‬
‭ ,‬‭
‭ self‬
.show_winnings_details)‬

‭ to Hide the winnings label initially‬


#
self‬
‭ .winnings_label.grid_forget()‬

‭ Create roulette timer frame‬
#
self‬
‭ .timer_frame = tk.Frame(‬
‭ self‬
‭ .root,‬‭
‭ bd‬
=‬
‭ 1‭
‭,
‬‬‭
relief‬
=tk.SUNKEN)‬

self‬
‭ .timer_frame.pack(‬
‭ side‬
‭ =tk.BOTTOM,‬‭
‭ fill‬=tk.X)‬

‭ Create timer label and voucher label‬


#
self‬
‭ .timer_label = tk.Label(‬
‭ self‬
‭ .timer_frame,‬‭
‭ text‬
=‬
‭ "24:00:00"‬
‭ ,‬

font‬
‭ =(‬
‭ "Arial"‬
‭ ,‬‭
‭ 12‬
))‬

self‬
‭ .timer_label.pack(‬
‭ side‬
‭ =tk.RIGHT,‬‭
‭ padx‬
=‬
‭5‭
‭)
‬‬

‭ voucher available na nagrurun‬


#
self‬
‭ .voucher_label = tk.Label(‬
‭ self‬
‭ .timer_frame,‬‭
‭ text‬
=‭
‭"
‬Voucher Available‬
Until:"‬
‭ ,‬‭
‭ font‬
=(‬
‭ "Arial"‬
‭ ,‬‭
‭ 12‬
))‬

self‬
‭ .voucher_label.pack(‬
‭ side‬
‭ =tk.LEFT,‬‭
‭ padx‬
=‭
‭5‬‬
)‬

‭elf‬
s .countdown =‬‭
‭ 86400‬‭
# Set initial countdown‬‭
to 1 minute‬
self‬
‭ .timer_running =‬‭
‭ False‬
self‬
‭ .spun_once =‬‭
‭ False‬ ‭
# Flag to track if‬‭
spin has been used‬

def‬‭
‭ spin‬
(‬
‭self‬
‭ ):‬

if not‬‭
‭ self‬.spun_once‬‭
‭ or‬‭
self‬
.countdown ==‬‭
‭ 0‬
:‬ ‭
‭ # condition if kapag‬
zero na timer‬

self‬
‭ .spin_button.config(‬
‭ state‬
‭ =‬
‭"disabled"‬
‭ )‬‭
‭ # naka disable kapag‬
nagrurun pa timer‬

self‬
‭ .spin_anim()‬

self‬
‭ .start_timer()‬

self‬
‭ .spun_once =‬‭
‭ True‬‭
# pwede na ulit magspin‬‭if zero na timer‬

‭ef‬‭
d spin_anim‬
(‬
‭self‬
‭ ):‬

# Randomly select the winning number from 1 - 8‬

winning_number = random.choice(‬
‭ self‬
‭ .numbers)‬

# Rotate the numbers‬



angle =‬‭
‭ 0‬
while‬‭
‭ angle <‬‭
360‬‭*‬‭
6‬
:‬ ‭
‭ # Increase the total‬‭
rotation angle‬
angle +=‬‭
‭ 5‬
for‬‭
‭ i, rect‬‭in‬‭
enumerate‬
(‬
‭self‬
‭ .number_rects):‬

x0, y0, x1, y1 =‬‭
‭ self‬
.canvas.coords(rect)‬

x =‬‭
‭ 250‬‭+‬‭
200‬‭
* math.cos(math.radians(angle‬‭+ i *‬‭
360‬‭
/‬
len‬
‭ (‭
‭s
‬elf‬
.numbers)))‬‭
‭ #coords nung spinning animation‬‭x and y‬
y =‬‭
‭ 250‬‭+‬‭
200‬‭
* math.sin(math.radians(angle‬‭+ i *‬‭
360‬‭
/‬
len‬
‭ (‭
‭s
‬elf‬
.numbers)))‬

self‬
‭ .canvas.coords(rect, x -‬‭
‭ 20‬
, y‬‭
‭ -‬‭
20‬
, x +‬‭
‭ 20‬
, y +‬‭
‭ 20‬)‬‭
‭ #size‬
nung umiikot HAHA‬

self‬
‭ .canvas.move(‬
‭ self‬
‭ .number_labels[i],‬‭
‭ x - x0, y - y0)‬
self‬
‭ .root.update()‬

time.sleep(‬
‭ 0.005‬
‭ )‬ ‭
‭ # Reduce the sleep time‬‭
for faster animation‬

# Highlight the winning number and update the winnings label‬



for‬‭
‭ i, number‬‭
in‬‭
enumerate‬
(‬
‭ self‬
‭ .numbers):‬

if‬‭
‭ number == winning_number:‬
self‬
‭ .canvas.itemconfig(‬
‭ self‬
‭ .number_rects[i])‬

self‬
‭ .winnings_label.config(‬
‭ text‬
‭ =‬
‭f"You‬‭
‭ won‬‭
{‬self‬
‭ .items[i]‬
‭ }‭
‭"‬‭
)
‬‬
self‬
‭ .winnings_label.grid()‬ ‭
‭ # Show‬‭
yung winnings label‬

if‬‭
‭ hasattr‬
(‬
‭self‬
‭ ,‬‭
‭ 'on_voucher_win'‬
):‬

self‬
‭ .on_voucher_win((number,‬‭
‭ self‬
.items[i]))‬ ‭
‭ # Send the‬
number and item, pagapply ng voucher sa item 1 time lang‬

break‬

‭ After spin animation ends, reset‬‭


# the timer and hide winnings‬
self‬
‭ .timer_running =‬‭
‭ False‬
self‬
‭ .spin_button.config(‬
‭ state‬
‭ =‬
‭"normal"‬
‭ )‬ ‭
‭ # Enable the spin button‬
after mag 0 timer‬

self‬
‭ .winnings_label.grid_forget()‬ ‭
‭ # Hide‬‭
the winnings label para‬
ibang voucher lumabas after spin ulit‬

self‬
‭ .countdown =‬‭
‭ 86400‬ ‭
# Reset the countdown‬

# Update the timer‬



if‬‭
‭ self‬
.timer_running:‬

self‬
‭ .countdown -=‬‭
‭ 1‬
minutes, seconds =‬‭
‭ divmod‬
(‬
‭self‬
‭ .countdown,‬‭
‭ 60‬
)‬‭
‭ # converts‬
seconds to minutes‬

hours, minutes =‬‭
‭ divmod‬
(minutes,‬‭
‭ 60‬
)‬‭
‭ # converts minutes to‬
hours‬

‭elf‬
s .timer_label.config(‬
‭ text‬
‭ =‭
‭f‬"‬
{‬
‭ hours‬
‭ :‬
‭02d‬
‭ }‬
‭:‬
‭ {‬
‭minutes‬
‭ :‬
‭02d‬
‭ }‭
‭:‬‭
{
‬‬seconds‬
‭ :‬
‭ 02d‬
‭ }‬
‭ "‬
‭ )‬

#label nung timer‬

‭ Check if the countdown has finished‬


#
if‬‭
‭ self‬
.countdown ==‬‭
‭ 0‬
:‬

self‬
‭ .timer_running =‬‭
‭ False‬ ‭
# Stop‬‭
the timer if 0 na‬
self‬
‭ .spin_button.config(‬
‭ state‬
‭ =‭
‭"
‬normal"‬
)‬ ‭
‭ # Enable the spin‬
button ulit‬

self‬
‭ .countdown =‬‭
‭ 86400‬ ‭
# Reset the‬‭
countdown kapag nag spin‬
ulit‬

break‬

‭ Highlight the winning number and update the‬‭


# winnings label‬
for‬‭
‭ i, number‬‭
in‬‭
enumerate‬
(‬
‭ self‬
‭ .numbers):‬

if‬‭
‭ number == winning_number:‬
self‬
‭ .canvas.itemconfig(‬
‭ self‬
‭ .number_rects[i])‬

self‬
‭ .winnings_label.config(‬
‭ text‬
‭ =‬
‭f"You‬‭
‭ won‬‭
{‬self‬
‭ .items[i]‬
‭ }‭
‭"‬‭
)
‬‬‭
#‬
label ng nakuha mo‬

self‬
‭ .winnings_label.grid()‬ ‭
‭ # Show‬‭
the winnings label‬
break‬

def‬‭
‭ show_winnings_details‬
(‭
‭s
‬elf‬
, event):‬

‭ Display detailed winnings information in a popup window‬
#
popup = tk.Toplevel(‬
‭ self‬
‭ .root)‬

popup.title(‬
‭ "Winnings Details"‬
‭ )‬

popup.geometry(‬
‭ "300x100"‬
‭ )‬

‭ Create a label to display the winnings details‬


#
details_label = tk.Label(popup,‬‭
‭ text‬ =‬
‭self‬
‭ .winnings_label.cget(‬
‭ "text"‬
‭ ),‬

font‬
‭ =(‬
‭ "Arial"‬
‭ ,‬‭
‭ 12‬
))‬

details_label.pack(‬
‭ padx‬
‭ =‬
‭10‬
‭ ,‬‭
‭ pady‬
=‭
‭1‬0‬
)‬

‭ Create a close button‬


#
close_button = tk.Button(popup,‬‭
‭ text‬
=‬
‭"Use voucher"‬
‭ )‬

close_button.pack()‬

def‬‭
‭ start_timer‬
(‭
‭s‬elf‬
):‬

self‬
‭ .timer_running =‬‭
‭ True‬‭
# pagstart ng timer‬
self‬
‭ .update_timer(‬
‭ self‬
‭ .root)‬

def‬‭
‭ update_timer‬
(‬
‭self‬
‭ , root):‬

if‬‭
‭ self‬
.timer_running:‬

if‬‭
‭ self‬
.countdown >‬‭
‭ 0‬
:‬

self‬
‭ .countdown -=‬‭
‭ 1‬‭
# reverse timer‬‭
papunta zero‬
minutes, seconds =‬‭
‭ divmod‬
(‬
‭self‬
‭ .countdown,‬‭
‭ 60‬
)‬‭
‭ # Ginamit divmod‬
function para maconvert ang remaining seconds into hours, minutes, and seconds‬

hours, minutes =‬‭
‭ divmod‬(minutes,‬‭
‭ 60‬
)‬‭
‭ # ang divmod ay ginamit‬
para sa pagcalculate ng total countdown papunta zero.‬

‭elf‬
s .timer_label.config(‬
‭ text‬
‭ =‭
‭f‬"‬
{‬
‭ hours‬
‭ :‬
‭02d‬
‭ }‬
‭:‬
‭ {‬
‭minutes‬
‭ :‬
‭02d‬
‭ }‭
‭:‬‭
{
‬‬seconds‬
‭ :‬
‭ 02d‬
‭ }‬
‭ "‬
‭ )‬ ‭
‭ #‬
digits na display para sa countdown‬

root.after(‬
‭ 1000‬
‭ ,‬‭
‭ self‬
.update_timer,‬‭
‭ root)‬‭# ginamit pang update‬
ng timer hanggat hindi zero ito‬

else‬
‭ :‬

self‬
‭ .timer_running =‬‭
‭ False‬ ‭ # Stop‬‭
the timer when it reaches‬
zero‬

self‬
‭ .spin_button.config(‬
‭ state‬
‭ =‭
‭"
‬normal"‬
)‬ ‭
‭ # Enable the spin‬
button‬

self‬
‭ .winnings_label.grid_forget()‬ ‭
‭ # Hide the winnings label‬

if‬‭
‭ __name__ ==‬‭
"__main__"‬
:‬

root = tk.Tk()‬

shop = Shop(root)‬

root.mainloop()‬

You might also like