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


Python gui.MainWindow方法代码示例

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


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

示例1: main

# 需要导入模块: import gui [as 别名]
# 或者: from gui import MainWindow [as 别名]
def main():
    """Main function of Ex.Co."""
    #Check arguments
    options = parse_arguments()
    if options.debug_mode == True:
        data.debug_mode = True
    if options.logging_mode == True:
        data.logging_mode = True
    file_arguments = options.files
    if options.single_file != None:
        if file_arguments != None:
            file_list = file_arguments.split(";")
            file_list.append(options.single_file)
            file_arguments = ";".join(file_list)
        else:
            file_arguments = [options.single_file]
    if file_arguments == ['']:
        file_arguments = None
    #Get the application directory
    if getattr(sys, 'frozen', False):
        # frozen
        data.application_directory = os.path.dirname(sys.executable).replace("\\", "/")
    else:
        # unfrozen
        data.application_directory = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
    #Check if Ex.Co. is run as a cx_freeze executable (the path will contain library.zip)
    if data.application_directory.endswith(".zip"):
        data.application_directory = os.path.dirname(data.application_directory)
    #Set the resources directory
    data.resources_directory = os.path.join(data.application_directory,  "resources")
    #Combine the application path with the Ex.Co. icon file name (the icon file name is set in the global module)
    data.application_icon = os.path.join(
        data.resources_directory,
        data.application_icon
    )
    #Combine the application path with the Ex.Co. information file name (the information file name is set in the global module)
    data.about_image = os.path.join(
        data.resources_directory,
        data.about_image
    )
    #Create QT application, needed to use QT forms
    app = data.QApplication(sys.argv)
    #Save the Qt application to the global reference
    data.application = app
    #Create the main window, pass the filename that may have been passed as an argument
    main_window = gui.MainWindow(
        new_document = options.new_document, 
        logging=data.logging_mode, 
        file_arguments=file_arguments
    )
    components.TheSquid.init_objects(main_window)
    main_window.import_user_functions()
    main_window.show()
    sys.exit(app.exec_())
    
#Check if this is the main executing script 
开发者ID:matkuki,项目名称:ExCo,代码行数:58,代码来源:main.py


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