本文整理匯總了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