if __name__ == '__main__':
    
    import sys
    from PyQt5.QtWidgets import QApplication
    app = QApplication(sys.argv)  
    
    
#####################################################   
    
    print('main')
    import sys
    sys.path.append("../")
    
    module_name = "view"   #模块名  
    class_name = "HomeView" #类名     
    method = "show"          #方法名  
    module = __import__(module_name) # import module  
    print ("#module:",module  )
    print('dir', dir(module))
    cl = getattr(module,class_name)    
    print("#class:",cl  )
    

    
    obj = cl() # new class  
    print("#obj:",obj  ) 
    mtd = getattr(obj,method)  
    print("#method:",mtd  ) 
    mtd() # call def  
    
    
    
#####################################################   
    sys.exit(app.exec_())

 

需要在__init__.py文件中引出才行....囧

 

 

今天未来得及看的:

https://github.com/processone/grapherl

http://toutiao.com/i6215417552374333953/?tt_from=mobile_qq&utm_campaign=client_share&app=news_article&utm_source=mobile_qq&iid=3160476964&utm_medium=toutiao_ios

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-13
  • 2022-12-23
  • 2021-06-13
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-30
  • 2021-06-24
  • 2021-12-22
  • 2022-03-06
  • 2021-09-11
  • 2022-01-07
相关资源
相似解决方案