def __init__(self): QMainWindow.__init__(self) # self.setWindowIcon(QIcon('./FiSig/icon/icon_fifi.png')) # self.setAcceptDrops(True) # ==================================== # メンバ変数の定義 # ==================================== self.fileName = None # パス名 path の正規化された絶対パスを返します。 self.abspath = None # パス名 path の末尾のファイル名部分を返します。 self.basename = None # パス名 path のディレクトリ名を返します。 self.dirname = None # pathが実在するパスか、オープンしているファイル記述子を参照している場合 True を返します。 self.exists = None # 拡張子無しファイル名と、拡張子を返す self.name, self.ext = None, None # ==================================== # UIの生成 # ==================================== # QListViewを使うためには下のコードを書くだけ self.myListView = FileListView() self.widget = QWidget() layout = QVBoxLayout(self.widget) layout.addWidget(self.myListView) self.setCentralWidget(self.widget) # ==================================== # シグナルスロットのコネクト # ==================================== self.connect(self.myListView, SIGNAL("clicked(QModelIndex)"), self.slot1)
def __init__(self, parent=None): super(getFilesDlg, self).__init__(parent) self.setMinimumSize(500,500) self.fileDlgPaths = [] layout = QVBoxLayout() self.btnBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.btnBox.accepted.connect(self.getPaths) self.btnBox.rejected.connect(self.close) self.fsModel = QFileSystemModel() self.treeView = QTreeView() self.treeView.setSelectionMode(QTreeView.ExtendedSelection) self.treeView.setModel(self.fsModel) self.treeView.setColumnWidth(0, 361) self.treeView.setColumnHidden(1, True) self.treeView.setColumnHidden(3, True) layout.addWidget(self.treeView) layout.addWidget(self.btnBox) self.setLayout(layout) self.fsModel.setRootPath(environ['HOMEPATH']) # self.treeView.setRootIndex(self.fsModel.index("\\")) self.treeView.expand(self.treeView.rootIndex())
def __init__(self, page, layout, parent): self.page = page self.parent = parent container = QVBoxLayout() # actions section actionsContainer = QHBoxLayout() self.saveButton = QPushButton('Save') self.saveButton.clicked.connect(lambda: save_clicked(self)) actionsContainer.addWidget(QLabel('Link: ')) self.linkText = QLineEdit(page.url) label = QLabel('<a href="' + page.url + '">Open Externally</a>') label.setOpenExternalLinks(True) actionsContainer.addWidget(self.linkText) actionsContainer.addWidget(self.saveButton) actionsContainer.addWidget(label) container.addLayout(actionsContainer) # content self.view = QWebView() self.view.setUrl(page.url) container.addWidget(self.view) layout.addLayout(container)
def deleteTab(self): dialog = QDialog( self ) dialog.setWindowTitle( "Remove Tab" ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout(dialog) description = QLabel( "'%s' ���� �����Ͻð� ���ϱ�?".decode('utf-8') % self.tabText( self.currentIndex() ) ) layoutButtons = QHBoxLayout() buttonDelete = QPushButton( "�����".decode('utf-8') ) buttonCancel = QPushButton( "���".decode('utf-8') ) layoutButtons.addWidget( buttonDelete ) layoutButtons.addWidget( buttonCancel ) mainLayout.addWidget( description ) mainLayout.addLayout( layoutButtons ) dialog.show() def cmd_delete(): self.removeTab( self.indexOf( self.currentWidget() ) ) dialog.close() def cmd_cancel(): dialog.close() QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL('clicked()'), cmd_delete ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL('clicked()'), cmd_cancel )
def createGUI(self): self.mainWidget = QWidget() self._createMenus() hLayout = QHBoxLayout() vLayout = QVBoxLayout() innerVLayout = QVBoxLayout() self.profileBox = Profile(self.athlete) self.addPushupBtn = QPushButton("Add Pushup") self.addPushupBtn.setMaximumWidth(100) self.pushupsListWidget = PushupList(self.pushups) self.graphWidget = GraphWidget() #self.graphWidget.setMaximumSize(400, 300) vLayout.addWidget(self.profileBox) hLayout.addWidget(self.pushupsListWidget) innerVLayout.addWidget(self.graphWidget) hLayout.addLayout(innerVLayout) vLayout.addLayout(hLayout) vLayout.addWidget(self.addPushupBtn) self.mainWidget.setLayout(vLayout) self.setCentralWidget(self.mainWidget)
def __init__(self, config, parent=None, **kwargs): QWidget.__init__(self, parent) self.startTime = None self.numDataPoints = 0 self.datasets = {} for display in config['displays']: self.datasets[display['field']] = self.createDatasetForDisplay(display) self.graph = PlotWidget(title=config['title'], labels=config['labels']) # Only add a legend to the graph if there is more than one dataset displayed on it if len(self.datasets) > 1: self.graph.addLegend() # Show grid lines self.graph.showGrid(x=True, y=True) for _, dataset in self.datasets.items(): self.graph.addItem(dataset['plotData']) vbox = QVBoxLayout() vbox.addWidget(self.graph) self.setLayout(vbox)
def __init__(self, parent=None): super(QtReducePreferencePane, self).__init__(parent) self.__createContents() self.toolBar = QtReducePreferencesToolBar(self) self.worksheet = QtReducePreferencesWorksheet(self) self.computation = QtReducePreferencesComputation(self) self.pagesWidget = QStackedWidget() self.pagesWidget.addWidget(self.toolBar) self.pagesWidget.addWidget(self.worksheet) self.pagesWidget.addWidget(self.computation) self.pagesWidget.setCurrentIndex( self.contentsWidget.row(self.contentsWidget.currentItem())) closeButton = QPushButton(self.tr("Close")) closeButton.clicked.connect(self.close) horizontalLayout = QHBoxLayout() horizontalLayout.addWidget(self.contentsWidget) horizontalLayout.addWidget(self.pagesWidget) buttonsLayout = QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QVBoxLayout() mainLayout.addLayout(horizontalLayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout) self.setWindowTitle(self.tr("QReduce Preferences"))
class WallframeAppButton(QWidget): def __init__(self, app_tag, app_image_path, app_description_path): QWidget.__init__(self) # App tag self.app_tag_ = QLabel(app_tag) # App image app_image = QPixmap() app_image.load(app_image_path) self.app_image_ = QLabel() self.app_image_.setPixmap(app_image) # App description try: f = open(app_description_path, "r") self.app_description_ = f.read() f.close() except: print "Error opening description. Quitting." self.setToolTip(self.app_description_) # Layout the child widgets self.child_layout_ = QVBoxLayout() self.child_layout_.addWidget(self.app_image_) self.child_layout_.addWidget(self.app_tag_) self.setLayout(self.child_layout_)
def __init__(self,parent=None): super(QtReducePreferencesWorksheet,self).__init__(parent) fontGroup = QGroupBox(self.tr("Fonts")) self.fontCombo = QtReduceFontComboBox(self) self.setFocusPolicy(Qt.NoFocus) self.fontCombo.setEditable(False) self.fontCombo.setCurrentFont(self.parent().parent().controller.view.font()) self.sizeCombo = QtReduceFontSizeComboBox() self.sizeComboFs = QtReduceFontSizeComboBoxFs() self.findSizes(self.fontCombo.currentFont()) self.fontCombo.currentFontChanged.connect(self.findSizes) fontLayout = QFormLayout() fontLayout.addRow(self.tr("General Worksheet Font"),self.fontCombo) fontLayout.addRow(self.tr("Font Size"),self.sizeCombo) fontLayout.addRow(self.tr("Full Screen Font Size"),self.sizeComboFs) fontGroup.setLayout(fontLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(fontGroup) self.setLayout(mainLayout)
def __init__(self,parent=None): super(QtReducePreferencesComputation,self).__init__(parent) reduceGroup = QGroupBox("Reduce") self.reduceBinary = QLineEdit() # font = self.reduceBinary.font() # font.setFamily(QSettings().value("worksheet/fontfamily", # QtReduceDefaults.FONTFAMILY)) # self.reduceBinary.setFont(font) self.reduceBinary.setText(QSettings().value("computation/reduce", QtReduceDefaults.REDUCE)) self.reduceBinary.editingFinished.connect(self.editingFinishedHandler) reduceLayout = QFormLayout() reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary) reduceGroup.setLayout(reduceLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(reduceGroup) self.setLayout(mainLayout)
def initUi(self): #slider slider = QSlider(PySide.QtCore.Qt.Orientation.Horizontal, self) slider.setRange(0,2) slider.setTickInterval(1) slider.setValue(2) self.slider = slider #.. and corresponding label element label = QLabel(self) label.setText(self.activation_states[slider.value()]) self.label = label #connections #PySide.QtCore.QObject.connect(slider, slider.valueChanged, self, self.update_label) #self.connect(slider.valueChanged, self.update_label()) slider.valueChanged[int].connect(self.update_label) # layout lo = QVBoxLayout() lo.addWidget( slider ) lo.addWidget( label ) self.setLayout(lo)
def __init__(self, fig): QDialog.__init__(self) self.fig = fig main_layout = QVBoxLayout() self.setLayout(main_layout) top_widget = QWidget() bottom_widget = QWidget() main_layout.addWidget(top_widget) main_layout.addWidget(bottom_widget) top_layout = QHBoxLayout() bottom_layout = QHBoxLayout() top_widget.setLayout(top_layout) bottom_widget.setLayout(bottom_layout) self.atext = qHotField("annotation", unicode, "the_text") top_layout.addWidget(self.atext) self.segment_number = qHotField("Segment", int, 1) top_layout.addWidget(self.segment_number) qmy_button(top_layout, self.annotate_it, "annotate") self.over = qHotField("over", int, -70) bottom_layout.addWidget(self.over) self.up = qHotField('up', int, 30) bottom_layout.addWidget(self.up) qmy_button(bottom_layout, self.remove_annotations, "remove all") qmy_button(bottom_layout, self.remove_last_annotation, "remove last") self.annotations = []
def __init__(self, page, parent=None): super(HelpForm, self).__init__(parent) self.pageLabel = QLabel("<font color=purple size=30><b>Help Contents</b></font>") self.pageLabel.setMinimumSize(400, 50) self.pageLabel.setAlignment(Qt.AlignCenter) appicom = QIcon(":/icons/njnlogo.png") self.setWindowIcon(appicom) toolBar = QToolBar() pixmap = QPixmap(":/icons/njnlogo.png") lbl = QLabel(self) lbl.setPixmap(pixmap) lbl.setFixedSize(70, 70) toolBar.setMinimumHeight(70) toolBar.setMaximumHeight(80) toolBar.addWidget(lbl) toolBar.addWidget(self.pageLabel) self.textBrowser = QTextBrowser() layout = QVBoxLayout() layout.addWidget(toolBar) layout.addWidget(self.textBrowser, 1) self.setLayout(layout) self.textBrowser.setSource(QUrl(page)) self.setMinimumSize(650, 650) self.setMaximumSize(650, 660) self.setWindowTitle("Nigandu English to Tamil Dictionary | HELP")
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, parent=None): global client super(CharacterSelect, self).__init__(parent) self.setWindowTitle("Select A Character") # Character Portrait # Character Sprite # Name # Current zone # Money self.charbuttons = {} for char in client.characters: button = QPushButton() button.setText(char) button.setIcon(QIcon.fromTheme('applications-games')) func = functools.partial(self.select_character, char=char) button.clicked.connect(func) self.charbuttons[char] = button layout = QVBoxLayout() for w in self.charbuttons.values(): layout.addWidget(w) self.setLayout(layout) self.character_chosen.connect(qtclient.choose_char)
def __init__(self, parent=None): super(LoginForm, self).__init__(parent) self.setWindowTitle("Login") self.status_icon = QIcon.fromTheme("user-offline") self.setWindowIcon(self.status_icon) self.server_status = QLabel() self.server_status.setAlignment(Qt.AlignCenter) self.server_status.setPixmap(self.status_icon.pixmap(64)) self.username = QLineEdit("Username") self.password = QLineEdit("Password") self.password.setEchoMode(QLineEdit.Password) self.login_button = QPushButton("Getting server status...") self.login_button.setEnabled(False) self.login_button.clicked.connect(self.login) self.login_button.setIcon(self.status_icon) self.ping_timer = QTimer(self) self.connect(self.ping_timer, SIGNAL("timeout()"), self.is_server_up) self.ping_timer.start(1000) layout = QVBoxLayout() for w in (self.server_status, self.username, self.password, self.login_button): layout.addWidget(w) self.setLayout(layout) self.logged_in.connect(qtclient.login)
def make_central_widget(self, labelText): self.label = QLabel(labelText) mainLayout = QVBoxLayout() mainLayout.addWidget(self.label) w = QWidget() w.setLayout(mainLayout) self.setCentralWidget(w)
def __init__(self, parent = None) : ''' Constructor ''' super(QmlGameFrame, self).__init__(parent) layout = QVBoxLayout() self.view = QDeclarativeView(self) layout.addWidget(self.view) self.setLayout(layout) self.geoMap = GeoMap() #self.model.connect() #self.noteList = self.model.getNoteList() #self.noteList = self.model.getToDoList() rootContext = self.view.rootContext() rootContext.setContextProperty('geoMap', self.geoMap) path = QDir.currentPath() + '/../../qml/SimpleQmlGameEngine/main.qml' path = path.replace('users', 'Users') print path url = QUrl(path) #url = QUrl('file:///Users/unseon_pro/myworks/SimpleQmlGameEngine/qml/SimpleQmlGameEngine/main.qml') self.view.setSource(url)
def setup_ui(self): """ Setup the UI for the window. """ central_widget = QWidget() layout = QVBoxLayout() layout.addWidget(self.clock_view) layout.addWidget(self.message_view) central_widget.setLayout(layout) self.setCentralWidget(central_widget) menubar = self.menuBar() file_menu = QMenu('File') preferences_action = QAction('Preferences', file_menu) preferences_action.triggered.connect(self.on_preferences_triggered) quit_action = QAction('Quit', file_menu) quit_action.triggered.connect(self.on_quit_triggered) file_menu.addAction(preferences_action) file_menu.addAction(quit_action) menubar.addMenu(file_menu) view_menu = QMenu('View') fullscreen_action = QAction('Fullscreen', view_menu) fullscreen_action.setCheckable(True) fullscreen_action.setChecked(Config.get('FULLSCREEN', True)) fullscreen_action.setShortcut('Ctrl+Meta+F') fullscreen_action.toggled.connect(self.on_fullscreen_changed) view_menu.addAction(fullscreen_action) menubar.addMenu(view_menu)
def _setup_ui(self): self._btn_pick_1.setFixedWidth(25) self._btn_pick_1.setToolTip('Pick first sequence.') self._btn_pick_2.setFixedWidth(25) self._btn_pick_2.setToolTip('Pick second sequence.') self._btn_compare.setToolTip('Compare sequences.') self._progress_bar.setFixedHeight(10) lyt_seq1 = QHBoxLayout() lyt_seq1.addWidget(self._ledit1) lyt_seq1.addWidget(self._btn_pick_1) lyt_seq2 = QHBoxLayout() lyt_seq2.addWidget(self._ledit2) lyt_seq2.addWidget(self._btn_pick_2) lyt_main = QVBoxLayout() lyt_main.addLayout(lyt_seq1) lyt_main.addLayout(lyt_seq2) lyt_main.addWidget(self._btn_compare) main_widget = QWidget() main_widget.setLayout(lyt_main) self.setCentralWidget(main_widget)
def _create_contents ( self, parent ): lay = QVBoxLayout() lay.addWidget( self._create_dialog_area( parent ) ) lay.addWidget( self._create_buttons( parent ) ) parent.setLayout( lay )
def __init__(self, theScene, parent): """ Default class constructor. :param `theScene`: TOWRITE :type `theScene`: `QGraphicsScene`_ :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ """ super(EmbDetailsDialog, self).__init__(parent) self.setMinimumSize(750, 550) self.getInfo() mainWidget = self.createMainWidget() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok) buttonBox.accepted.connect(self.accept) vboxLayoutMain = QVBoxLayout(self) vboxLayoutMain.addWidget(mainWidget) vboxLayoutMain.addWidget(buttonBox) self.setLayout(vboxLayoutMain) self.setWindowTitle(self.tr("Embroidery Design Details")) QApplication.setOverrideCursor(Qt.ArrowCursor)
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) title = "" if kwargs.has_key( 'title' ): title = kwargs['title'] self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_LoadVertex_%s.txt" % title sgCmds.makeFile( self.infoPath ) vLayout = QVBoxLayout( self ); vLayout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) groupBox.setAlignment( QtCore.Qt.AlignCenter ) vLayout.addWidget( groupBox ) hLayout = QHBoxLayout() lineEdit = QLineEdit() button = QPushButton("Load"); button.setFixedWidth( 50 ) hLayout.addWidget( lineEdit ) hLayout.addWidget( button ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.loadVertex ) self.loadInfo()
def __init__(self, name, arg_dict, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.cbox = QCheckBox() # self.efield.setMaximumWidth(max_size) self.cbox.setFont(QFont('SansSerif', 12)) self.label = QLabel(name) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.cbox) self.arg_dict = arg_dict self.name = name self.mytype = type(self.arg_dict[name]) if self.mytype != bool: self.cbox.setChecked(bool(self.arg_dict[name])) else: self.cbox.setChecked(self.arg_dict[name]) self.cbox.toggled.connect(self.when_modified) self.when_modified()
def makeContent(self): ''' Override this method to return the layout with the contents of this screen. ''' l = QVBoxLayout() l.addWidget(QLabel("This Screen Intentionally Left Blank")) return l
def __init__(self, title, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title sgCmds.makeFile( self.infoPath ) layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) layout.addWidget( groupBox ) baseLayout = QVBoxLayout() groupBox.setLayout( baseLayout ) listWidget = QListWidget() hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 ) b_addSelected = QPushButton( "Add Selected" ) b_clear = QPushButton( "Clear" ) hl_buttons.addWidget( b_addSelected ) hl_buttons.addWidget( b_clear ) baseLayout.addWidget( listWidget ) baseLayout.addLayout( hl_buttons ) self.listWidget = listWidget QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem ) QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected ) QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected ) self.otherWidget = None self.loadInfo()
def __init__(self): super(STMainWindow, self).__init__() self.createActions() self.createMenus() layout = QVBoxLayout() self.tabs = QTabWidget() self.tabs.setTabPosition(QTabWidget.West) self.tabs.currentChanged[int].connect(self.tabChanged) self.sessiontab = sweattrails.qt.sessiontab.SessionTab(self) self.tabs.addTab(self.sessiontab, "Sessions") self.tabs.addTab(sweattrails.qt.fitnesstab.FitnessTab(self), "Fitness") self.tabs.addTab(sweattrails.qt.profiletab.ProfileTab(self), "Profile") self.usertab = sweattrails.qt.usertab.UserTab(self) self.tabs.addTab(self.usertab, "Users") self.usertab.hide() layout.addWidget(self.tabs) w = QWidget(self) w.setLayout(layout) self.setCentralWidget(w) self.statusmessage = QLabel() self.statusmessage.setMinimumWidth(200) self.statusBar().addPermanentWidget(self.statusmessage) self.progressbar = QProgressBar() self.progressbar.setMinimumWidth(100) self.progressbar.setMinimum(0) self.progressbar.setMaximum(100) self.statusBar().addPermanentWidget(self.progressbar) self.setWindowTitle("SweatTrails") self.setWindowIconText("SweatTrails") icon = QPixmap("image/sweatdrops.png") self.setWindowIcon(QIcon(icon)) QCoreApplication.instance().refresh.connect(self.userSet)
def __init__(self, name, arg_dict, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.efield = QLineEdit("Default Text") # self.efield.setMaximumWidth(max_size) self.efield.setFont(QFont('SansSerif', 12)) self.label = QLabel(name) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.efield) self.arg_dict = arg_dict self.name = name self.mytype = type(self.arg_dict[name]) if self.mytype != str: self.efield.setText(str(self.arg_dict[name])) self.efield.setMaximumWidth(50) else: self.efield.setText(self.arg_dict[name]) self.efield.setMaximumWidth(100) self.efield.textChanged.connect(self.when_modified)
def _updateView(self, data=None): ''' ''' #wrap it in a try-catch try: #if the data argument is not None #assign it to the instance var data if data: self.data = data if not self.fig: # on first plot self.dpi = self.logicalDpiX() logging.info("Plotting at %s dpi." % self.dpi) self.fig = Figure(dpi=self.dpi) self.canvas = FigureCanvas(self.fig) self.axes = self.fig.add_subplot(111) self.mpl_toolbar = NavigationToolbar(self.canvas, None) left_vbox = QVBoxLayout(self.plotWrapper) left_vbox.addWidget(self.canvas) left_vbox.addWidget(self.mpl_toolbar) self.setAxesAndData() self.canvas.draw() else: self.axes.clear() self.setAxesAndData() self.canvas.draw() except Exception as e: logging.debug("PlotWidgetController._updateView: Error occurred: %s" % e)
def __init__(self, parent,silhouette,completeness,homogeneity,v_score,AMI,ARS): QDialog.__init__( self, parent ) layout = QVBoxLayout() viewLayout = QFormLayout() viewLayout.addRow(QLabel('Silhouette score: '),QLabel(silhouette)) viewLayout.addRow(QLabel('Completeness: '),QLabel(completeness)) viewLayout.addRow(QLabel('Homogeneity: '),QLabel(homogeneity)) viewLayout.addRow(QLabel('V score: '),QLabel(v_score)) viewLayout.addRow(QLabel('Adjusted mutual information: '),QLabel(AMI)) viewLayout.addRow(QLabel('Adjusted Rand score: '),QLabel(ARS)) viewWidget = QGroupBox() viewWidget.setLayout(viewLayout) layout.addWidget(viewWidget) #Accept cancel self.acceptButton = QPushButton('Ok') self.cancelButton = QPushButton('Cancel') self.acceptButton.clicked.connect(self.accept) self.cancelButton.clicked.connect(self.reject) hbox = QHBoxLayout() hbox.addWidget(self.acceptButton) hbox.addWidget(self.cancelButton) ac = QWidget() ac.setLayout(hbox) layout.addWidget(ac) self.setLayout(layout)
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.installEventFilter(self) self.layout = QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.checkBox = QCheckBox("To Parent") self.layout.addWidget(self.checkBox)
def __init__(self, title): QWidget.__init__(self) # Layout Init. self.setGeometry(300, 300, 600, 100) self.setFixedSize(600, 400) self.setWindowTitle(title) # Attributes self.components = {} self.container = QVBoxLayout() self.interceptor = None
def __init__(self, parent=None): super(NotificationTemplate, self).__init__(parent) self.setObjectName('notification_template') self.msg_id = '' self.horizontal = QVBoxLayout(self) self.body = QLabel(self) self.body.mouseReleaseEvent = self.mouseReleaseEvent self.horizontal.addWidget(self.body) self.setStyleSheet('QWidget:hover {' 'background-color:#4285f4;color:white;}')
def __init__(self): QWidget.__init__(self) self.__test = QPushButton("ViewCheck") _layout = QVBoxLayout() self.setLayout(_layout) _layout.addWidget(self.__test)
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.createLayout() windowLayout = QVBoxLayout() windowLayout.addWidget(self.GridGroupBox) self.setLayout(windowLayout) self.show()
def __init__(self, parent, change_tracker: ChangeTracker): super(CommentsWidget, self).__init__(parent) self._change_tracker = change_tracker #self.setObjectName("zwhite") layout = QVBoxLayout() self.comments_list_widget = QFrame( self ) # If you use QWidget, the background won't be set; don't know why :-( self.comments_list_widget.setStyleSheet("background: white;") self.comments_list_widget.setAutoFillBackground(True) #self.comments_list_widget.setObjectName("zwhite") self._comments_layout = QVBoxLayout() self.comments_list_widget.setLayout(self._comments_layout) self.comments_list_widget.hide() self.text_edit = QTextEdit(self) self.submit_button = QPushButton(("Add"), self) layout.addWidget(self.comments_list_widget) layout.addWidget(self.text_edit) hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(self.submit_button) layout.addLayout(hlayout) self.setLayout(layout) self.submit_button.clicked.connect(self.submit_comment)
def __init__(self, parent=None): super(SettingsDialog, self).__init__(parent) self.setWindowTitle("Settings") main_layout = QVBoxLayout() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) settings = QSettings() db_group = QGroupBox("Database") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("File"), 0, 0) text = settings.value('DB/File') self.file = QLineEdit(text) self.file.setText(text) grid_layout.addWidget(self.file, 0, 1) browse = QPushButton("Browse") browse.clicked.connect(self.browse) grid_layout.addWidget(browse, 0, 2) db_group.setLayout(grid_layout) main_layout.addWidget(db_group) ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000 ") smtp_group = QGroupBox("SMTP") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) text = settings.value('SMTP/Server') self.smtp_server = QLineEdit(text) self.smtp_server.setText(text) grid_layout.addWidget(self.smtp_server, 0, 1) smtp_group.setLayout(grid_layout) main_layout.addWidget(smtp_group) self.http_proxy = QGroupBox("HTTP Proxy") self.http_proxy.setCheckable(True) self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled'))) grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) self.http_proxy_ip = QLineEdit() self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP')) self.http_proxy_ip.setMinimumWidth(ip_width) grid_layout.addWidget(self.http_proxy_ip, 0, 1) grid_layout.setColumnStretch(0, 1) self.http_proxy.setLayout(grid_layout) main_layout.addWidget(self.http_proxy) main_layout.addWidget(buttonBox) self.setLayout(main_layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, variable_setting, parent=None): super(FoamDictWidget, self).__init__(parent) self.buttonLayout = QHBoxLayout() self.pushButtonInsert = QPushButton("Add new row") self.pushButtonRemove = QPushButton("Del selected row") self.pushButtonRestore = QPushButton("Restore table") self.pushButtonClear = QPushButton("Clear table") self.buttonLayout.addWidget(self.pushButtonInsert) self.buttonLayout.addWidget(self.pushButtonRemove) self.buttonLayout.addWidget(self.pushButtonRestore) self.buttonLayout.addWidget(self.pushButtonClear) self.tableWidget = QTableWidget() # header, should not sort, has vertical scrollbar # set column count, fixed to 2, size of TableItem self.tableWidget.setColumnCount(2) # self.tableWidget.setHorizontalHeaderItem(0, ) self.tableWidget.setHorizontalHeaderLabels(['key', 'value text']) # set a default row count, insert as needed self.tableWidget.setRowCount(0) self.buttonPreview = QPushButton('Preview FoamFile write-out') # self.buttonLoad = QPushButton('load dict from existing case ') self.buttonCustomize = QPushButton('Customize (convert into raw)') self.textPreview = QTextEdit('') self.textPreview.setVisible(False) self.textPreview.setEnabled(False) #PySide has different name other than @QtCore.pyqtSlot, but PySide.QtCore.SLOT #PySide has different name other than @QtCore.pyqtSlot, but PySide.QtCore.SLOT self.pushButtonInsert.clicked.connect(self.insertRow) self.pushButtonRemove.clicked.connect(self.removeRow) self.pushButtonRestore.clicked.connect(self.restoreDict) self.pushButtonClear.clicked.connect(self.clearDict) # self.tableWidget.doubleClicked.connect( self.showPreview) # does not work for PySide self.buttonPreview.clicked.connect(self.showPreview) self.buttonCustomize.clicked.connect(self.customizeDict) self._previewing = False self.settings = variable_setting self.previous_settings = self.settings #self.restoreDict() self.updateDictView(self.settings) self.myLayout = QVBoxLayout() self.myLayout.addLayout(self.buttonLayout) self.myLayout.addWidget(self.tableWidget) self.myLayout.addWidget(self.buttonPreview) self.myLayout.addWidget(self.textPreview) self.setLayout(self.myLayout)
def _init_ui(self, txt): self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) pal = QPalette() color = QColor() color.setNamedColor(self._window_bgcolor) color.setAlpha(255 * self._opacity) pal.setColor(QPalette.Background, color) self.setAutoFillBackground(True) self.setPalette(pal) wm, hm = 5, 5 spacing = 8 layout = QVBoxLayout() layout.setSpacing(spacing) layout.setContentsMargins(wm, hm, wm, hm) nlines, ts = self._generate_text(txt) qlabel = QLabel('\n'.join(ts)) ss = 'QLabel {{color: {}; font-family:{}, sans-serif; font-size: {}px}}'.format(self._color, self._font, self._fontsize) qlabel.setStyleSheet(ss) layout.addWidget(qlabel) hlabel = QLabel('double click to dismiss') hlabel.setStyleSheet('QLabel {font-size: 10px}') hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(hlabel) hlayout.addStretch() layout.addLayout(hlayout) self.setLayout(layout) font = QFont(self._font, self._fontsize) fm = QFontMetrics(font) pw = max([fm.width(ti) for ti in ts]) ph = (fm.height() + 2) * nlines w = pw + wm * 2 h = ph + (hm + spacing + 1) * 2 self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setFixedWidth(w) self.setFixedHeight(h) self.setMask(mask(self.rect(), 10))
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) #Validators for data input ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])" ipRegex = QRegExp("^" + ipRange + "\\." + ipRange + "\\." + ipRange + "\\." + ipRange + "$") ipValidator = QRegExpValidator(self.leGraylogIP) ipValidator.setRegExp(ipRegex) self.leGraylogIP.setValidator(ipValidator) self.leGraylogPort.setValidator(QIntValidator(1, 65535)) self.leGraylogHttpPort.setValidator(QIntValidator(1, 65535)) ipValidator = QRegExpValidator(self.leAsterixIP) ipValidator.setRegExp(ipRegex) self.leAsterixIP.setValidator(ipValidator) self.leAsterixPort.setValidator(QIntValidator(1, 65535)) self.leAsterixSic.setValidator(QIntValidator(1, 256)) self.leIamodPort.setValidator(QIntValidator(1, 65535)) self.leIamodThreshold.setValidator(QIntValidator(0, 99999)) #Define functions for GUI actions self.pbStart.clicked.connect(self.__startServer) self.pbStop.clicked.connect(self.__stopServer) self.actionLicense.triggered.connect(self.__license) self.actionLoad_Config_File.triggered.connect(self.__dialogConfigFile) self.pbSaveConfiguration.clicked.connect(self.__writeConfigFile) self.pbStart.setEnabled(False) if self.__checkServerIsRunning(): self.__serverStatusImage(True) else: self.__serverStatusImage(False) self.configFile = ConfigParser.ConfigParser() self.view = QWebView() self.webLayout.addWidget(self.view) self.view.settings().setAttribute( QWebSettings.JavascriptCanOpenWindows, True) self.view.settings().setAttribute(QWebSettings.LocalStorageEnabled, True) self.pbConnect.clicked.connect(self.__connectHttpServer) l = QVBoxLayout(self.tab2) sc = StaticCanvas(self.tab2, width=5, height=4, dpi=100) dc = DynamicCanvas(self.tab2, width=5, height=4, dpi=100) l.addWidget(sc) l.addWidget(dc)
def layoutWidgets(self): vbox = QVBoxLayout() vbox.addWidget(self.termLabel) for radioButton in self.radioButtons: vbox.addWidget(radioButton) hbox = QHBoxLayout() hbox.addWidget(self.customRadioButton) hbox.addWidget(self.sortAsEdit) vbox.addLayout(hbox) vbox.addWidget(self.buttonBox) self.setLayout(vbox)
def _init_widgets(self): area = QScrollArea() area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setWidgetResizable(True) self._area = area base_layout = QVBoxLayout() base_layout.addWidget(area) self.setLayout(base_layout)
def _init_avoids_tab(self, tab): avoids_list = QListWidget() self._avoids_list = avoids_list layout = QVBoxLayout() layout.addWidget(avoids_list) frame = QFrame() frame.setLayout(layout) tab.addTab(frame, 'Avoids')
def __init__(self, parent, label, units): QDataDisplay.__init__(self, parent) self.units = units self.buildLabels(label) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addWidget(self.label) vbox.addWidget(self.data) vbox.addStretch(1) self.setLayout(vbox)
def __init__(self,content_widget,parent=None): super(InlineSubFrame,self).__init__(parent) self.setFrameShape(QFrame.Panel) self.setFrameShadow(QFrame.Sunken) self.setObjectName("HorseRegularFrame") if isinstance(content_widget,QLayout): self.setLayout(content_widget) elif content_widget: vlayout2 = QVBoxLayout(None) vlayout2.addWidget(content_widget) self.setLayout(vlayout2)
def __init__(self, parent): self.figure = Figure() self.canvas = FigureCanvas(self.figure) self.canvas.setParent(parent) self.mpl_toolbar = NavigationToolbar(self.canvas, parent) self.axes = self.figure.add_subplot(111) self.grid_layout = QVBoxLayout() self.grid_layout.addWidget(self.canvas) self.grid_layout.addWidget(self.mpl_toolbar) parent.setLayout(self.grid_layout)
def layoutWidgets(self): layout = QHBoxLayout() layout.addWidget(self.pane, 1) vbox = QVBoxLayout() vbox.addWidget(self.scrollbar) vbox.addWidget(self.square) vbox.setSpacing(0) vbox.setContentsMargins(0, 0, 0, 0) layout.addLayout(vbox) layout.setSpacing(0) layout.setContentsMargins(5, 5, 5, 5) self.setLayout(layout)
def __init__(self, parent: QWidget, wrapped_widget: QWidget, accept_multiple_files=True): # This widget will wrap the wrapped widget in an invisible way. super(DragDropWidget, self).__init__(parent) self.setContentsMargins(0, 0, 0, 0) self._layout = QVBoxLayout() self._layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self._layout) self._layout.addWidget(wrapped_widget) self.setAcceptDrops(True) self._accept_multiple_files = accept_multiple_files
def loadToolTip(self): try: self.dialog.deleteLater() except: pass self.dialog = QDialog(self) self.dialog.setWindowTitle("툴 정보".decode('utf-8')) dialogLayout = QVBoxLayout(self.dialog) lb_description = Label_descriptionImage() dialogLayout.addWidget(lb_description) self.dialog.show()
def __init__(self): QWidget.__init__(self) layout = QVBoxLayout(self) label = QLabel() listWidget = QListWidget() listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) hLayout = QHBoxLayout() buttonLoad = QPushButton("LOAD") buttonRemove = QPushButton("REMOVE") hLayout.addWidget(buttonLoad) hLayout.addWidget(buttonRemove) layout.addWidget(label) layout.addWidget(listWidget) layout.addLayout(hLayout) self.label = label self.listWidget = listWidget self.buttonLoad = buttonLoad self.buttonRemove = buttonRemove QtCore.QObject.connect(self.buttonLoad, QtCore.SIGNAL('clicked()'), self.loadCommand) QtCore.QObject.connect(self.buttonRemove, QtCore.SIGNAL('clicked()'), self.removeCommand)
def _make_tabs_button(self, side_widgets, side_icons): if len(side_widgets) != len(side_icons): raise Exception( "Bad parameters : len(side_widgets) ({}) != len(side_icons) ({})" .format(len(side_widgets), len(side_icons))) layout = QVBoxLayout() self._side_icons = [] ndx = 0 for w in side_widgets: resource_name = side_icons[ndx] pixmap = QPixmap(os.path.join(resource_dir, resource_name)) icon = QIcon(pixmap) self._side_icons.append(icon) b = QToolButton() b.setIcon(icon) b.setIconSize(pixmap.rect().size()) b.setMaximumWidth(pixmap.rect().width() + 6) b.clicked.connect(self.signal_mapper_tab_changed.map) self.signal_mapper_tab_changed.setMapping(b, ndx) layout.addWidget(b) layout.setStretch(ndx, 1) ndx += 1 layout.addStretch() return layout
def __init__(self, title=None): super(TitleWidget, self).__init__() if sys.platform.startswith("darwin"): color1 = QColor(230, 230, 230, 255) color2 = QColor(177, 177, 177, 255) gradient = QLinearGradient() gradient.setStart(0, 0) gradient.setFinalStop(0, TitleWidget.TitleHeight) gradient.setColorAt(0, color1) gradient.setColorAt(1, color2) brush = QBrush(gradient) palette = QPalette() palette.setBrush(QPalette.Background, brush) self.setPalette(palette) self.setAutoFillBackground(True) self.setMaximumHeight(TitleWidget.TitleHeight) self.setMinimumHeight(TitleWidget.TitleHeight) self.titleLabel = QLabel("", parent=self) font = self.titleLabel.font() font.setPixelSize(11) self.titleLabel.setFont(font) self.titleLabel.setAlignment(Qt.AlignCenter) self.titleLabel.setText(title) layout = QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.titleLabel) self.setLayout(layout)
def __init__(self, *args, **kwargs): super(Widget_listMeshs, self).__init__(*args, **kwargs) mainLayout = QVBoxLayout(self) listWidget = QListWidget() button = QPushButton("Refresh") w_buttons = QWidget() lay_buttons = QHBoxLayout(w_buttons) lay_buttons.setContentsMargins(0, 0, 0, 0) buttonSelect = QPushButton("Select One Meterial Face Shaded Objects") buttonClear = QPushButton("Clear") lay_buttons.addWidget(buttonSelect) lay_buttons.addWidget(buttonClear) mainLayout.addWidget(listWidget) mainLayout.addWidget(w_buttons) mainLayout.addWidget(button) listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) self.listWidget = listWidget self.load() QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.load) QtCore.QObject.connect(buttonSelect, QtCore.SIGNAL("clicked()"), self.selectOneMeterialFaceShadedObjects) QtCore.QObject.connect(buttonClear, QtCore.SIGNAL("clicked()"), self.cmd_clear) QtCore.QObject.connect(listWidget, QtCore.SIGNAL("itemSelectionChanged()"), self.selectItems) self.currentIndex = 0
def layoutWidgets(self): hbox = QHBoxLayout() hbox.addWidget(self.indentLabel) hbox.addWidget(self.indentComboBox) hbox.addStretch() self.txtGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.rtfIndentLabel) hbox.addWidget(self.rtfIndentComboBox) hbox.addStretch() self.rtfGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.paperSizeLabel) hbox.addWidget(self.letterRadioButton) hbox.addWidget(self.a4RadioButton) hbox.addStretch() self.pdfGroupBox.setLayout(hbox) vbox = QVBoxLayout() vbox.addWidget(self.rtfGroupBox) vbox.addWidget(self.txtGroupBox) vbox.addWidget(self.pdfGroupBox) vbox.addStretch() self.setLayout(vbox)
def __init__(self, *args, **kwargs ): QMainWindow.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setObjectName( Window.objectName ) self.setWindowTitle( Window.title ) mainWidget = QWidget(); self.setCentralWidget( mainWidget ) mainLayout = QVBoxLayout( mainWidget ) addButtonsLayout = QHBoxLayout() buttonAddTab = QPushButton( 'Add Tab' ) buttonAddLine = QPushButton( 'Add Line' ) addButtonsLayout.addWidget( buttonAddTab ) addButtonsLayout.addWidget( buttonAddLine ) tabWidget = TabWidget() self.tabWidget = tabWidget buttonLayout = QHBoxLayout() buttonCreate = QPushButton( "Create" ) buttonClose = QPushButton( "Close" ) buttonLayout.addWidget( buttonCreate ) buttonLayout.addWidget( buttonClose ) mainLayout.addLayout( addButtonsLayout ) mainLayout.addWidget( tabWidget ) mainLayout.addLayout( buttonLayout ) QtCore.QObject.connect( buttonAddTab, QtCore.SIGNAL( 'clicked()' ), partial( self.addTab ) ) QtCore.QObject.connect( buttonAddLine, QtCore.SIGNAL( "clicked()" ), partial( tabWidget.addLine ) ) QtCore.QObject.connect( buttonCreate, QtCore.SIGNAL( "clicked()" ), self.cmd_create ) QtCore.QObject.connect( buttonClose, QtCore.SIGNAL( "clicked()" ), self.cmd_close )
def _init_widgets(self): layout = QVBoxLayout() # address lbl_addr = QLabel() lbl_addr.setText("Address") txt_addr = QLineEdit() txt_addr.returnPressed.connect(self._on_address_entered) self._txt_addr = txt_addr top_layout = QHBoxLayout() top_layout.addWidget(lbl_addr) top_layout.addWidget(txt_addr) self._view = QMemoryView(self.workspace) area = QScrollArea() self._scrollarea = area area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setWidgetResizable(True) area.setWidget(self._view) layout.addLayout(top_layout) layout.addWidget(area) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def _setupUi(self): self.setMinimumWidth(800) self.setMinimumHeight(600) layout = QVBoxLayout() self.setLayout(layout) self.editPmCmd = QLineEdit() layout.addWidget(self.editPmCmd) self.modesWidget = QWidget() self.modesLayout = QHBoxLayout() self.modesWidget.setLayout(self.modesLayout) layout.addWidget(self.modesWidget) self.checkBoxes = [] for mode in 'create query edit'.split(): chkBox = QCheckBox(mode) chkBox.setProperty('mode', mode) self.checkBoxes.append(chkBox) for checkBox in self.checkBoxes: self.modesLayout.addWidget(checkBox) checkBox.setChecked(True) if self.command: self.updateDocs() else: layout.addStretch()
def __init__(self): QWidget.__init__(self) self.title = u"执行" # View RunDef self.__wid_run_def = ViewRunDef() # View ReportDet self.__wid_report_det = ViewReportDet() # Search condition widget self.__wid_search_cond = ViewSearch(def_view_run_def) self.__wid_search_cond.create() # 底部 layout _layout_bottom = QSplitter() _layout_bottom.addWidget(self.__wid_run_def) _layout_bottom.addWidget(self.__wid_report_det) # main layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_layout_bottom) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) self.__wid_run_def.sig_search.connect(self.search) self.__wid_run_def.sig_selected.connect( self.__wid_report_det.usr_refresh)
def __init__(self, parent): super(AboutDemoDialog, self).__init__(parent) title = _("Welcome to {}...").format( configuration.get("Globals", "name")) self.setWindowTitle(title) top_layout = QVBoxLayout() self.title_widget = TitleWidget(title, self) top_layout.addWidget(self.title_widget) text = QLabel( _(""" <p>Welcome to the demo of {0}. This demo is fully functional and it comes with an example database. That should be enough to have a full tour of {0}.</p> <p>The first screen you'll see is a list of orders that were done in our imaginary company. If you double click on one of them, you'll see its details. From there on, you can browse around and test everything.</p> <p>As it is the demo version, all the data you'll change will be visible on internet. The demonstration database will be reased from time to time.</p> <p>Enjoy and feel free to contact us in case of problems : <a href="mailto:[email protected]">[email protected]</a></p> """).format(configuration.get("Globals", "name"))) text.setTextFormat(Qt.RichText) text.setWordWrap(True) top_layout.addWidget(text) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) top_layout.addWidget(self.buttons) self.setLayout(top_layout) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def initUI(self): self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.listWidget = QWidget() self.layout = QVBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.listWidget.setLayout(self.layout) self.setWidgetResizable(True) self.setWidget(self.listWidget) self.updateList()