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


Python QtGui.QMainWindow方法代码示例

本文整理汇总了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) 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:26,代码来源:timetrace_scroll_pygraphqt.py

示例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')
        
    ##################################################################### 
开发者ID:jfstepha,项目名称:differential-drive,代码行数:21,代码来源:virtual_joystick.py

示例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
    #======================================= 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:21,代码来源:universal_tool_template_1116.py

示例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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:universal_tool_template_1020.py

示例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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:UITranslator_v1.0.py

示例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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:universal_tool_template_v7.3.py

示例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_() 
开发者ID:RedFalsh,项目名称:PyQt5_stylesheets,代码行数:41,代码来源:example_pyside.py

示例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 
开发者ID:AirbusCyber,项目名称:grap,代码行数:11,代码来源:QtShim.py

示例9: height

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMainWindow [as 别名]
def height(self):
            return QtGui.QMainWindow.height(self) 
开发者ID:mwisslead,项目名称:vfp2py,代码行数:4,代码来源:vfpfunc.py

示例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
    #------------------------------ 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:36,代码来源:universal_tool_template_1116.py

示例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) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:9,代码来源:ClassName_1010.py

示例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]) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:17,代码来源:universal_tool_template_2010.py

示例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
    #------------------------------ 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:34,代码来源:universal_tool_template_2010.py

示例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) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:16,代码来源:GearBox_template_1010.py

示例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
    #------------------------------ 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:35,代码来源:GearBox_template_1010.py


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