Skip to content

Commit

Permalink
button
Browse files Browse the repository at this point in the history
  • Loading branch information
Muntazir Jahangir authored and Muntazir Jahangir committed Mar 16, 2024
1 parent aa8d582 commit f4b566b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Binary file modified __pycache__/bingo_function.cpython-311.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion bingo_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def check_win(row_score, column_score, diagonal_score, row_completed, column_com
#print(f"Row Score: {row_score}, Column Score: {column_score}, Diagonal Score: {diagonal_score},Score: {score}, sum:{score+diagonal_score}")
if score + diagonal_score == 5:
print("BINGO!")
messagebox.showinfo("BINGO","\nCongratulations! You've won the game!")
messagebox.showinfo("BINGO","BINGO\nCongratulations! You've won the game!")

# return row_score, column_score, diagonal_score, row_completed, column_completed, left_diagonal_completed, right_diagonal_completed
6 changes: 3 additions & 3 deletions bingo_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
root = Tk()
root.configure(background="green")
root.title("Bingo!!!")
root.geometry("310x190")
root.geometry("360x240")

# Initialize score counters
row_score = 0
Expand All @@ -25,7 +25,7 @@ def change_color(button):
global row_completed, column_completed, left_diagonal_completed, right_diagonal_completed

# change button color
button.config(bg="green", fg="red")
button.config(bg="green", fg="red", state=DISABLED, relief=SUNKEN, disabledforeground="red")

# Update row, column, diagonal scores and check win
check_win(row_score, column_score, diagonal_score, row_completed, column_completed, left_diagonal_completed, right_diagonal_completed,buttons)
Expand All @@ -41,7 +41,7 @@ def change_color(button):
num = data[i*5 + j]
txt = "{:^2}".format(num)
button = Button(root, text=txt, fg="green")
button.grid(row=i, column=j, padx=5, pady=5)
button.grid(row=i, column=j, padx=5, pady=5, ipadx=5, ipady=5, sticky="nsew")
buttons.append(button)
button.config(command=lambda b=button: change_color(b)) # Pass button as argument to lambda

Expand Down

0 comments on commit f4b566b

Please sign in to comment.