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


Python QWidget.setWindowTitle方法代码示例

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


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

示例1: QTBase

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [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

示例2: input_dialog

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [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

示例3: radio_dialog

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [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

示例4: main

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [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

示例5: test

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [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

示例6: Ninekey

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [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

示例7: __init__

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]
 def __init__ (self, parent):
     super().__init__(parent)
     layout = QHBoxLayout(self)
     self.inputline = QLineEdit(self)
     self.inputline.editingFinished.connect(self.search)
     self.inputline.setPlaceholderText("Search")
     searchbutton = QPushButton(self)
     searchbutton.setIcon(QIcon.fromTheme("edit-find"))
     searchbutton.setToolTip("Search")
     searchbutton.clicked.connect(self.search)
     advbutton = QPushButton(self)
     advbutton.setIcon(QIcon.fromTheme("preferences-other"))
     advbutton.setToolTip("Search Fields")
     advbutton.clicked.connect(self.advancedpopup)
     
     self.popup = None
     self.fields = {"text": True}
     
     checks = OrderedDict()
     checks["Text"] = (("Text", "text"), ("Speaker", "speaker"), ("Listener", "listener"))
     checks["Enter Scripts"] = (("Function name", "entername"), ("Arguments", "enterarg"))
     checks["Exit Scripts"] = (("Function name", "exitname"), ("Arguments", "exitarg"))
     checks["Condition"] = (("Function name", "condname"), ("Arguments", "condarg"))
     checks["Properties"] = (("Persistence", "persistence"), ("Bank mode", "bankmode"), ("Question hub", "questionhub"), ("Random weight", "randweight"), ("Comment", "comment"))
     
     popup = QWidget(FlGlob.mainwindow, Qt.Dialog)
     popup.setWindowTitle("Fields")
     poplayout = QVBoxLayout(popup)
     for group in checks.keys():
         box = QGroupBox(group, popup)
         boxlayout = QVBoxLayout(box)
         for label, field in checks[group]:
             check = QCheckBox(label, box)
             check.stateChanged.connect(self.adv_factory(field))
             if field in self.fields:
                 check.setChecked(self.fields[field])
             boxlayout.addWidget(check)
         boxlayout.addStretch()
         poplayout.addWidget(box)
     self.popup = popup
     
     layout.addWidget(self.inputline)
     layout.addWidget(searchbutton)
     layout.addWidget(advbutton)
开发者ID:bucaneer,项目名称:flint,代码行数:46,代码来源:nodelistwidget.py

示例8: main

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

    w = QWidget()
    #w.setWindowFlags( Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint )
    w.setGeometry(300, 300, 250, 150)
    w.setWindowTitle('Test')

    l = QLabel('Hello, world!', w)
    l.show()
    LOG.debug('Label: {}'.format(l))

    # class patching is my new thing
    # class patch the OK button
    def newOk(w):
        print 'Ok'
        w.text = 'OK'
        # make update
        w.hide()
        w.show()
    FocusOverlay.okChecked = newOk

    # could use f = FocusOverlay( w )
    # then dont need to adjust top level
    f = FocusOverlay()
    f.top_level = w
    f.newParent()
    # set with qtproperty call
    f.setshow_buttons(True)

    w.show()

    timer2 = QTimer()
    timer2.timeout.connect(lambda: f.show())
    timer2.start(1500)

    sys.exit(app.exec_())
开发者ID:LinuxCNC,项目名称:linuxcnc,代码行数:40,代码来源:overlay_widget.py

示例9: hpc_class

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]

#.........这里部分代码省略.........
			self.cluster_clean.setEnabled(True)
			self.cluster_make.setEnabled(True)
			self.cluster_copy_src.setEnabled(True)
			self.cluster_get_info.setEnabled(True)
			self.cluster_get_data.setEnabled(True)
			self.cluster_off.setEnabled(True)
			self.cluster_sync.setEnabled(True)
			self.cluster_jobs.setEnabled(True)
			self.cluster_stop.setEnabled(True)
			self.cluster_view_button.setEnabled(True)

		else:
			self.cluster_button.setIcon(QIcon(os.path.join(get_image_file_path(),"not_connected.png")))
			self.cluster_clean.setEnabled(False)
			self.cluster_make.setEnabled(False)
			self.cluster_copy_src.setEnabled(False)
			self.cluster_get_info.setEnabled(False)
			self.cluster_get_data.setEnabled(False)
			self.cluster_off.setEnabled(False)
			self.cluster_sync.setEnabled(False)
			self.cluster_jobs.setEnabled(False)
			self.cluster_stop.setEnabled(False)
			self.cluster_view_button.setEnabled(False)

	#def closeEvent(self, event):
	#	self.win_list.update(self,"hpc_window")
	#	self.hide()
	#	event.accept()
		
	def init_job_window(self):
		self.status_window=QWidget()
		self.status_window.setFixedSize(900, 600)
		self.status_window.setWindowIcon(QIcon(os.path.join(get_image_file_path(),"connected.png")))
		self.status_window.setWindowTitle(_("Steady state simulation (www.gpvdm.com)")) 
		
		self.main_vbox = QVBoxLayout()

		self.tool_bar=QToolBar()

		self.tool_bar.setIconSize(QSize(42, 42))

		self.cluster_get_data = QAction(QIcon(os.path.join(get_image_file_path(),"server_get_data.png")), _("Cluster get data"), self)
		self.cluster_get_data.triggered.connect(self.callback_cluster_get_data)
		self.tool_bar.addAction(self.cluster_get_data)
		self.cluster_get_data.setEnabled(False)

		self.cluster_get_info = QAction(QIcon(os.path.join(get_image_file_path(),"server_get_info.png")), _("Cluster get info"), self)
		self.cluster_get_info.triggered.connect(self.callback_cluster_get_info)
		self.tool_bar.addAction(self.cluster_get_info)
		self.cluster_get_info.setEnabled(False)

		self.cluster_copy_src = QAction(QIcon(os.path.join(get_image_file_path(),"server_copy_src.png")), _("Copy src to cluster"), self)
		self.cluster_copy_src.triggered.connect(self.callback_cluster_copy_src)
		self.tool_bar.addAction(self.cluster_copy_src)
		self.cluster_copy_src.setEnabled(False)

		self.cluster_make = QAction(QIcon(os.path.join(get_image_file_path(),"server_make.png")), _("Make on cluster"), self)
		self.cluster_make.triggered.connect(self.callback_cluster_make)
		self.tool_bar.addAction(self.cluster_make)
		self.cluster_make.setEnabled(False)

		self.cluster_clean = QAction(QIcon(os.path.join(get_image_file_path(),"server_clean.png")), _("Clean cluster"), self)
		self.cluster_clean.triggered.connect(self.callback_cluster_clean)
		self.tool_bar.addAction(self.cluster_clean)
		self.cluster_clean.setEnabled(False)
开发者ID:roderickmackenzie,项目名称:gpvdm,代码行数:69,代码来源:hpc.py

示例10: Ui_TableWindow

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]
class Ui_TableWindow(object):
    def setupUi(self, TableWindow, name, headers):
        TableWindow.setObjectName("TableWindow: " + name)
        TableWindow.resize(1240, 800)
        self.main_widget = QWidget(TableWindow)
        self.main_widget.setObjectName("table_window")

        layout_main = QGridLayout(self.main_widget)
        layout_table = QVBoxLayout()
        layout_controls = QHBoxLayout()

        self.table = MyTable(self.main_widget)
        self.table.setRowCount(550)
        self.table.setColumnCount(len(headers))
        HeaderLabels = headers
        self.table.setHorizontalHeaderLabels(HeaderLabels)
        [self.table.setColumnWidth(i,90) for i in range(10)]


        groupbox_table = QGroupBox(self.main_widget)
        groupbox_table.setLayout(layout_table)
        layout_table.addWidget(self.table)

        self.button_load = QPushButton('Load')
        self.button_calc = QPushButton('Calculate')
        self.button_graph = QPushButton('Graph')
        self.check_correct = QCheckBox('Correct')
        self.check_background = QCheckBox('Background')
        self.button_reabs = QPushButton('Reabsorption')
        self.input_reab= QLineEdit()
        self.input_reab.setFixedWidth(40)
        self.input_reab.setText('1.0')
        self.button_filter_calc = QPushButton('Filter calculate')
        self.input_filter = QLineEdit()
        self.input_filter.setFixedWidth(60)
        self.input_filter.setText('0.00538')
        self.output_QY = QLineEdit()
        self.output_QY.setFixedWidth(60)

        status = False
        self.button_calc.setEnabled(status)
        self.button_graph.setEnabled(status)
        self.button_filter_calc.setEnabled(status)
        self.button_reabs.setEnabled(status)
        self.input_filter.setEnabled(status)
        self.input_reab.setEnabled(status)

        groubox_controls = QGroupBox(self.main_widget)
        groubox_controls.setLayout(layout_controls)
        layout_controls.addWidget(self.button_load)
        layout_controls.addWidget(self.button_calc)
        layout_controls.addWidget(self.check_correct)
        layout_controls.addWidget(self.check_background)
        layout_controls.addWidget(self.button_graph)
        layout_controls.addWidget(self.button_reabs)
        layout_controls.addWidget(self.input_reab)
        layout_controls.addWidget(self.button_filter_calc)
        layout_controls.addWidget(self.input_filter)
        layout_controls.addWidget(self.output_QY)

        layout_main.addWidget(groupbox_table)
        layout_main.addWidget(groubox_controls)

        self.main_widget.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.main_widget.setWindowTitle("TableWindow")

        self.main_widget.setFocus()
        TableWindow.setCentralWidget(self.main_widget)

        self.retranslateUi(TableWindow, name)

    def retranslateUi(self, TableWindow, name):
        _translate = QtCore.QCoreApplication.translate
        TableWindow.setWindowTitle(_translate("TableWindow", "Table (raw data): " + name))
开发者ID:Saldenisov,项目名称:QY_itegrating_sphere,代码行数:76,代码来源:ui_tablewindow.py

示例11: QApplication

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import sys
from PyQt5.QtWidgets import QApplication, QWidget

app = QApplication(sys.argv)

# The default constructor has no parent.
# A widget with no parent is a window.
window = QWidget()

window.resize(250, 150)
window.setWindowTitle('Hello')
window.show()

# The mainloop of the application. The event handling starts from this point.
# The exec_() method has an underscore. It is because the exec is a Python keyword. And thus, exec_() was used instead. 
exit_code = app.exec_()

# The sys.exit() method ensures a clean exit.
# The environment will be informed, how the application ended.
sys.exit(exit_code)
开发者ID:jeremiedecock,项目名称:snippets,代码行数:33,代码来源:hello_as_widget.py

示例12: QPainter

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]
        painter = QPainter()
        painter.begin(tempPixmap)
        painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127))
        painter.end()

        child.setPixmap(tempPixmap)

        if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction:
            child.close()
        else:
            child.show()
            child.setPixmap(pixmap)


