当前位置: 首页>>代码示例>>Python>>正文


Python QWidget.show方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QWidget.show方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.show方法的具体用法?Python QWidget.show怎么用?Python QWidget.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QWidget的用法示例。


在下文中一共展示了QWidget.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __addRangesLine

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
 def __addRangesLine(self):
     """
     Private slot to add a line of entry widgets for character ranges.
     """
     hbox = QWidget(self.rangesItemsBox)
     hboxLayout = QHBoxLayout(hbox)
     hboxLayout.setContentsMargins(0, 0, 0, 0)
     hboxLayout.setSpacing(6)
     hbox.setLayout(hboxLayout)
     cb1 = QComboBox(hbox)
     cb1.setEditable(False)
     cb1.addItems(self.comboItems)
     hboxLayout.addWidget(cb1)
     l1 = QLabel(self.tr("Between:"), hbox)
     hboxLayout.addWidget(l1)
     le1 = QLineEdit(hbox)
     le1.setValidator(self.charValidator)
     hboxLayout.addWidget(le1)
     l2 = QLabel(self.tr("And:"), hbox)
     hboxLayout.addWidget(l2)
     le2 = QLineEdit(hbox)
     le2.setValidator(self.charValidator)
     hboxLayout.addWidget(le2)
     self.rangesItemsBoxLayout.addWidget(hbox)
     
     cb1.activated[int].connect(self.__rangesCharTypeSelected)
     
     hbox.show()
     
     self.rangesItemsBox.adjustSize()
     
     self.rangesEntries.append([cb1, le1, le2])
开发者ID:pycom,项目名称:EricShort,代码行数:34,代码来源:PyRegExpWizardCharactersDialog.py

示例2: show

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
 def show(self):
     """Override the QWidget::show() method to properly recalculate the
        editor viewport.
     """
     if self.isHidden():
         QWidget.show(self)
         self._qpart.updateViewport()
开发者ID:SergeySatskiy,项目名称:qutepart,代码行数:9,代码来源:margins.py

示例3: show

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
    def show(self, timeout=0, above=False):
        self.cursor_start_col = self.textedit.textCursor().columnNumber()
        desktop = qApp.desktop()
        screen = desktop.screen(desktop.screenNumber(self))
        screen_width = screen.width()
        screen_height = screen.height()
        win_width = self.width()
        win_height = self.height()
        cursorRect = self.textedit.cursorRect()
        if above:
            pos = self.textedit.mapToGlobal(cursorRect.topLeft())
            pos.setY(pos.y() - win_height)
        else:
            pos = self.textedit.mapToGlobal(cursorRect.bottomLeft())
        if pos.y() < 0:
            pos = self.textedit.mapToGlobal(cursorRect.bottomLeft())
        if pos.y() + win_height > screen_height:
            pos = self.textedit.mapToGlobal(cursorRect.topLeft())
            pos.setY(pos.y() - win_height)
        if pos.x() + win_width > screen_width:
            pos.setX(screen_width - win_width)

        self.move(pos)
        QWidget.show(self)
        self.active = True
        if timeout:
            QTimer.singleShot(timeout * 1000, self.hide)
开发者ID:QuLogic,项目名称:scribus-plugin-scripter,代码行数:29,代码来源:assist.py

示例4: QTBase

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
class QTBase(UIBase):
    a = None
    w = None

    def new_win(self, title=""):
        self.a = QApplication(sys.argv)
        self.w = QWidget()
        self.w.setWindowTitle(title)
        return self.w

    def new_textbox(self):
        pass

    def new_radiobox(self):
        pass

    def new_label(self):
        pass

    def new_checkbox(self):
        pass

    def show(self):
        self.w.show()
        sys.exit(self.a.exec_())
开发者ID:Mortezaipo,项目名称:ugtrain-gui,代码行数:27,代码来源:qt_base.py

示例5: __addSinglesLine

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
 def __addSinglesLine(self):
     """
     Private slot to add a line of entry widgets for single characters.
     """
     hbox = QWidget(self.singlesItemsBox)
     hboxLayout = QHBoxLayout(hbox)
     hboxLayout.setContentsMargins(0, 0, 0, 0)
     hboxLayout.setSpacing(6)
     hbox.setLayout(hboxLayout)
     cb1 = QComboBox(hbox)
     cb1.setEditable(False)
     cb1.addItems(self.comboItems)
     cb1.addItems(self.singleComboItems)
     hboxLayout.addWidget(cb1)
     le1 = QLineEdit(hbox)
     le1.setValidator(self.charValidator)
     hboxLayout.addWidget(le1)
     cb2 = QComboBox(hbox)
     cb2.setEditable(False)
     cb2.addItems(self.comboItems)
     cb2.addItems(self.singleComboItems)
     hboxLayout.addWidget(cb2)
     le2 = QLineEdit(hbox)
     le2.setValidator(self.charValidator)
     hboxLayout.addWidget(le2)
     self.singlesItemsBoxLayout.addWidget(hbox)
     
     cb1.activated[int].connect(self.__singlesCharTypeSelected)
     cb2.activated[int].connect(self.__singlesCharTypeSelected)
     hbox.show()
     
     self.singlesItemsBox.adjustSize()
     
     self.singlesEntries.append([cb1, le1])
     self.singlesEntries.append([cb2, le2])
