基于Qt的一款五子棋应用(包括AI,双人对战,联网对战,华丽的UI界面,音效等)

        先将程序开源,后期补上相应文档介绍,具体代码请参考我的github:https://github.com/Vashonisonly/GoBang-

        其中联网对战模块尚且不够完善,后面会修复的。

  • 5
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
用tkinter 实现的五子棋UI界面 import tkinter as tk from tkinter import messagebox from chessboard import ChessBoard ChessBoard = ChessBoard() class GUI(object): def __init__(self): self.counter = 0 self.winner = 0 self.is_start = False self.is_surrender = False self.window = tk.Tk() # 窗口对象(首字母大写) self.window.title('Gobang') self.window.geometry('800x540') self.window.resizable(width = False, height = False) # 画布对象 棋盘 self.canvas = tk.Canvas(self.window, height = 540, width = 540) self.chessboard = tk.PhotoImage(file = 'Gobang_chessboard/chessboard.gif') self.blackpoint = tk.PhotoImage(file = 'Gobang_chessboard/blackpoint.gif') self.whitepoint = tk.PhotoImage(file = 'Gobang_chessboard/whitepoint.gif') self.canvas.create_image(0, 0, anchor = 'nw', image = self.chessboard) self.canvas.bind("", self.get_point) self.start_point = 10 # 起始点位置 self.step = 35 # 每个格子的跨度 self.canvas.place(x = 0, y = 0) # 标签对象 self.l_info = tk.Label(self.window, text = 'Not started', font=('Arial', 12), width = 25, height = 2) self.l_info.place(x = 545, y = 0) # 文本框对象 self.t = tk.Text(self.window, height = 15) self.t.place(x = 540, y = 40) # 按钮对象 self.f_header = tk.Frame(self.window, highlightthickness=0) self.b_start = tk.Button(self.f_header, text = 'start', command = self.start) self.b_restart = tk.Button(self.f_header, text = 'restart', command = self.restart) self.b_regret = tk.Button(self.f_header, text = 'regret', command = self.regret) self.b_surrender = tk.Button(self.f_header, text = 'surrender', command = self.surrender) self.f_header.place(x = 545, y = 250) self.b_start.pack(side='left', padx=10) self.b_restart.pack(side = 'left') self.b_surrender.pack(side = 'right') self.b_regret.pac
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值