if __name__ == '__main__':

    import sys

    app = QApplication(sys.argv)

    mainWidget = QWidget()
    horizontalLayout = QHBoxLayout()
    horizontalLayout.addWidget(DragWidget())
    horizontalLayout.addWidget(DragWidget())

    mainWidget.setLayout(horizontalLayout)
    mainWidget.setWindowTitle("Draggable Icons")
    mainWidget.show()

    sys.exit(app.exec_())
开发者ID:Axel-Erfurt,项目名称:pyqt5,代码行数:32,代码来源:draggableicons.py

示例13: SettingsPage

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]

#.........这里部分代码省略.........
                tokens = int(float(tokens))
            except ValueError:
                ConfirmationDialog.show_error(self.window(), "Wrong input", "The provided amount is not a number")
                return

            self.confirm_empty_tokens_dialog = ConfirmationDialog(self, "Empty tokens into another account",
                                                                  "Are you sure you want to empty %d bandwidth tokens "
                                                                  "into another account? "
                                                                  "Warning: one-way action that cannot be revered" %
                                                                  tokens,
                                                                  [
                                                                      ('EMPTY', BUTTON_TYPE_NORMAL),
                                                                      ('CANCEL', BUTTON_TYPE_CONFIRM)
                                                                  ])
            self.confirm_empty_tokens_dialog.button_clicked.connect(
                lambda action2: self.on_confirm_partially_empty_tokens(action2, tokens))
            self.confirm_empty_tokens_dialog.show()

    def on_confirm_partially_empty_tokens(self, action, tokens):
        self.confirm_empty_tokens_dialog.close_dialog()
        self.confirm_empty_tokens_dialog = None
        if action == 0:
            self.trustchain_request_mgr = TriblerRequestManager()
            self.trustchain_request_mgr.perform_request("trustchain/bootstrap?amount=%d" % (tokens * MEBIBYTE),
                                                        self.on_emptying_tokens)

    def on_emptying_tokens(self, data):
        if not data:
            return
        json_data = json.dumps(data)

        if has_qr:
            self.empty_tokens_barcode_dialog = QWidget()
            self.empty_tokens_barcode_dialog.setWindowTitle("Please scan the following QR code")
            self.empty_tokens_barcode_dialog.setGeometry(10, 10, 500, 500)
            qr = qrcode.QRCode(
                version=1,
                error_correction=qrcode.constants.ERROR_CORRECT_M,
                box_size=10,
                border=5,
            )
            qr.add_data(json_data)
            qr.make(fit=True)

            img = qr.make_image()  # PIL format

            qim = ImageQt(img)
            pixmap = QtGui.QPixmap.fromImage(qim).scaled(600, 600, QtCore.Qt.KeepAspectRatio)
            label = QLabel(self.empty_tokens_barcode_dialog)
            label.setPixmap(pixmap)
            self.empty_tokens_barcode_dialog.resize(pixmap.width(), pixmap.height())
            self.empty_tokens_barcode_dialog.show()
        else:
            ConfirmationDialog.show_error(self.window(), DEPENDENCY_ERROR_TITLE, DEPENDENCY_ERROR_MESSAGE)

    def on_channel_autocommit_checkbox_changed(self, _):
        self.window().gui_settings.setValue("autocommit_enabled", self.window().channel_autocommit_checkbox.isChecked())

    def on_family_filter_checkbox_changed(self, _):
        self.window().gui_settings.setValue("family_filter", self.window().family_filter_checkbox.isChecked())

    def on_developer_mode_checkbox_changed(self, _):
        self.window().gui_settings.setValue("debug", self.window().developer_mode_enabled_checkbox.isChecked())
        self.window().left_menu_button_debug.setHidden(not self.window().developer_mode_enabled_checkbox.isChecked())

    def on_use_monochrome_icon_checkbox_changed(self, _):
