Python-PyQt5如何制作出来好看的界面②

源码 +资源在qq群:2076966127
这个是我更新这个系列的第二期,现在看看几个月之前画的UI我真想吐了。好丑啊~~~~~
现在我再一些大型的 图标网站找到了很多好看简介免费的图标~~
https://www.flaticon.com
这个就很不错~
还是先准备好你的QtDesigner这个原本是为了C++准备GUI编辑器但是现在Python社区的小伙伴们就研发出来了.UI代码转成Py代码。实际上我看了.UI文件其实里面就是html语言,也就是说python的这个可以支持css里面的任何写法~
下面,就让我们开始今天的教程~~~
咱们先找好素材·-·
先给你们看看效果~

image.png

image.png
image.png

界面主要运用了高斯模糊的图片作为背景,让界面感觉非常的清新,干净。
然后就是寻找素材,我按钮上面这些图标还有这些图片我都是从这个网站找的: https://www.flaticon.com/
这个上面的图标真的非常不错,最重要还是免费的~
这次我的界面按钮用的主要的css样式是这样的:
QPushButton{
background:#6C6C6C;
color:white;
box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;
}
QPushButton:hover{
background:#9D9D9D;
}
QPushButton:pressed{
border: 1px solid #3C3C3C!important;
}
让人感觉比较舒服~
但是实际上你的按钮越少你写的软件操作九月自动化,所以我还是不建议使用过多的按钮。精良把你的软件写的自动化一些。
下面就是代码:

import sys, os
if hasattr(sys, 'frozen'):
    os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