开发者ID:pycom,项目名称:EricShort,代码行数:37,代码来源:PyRegExpWizardCharactersDialog.py

示例6: test_view

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def test_view(qtbot):
    from views import UiMainWidget
    from PyQt5.QtWidgets import QWidget
    w = QWidget()
    ui = UiMainWidget()
    ui.setup_ui(w)
    w.show()
    qtbot.addWidget(w)
开发者ID:ykelvis,项目名称:FeelUOwn,代码行数:10,代码来源:test_view.py

示例7: input_dialog

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def input_dialog(prompt,def_answer=None,name='Type Parameters'):
    ok = False
    def _pressed_ok():
        nonlocal ok
        w.close()
        app.quit()
        ok |= True
    def _pressed_cancel():
        nonlocal ok
        w.close()
        app.quit()
        ok &= False

    if isinstance(prompt,str): prompt = [prompt]
    if def_answer is None: def_answer = len(prompt)*['']
    if isinstance(def_answer,str): def_answer = [def_answer]
    if len(prompt) != len(def_answer):
        raise IndexError("'prompt' and 'def_answer' must be the same length.")

    app = QCoreApplication.instance() or QApplication([])

    w = QWidget()
    w.setWindowTitle(name)
    grid = QGridLayout()
    grid.setSpacing(10)
    edit = []
    for i in range(len(prompt)):
        title  = QLabel(prompt[i])
        edit  += [QLineEdit()]
        if def_answer is not None: edit[i].setText(def_answer[i])
        grid.addWidget(title, 2*i,  0,1,2)# title, row,col,spanrow,spancol
        grid.addWidget(edit[i], 2*i+1, 0,1,2)
    #Ok Button
    qbtn = QPushButton('Ok', w)
    qbtn.clicked.connect(_pressed_ok)
    qbtn.resize(qbtn.sizeHint())
    grid.addWidget(qbtn, 2*(i+1), 0)
    #Cancel Button
    qbtn = QPushButton('Cancel', w)
    qbtn.clicked.connect(_pressed_cancel)
    qbtn.resize(qbtn.sizeHint())
    grid.addWidget(qbtn, 2*(i+1), 1)

    #Defining the layout of the window:
    w.setLayout(grid)
    w.resize(50, i*50)
    qr = w.frameGeometry()
    cp = QDesktopWidget().availableGeometry().center()
    qr.moveCenter(cp)
    w.move(qr.topLeft())

    w.show()
    app.exec_()

    text = []
    for ed in edit:
        text += [ed.text()]
    return ok, text
开发者ID:douglasgalante,项目名称:lnls,代码行数:60,代码来源:dialog.py

示例8: show_window

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def show_window():
    app = QApplication(sys.argv)
    registration_window =QWidget()
    ui = registration_ui.Ui_Students_health_records_registration_ui()
    ui.setupUi(registration_window)
    #QObject.connect(ui.btnQuit, QtCore.SIGNAL("clicked"),
    #                       QtGui.qApp.quit)

    registration_window.show()
    sys.exit(app.exec_())
开发者ID:DanaSemaniv,项目名称:Students_health_records,代码行数:12,代码来源:registration.py

示例9: radio_dialog

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def radio_dialog(options, name='Selection', default_idx=0):

    ok = False
    def _pressed_ok():
        nonlocal ok
        w.close()
        app.quit()
        ok |= True
    def _pressed_cancel():
        nonlocal ok
        w.close()
        app.quit()
        ok &= False

    app = QCoreApplication.instance() or QApplication([])

    w = QWidget()
    w.setWindowTitle(name)
    grid = QGridLayout()
    grid.setSpacing(10)
    edit = []
    for i in range(len(options)):
        r = QRadioButton(options[i])
        if i == default_idx:
            r.setChecked(True)
        edit.append(r)
        grid.addWidget(r,0,i)



    #Ok Button
    qbtn = QPushButton('Ok', w)
    qbtn.clicked.connect(_pressed_ok)
    qbtn.resize(qbtn.sizeHint())
    grid.addWidget(qbtn, 2*(i+1), 0)
    #Cancel Button
    qbtn = QPushButton('Cancel', w)
    qbtn.clicked.connect(_pressed_cancel)
    qbtn.resize(qbtn.sizeHint())
    grid.addWidget(qbtn, 2*(i+1), 1)

    #Defining the layout of the window:
    w.setLayout(grid)
    w.resize(50, i*50)
    qr = w.frameGeometry()
    cp = QDesktopWidget().availableGeometry().center()
    qr.moveCenter(cp)
    w.move(qr.topLeft())

    w.show()
    app.exec_()

    for r in edit:
        if r.isChecked(): text = r.text()
    return ok, text
