Python PyQt5.QtWidgets() Examples
The following are 30
code examples of PyQt5.QtWidgets().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5
, or try the search function
.
Example #1
Source File: qt_compat.py From twitter-stock-recommendation with MIT License | 32 votes |
def _setup_pyqt5(): global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName if QT_API == QT_API_PYQT5: from PyQt5 import QtCore, QtGui, QtWidgets __version__ = QtCore.PYQT_VERSION_STR QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot QtCore.Property = QtCore.pyqtProperty elif QT_API == QT_API_PYSIDE2: from PySide2 import QtCore, QtGui, QtWidgets, __version__ else: raise ValueError("Unexpected value for the 'backend.qt5' rcparam") _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName def is_pyqt5(): return True
Example #2
Source File: pyeditor.py From Python_editor with The Unlicense | 6 votes |
def setupUi1(self, messageformForm): messageformForm.setObjectName("messageformForm") messageformForm.resize(404, 169) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(messageformForm.sizePolicy().hasHeightForWidth()) messageformForm.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Consolas") messageformForm.setFont(font) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/icons/twa.gif"), QtGui.QIcon.Normal, QtGui.QIcon.Off) messageformForm.setWindowIcon(icon2) self.label = QtWidgets.QLabel(messageformForm) self.label.setGeometry(QtCore.QRect(40, 20, 341, 111)) font = QtGui.QFont() font.setPointSize(19) self.label.setFont(font) self.label.setObjectName("label") self.retranslateUi(messageformForm) QtCore.QMetaObject.connectSlotsByName(messageformForm)
Example #3
Source File: _compat.py From mGui with MIT License | 6 votes |
def _pyside2_as_qt_object(widget): from PySide2.QtCore import QObject from PySide2.QtWidgets import QWidget from PySide2 import QtWidgets from shiboken2 import wrapInstance if hasattr(widget, '__qt_object__'): return widget.__qt_object__ ptr = _find_widget_ptr(widget) qobject = wrapInstance(long(ptr), QObject) meta = qobject.metaObject() _class = meta.className() _super = meta.superClass().className() qclass = getattr(QtWidgets, _class, getattr(QtWidgets, _super, QWidget)) return wrapInstance(long(ptr), qclass)
Example #4
Source File: mergePluginsHide.py From mo2-plugins with MIT License | 6 votes |
def refreshMergedModList(self): self.mergedModList.clear() for modName in sorted(self.__mergedModInfo): modPluginsState = self.getMergedModPluginsState(modName) color = { Dc.ModPluginsState.UNKNOWN: Dc.red, Dc.ModPluginsState.ACTIVE: None, Dc.ModPluginsState.MIXED: Dc.yellow, Dc.ModPluginsState.INACTIVE: Dc.green }[modPluginsState] stateDescription = { Dc.ModPluginsState.UNKNOWN: self.__tr("Unknown"), Dc.ModPluginsState.ACTIVE: self.__tr("All plugins active"), Dc.ModPluginsState.MIXED: self.__tr("Some plugins active"), Dc.ModPluginsState.INACTIVE: self.__tr("All plugins inactive") }[modPluginsState] item = QtWidgets.QTreeWidgetItem(self.mergedModList, [modName, stateDescription]) for x in range(2): if color: item.setBackground(x, color) item.setForeground(x, Qt.black) item.setData(x, Qt.UserRole, {"modName": modName, "modPluginsState": modPluginsState}) self.mergedModList.addTopLevelItem(item) self.mergedModList.resizeColumnToContents(0)
Example #5
Source File: pyeditor.py From Python_editor with The Unlicense | 6 votes |
def setupUi1(self, messageformForm): messageformForm.setObjectName("messageformForm") messageformForm.resize(404, 169) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(messageformForm.sizePolicy().hasHeightForWidth()) messageformForm.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Consolas") messageformForm.setFont(font) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/icons/twa.gif"), QtGui.QIcon.Normal, QtGui.QIcon.Off) messageformForm.setWindowIcon(icon2) self.label = QtWidgets.QLabel(messageformForm) self.label.setGeometry(QtCore.QRect(40, 20, 341, 111)) font = QtGui.QFont() font.setPointSize(19) self.label.setFont(font) self.label.setObjectName("label") self.retranslateUi(messageformForm) QtCore.QMetaObject.connectSlotsByName(messageformForm)
Example #6
Source File: loader.py From Python_editor with The Unlicense | 5 votes |
def __init__(self, package): UIParser.__init__(self, QtCore, QtGui, QtWidgets, LoaderCreatorPolicy(package))
Example #7
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def font_choice(self): self.lbl = self.lexer font, ok = QtWidgets.QFontDialog.getFont() if ok: self.lbl.setFont(font)
Example #8
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def _translate(context, text, disambig): return QtWidgets.QApplication.translate(context, text, disambig, _encoding)
Example #9
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def _translate(context, text, disambig): return QtWidgets.QApplication.translate(context, text, disambig)
Example #10
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetemp(self): self.path = QtCore.QFileInfo(self.filename).path() (self.filename, _) = \ QtWidgets.QFileDialog.getSaveFileName(self, 'Save as' , self.path, 'Python Files (*.py *.pyc *.pyw)') if self.filename: self.savetexttemp(self.filename) os.chdir(str(self.path))
Example #11
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetexttemp(self, fileName): textout = self.TemptextEdit.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.tempwizardPage, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #12
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def openscript(self): print "hello" self.path = QtCore.QFileInfo(self.filename).path() # Get filename and show only .writer files (self.filename, _) = \ QtWidgets.QFileDialog.getOpenFileName(self.wizardPage_3, 'Open File', self.path, 'Python Files (*.py *.pyc *.pyw)', '') if self.filename: with open(self.filename, 'r') as self.file: self.script_textEdit.setText(self.file.read()) os.chdir(str(self.path))
Example #13
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savescript(self): self.path = QtCore.QFileInfo(self.filename).path() (self.filename, _) = \ QtWidgets.QFileDialog.getSaveFileName(self.wizardPage_3, 'Save as' , self.path, 'Python Files (*.py *.pyc *.pyw)') if self.filename: self.savetextscript(self.filename) os.chdir(str(self.path))
Example #14
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetextscript(self, fileName): textout = self.script_textEdit.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.wizardPage_3, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #15
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savefile(self): self.path = QtCore.QFileInfo(self.filename).path() (self.filename, _) = \ QtWidgets.QFileDialog.getSaveFileName(self.vindu, 'Save as' , self.path, 'Python Files (*.py *.pyc *.pyw)') if self.filename: self.savetext(self.filename) os.chdir(str(self.path))
Example #16
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savetext(self, fileName): textout = self.codebox.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.vindu, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #17
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def font_choice(self): self.lbl = self.lexer font, ok = QtWidgets.QFontDialog.getFont() if ok: self.lbl.setFont(font)
Example #18
Source File: main.py From BeautyCamera with MIT License | 5 votes |
def __init__(self): app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() self.raw_image = None self.ui = window.Ui_MainWindow() self.ui.setupUi(MainWindow) self.action_connect() MainWindow.show() sys.exit(app.exec_()) # 信号槽绑定
Example #19
Source File: main.py From BeautyCamera with MIT License | 5 votes |
def new_camera(self): Dialog = QtWidgets.QDialog() self.ui_2 = window2.Ui_Form() self.ui_2.setupUi(Dialog) Dialog.show() self.ui_2.pushButton_2.clicked.connect(self.get_image) Dialog.exec_() if self.ui_2.cap.isOpened(): self.ui_2.cap.release() if self.ui_2.timer_camera.isActive(): self.ui_2.timer_camera.stop() # 获取摄像头的图片
Example #20
Source File: syncModOrder.py From mo2-plugins with MIT License | 5 votes |
def refreshProfileList(self): self.profileList.clear() for profileName in sorted(self.__profileInfo): item = QtWidgets.QTreeWidgetItem(self.profileList, [profileName]) item.setData(0, Qt.UserRole, {"profileName": profileName}) self.profileList.addTopLevelItem(item) self.profileList.resizeColumnToContents(0)
Example #21
Source File: syncModOrder.py From mo2-plugins with MIT License | 5 votes |
def openProfileMenu(self, position): selectedItems = self.profileList.selectedItems() if selectedItems: menu = QtWidgets.QMenu() selectedItemsData = [item.data(0, Qt.UserRole) for item in selectedItems] selectedProfiles = [selectedItemData['profileName'] for selectedItemData in selectedItemsData] syncAction = QtWidgets.QAction(QtGui.QIcon(':/MO/gui/next'), self.__tr('&Sync mod order'), self) syncAction.setEnabled(True) menu.addAction(syncAction) action = menu.exec_(self.profileList.mapToGlobal(position)) try: if action == syncAction: for profileName in selectedProfiles: profileInfo = self.__profileInfo[profileName] modListPath = os.path.join(profileInfo['path'], 'modlist.txt') modListBackupPath = modListPath + '.' + datetime.datetime.now().strftime('%Y%m%d%H%M%S%f') qDebug(self.__tr("Backing up to {}".format(modListBackupPath)).encode('utf-8')) shutil.copy(modListPath, modListBackupPath) selectedModListInfo = self.getModListInfoByPath(modListPath) mergedModListInfo = dict(self.__modListInfo, **selectedModListInfo) for modName in list(self.__modListInfo.keys()): mergedModListInfo[modName]['index'] = self.__modListInfo[modName]['index'] qDebug(self.__tr("Updating {} mod order".format(modListPath)).encode('utf-8')) with open(modListPath, 'w', encoding='utf-8') as modListFile: for modName, modListEntry in sorted(list(mergedModListInfo.items()), key=lambda x: x[1]['index']): modListFile.write(modListEntry['symbol'] + modListEntry['name'] + '\n') self.refreshProfileList() except Exception as e: qCritical(str(e).encode('utf-8'))
Example #22
Source File: Editor_x64dbg.py From X64dbg_script_editor with The Unlicense | 5 votes |
def _translate(context, text, disambig): return QtWidgets.QApplication.translate(context, text, disambig)
Example #23
Source File: Editor_x64dbg.py From X64dbg_script_editor with The Unlicense | 5 votes |
def _translate(context, text, disambig): return QtWidgets.QApplication.translate(context, text, disambig, _encoding)
Example #24
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def savefile(self): self.path = QtCore.QFileInfo(self.filename).path() (self.filename, _) = \ QtWidgets.QFileDialog.getSaveFileName(self.vindu, 'Save as' , self.path, 'Python Files (*.py *.pyc *.pyw)') if self.filename: self.savetext(self.filename) os.chdir(str(self.path))
Example #25
Source File: Editor_x64dbg.py From X64dbg_script_editor with The Unlicense | 5 votes |
def savetext(self, fileName): textout = self.codebox.text() file = QtCore.QFile(fileName) if file.open(QtCore.QIODevice.WriteOnly): QtCore.QTextStream(file) << textout else: QtWidgets.QMessageBox.information(self.vindu, 'Unable to open file', file.errorString()) os.chdir(str(self.path))
Example #26
Source File: Editor_x64dbg.py From X64dbg_script_editor with The Unlicense | 5 votes |
def savefile(self): self.path = QtCore.QFileInfo(self.filename).path() (self.filename, _) = \ QtWidgets.QFileDialog.getSaveFileName(self.vindu, 'Save as' , self.path, 'Python Files (*.py *.pyc *.pyw)') if self.filename: self.savetext(self.filename) os.chdir(str(self.path))
Example #27
Source File: Editor_x64dbg.py From X64dbg_script_editor with The Unlicense | 5 votes |
def open(self): self.path = QtCore.QFileInfo(self.filename).path() # Get filename and show only .writer files (self.filename, _) = \ QtWidgets.QFileDialog.getOpenFileName(self.vindu, 'Open File', self.path, 'Python Files (*.py *.pyc *.pyw)', '') if self.filename: with open(self.filename, 'r') as self.file: self.codebox.setText(self.file.read()) os.chdir(str(self.path))
Example #28
Source File: _compat.py From mGui with MIT License | 5 votes |
def _pyqt5_as_qt_object(widget): from PyQt5.QtWidgets import QWidget from sip import wrapinstance if hasattr(widget, '__qt_object__'): return widget.__qt_object__ ptr = _find_widget_ptr(widget) return wrapinstance(long(ptr), QWidget)
Example #29
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def _translate(context, text, disambig): return QtWidgets.QApplication.translate(context, text, disambig, _encoding)
Example #30
Source File: pyeditor.py From Python_editor with The Unlicense | 5 votes |
def _translate(context, text, disambig): return QtWidgets.QApplication.translate(context, text, disambig)