当前位置:   article > 正文

Pyqt5实践:实现快捷方式软件_使用pyqt5做的软件怎么放到桌面快捷方式

使用pyqt5做的软件怎么放到桌面快捷方式

Pyqt5实践:实现快捷方式软件@TOC

工具准备

Python3.x;
Python库:pyqt5

代码展示:

直接贴代码,由于工作繁忙,实在没时间写文档0.0,代码里面都有注释,有不懂评论区问。(先看看反响咋样,如果看的人多我再写具体思路。)

界面代码,使用QtDesigner画的,再通过pyuic转换的。

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'Form.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(250, 500)
        Form.setStyleSheet("#Form{\n"
" border-top-left-radius:10px;\n"
" border-bottom-left-radius:10px;\n"
"\n"
"}\n"
"QGroupBox{\n"
"border-top:0px solid rgb(190, 190, 190);\n"
"border-right:0px solid rgb(190, 190, 190);\n"
"border-bottom:2px solid rgb(190, 190, 190);\n"
"border-left:0px solid rgb(190, 190, 190);\n"
"font: 75 10pt \"微软雅黑\";\n"
"}")
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.choose_exe_btn = QtWidgets.QPushButton(Form)
        self.choose_exe_btn.setObjectName("choose_exe_btn")
        self.horizontalLayout.addWidget(self.choose_exe_btn)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.scrollArea = QtWidgets.QScrollArea(Form)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
        self.scrollArea.setSizePolicy(sizePolicy)
        self.scrollArea.setMinimumSize(QtCore.QSize(250, 475))
        self.scrollArea.setMaximumSize(QtCore.QSize(250, 475))
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.main_widget = QtWidgets.QWidget()
        self.main_widget.setGeometry(QtCore.QRect(0, 0, 248, 473))
        self.main_widget.setMinimumSize(QtCore.QSize(240, 470))
        self.main_widget.setStyleSheet("#main_widget{\n"
"    background-color:rgb(68, 68, 68);\n"
"}\n"
"\n"
"QPushButton{\n"
"    border:1px solid lightgray;\n"
"    background:rgb(255, 255, 255);\n"
"}\n"
"QPushButton::hover{\n"
"    border-color:rgb(0, 170, 255);\n"
"    background:transparent;\n"
"}")
        self.main_widget.setObjectName("main_widget")
        self.main_layout = QtWidgets.QVBoxLayout(self.main_widget)
        self.main_layout.setContentsMargins(0, 0, 0, 6)
        self.main_layout.setObjectName("main_layout")
        spacerItem1 = QtWidgets.QSpacerItem(20, 464, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.main_layout.addItem(spacerItem1)
        self.scrollArea.setWidget(self.main_widget)
        self
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/264641
推荐阅读
相关标签
  

闽ICP备14008679号