Skip to content

Commit 11930b6

Browse files
Merge pull request #2708 from pratyanj/bank_managment_system_pratyanj
Bank managment system pratyanj
2 parents f8b9f0a + a24cb1b commit 11930b6

File tree

5 files changed

+1408
-11
lines changed

5 files changed

+1408
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ print(lower+upper+odd+even)
2424

2525
# thumbnail cache on Windows
2626
Thumbs.db
27+
bankmanaging.db

AI Game/Tic-Tac-Toe-AI/tictactoe.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import tkinter as tk #provides a library of basic elements of GUI widgets
21
from tkinter import messagebox #provides a different set of dialogues that are used to display message boxes
3-
import random
4-
2+
import customtkinter as ctk
3+
import customtkinter as messagebox
54
def check_winner(board, player):
65
# Check rows, columns, and diagonals for a win
76
for i in range(3):
@@ -63,7 +62,8 @@ def best_move(board):
6362
def make_move(row, col):
6463
if board[row][col] == ' ':
6564
board[row][col] = 'X'
66-
buttons[row][col].config(text='X')
65+
# in tk we use the config but in customtkinter we use configure for
66+
buttons[row][col].configure(text='X')
6767
if check_winner(board, 'X'):
6868
messagebox.showinfo("Tic-Tac-Toe", "You win!")
6969
root.quit()
@@ -79,15 +79,15 @@ def make_move(row, col):
7979
def ai_move():
8080
row, col = best_move(board)
8181
board[row][col] = 'O'
82-
buttons[row][col].config(text='O')
82+
buttons[row][col].configure(text='O')
8383
if check_winner(board, 'O'):
8484
messagebox.showinfo("Tic-Tac-Toe", "AI wins!")
8585
root.quit()
8686
elif is_board_full(board):
8787
messagebox.showinfo("Tic-Tac-Toe", "It's a draw!")
8888
root.quit()
89-
90-
root = tk.Tk()
89+
# change old UI code to customtkinter UI
90+
root = ctk.CTk()
9191
root.title("Tic-Tac-Toe")
9292

9393
board = [[' ' for _ in range(3)] for _ in range(3)]
@@ -96,8 +96,8 @@ def ai_move():
9696
for i in range(3):
9797
row_buttons = []
9898
for j in range(3):
99-
button = tk.Button(root, text=' ', font=('normal', 30), width=5, height=2, command=lambda row=i, col=j: make_move(row, col))
100-
button.grid(row=i, column=j)
99+
button = ctk.CTkButton(root, text=' ', font=('normal', 30), width=100, height=100, command=lambda row=i, col=j: make_move(row, col))
100+
button.grid(row=i, column=j, padx=2, pady=2)
101101
row_buttons.append(button)
102102
buttons.append(row_buttons)
103103

0 commit comments

Comments
 (0)