• 大小:
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-06-22
  • 语言: 其他
  • 标签: pyqt5  python  

资源简介

pyqt5实例(PyQt5快速开发与实战)

资源截图

代码片段和文件信息

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

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class Example(QWidget):
def __init__(self):
super(Example self).__init__()
self.initUI()

def initUI(self): 
hbox = QHBoxLayout( )
self.l1 = QLabel(“拖动滑块改变颜色“)
self.l1.setFont(QFont(“Arial“16))
hbox.addWidget(self.l1)
self.s1 = QScrollBar()
self.s1.setMaximum(255)
self.s1.sliderMoved.connect(self.sliderval)
self.s2 = QScrollBar()
self.s2.setMaximum(255)
self.s2.sliderMoved.connect(self.sliderval)
self.s3 = QScrollBar()
self.s3.setMaximum(255)
self.s3.sliderMoved.connect(self.sliderval)
hbox.addWidget(self.s1)
hbox.addWidget(self.s2)
hbox.addWidget(self.s3)
self.setGeometry(300 300 300 200)
self.setWindowtitle(‘字体例子‘)
self.setLayout( hbox )

def sliderval(self):
print( self.s1.value()self.s2.value() self.s3.value() )
palette = QPalette()
c = QColor(self.s1.value()self.s2.value() self.s3.value()255)
palette.setColor(QPalette.Foregroundc)
self.l1.setPalette(palette)

if __name__ == ‘__main__‘:
app = QApplication(sys.argv)
demo = Example() 
demo.show()
sys.exit(app.exec_())

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-06 10:29  PyQt5-master\
     目录           0  2018-11-04 23:05  PyQt5-master\Chapter01\
     目录           0  2018-11-04 23:05  PyQt5-master\Chapter01\EricPro01\
     文件        1620  2018-04-15 16:10  PyQt5-master\Chapter01\EricPro01\FirstPyQtPro.e4p
     文件         620  2018-04-15 16:10  PyQt5-master\Chapter01\EricPro01\FirstWin.py
     文件           0  2018-04-15 16:10  PyQt5-master\Chapter01\EricPro01\__init__.py
     目录           0  2018-11-04 23:05  PyQt5-master\Chapter01\EricPro01\_eric6project\
     文件         246  2018-04-15 16:10  PyQt5-master\Chapter01\EricPro01\_eric6project\FirstPyQtPro.e4q
     文件         240  2018-04-15 16:10  PyQt5-master\Chapter01\EricPro01\_eric6project\FirstPyQtPro.e6t
     文件         389  2018-04-15 16:10  PyQt5-master\Chapter01\FirstWin.py
     文件         265  2018-04-15 16:10  PyQt5-master\Chapter01\qt101_testPyQt.py
     文件         397  2018-04-15 16:10  PyQt5-master\Chapter01\qt102_PrintApi.py
     文件         320  2018-04-15 16:10  PyQt5-master\Chapter01\qt103_runPyQt.py
     目录           0  2018-11-04 23:05  PyQt5-master\Chapter02\
     文件         335  2018-04-15 16:10  PyQt5-master\Chapter02\py201math.py
     文件         324  2018-04-15 16:10  PyQt5-master\Chapter02\py202str.py
     文件         892  2018-04-15 16:10  PyQt5-master\Chapter02\py203str2.py
     文件         310  2018-04-15 16:10  PyQt5-master\Chapter02\py204list.py
     文件         310  2018-04-15 16:10  PyQt5-master\Chapter02\py205tuple.py
     文件         334  2018-04-15 16:10  PyQt5-master\Chapter02\py206dict.py
     文件         391  2018-04-15 16:10  PyQt5-master\Chapter02\py207ctrl.py
     文件         223  2018-04-15 16:10  PyQt5-master\Chapter02\py208fun.py
     文件         358  2018-04-15 16:10  PyQt5-master\Chapter02\py209fun.py
     文件         136  2018-04-15 16:10  PyQt5-master\Chapter02\py210fun.py
     文件         416  2018-04-15 16:10  PyQt5-master\Chapter02\py211class.py
     文件         794  2018-04-15 16:10  PyQt5-master\Chapter02\py212privateProperty.py
     文件         582  2018-04-15 16:10  PyQt5-master\Chapter02\py213property01.py
     文件         524  2018-04-15 16:10  PyQt5-master\Chapter02\py213property02.py
     目录           0  2018-11-06 17:10  PyQt5-master\Chapter03\
     文件         440  2018-11-06 17:10  PyQt5-master\Chapter03\CallFirstMainWin.py
     文件         436  2018-04-15 16:10  PyQt5-master\Chapter03\CallMainWin02.py
............此处省略661个文件信息

评论

共有 条评论