开发者ID:Tribler,项目名称:tribler,代码行数:70,代码来源:settingspage.py

示例14: QApplication

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]
# -*- coding: utf-8 -*-
'''
    【简介】
	PyQT5的第一个简单例子
   
  
'''

import sys
from PyQt5.QtWidgets import QApplication, QWidget

app = QApplication(sys.argv)
window = QWidget()
window.resize(500, 500)
window.move(300, 300)
window.setWindowTitle('hello PyQt5')
window.show()
sys.exit(app.exec_())   
开发者ID:kiorry,项目名称:PYQT,代码行数:20,代码来源:qt103_runPyQt.py

示例15: __init__

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import setWindowTitle [as 别名]
class TweetPost:
    
    def __init__(self):
        super().__init__()
        
        self.initUI()
        
        
    def initUI(self):
        self.post_win = QWidget()
        self.post_win.label = QLabel('いまどうしてる?')
        self.post_win.text1 = QTextEdit()

        #残り文字数 textlen
        textlen = 140-len(self.post_win.text1.toPlainText())
        self.post_win.label2 = QLabel()
        self.post_win.label2.setText(str(textlen))
        
        self.post_win.btn1 = QPushButton('Tweet')
        self.post_win.btn2 = QPushButton('Cancel')

        self.post_win.hbox = QHBoxLayout()
        self.post_win.hbox.addWidget(self.post_win.label2)
        self.post_win.hbox.addStretch(1)
        self.post_win.hbox.addWidget(self.post_win.btn1)
        self.post_win.hbox.addWidget(self.post_win.btn2)

        self.post_win.vbox = QVBoxLayout()
        self.post_win.vbox.addWidget(self.post_win.label)
        self.post_win.vbox.addWidget(self.post_win.text1)
        self.post_win.vbox.addLayout(self.post_win.hbox)
        
        self.post_win.setLayout(self.post_win.vbox)    

        self.post_win.setGeometry(300, 300, 450, 100)
        self.post_win.setWindowTitle('Tweet')

        #文字を入力したときの残り文字数の変化
        self.post_win.text1.textChanged.connect(self.text_count)
	#button1を押したときのイベントをpost_tweetメソッドに指定		
        self.post_win.btn1.clicked.connect(self.post_tweet)
	#button2を押したときのイベントをexit_actionメソッドに指定
        self.post_win.btn2.clicked.connect(self.exit_action)

        self.post_win.show()

    def text_count(self):
        textlen=140-len(self.post_win.text1.toPlainText())
        self.post_win.label2.setText(str(textlen))
        
    def post_tweet(self):
        api = tweepy.API(TweetAuth.auth)

        try:
            post1=self.post_win.text1.toPlainText()
            api.update_status(status=post1)
    
        except tweepy.error.TweepError as e:
                    #例外発生したときのステータス
            print (e.response)
                    #例外発生した時の理由
            print (e.reason)
        
        self.post_win.text1.clear()
                
    def exit_action(self):
        self.post_win.close()
开发者ID:rago1975,项目名称:ragotweet,代码行数:69,代码来源:tweetpost.py


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