#=导入相关包=========
import sys
import cfg
from modules import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
#=游戏开始界面===
class gameStartUI(QWidget):
def init(self, parent=None, **kwargs):
super(gameStartUI, self).init(parent)
self.setFixedSize(760, 650)
self.setWindowTitle(‘五子棋 —— 与女朋友对弈’)
self.setWindowIcon(QIcon(cfg.ICON_FILEPATH))
#背景图片===
palette = QPalette()
palette.setBrush(self.backgroundRole(), QBrush(QPixmap(cfg.BACKGROUND_IMAGEPATHS.get(‘bg_start’))))
self.setPalette(palette)
#按钮==
#==人机对战=
self.ai_button = PushButton(cfg.BUTTON_IMAGEPATHS.get(‘ai’), self)
self.ai_button.move(250, 200)
self.ai_button.show()
self.ai_button.click_signal.connect(self.playWithAI)
#联机对战
self.online_button = PushButton(cfg.BUTTON_IMAGEPATHS.get(‘online’), self)
self.online_button.move(250, 350)
self.online_button.show()
self.online_button.click_signal.connect(self.playOnline)
#人机对战====
def playWithAI(self):
self.close()
self.gaming_ui = playWithAIUI(cfg)
self.gaming_ui.exit_signal.connect(lambda: sys.exit())
self.gaming_ui.back_signal.connect(self.show)
self.gaming_ui.show()
#联机对战===
def playOnline(self):
self.close()
self.gaming_ui = playOnlineUI(cfg, self)
self.gaming_ui.show()
#=运行====
if name == ‘main’:
app = QApplication(sys.argv)
handle = gameStartUI()
font = QFont()
font.setPointSize(12)
handle.setFont(font)
handle.show()
sys.exit(app.exec_())
cfg库:
‘’‘config file’‘’
import os
图标路径
ICON_FILEPATH = os.path.join(os.getcwd(), ‘resources/images/icon/icon.ico’)
背景图片路径
BACKGROUND_IMAGEPATHS = {
‘bg_game’: os.path.join(os.getcwd(), ‘resources/images/bg/bg_game.png’),
‘bg_start’: os.path.join(os.getcwd(), ‘resources/images/bg/bg_start.png’)
}
按钮图片路径
BUTTON_IMAGEPATHS = {
‘online’: [
os.path.join(os.getcwd(), ‘resources/images/buttons/online_0.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/online_1.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/online_2.png’)
],
‘ai’: [
os.path.join(os.getcwd(), ‘resources/images/buttons/ai_0.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/ai_1.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/ai_2.png’)
],
‘home’: [
os.path.join(os.getcwd(), ‘resources/images/buttons/home_0.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/home_1.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/home_2.png’)
],
‘givein’: [
os.path.join(os.getcwd(), ‘resources/images/buttons/givein_0.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/givein_1.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/givein_2.png’)
],
‘regret’: [
os.path.join(os.getcwd(), ‘resources/images/buttons/regret_0.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/regret_1.png’),
os.path.join(os.getcwd(), ‘resources/images/buttons/regret_2.png’)
],
‘startgame’: [
一、Python所有方向的学习路线
Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照下面的知识点去找对应的学习资源,保证自己学得较为全面。
二、Python必备开发工具
工具都帮大家整理好了,安装就可直接上手!
三、最新Python学习笔记
当我学到一定基础,有自己的理解能力的时候,会去阅读一些前辈整理的书籍或者手写的笔记资料,这些笔记详细记载了他们对一些技术点的理解,这些理解是比较独到,可以学到不一样的思路。
四、Python视频合集
观看全面零基础学习视频,看视频学习是最快捷也是最有效果的方式,跟着视频中老师的思路,从基础到深入,还是很容易入门的。
五、实战案例
纸上得来终觉浅,要学会跟着视频一起敲,要动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。
六、面试宝典
简历模板
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!