import tkinter.messagebox, requests, winreg
import subprocess, time
from PyQt5 import  QtWidgets
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtCore import *
from PyQt5 import QtCore
from PyQt5 import QtGui
class Login(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        self.init_ui()
    def init_ui(self):
        self.setFixedSize(920,557)
        self.setWindowFlags(Qt.FramelessWindowHint)  # 去边框
        self.setAttribute(Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.setStyleSheet("font-family:微软雅黑;")
        self.centralwidget = QtWidgets.QWidget(self)
        self.centralwidget.setObjectName("centralwidget")
        self.pushButton_12 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_12.setGeometry(QtCore.QRect(890, 20, 21, 21))
        self.pushButton_12.setStyleSheet("QPushButton{\n"
                                         "    background:#CE0000;\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 10px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#FF2D2D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    border: 1px solid #3C3C3C!important;\n"
                                         "    background:#AE0000;\n"
                                         "}")
        self.pushButton_12.setText("")
        self.pushButton_12.setObjectName("pushButton_12")
        self.pushButton_11 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_11.setGeometry(QtCore.QRect(850, 20, 21, 21))
        self.pushButton_11.setStyleSheet("QPushButton{\n"
                                         "    background:#6C6C6C;\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 10px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#9D9D9D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    border: 1px solid #3C3C3C!important;\n"
                                         "}")
        self.pushButton_11.setText("")
        self.pushButton_11.setObjectName("pushButton_11")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(-2, -30, 931, 591))
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.label_33 = QtWidgets.QLabel(self.tab)
        self.label_33.setGeometry(QtCore.QRect(280, 90, 591, 141))
        self.label_33.setText("")
        self.label_33.setPixmap(QtGui.QPixmap("res/gsmw.jpg"))
        self.label_33.setScaledContents(False)
        self.label_33.setObjectName("label_33")
        self.label_34 = QtWidgets.QLabel(self.tab)
        self.label_34.setGeometry(QtCore.QRect(300, 89, 101, 31))
        self.label_34.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label_34.setObjectName("label_34")
        self.label_35 = QtWidgets.QLabel(self.tab)
        self.label_35.setEnabled(True)
        self.label_35.setGeometry(QtCore.QRect(300, 129, 541, 101))
        self.label_35.setMouseTracking(True)
        self.label_35.setTabletTracking(False)
        self.label_35.setAcceptDrops(False)
        self.label_35.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label_35.setAutoFillBackground(False)
        self.label_35.setInputMethodHints(QtCore.Qt.ImhNone)
        self.label_35.setScaledContents(True)
        self.label_35.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
        self.label_35.setWordWrap(True)
        self.label_35.setOpenExternalLinks(False)
        self.label_35.setObjectName("label_35")
        self.label_36 = QtWidgets.QLabel(self.tab)
        self.label_36.setGeometry(QtCore.QRect(-2, 0, 931, 561))
        self.label_36.setText("")
        self.label_36.setPixmap(QtGui.QPixmap("res/demo_blur.png"))
        self.label_36.setScaledContents(True)
        self.label_36.setWordWrap(False)
        self.label_36.setObjectName("label_36")
        self.label_37 = QtWidgets.QLabel(self.tab)
        self.label_37.setGeometry(QtCore.QRect(230, 480, 691, 81))
        self.label_37.setText("")
        self.label_37.setPixmap(QtGui.QPixmap("res/Gray.png"))
        self.label_37.setScaledContents(True)
        self.label_37.setObjectName("label_37")
        self.pushButton_33 = QtWidgets.QPushButton(self.tab)
        self.pushButton_33.setGeometry(QtCore.QRect(510, 490, 51, 51))
        self.pushButton_33.setStyleSheet("QPushButton{\n"
                                         "    background:#6C6C6C;\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:24px;border-radius: 24px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#9D9D9D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    background:gray;\n"
                                         "}")
        self.pushButton_33.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("res/interface.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_33.setIcon(icon)
        self.pushButton_33.setIconSize(QtCore.QSize(51, 51))
        self.pushButton_33.setObjectName("pushButton_33")
        self.pushButton_34 = QtWidgets.QPushButton(self.tab)
        self.pushButton_34.setGeometry(QtCore.QRect(460, 500, 31, 31))
        self.pushButton_34.setStyleSheet("QPushButton{\n"
                                         "    background:#6C6C6C;\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:24px;border-radius: 24px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#9D9D9D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    background:gray;\n"
                                         "}")
        self.pushButton_34.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("res/directional.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_34.setIcon(icon1)
        self.pushButton_34.setIconSize(QtCore.QSize(20, 20))
        self.pushButton_34.setObjectName("pushButton_34")
        self.pushButton_35 = QtWidgets.QPushButton(self.tab)
        self.pushButton_35.setGeometry(QtCore.QRect(580, 500, 31, 31))
        self.pushButton_35.setStyleSheet("QPushButton{\n"
                                         "    background:#6C6C6C;\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:24px;border-radius: 24px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#9D9D9D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    background:gray;\n"
                                         "}")
        self.pushButton_35.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap("res/next.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_35.setIcon(icon2)
        self.pushButton_35.setIconSize(QtCore.QSize(20, 20))
        self.pushButton_35.setObjectName("pushButton_35")
        self.label_10 = QtWidgets.QLabel(self.tab)
        self.label_10.setGeometry(QtCore.QRect(240, 490, 91, 21))
        self.label_10.setStyleSheet("color:white;\n"
                                    "font-size:18px;")
        self.label_10.setObjectName("label_10")
        self.label_11 = QtWidgets.QLabel(self.tab)
        self.label_11.setGeometry(QtCore.QRect(240, 520, 71, 21))
        self.label_11.setStyleSheet("color:white;")
        self.label_11.setObjectName("label_11")
        self.label_15 = QtWidgets.QLabel(self.tab)
        self.label_15.setGeometry(QtCore.QRect(0, 0, 921, 61))
        self.label_15.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_15.setText("")
        self.label_15.setObjectName("label_15")
        self.label_25 = QtWidgets.QLabel(self.tab)
        self.label_25.setGeometry(QtCore.QRect(20, 5, 51, 51))
        self.label_25.setStyleSheet("")
        self.label_25.setText("")
        self.label_25.setPixmap(QtGui.QPixmap("res/Breath.png"))
        self.label_25.setScaledContents(True)
        self.label_25.setWordWrap(False)
        self.label_25.setObjectName("label_25")
        self.label_38 = QtWidgets.QLabel(self.tab)
        self.label_38.setGeometry(QtCore.QRect(80, 15, 161, 31))
        self.label_38.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label_38.setStyleSheet("color:Gray;\n"
                                    "font-size:20px;")
        self.label_38.setObjectName("label_38")
        self.label_36.raise_()
        self.label_33.raise_()
        self.label_34.raise_()
        self.label_35.raise_()
        self.label_37.raise_()
        self.pushButton_33.raise_()
        self.pushButton_34.raise_()
        self.pushButton_35.raise_()
        self.label_10.raise_()
        self.label_11.raise_()
        self.label_15.raise_()
        self.label_25.raise_()
        self.label_38.raise_()
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.label_5 = QtWidgets.QLabel(self.tab_2)
        self.label_5.setGeometry(QtCore.QRect(310, 107, 591, 126))
        self.label_5.setText("")
        self.label_5.setPixmap(QtGui.QPixmap("res/gsmw.jpg"))
        self.label_5.setScaledContents(True)
        self.label_5.setObjectName("label_5")
        self.label_2 = QtWidgets.QLabel(self.tab_2)
        self.label_2.setGeometry(QtCore.QRect(310, 61, 591, 41))
        self.label_2.setText("")
        self.label_2.setPixmap(QtGui.QPixmap("res/gsmw.jpg"))
        self.label_2.setScaledContents(False)
        self.label_2.setObjectName("label_2")
        self.label_4 = QtWidgets.QLabel(self.tab_2)
        self.label_4.setGeometry(QtCore.QRect(330, 60, 211, 41))
        self.label_4.setStyleSheet("color:white;")
        self.label_4.setObjectName("label_4")
        self.label_3 = QtWidgets.QLabel(self.tab_2)
        self.label_3.setGeometry(QtCore.QRect(860, 66, 31, 31))
        self.label_3.setText("")
        self.label_3.setPixmap(QtGui.QPixmap("res/down.png"))
        self.label_3.setScaledContents(True)
        self.label_3.setObjectName("label_3")
        self.pushButton_17 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_17.setGeometry(QtCore.QRect(310, 170, 591, 31))
        self.pushButton_17.setStyleSheet("QPushButton{\n"
                                         "    background:rgb(255, 255, 255, 60);\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 4px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:rgb(255, 255, 255, 100);\n"
                                         "}")
        self.pushButton_17.setText("")
        self.pushButton_17.setObjectName("pushButton_17")
        self.pushButton_18 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_18.setGeometry(QtCore.QRect(310, 200, 591, 31))
        self.pushButton_18.setStyleSheet("QPushButton{\n"
                                         "    background:rgb(255, 255, 255, 60);\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 4px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:rgb(255, 255, 255, 100);\n"
                                         "}")
        self.pushButton_18.setText("")
        self.pushButton_18.setObjectName("pushButton_18")
        self.pushButton_16 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_16.setGeometry(QtCore.QRect(310, 140, 591, 31))
        self.pushButton_16.setStyleSheet("QPushButton{\n"
                                         "    background:rgb(255, 255, 255, 60);\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 4px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:rgb(255, 255, 255, 100);\n"
                                         "}")
        self.pushButton_16.setText("")
        self.pushButton_16.setObjectName("pushButton_16")
        self.label_7 = QtWidgets.QLabel(self.tab_2)
        self.label_7.setGeometry(QtCore.QRect(320, 144, 121, 21))
        self.label_7.setStyleSheet("color:white;")
        self.label_7.setObjectName("label_7")
        self.label_6 = QtWidgets.QLabel(self.tab_2)
        self.label_6.setGeometry(QtCore.QRect(320, 172, 121, 21))
        self.label_6.setStyleSheet("color:white;")
        self.label_6.setObjectName("label_6")
        self.label_8 = QtWidgets.QLabel(self.tab_2)
        self.label_8.setGeometry(QtCore.QRect(320, 201, 121, 21))
        self.label_8.setStyleSheet("color:white;")
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.tab_2)
        self.label_9.setGeometry(QtCore.QRect(330, 80, 121, 21))
        self.label_9.setStyleSheet("color:white;")
        self.label_9.setObjectName("label_9")
        self.label_32 = QtWidgets.QLabel(self.tab_2)
        self.label_32.setGeometry(QtCore.QRect(320, 113, 121, 21))
        self.label_32.setStyleSheet("color:white;")
        self.label_32.setScaledContents(False)
        self.label_32.setObjectName("label_32")
        self.pushButton_15 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_15.setGeometry(QtCore.QRect(310, 110, 591, 31))
        self.pushButton_15.setStyleSheet("QPushButton{\n"
                                         "    background:rgb(255, 255, 255, 60);\n"
                                         "    color:white;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 4px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:rgb(255, 255, 255, 100);\n"
                                         "}")
        self.pushButton_15.setText("")
        self.pushButton_15.setObjectName("pushButton_15")
        self.label_13 = QtWidgets.QLabel(self.tab_2)
        self.label_13.setGeometry(QtCore.QRect(310, 120, 591, 421))
        self.label_13.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_13.setText("")
        self.label_13.setObjectName("label_13")
        self.listWidget_2 = QtWidgets.QListWidget(self.tab_2)
        self.listWidget_2.setGeometry(QtCore.QRect(340, 180, 531, 281))
        self.listWidget_2.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.listWidget_2.setStyleSheet("background:transparent;\n"
                                        "color:white;\n"
                                        "font-size:20px;")
        self.listWidget_2.setObjectName("listWidget_2")
        item = QtWidgets.QListWidgetItem()
        self.listWidget_2.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidget_2.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidget_2.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidget_2.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidget_2.addItem(item)
        self.pushButton_6 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_6.setGeometry(QtCore.QRect(750, 490, 121, 31))
        self.pushButton_6.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap("res/electronics.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_6.setIcon(icon3)
        self.pushButton_6.setObjectName("pushButton_6")
        self.label_19 = QtWidgets.QLabel(self.tab_2)
        self.label_19.setGeometry(QtCore.QRect(0, 0, 931, 561))
        self.label_19.setText("")
        self.label_19.setPixmap(QtGui.QPixmap("res/demo_blur.png"))
        self.label_19.setScaledContents(True)
        self.label_19.setWordWrap(False)
        self.label_19.setObjectName("label_19")
        self.label_14 = QtWidgets.QLabel(self.tab_2)
        self.label_14.setGeometry(QtCore.QRect(0, 0, 921, 61))
        self.label_14.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_14.setText("")
        self.label_14.setObjectName("label_14")
        self.pushButton_8 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_8.setGeometry(QtCore.QRect(340, 140, 30, 30))
        self.pushButton_8.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        self.pushButton_8.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap("res/button.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_8.setIcon(icon4)
        self.pushButton_8.setIconSize(QtCore.QSize(15, 15))
        self.pushButton_8.setObjectName("pushButton_8")
        self.pushButton_9 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_9.setGeometry(QtCore.QRect(390, 140, 30, 30))
        self.pushButton_9.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        self.pushButton_9.setText("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap("res/tools-and-utensils.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_9.setIcon(icon5)
        self.pushButton_9.setIconSize(QtCore.QSize(15, 15))
        self.pushButton_9.setObjectName("pushButton_9")
        self.pushButton_10 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_10.setGeometry(QtCore.QRect(440, 140, 30, 30))
        self.pushButton_10.setStyleSheet("QPushButton{\n"
                                         "    background:#6C6C6C;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#9D9D9D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    border: 1px solid #3C3C3C!important;\n"
                                         "}")
        self.pushButton_10.setText("")
        self.pushButton_10.setIcon(icon5)
        self.pushButton_10.setIconSize(QtCore.QSize(15, 15))
        self.pushButton_10.setObjectName("pushButton_10")
        self.pushButton_13 = QtWidgets.QPushButton(self.tab_2)
        self.pushButton_13.setGeometry(QtCore.QRect(840, 140, 30, 30))
        self.pushButton_13.setStyleSheet("QPushButton{\n"
                                         "    background:#6C6C6C;\n"
                                         "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                         "}\n"
                                         "QPushButton:hover{                    \n"
                                         "    background:#9D9D9D;\n"
                                         "}\n"
                                         "QPushButton:pressed{\n"
                                         "    border: 1px solid #3C3C3C!important;\n"
                                         "}")
        self.pushButton_13.setText("")
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap("res/multimedia-option.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_13.setIcon(icon6)
        self.pushButton_13.setIconSize(QtCore.QSize(15, 15))
        self.pushButton_13.setObjectName("pushButton_13")
        self.label_19.raise_()
        self.label_13.raise_()
        self.pushButton_13.raise_()
        self.pushButton_10.raise_()
        self.pushButton_8.raise_()
        self.listWidget_2.raise_()
        self.pushButton_9.raise_()
        self.label_5.raise_()
        self.label_32.raise_()
        self.label_6.raise_()
        self.label_7.raise_()
        self.label_8.raise_()
        self.label_9.raise_()
        self.label_2.raise_()
        self.label_4.raise_()
        self.label_3.raise_()
        self.pushButton_17.raise_()
        self.pushButton_18.raise_()
        self.pushButton_16.raise_()
        self.pushButton_15.raise_()
        self.label_14.raise_()
        self.pushButton_6.raise_()
        self.tabWidget.addTab(self.tab_2, "")
        self.tab_3 = QtWidgets.QWidget()
        self.tab_3.setObjectName("tab_3")
        self.label_21 = QtWidgets.QLabel(self.tab_3)
        self.label_21.setGeometry(QtCore.QRect(0, 0, 931, 561))
        self.label_21.setText("")
        self.label_21.setPixmap(QtGui.QPixmap("res/demo_blur.png"))
        self.label_21.setScaledContents(True)
        self.label_21.setWordWrap(False)
        self.label_21.setObjectName("label_21")
        self.label_17 = QtWidgets.QLabel(self.tab_3)
        self.label_17.setGeometry(QtCore.QRect(0, 0, 921, 61))
        self.label_17.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_17.setText("")
        self.label_17.setObjectName("label_17")
        self.tabWidget.addTab(self.tab_3, "")
        self.tab_4 = QtWidgets.QWidget()
        self.tab_4.setObjectName("tab_4")
        self.label_22 = QtWidgets.QLabel(self.tab_4)
        self.label_22.setGeometry(QtCore.QRect(0, 0, 931, 561))
        self.label_22.setText("")
        self.label_22.setPixmap(QtGui.QPixmap("res/demo_blur.png"))
        self.label_22.setScaledContents(True)
        self.label_22.setWordWrap(False)
        self.label_22.setObjectName("label_22")
        self.label_18 = QtWidgets.QLabel(self.tab_4)
        self.label_18.setGeometry(QtCore.QRect(0, 0, 921, 61))
        self.label_18.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_18.setText("")
        self.label_18.setObjectName("label_18")
        self.textEdit = QtWidgets.QTextEdit(self.tab_4)
        self.textEdit.setGeometry(QtCore.QRect(235, 405, 641, 151))
        self.textEdit.setStyleSheet("background:rgb(255, 255, 255, 60);\n"
                                    "color:gray;")
        self.textEdit.setFrameShape(QtWidgets.QFrame.Box)
        self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
        self.textEdit.setObjectName("textEdit")
        self.pushButton_7 = QtWidgets.QPushButton(self.tab_4)
        self.pushButton_7.setGeometry(QtCore.QRect(875, 405, 46, 151))
        self.pushButton_7.setStyleSheet("QPushButton{\n"
                                        "    background:rgb(255, 255, 255, 60);\n"
                                        "    color:white;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 1px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:rgb(255, 255, 255, 40);\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    background:rgb(255, 255, 255, 80);\n"
                                        "}")
        self.pushButton_7.setText("")
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap("res/right.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_7.setIcon(icon7)
        self.pushButton_7.setObjectName("pushButton_7")
        self.textEdit_2 = QtWidgets.QTextEdit(self.tab_4)
        self.textEdit_2.setGeometry(QtCore.QRect(235, 63, 685, 341))
        self.textEdit_2.setStyleSheet("background:rgb(255, 255, 255, 50);\n"
                                      "color:gray;")
        self.textEdit_2.setFrameShape(QtWidgets.QFrame.Box)
        self.textEdit_2.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
        self.textEdit_2.setObjectName("textEdit_2")
        self.tabWidget.addTab(self.tab_4, "")
        self.tab_5 = QtWidgets.QWidget()
        self.tab_5.setObjectName("tab_5")
        self.label_23 = QtWidgets.QLabel(self.tab_5)
        self.label_23.setGeometry(QtCore.QRect(0, 0, 931, 561))
        self.label_23.setText("")
        self.label_23.setPixmap(QtGui.QPixmap("res/demo_blur.png"))
        self.label_23.setScaledContents(True)
        self.label_23.setWordWrap(False)
        self.label_23.setObjectName("label_23")
        self.label_24 = QtWidgets.QLabel(self.tab_5)
        self.label_24.setGeometry(QtCore.QRect(0, 0, 921, 61))
        self.label_24.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_24.setText("")
        self.label_24.setObjectName("label_24")
        self.tabWidget.addTab(self.tab_5, "")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(20, 510, 181, 21))
        self.label.setStyleSheet("color:gray;")
        self.label.setObjectName("label")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(20, 210, 171, 31))
        self.pushButton_2.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    color:white;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap("res/web.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_2.setIcon(icon8)
        self.pushButton_2.setObjectName("pushButton_2")
        self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_3.setGeometry(QtCore.QRect(20, 160, 171, 31))
        self.pushButton_3.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    color:white;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        self.pushButton_3.setIcon(icon3)
        self.pushButton_3.setObjectName("pushButton_3")
        self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_4.setGeometry(QtCore.QRect(20, 260, 171, 31))
        self.pushButton_4.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    color:white;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        icon9 = QtGui.QIcon()
        icon9.addPixmap(QtGui.QPixmap("res/chat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_4.setIcon(icon9)
        self.pushButton_4.setObjectName("pushButton_4")
        self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_5.setGeometry(QtCore.QRect(20, 310, 171, 31))
        self.pushButton_5.setStyleSheet("QPushButton{\n"
                                        "    background:#6C6C6C;\n"
                                        "    color:white;\n"
                                        "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                        "}\n"
                                        "QPushButton:hover{                    \n"
                                        "    background:#9D9D9D;\n"
                                        "}\n"
                                        "QPushButton:pressed{\n"
                                        "    border: 1px solid #3C3C3C!important;\n"
                                        "}")
        icon10 = QtGui.QIcon()
        icon10.addPixmap(QtGui.QPixmap("res/symbol.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_5.setIcon(icon10)
        self.pushButton_5.setObjectName("pushButton_5")
        self.label_30 = QtWidgets.QLabel(self.centralwidget)
        self.label_30.setGeometry(QtCore.QRect(2, 60, 231, 495))
        self.label_30.setText("")
        self.label_30.setPixmap(QtGui.QPixmap("res/Gray.png"))
        self.label_30.setScaledContents(True)
        self.label_30.setObjectName("label_30")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(20, 110, 171, 31))
        self.pushButton.setStyleSheet("QPushButton{\n"
                                      "    background:#6C6C6C;\n"
                                      "    color:white;\n"
                                      "    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);font-size:16px;border-radius: 14px;font-family: 微软雅黑;\n"
                                      "}\n"
                                      "QPushButton:hover{                    \n"
                                      "    background:#9D9D9D;\n"
                                      "}\n"
                                      "QPushButton:pressed{\n"
                                      "    border: 1px solid #3C3C3C!important;\n"
                                      "}")
        icon11 = QtGui.QIcon()
        icon11.addPixmap(QtGui.QPixmap("res/house.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon11)
        self.pushButton.setObjectName("pushButton")
        self.label_12 = QtWidgets.QLabel(self.centralwidget)
        self.label_12.setGeometry(QtCore.QRect(0, -2, 921, 61))
        self.label_12.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_12.setText("")
        self.label_12.setObjectName("label_12")
        self.label_16 = QtWidgets.QLabel(self.centralwidget)
        self.label_16.setGeometry(QtCore.QRect(0, 0, 921, 61))
        self.label_16.setStyleSheet("background:rgb(255, 255, 255, 20);")
        self.label_16.setText("")
        self.label_16.setObjectName("label_16")
        self.label_20 = QtWidgets.QLabel(self.centralwidget)
        self.label_20.setGeometry(QtCore.QRect(0, 0, 931, 561))
        self.label_20.setText("")
        self.label_20.setPixmap(QtGui.QPixmap("res/demo_blur.png"))
        self.label_20.setScaledContents(True)
        self.label_20.setWordWrap(False)
        self.label_20.setObjectName("label_20")
        self.label_20.raise_()
        self.label_16.raise_()
        self.label_12.raise_()
        self.tabWidget.raise_()
        self.label_30.raise_()
        self.pushButton_11.raise_()
        self.pushButton_12.raise_()
        self.label.raise_()
        self.pushButton_2.raise_()
        self.pushButton_3.raise_()
        self.pushButton_4.raise_()
        self.pushButton_5.raise_()
        self.pushButton.raise_()
        self.setCentralWidget(self.centralwidget)

        self.retranslateUi(self)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(self)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_34.setText(_translate("MainWindow", "公告:"))
        self.label_35.setText(_translate("MainWindow", "Breath 交流群 -- 1033323345 与带师们一起聊天."))
        self.label_10.setText(_translate("MainWindow", "Tuesday"))
        self.label_11.setText(_translate("MainWindow", "Loading..."))
        self.label_38.setText(_translate("MainWindow", "Breath ToolBox"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "主页"))
        self.label_4.setText(_translate("MainWindow", "请选择注入模式"))
        self.label_7.setText(_translate("MainWindow", "[Breath] 西瓜星球"))
        self.label_6.setText(_translate("MainWindow", "[Breath] Hypixel"))
        self.label_8.setText(_translate("MainWindow", "[Breath] Domcer"))
        self.label_9.setText(_translate("MainWindow", "[Breath] 花雨庭"))
        self.label_32.setText(_translate("MainWindow", "[Breath] 花雨庭"))
        __sortingEnabled = self.listWidget_2.isSortingEnabled()
        self.listWidget_2.setSortingEnabled(False)
        item = self.listWidget_2.item(0)
        item.setText(_translate("MainWindow", "LiquidBounce B64.jar"))
        item = self.listWidget_2.item(1)
        item.setText(_translate("MainWindow", "BetterGaming 1.0.jar"))
        item = self.listWidget_2.item(2)
        item.setText(_translate("MainWindow", "OptFine 1.8.jar"))
        item = self.listWidget_2.item(3)
        item.setText(_translate("MainWindow", "ChineseInput 1.0.jar"))
        item = self.listWidget_2.item(4)
        item.setText(_translate("MainWindow", "BetterFps 1.1.jar"))
        self.listWidget_2.setSortingEnabled(__sortingEnabled)
        self.pushButton_6.setText(_translate("MainWindow", "启动"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "注入"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "开端"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("MainWindow", "交流"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("MainWindow", "设置"))
        self.label.setText(_translate("MainWindow", "Breath ToolBox Reload"))
        self.pushButton_2.setText(_translate("MainWindow", "开端"))
        self.pushButton_3.setText(_translate("MainWindow", "注入"))
        self.pushButton_4.setText(_translate("MainWindow", "交流"))
        self.pushButton_5.setText(_translate("MainWindow", "设置"))
        self.pushButton.setText(_translate("MainWindow", "主页"))
    def mousePressEvent(self, e):
        if e.button() == Qt.LeftButton:
            self.m_drag = True
            self.m_DragPosition = e.globalPos() - self.pos()
            e.accept()
    def mouseReleaseEvent(self, e):
        if e.button() == Qt.LeftButton:
            self.m_drag = False
    def mouseMoveEvent(self, e):
        try:
            if Qt.LeftButton and self.m_drag:
                self.move(e.globalPos() - self.m_DragPosition)
                e.accept()
        except:
            print("错误代码:000x0")
def main():
    app = QtWidgets.QApplication(sys.argv)
    gui = Login()
    gui.show()
    sys.exit(app.exec_())
if __name__ == '__main__':
    main()

如果你的代码会发生报错,请一定联系我的QQ:2076966127
我一般都是全天在线。可以为您解答。这里不让上传文件没办法把那些素材图片上传过来直接加我QQ我就发给您们~
QQ:2076966127

你可能感兴趣的:(Python-PyQt5如何制作出来好看的界面②)