开发者ID:douglasgalante,项目名称:lnls,代码行数:57,代码来源:dialog.py

示例10: main

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def main():

    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    w.show()

    sys.exit(app.exec_())
开发者ID:ejunior,项目名称:python_models,代码行数:13,代码来源:tempo.py

示例11: test

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def test():
    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    b = QPushButton(parent=w, text='test')
    b.ac
    w.show()

    sys.exit(app.exec_())
开发者ID:judgerain,项目名称:chatlogparser,代码行数:14,代码来源:qt_gui.py

示例12: __init__

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
    def __init__(self, weboob, parent=None):
        super(AccountsStatus, self).__init__(parent)

        self.weboob = weboob

        self.setFrameShadow(self.Plain)
        self.setFrameShape(self.NoFrame)
        self.setWidgetResizable(True)

        widget = QWidget(self)
        widget.setLayout(QVBoxLayout())
        widget.show()
        self.setWidget(widget)
开发者ID:P4ncake,项目名称:weboob,代码行数:15,代码来源:status.py

示例13: fake_statusbar

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def fake_statusbar(qtbot):
    """Fixture providing a statusbar in a container window."""
    container = QWidget()
    qtbot.add_widget(container)
    vbox = QVBoxLayout(container)
    vbox.addStretch()

    statusbar = FakeStatusBar(container)
    statusbar.container = container  # to make sure container isn't GCed
    vbox.addWidget(statusbar)

    container.show()
    qtbot.waitForWindowShown(container)
    return statusbar
开发者ID:ProtractorNinja,项目名称:qutebrowser,代码行数:16,代码来源:test_progress.py

示例14: fake_statusbar

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
def fake_statusbar(qtbot):
    """Fixture providing a statusbar in a container window."""
    container = QWidget()
    qtbot.add_widget(container)
    vbox = QVBoxLayout(container)
    vbox.addStretch()

    statusbar = FakeStatusBar(container)
    # to make sure container isn't GCed
    # pylint: disable=attribute-defined-outside-init
    statusbar.container = container
    vbox.addWidget(statusbar)

    container.show()
    qtbot.waitForWindowShown(container)
    return statusbar
开发者ID:forkbong,项目名称:qutebrowser,代码行数:18,代码来源:fixtures.py

示例15: Ninekey

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import show [as 别名]
class Ninekey(QApplication):
    def __init__(self, args):
        super().__init__(args)
        self.addWidgets()
        self.exec_()

    def addWidgets(self):
        appname = "ninekey"
        apptitle = "Ninekey"

        self.window = QWidget()
        self.window.setFixedSize(300, 300)
        self.window.setWindowTitle(apptitle)
        self.window.setWindowIcon(QIcon(appname + ".png"))
        self.window.show()

        # Set up the config file.
        if os.name == "posix":
            conf_dir_path = "/".join([os.environ["HOME"], ".config", appname])
            conf_file_path = "/".join([conf_dir_path, appname + ".conf"])
        elif os.name == "nt":
            conf_dir = "\\".join(["%APPDATA%", appname])
            conf_file_path = "\\".join([conf_dir_path, appname + ".conf"])
        else:
            conf_dir = ""
            conf_file_path = appname + ".conf"
        
        if not os.path.exists(conf_dir_path):
            os.mkdir(conf_dir_path)

        if os.path.exists(conf_file_path):
            conf_file = open(conf_file_path,"r")
        else:
            conf_file = open(conf_file_path,"w+")

        # Add the buttons.
        buttons = []
        for i in range(9):
            label = conf_file.readline()
            command = conf_file.readline()
            newButton = CommandButton(self.window, label, command)
            buttons.append(newButton)

        for y in range(0, 3):
            for x in range(0, 3):
                buttons[x + y*3].move(100 * x, 100 * y)
                buttons[x + y*3].show()
开发者ID:xordspar0,项目名称:ninekey,代码行数:49,代码来源:app.py


注:本文中的PyQt5.QtWidgets.QWidget.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。