本文整理匯總了Python中PyQt5.QtWidgets.QScrollArea方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QScrollArea方法的具體用法?Python QtWidgets.QScrollArea怎麽用?Python QtWidgets.QScrollArea使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QScrollArea方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def __init__(self, parent=None, frame=QtWidgets.QFrame.Box):
super(FIRSTUI.ScrollWidget, self).__init__()
# Container Widget
widget = QtWidgets.QWidget()
# Layout of Container Widget
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
widget.setLayout(self.layout)
# Scroll Area Properties
scroll = QtWidgets.QScrollArea()
scroll.setFrameShape(frame)
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scroll.setWidgetResizable(True)
scroll.setWidget(widget)
# Scroll Area Layer add
scroll_layout = QtWidgets.QVBoxLayout(self)
scroll_layout.addWidget(scroll)
scroll_layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(scroll_layout)
示例2: stepsFigure
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def stepsFigure(workspace):
"""GUI layout for step-by-step solution
Arguments:
workspace {QtWidgets.QWidget} -- main layout
Returns:
stepslayout {QtWidgets.QVBoxLayout} -- step-by-step solution layout
"""
workspace.stepsfigure = Figure()
workspace.stepscanvas = FigureCanvas(workspace.stepsfigure)
workspace.stepsfigure.clear()
workspace.scroll = QScrollArea()
workspace.scroll.setWidget(workspace.stepscanvas)
stepslayout = QVBoxLayout()
stepslayout.addWidget(workspace.scroll)
return stepslayout
示例3: create_message_box
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def create_message_box(title, text, icon="information", width=150):
msg = QMessageBox()
msg.setWindowTitle(title)
lineCnt = len(text.split('\n'))
if lineCnt > 15:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(text)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
msg.layout().addWidget(scroll, 12, 10, 1, msg.layout().columnCount())
msg.setStyleSheet("QScrollArea{min-width:550 px; min-height: 400px}")
else:
msg.setText(text)
if icon == "warning":
msg.setIcon(QtWidgets.QMessageBox.Warning)
msg.setStyleSheet("QMessageBox Warning{min-width: 50 px;}")
else:
msg.setIcon(QtWidgets.QMessageBox.Information)
msg.setStyleSheet("QMessageBox Information{min-width: 50 px;}")
msg.setStyleSheet("QmessageBox QLabel{min-width: "+str(width)+"px;}")
msg.exec_()
示例4: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def __init__(self, title, subtitle, layout=QtWidgets.QVBoxLayout, parent=None):
super().__init__(parent)
self.setWindowTitle(title)
self.mainWidget = QtWidgets.QWidget(self)
self.mainWidget.layout = QtWidgets.QVBoxLayout(self.mainWidget)
self.mainWidget.setLayout(self.mainWidget.layout)
self.setCentralWidget(self.mainWidget)
if subtitle:
self.mainWidget.layout.addWidget(QtWidgets.QLabel(subtitle))
self.scrollArea = QtWidgets.QScrollArea(self.mainWidget)
self.scrollArea.setWidgetResizable(True)
self.contents = QtWidgets.QWidget(self.scrollArea)
self.contents.layout = layout()
self.contents.setLayout(self.contents.layout)
self.mainWidget.layout.addWidget(self.contents)
self.mainWidget.layout.addWidget(self.scrollArea)
self.scrollArea.setWidget(self.contents)
示例5: initUI
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def initUI(self):
self.mainLayout = QVBoxLayout()
self.setWindowTitle(self.title)
self.setGeometry(150,150,800,400)
self.notes = QScrollArea()
self.scroll_widget = QWidget()
self.scroll_layout = QVBoxLayout(self.scroll_widget)
self.scroll_layout.setSpacing(20.0)
#List Generation of all the notes
for key,value in self.noteContents.items():
self.notetile = noteTile(key,value)
self.scroll_layout.addLayout(self.notetile.noteTileLayout)
self.notes.setWidget(self.scroll_widget)
self.mainLayout.addWidget(self.notes)
self.setLayout(self.mainLayout)
self.show()
示例6: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def __init__(self,passedKeywords):
super(TabLayout,self).__init__()
self.keywords = passedKeywords
self.customTab = QTabWidget()
self.news = QScrollArea()
self.scroll_widget = QWidget()
self.scroll_layout = QVBoxLayout(self.scroll_widget)
self.scroll_layout.setSpacing(20.0)
articles = news_func(self.keywords)
for article in articles:
self.myLabel = Tiles(parent="None",description = article['description'][0:100],title=article['title'],url=article['url'],urlImage=article['urlToImage'])
self.scroll_layout.addLayout(self.myLabel.tileLayout)
self.news.setWidget(self.scroll_widget)
self.customTab.addTab(self.news,"News")
示例7: quickMsg
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例8: quickMsg
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例9: get_QScrollArea
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def get_QScrollArea():
"""QScrollArea getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QScrollArea
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QScrollArea
示例10: _ui
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def _ui(self):
"""
Prepares the basic layout structure, including the intro label,
scroll area, radio buttons, and help/okay/cancel buttons.
"""
intro = Note() # see show() for where the text is initialized
intro.setObjectName('intro')
scroll = QtWidgets.QScrollArea()
scroll.setObjectName('scroll')
layout = super(BrowserStripper, self)._ui()
layout.addWidget(intro)
layout.addWidget(scroll)
layout.addSpacing(self._SPACING)
layout.addWidget(Label("... and remove the following:"))
for value, label in [
(
'ours',
"only [sound] tags or paths generated by Awesome&TTS",
),
(
'theirs',
"only [sound] tags ¬ generated by AwesomeTTS",
),
(
'any',
"&all [sound] tags, regardless of origin, and paths "
"generated by AwesomeTTS",
),
]:
radio = QtWidgets.QRadioButton(label)
radio.setObjectName(value)
layout.addWidget(radio)
layout.addWidget(self._ui_buttons())
return layout
示例11: show
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def show(self, *args, **kwargs):
"""
Populate the checkbox list of available fields and initialize
the introduction message, both based on what is selected.
"""
self._notes = [
self._browser.mw.col.getNote(note_id)
for note_id in self._browser.selectedNotes()
]
self.findChild(Note, 'intro').setText(
"From the %d note%s selected in the Browser, scan the following "
"fields:" %
(len(self._notes), "s" if len(self._notes) != 1 else "")
)
layout = QtWidgets.QVBoxLayout()
for field in sorted({field
for note in self._notes
for field in note.keys()}):
checkbox = Checkbox(field)
checkbox.atts_field_name = field
layout.addWidget(checkbox)
panel = QtWidgets.QWidget()
panel.setLayout(layout)
self.findChild(QtWidgets.QScrollArea, 'scroll').setWidget(panel)
(
self.findChild(
QtWidgets.QRadioButton,
self._addon.config['last_strip_mode'],
)
or self.findChild(QtWidgets.QRadioButton) # use first if config bad
).setChecked(True)
super(BrowserStripper, self).show(*args, **kwargs)
示例12: _init_ui
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def _init_ui(self):
# Layouts
files_layout = QtWidgets.QVBoxLayout()
files_label = QtWidgets.QLabel(self)
files_label.setText('Opened files:')
files_layout.addWidget(files_label)
files_layout.addWidget(self._list_of_files)
features_layout = QtWidgets.QVBoxLayout()
features_label = QtWidgets.QLabel(self)
features_label.setText('Detected features:')
features_layout.addWidget(features_label)
features_layout.addWidget(self._list_of_features)
canvas_layout = QtWidgets.QVBoxLayout()
canvas_layout.addWidget(self._toolbar)
canvas_layout.addWidget(self._canvas)
canvas_files_features_layout = QtWidgets.QHBoxLayout()
canvas_files_features_layout.addLayout(files_layout, 15)
canvas_files_features_layout.addLayout(canvas_layout, 70)
canvas_files_features_layout.addLayout(features_layout, 15)
scrollable_pb_list = QtWidgets.QScrollArea()
scrollable_pb_list.setWidget(self._pb_list)
scrollable_pb_list.setWidgetResizable(True)
main_layout = QtWidgets.QVBoxLayout()
main_layout.addLayout(canvas_files_features_layout, 90)
main_layout.addWidget(scrollable_pb_list, 10)
widget = QtWidgets.QWidget()
widget.setLayout(main_layout)
self.setCentralWidget(widget)
# Auxiliary methods
示例13: quickMsg
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def quickMsg(self, msg, block=1, ask=0):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
if ask==0:
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
else:
tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
if block:
value = tmpMsg.exec_()
if value == QtWidgets.QMessageBox.Ok:
return 1
else:
return 0
else:
tmpMsg.show()
return 0
示例14: setupAutoAttacksToolTab
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def setupAutoAttacksToolTab(self):
self.toolNameLabel = QtWidgets.QLabel()
self.toolNameLabel.setText('Tool')
self.toolNameLabel.setFixedWidth(150)
self.toolServicesLabel = QtWidgets.QLabel()
self.toolServicesLabel.setText('Services')
self.toolServicesLabel.setFixedWidth(300)
self.enableAllToolsLabel = QtWidgets.QLabel()
self.enableAllToolsLabel.setText('Run automatically')
self.enableAllToolsLabel.setFixedWidth(150)
self.autoToolTabHorLayout = QtWidgets.QHBoxLayout()
self.autoToolTabHorLayout.addWidget(self.toolNameLabel)
self.autoToolTabHorLayout.addWidget(self.toolServicesLabel)
self.autoToolTabHorLayout.addWidget(self.enableAllToolsLabel)
self.scrollArea = QtWidgets.QScrollArea()
self.scrollWidget = QtWidgets.QWidget()
self.globVerAutoToolsLayout = QtWidgets.QVBoxLayout(self.AutoToolsWidget)
self.globVerAutoToolsLayout.addLayout(self.autoToolTabHorLayout)
self.scrollVerLayout = QtWidgets.QVBoxLayout(self.scrollWidget)
self.enabledSpacer = QSpacerItem(60,0)
# by default the automated attacks are not activated and the tab is not enabled
self.AutoAttacksSettingsTab.setTabEnabled(1,False)
# for all the browse buttons
示例15: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QScrollArea [as 別名]
def __init__(self, parent=None):
QtWidgets.QWidget.__init__(self, parent)
self.scaleFactor = 0.0
self.imageLabel = QtWidgets.QLabel()
self.imageLabel.setBackgroundRole(QtGui.QPalette.Base)
self.imageLabel.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
self.imageLabel.setScaledContents(True)
self.scrollArea = QtWidgets.QScrollArea()
self.scrollArea.setBackgroundRole(QtGui.QPalette.Dark)
self.scrollArea.setWidget(self.imageLabel)