本文整理汇总了Python中PyQt5.QtWidgets.QProgressBar.setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:Python QProgressBar.setFixedSize方法的具体用法?Python QProgressBar.setFixedSize怎么用?Python QProgressBar.setFixedSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QProgressBar
的用法示例。
在下文中一共展示了QProgressBar.setFixedSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BusyProgressDialog
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import setFixedSize [as 别名]
class BusyProgressDialog(QDialog):
"""
This class implements a dialog showing a busy progress bar.
"""
def __init__(self, title='', parent=None):
"""
Initialize the form dialog.
:type title: str
:type parent: QWidget
"""
super().__init__(parent)
self.progressBar = QProgressBar(self)
self.progressBar.setAlignment(Qt.AlignHCenter)
self.progressBar.setRange(0, 0)
self.progressBar.setFixedSize(300, 30)
self.progressBar.setTextVisible(True)
self.progressBar.setFormat(title or 'Busy ...')
self.mainLayout = QVBoxLayout(self)
self.mainLayout.addWidget(self.progressBar)
self.setWindowIcon(QIcon(':/images/eddy'))
self.setWindowTitle(title or 'Busy ...')
self.setFixedSize(self.sizeHint())
####################################################################################################################
# #
# CONTEXT MANAGER #
# #
####################################################################################################################
def __enter__(self):
"""
Draw the dialog.
"""
self.show()
def __exit__(self, exc_type, exc_value, traceback):
"""
Close the dialog.
"""
self.close()
示例2: WindowSR
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import setFixedSize [as 别名]
class WindowSR(QMainWindow):
"""Main window of SoundRain"""
bad_id = pyqtSignal()
def __init__(self):
super().__init__()
self.initWin()
self.init_client_id()
def initWin(self):
"""Create main parts of the window"""
# Main Window
self.setFixedSize(900, 500)
self.center()
self.setWindowTitle("SoundRain")
self.setWindowIcon(QIcon('soundrainlogo.jpg'))
# Central Widget
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
# QVBox stocking every row
self.vertical_grid = QVBoxLayout()
# First row: URL request
row_url = QHBoxLayout()
label_url = QLabel("URL:", self)
self.text_url = QLineEdit(self)
self.text_url.textChanged.connect(self.block_dl)
self.but_url = QPushButton("Search", self)
self.but_url.clicked.connect(self.check_url)
row_url.addWidget(label_url)
row_url.addWidget(self.text_url)
row_url.addWidget(self.but_url)
# Row of separation 1
row_sep1 = QHBoxLayout()
line_sep = QFrame()
line_sep.setFrameShape(QFrame.HLine)
row_sep1.addWidget(line_sep)
# Second row (splitted screen between cover image and music info):
row_split = QHBoxLayout()
# Cover image
column_image = QVBoxLayout()
self.label_image = QLabel(self)
self.label_image.setMaximumHeight(280)
self.label_image.setMinimumHeight(280)
self.label_image.setMaximumWidth(280)
self.label_image.setMinimumHeight(280)
self.cover = QPixmap(280, 280)
self.cover.load("unknownperson.jpg")
self.label_image.setPixmap(self.cover)
column_image.addWidget(self.label_image)
# music info
column_info = QVBoxLayout()
label_name = QLabel("Name", self)
self.name = QLineEdit(self)
label_artist = QLabel("Artist", self)
self.artist = QLineEdit(self)
label_album = QLabel("Album", self)
self.album = QLineEdit(self)
label_genre = QLabel("Genre", self)
self.genre = QLineEdit(self)
# --
column_info.addWidget(label_name)
column_info.addWidget(self.name)
column_info.addWidget(label_artist)
column_info.addWidget(self.artist)
column_info.addWidget(label_album)
column_info.addWidget(self.album)
column_info.addWidget(label_genre)
column_info.addWidget(self.genre)
# --
row_split.addLayout(column_image)
row_split.addLayout(column_info)
# Row of separation 2
row_sep2 = QHBoxLayout()
line_sep2 = QFrame()
line_sep2.setFrameShape(QFrame.HLine)
row_sep2.addWidget(line_sep2)
# Add the file location selection row
row_file = QHBoxLayout()
self.but_file = QPushButton("Save location", self)
self.but_file.clicked.connect(self.open_f)
self.text_file = QLineEdit(self.default_path(), self)
row_file.addWidget(self.but_file)
row_file.addWidget(self.text_file)
# Row of separation 3
row_sep3 = QHBoxLayout()
line_sep3 = QFrame()
line_sep3.setFrameShape(QFrame.HLine)
row_sep3.addWidget(line_sep3)
# Download button row
#.........这里部分代码省略.........