本文整理汇总了Python中PySide.QtGui.QMainWindow方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QMainWindow方法的具体用法?Python QtGui.QMainWindow怎么用?Python QtGui.QMainWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QMainWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def __init__(self, fig):
# Setup data range variables for scrolling
self.fig = fig
self.xmin, self.xmax = fig.plotItem.vb.childrenBounds()[0]
self.step = 1 # axis units
self.scale = 1e3 # conversion betweeen scrolling units and axis units
# Retrive the QMainWindow used by current figure and add a toolbar
# to host the new widgets
self.win = QtGui.QMainWindow()
self.win.show()
self.win.resize(800,600)
self.win.setCentralWidget(fig)
self.toolbar = QtGui.QToolBar()
self.win.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
# Create the slider and spinbox for x-axis scrolling in toolbar
self.set_slider(self.toolbar)
self.set_spinbox(self.toolbar)
# Set the initial xlimits coherently with values in slider and spinbox
self.set_xlim = self.fig.setXRange
self.set_xlim(0, self.step)
示例2: initUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def initUI(self):
#####################################################################
img_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + "/../images/crosshair.jpg"
rospy.loginfo("initUI img_path: %s" % img_path)
self.statusBar()
self.setStyleSheet("QMainWindow { border-image: url(%s); }" % img_path)
self.setGeometry(0, 600, 200, 200)
self.setWindowTitle('Virtual Joystick')
self.show()
self.timer = QtCore.QBasicTimer()
self.statusBar().showMessage('started')
#####################################################################
示例3: qui_menubar
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
#=======================================
# ui creation functions
#=======================================
示例4: qui_menubar
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
# compatible hold function
示例5: setupWin
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def setupWin(self):
self.setWindowTitle("UITranslator" + " - v" + self.version)
self.setGeometry(300, 300, 300, 300)
# win icon setup
path = os.path.join(os.path.dirname(self.location),'icons','UITranslator.png')
self.setWindowIcon(QtGui.QIcon(path))
# initial win drag position
self.drag_position=QtGui.QCursor.pos()
#self.resize(250,250)
# - for frameless or always on top option
#self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui
# - for transparent and non-regular shape ui
#self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window
#self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
示例6: setupWin
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def setupWin(self):
self.setWindowTitle("TMP_UniversalToolUI_TND" + " - v" + self.version)
self.setGeometry(300, 300, 800, 600)
# win icon setup
path = os.path.join(os.path.dirname(self.location),'icons','TMP_UniversalToolUI_TND.png')
self.setWindowIcon(QtGui.QIcon(path))
# initial win drag position
self.drag_position=QtGui.QCursor.pos()
#self.resize(250,250)
# - for frameless or always on top option
#self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui
# - for transparent and non-regular shape ui
#self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window
#self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
示例7: main
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow()
# setup ui
ui = example_ui.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("QDarkStyle example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
示例8: get_QMainWindow
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def get_QMainWindow():
"""QMainWindow getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QMainWindow
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QMainWindow
示例9: height
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def height(self):
return QtGui.QMainWindow.height(self)
示例10: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def __init__(self, parent=None, mode=0):
UniversalToolUI.__init__(self, parent)
# class variables
self.version= version
self.date = date
self.log = log
self.help = help
# mode: example for receive extra user input as parameter
self.mode = 0
if mode in [0,1]:
self.mode = mode # mode validator
# Custom user variable
#------------------------------
# initial data
#------------------------------
self.memoData['data']=[]
self.memoData['settingUI']=[]
self.qui_user_dict = {} # e.g: 'edit': 'LNTextEdit',
self.setupStyle()
if isinstance(self, QtWidgets.QMainWindow):
self.setupMenu()
self.setupWin()
self.setupUI()
self.Establish_Connections()
self.loadLang()
self.loadData()
#------------------------------
# overwrite functions
#------------------------------
示例11: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
main_widget = QtWidgets.QWidget()
self.setCentralWidget(main_widget)
main_layout = QtWidgets.QVBoxLayout()
main_widget.setLayout(main_layout)
示例12: qui_menubar
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
示例13: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def __init__(self, parent=None, mode=0):
UniversalToolUI.__init__(self, parent)
# class variables
self.version= version
self.date = date
self.log = log
self.help = help
# mode: example for receive extra user input as parameter
self.mode = 0
if mode in [0,1]:
self.mode = mode # mode validator
# Custom user variable
#------------------------------
# initial data
#------------------------------
self.memoData['data']=[]
self.memoData['settingUI']=[]
self.qui_user_dict = {} # e.g: 'edit': 'LNTextEdit',
if isinstance(self, QtWidgets.QMainWindow):
self.setupMenu()
self.setupWin()
self.setupUI()
self.Establish_Connections()
self.loadLang()
self.loadData()
#------------------------------
# overwrite functions
#------------------------------
示例14: setupUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def setupUI(self, layout='grid'):
#------------------------------
# main_layout auto creation for holding all the UI elements
#------------------------------
main_layout = None
if isinstance(self, QtWidgets.QMainWindow):
main_widget = QtWidgets.QWidget()
self.setCentralWidget(main_widget)
main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
main_widget.setLayout(main_layout)
else:
# main_layout for QDialog
main_layout = self.quickLayout(layout, 'main_layout')
self.setLayout(main_layout)
示例15: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def __init__(self, parent=None, mode=0):
UniversalToolUI.__init__(self, parent)
# class variables
self.version= version
self.date = date
self.log = log
self.help = help
# mode: example for receive extra user input as parameter
self.mode = 0
if mode in [0,1]:
self.mode = mode # mode validator
# Custom user variable
#------------------------------
# initial data
#------------------------------
self.memoData['data']=[]
self.qui_user_dict = {} # e.g: 'edit': 'LNTextEdit',
self.setupStyle()
if isinstance(self, QtWidgets.QMainWindow):
self.setupMenu()
self.setupWin()
self.setupUI()
self.Establish_Connections()
self.loadLang()
self.loadData()
#------------------------------
# overwrite functions
#------------------------------