python类App()的实例源码

Control_Frameworks.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def wxPythonApp():
    import wx
    app = wx.App()
    frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150))
    frame.SetBackgroundColour('white')
    frame.CreateStatusBar()
    menu= wx.Menu()
    menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
    menuBar = wx.MenuBar()
    menuBar.Append(menu,"File") 
    frame.SetMenuBar(menuBar)     
    frame.Show()

    runT = Thread(target=app.MainLoop)
    runT.setDaemon(True)    
    runT.start()
    print(runT)
    print('createThread():', runT.isAlive())
Main.py 文件源码 项目:nodemcu-pyflasher 作者: marcelstoer 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _build_menu_bar(self):
        self.menuBar = wx.MenuBar()

        # File menu
        file_menu = wx.Menu()
        wx.App.SetMacExitMenuItemId(wx.ID_EXIT)
        exit_item = file_menu.Append(wx.ID_EXIT, "E&xit\tCtrl-Q", "Exit NodeMCU PyFlasher")
        exit_item.SetBitmap(images.Exit.GetBitmap())
        self.Bind(wx.EVT_MENU, self._on_exit_app, exit_item)
        self.menuBar.Append(file_menu, "&File")

        # Help menu
        help_menu = wx.Menu()
        help_item = help_menu.Append(wx.ID_ABOUT, '&About NodeMCU PyFlasher', 'About')
        self.Bind(wx.EVT_MENU, self._on_help_about, help_item)
        self.menuBar.Append(help_menu, '&Help')

        self.SetMenuBar(self.menuBar)
Main.py 文件源码 项目:Crypter 作者: sithis993 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def start_gui(self):
    '''
    @summary: Initialises and launches the ransomware GUI screen
    '''

    # Get Crypter start_time
    start_time = self.get_start_time()

    app = wx.App()
    # TODO Update this to new path and place in __init__
    #sys._MEIPASS = "..\\build\\images"
    crypter_gui = Gui.Gui(
        image_path=sys._MEIPASS, 
        start_time=start_time,
        decrypter=self,
        config=self.__config)

    crypter_gui.Show()
    app.MainLoop()
bonsu.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self):
        app = wx.App()
        self.frame = MainWindow(None, "Bonsu - The Interactive Phase Retrieval Suite")
        self.nb = wx.Notebook(self.frame)
        self.nb.AddPage(PanelPhase(self.nb), "Phasing Pipeline")
        self.nb.AddPage(PanelVisual(self.nb), "Visualisation")
        self.nb.AddPage(PanelGraph(self.nb), "Graph")
        self.nb.AddPage(PanelScript(self.nb), "Python Prompt")
        self.nb.AddPage(PanelStdOut(self.nb), "Log")
        self.frame.nb = self.nb
        self.frame.sizer.Add(self.nb, 1, wx.ALL|wx.EXPAND, 5)
        self.frame.SetBackgroundColour(wx.NullColour)
        self.frame.SetSizer(self.frame.sizer)
        self.frame.Fit()
        self.frame.Show()
        self.frame.OnFileArg()
        app.MainLoop()
imViewer_Simple.py 文件源码 项目:augment3D 作者: yulkang 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def show_file(self, imageFile, fullPath):
        """ Load the DICOM file, make sure it contains at least one
        image, and set it up for display by OnPaint().  ** be
        careful not to pass a unicode string to read_file or it will
        give you 'fp object does not have a defer_size attribute,
        or some such."""
        ds = pydicom.read_file(str(fullPath))
        ds.decode()                                         # change strings to unicode
        self.populateTree(ds)
        if 'PixelData' in ds:
            self.dImage = self.loadPIL_LUT(ds)
            if self.dImage is not None:
                tmpImage = self.ConvertPILToWX(self.dImage, False)
                self.bitmap = wx.BitmapFromImage(tmpImage)
                self.Refresh()

# ------ This is just the initialization of the App  -------------------------


# =======================================================
# The main App Class.
# =======================================================
sample_application.py 文件源码 项目:python-embedded-launcher 作者: zsquareplusc 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def main():
    app = wx.App()
    top = SampleFrame()
    top.Show()

    # close the console window as soon as the main window shows
    try:
        import launcher
    except ImportError:
        pass # ignore this when testing and running this file directly
    else:
        #~ launcher.close_console()
        launcher.hide_console_until_error()
        top.SetFocus()

    app.MainLoop()
pyDataView.py 文件源码 项目:pyDataView 作者: edwardsmith999 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run_visualiser(parent_parser=argparse.ArgumentParser(add_help=False)):

    #Keyword arguments
    parser = argparse.ArgumentParser(
                           description="""
                           Runs visualiser XXXX where XXXX is an 
                           increasingly more futuristic and exciting number""",
                           parents=[parent_parser])

    parser.add_argument('-d', '--fdir', dest='fdir', 
                        help='Directory containing results', 
                        default='../flowmol/src/results/')

    args = vars(parser.parse_args())

    app = wx.App()
    fr = pplv.MainFrame(None, fdir=args['fdir'])
    fr.Show()
    app.MainLoop()
LabellingInterface.py 文件源码 项目:hco-experiments 作者: zooniverse 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def main():

    parser = optparse.OptionParser("[!] usage: python wx_mpl_display_detections_gui.py\n"+\
                                   "\t -F <data file>\n")

    parser.add_option("-F", dest="dataFile", type="string", \
                      help="specify data file to analyse")


    (options, args) = parser.parse_args()
    dataFile = options.dataFile

    if dataFile is None:
        print parser.usage
        exit(0)

    app = wx.App(False)
    app.frame = mainFrame(dataFile)
    app.frame.Show()
    app.MainLoop()
LabellingInterface.py 文件源码 项目:hco-experiments 作者: zooniverse 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def main():

    parser = optparse.OptionParser("[!] usage: python wx_mpl_display_detections_gui.py\n"+\
                                   "\t -F <data file>\n")

    parser.add_option("-F", dest="dataFile", type="string", \
                      help="specify data file to analyse")


    (options, args) = parser.parse_args()
    dataFile = options.dataFile

    if dataFile is None:
        print parser.usage
        exit(0)

    app = wx.App(False)
    app.frame = mainFrame(dataFile)
    app.frame.Show()
    app.MainLoop()
updateframe.py 文件源码 项目:fmc-dialer 作者: sguron 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __del__(self):
        pass

# def nullfn(*arg):
#     print "run_updte called"
#
# if __name__ == '__main__':
#     app = wx.App()
#     app.appversion = 201
#     app.run_update = nullfn
#     wizard = UpdateFrame(None)
#     wizard.Show()
#     import time
#     #time.sleep(1)
#     wizard.check_update()
#     app.MainLoop()
Beremiz.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def CreateApplication(self):
        if os.path.exists("BEREMIZ_DEBUG"):
            __builtin__.__dict__["BMZ_DBG"] = True
        else:
            __builtin__.__dict__["BMZ_DBG"] = False

        global wx
        import wx

        if wx.VERSION >= (3, 0, 0):
            self.app = wx.App(redirect=BMZ_DBG)
        else:
            self.app = wx.PySimpleApp(redirect=BMZ_DBG)

        self.app.SetAppName('beremiz')
        if wx.VERSION < (3, 0, 0):
            wx.InitAllImageHandlers()

        self.ShowSplashScreen()
        self.BackgroundInitialization()
        self.app.MainLoop()
gui.py 文件源码 项目:ChiantiPy 作者: chianti-atomic 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, items,  label=None):
#       app = wx.PySimpleApp(0)
        app = wx.App()
        dlg = ui_choice2Dialog(None, -1, "")
        nItems = len(items)
        for i in range(nItems):
            dlg.numListBox.Insert(str(items[i]),i)
            dlg.denListBox.Insert(str(items[i]),i)
#       app.SetTopWindow(dialog_1)
        app.SetTopWindow(dlg)
        if dlg.ShowModal() == wx.ID_OK:
            self.numIndex = dlg.numListBox.GetSelections()
#           print ' numIndex = ', self.numIndex
            self.denIndex = dlg.denListBox.GetSelections()
            self.numText = []
            self.denText = []
            for one in self.numIndex:
#               print ' one = ', one
#               self.numText.append(items[self.numIndex[one]])
                self.numText.append(items[one])
            for one in self.denIndex:
#               self.denText.append(items[self.denIndex[one]])
                self.denText.append(items[one])
        dlg.Destroy()
ICPView.py 文件源码 项目:procrustes 作者: bmershon 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, xmeshfile, ymeshfile):
        #Do fast loading bypassing the mesh data structures since geometry
        #and topology are never changed
        xmesh = PolyMesh()
        print "Loading %s..."%xmeshfile
        (xmesh.VPos, xmesh.VColors, xmesh.ITris) = loadOffFileExternal(xmeshfile)
        xmesh.performDisplayUpdate(True)

        ymesh = PolyMesh()
        print "Loading %s..."%ymeshfile
        (ymesh.VPos, ymesh.VColors, ymesh.ITris) = loadOffFileExternal(ymeshfile)
        ymesh.performDisplayUpdate(True)

        app = wx.App()
        frame = ICPViewerFrame(None, -1, 'ICPViewer', xmesh, ymesh)
        frame.Show(True)
        app.MainLoop()
        app.Destroy()
imViewer_Simple.py 文件源码 项目:bids 作者: robertoostenveld 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def show_file(self, imageFile, fullPath):
        """ Load the DICOM file, make sure it contains at least one
        image, and set it up for display by OnPaint().  ** be
        careful not to pass a unicode string to read_file or it will
        give you 'fp object does not have a defer_size attribute,
        or some such."""
        ds = pydicom.read_file(str(fullPath))
        ds.decode()                                         # change strings to unicode
        self.populateTree(ds)
        if 'PixelData' in ds:
            self.dImage = self.loadPIL_LUT(ds)
            if self.dImage is not None:
                tmpImage = self.ConvertPILToWX(self.dImage, False)
                self.bitmap = wx.BitmapFromImage(tmpImage)
                self.Refresh()

# ------ This is just the initialization of the App  -------------------------


# =======================================================
# The main App Class.
# =======================================================
game.py 文件源码 项目:5622_PacMan_NN 作者: Brennan-M 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def getplayername(self):
            """Ask the player his name, to go on the high-score list."""
            if NO_WX: return USER_NAME
            try:
              import wx
            except:
              print "Pacman Error: No module wx. Can not ask the user his name!"
              print "     :(       Download wx from http://www.wxpython.org/"
              print "     :(       To avoid seeing this error again, set NO_WX in file pacman.pyw."
              return USER_NAME
            app=wx.App(None)
            dlog=wx.TextEntryDialog(None,"You made the high-score list! Name:")
            dlog.ShowModal()
            name=dlog.GetValue()
            dlog.Destroy()
            app.Destroy()
            return name
main.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, redirect=False, filename=None):
        wx.App.__init__(self, redirect, filename)

        BASEURL = "http://127.0.0.1:8000"
        self.InitUpdates(BASEURL,
                         BASEURL + "/" + 'ChangeLog.txt')
        self.SetAppDisplayName('Image Viewer')
        self.CheckForUpdate()

        self.frame = wx.Frame(None, title='Photo Control')

        self.panel = wx.Panel(self.frame)

        self.PhotoMaxSize = 500

        self.createWidgets()
        self.frame.Show()
main.py 文件源码 项目:pyupdater-wx-demo 作者: wettenhj 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, fileServerPort, status):
        self.fileServerPort = fileServerPort
        self.status = status
        self.frame = None
        self.panel = None
        self.statusBar = None
        self.sizer = None
        wx.App.__init__(self, redirect=False)
recipe-475155.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, -1, title, size = (1, 1),
            style=wx.FRAME_NO_TASKBAR|wx.NO_FULL_REPAINT_ON_RESIZE)

        self.tbicon = MyTaskBarIcon(self)
        self.tbicon.SetIconTimer()

        self.Show(True)

##
# The main application wx.App class
#
recipe-286201.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, app, twistedLogFileName=None):
        """'app' is a wx.App instance"""
        Thread.__init__(self)
        self.app = None
        self.twistedLogFileName = twistedLogFileName
        self.setApp(app)
        ThreadCommand.twistedThread = self
        if app:
            self.running = True
            self.start()
client_wx.py 文件源码 项目:pypilot 作者: pypilot 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def main():
    app = wx.App()
    MainFrame().Show()
    app.MainLoop()
scope_wx.py 文件源码 项目:pypilot 作者: pypilot 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def main():
    glutInit(sys.argv)
    app = wx.App()
    SignalKScope().Show()
    app.MainLoop()
autopilot_control.py 文件源码 项目:pypilot 作者: pypilot 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def main():
    app = wx.App()
    AutopilotControl().Show()
    app.MainLoop()
autopilot_calibration.py 文件源码 项目:pypilot 作者: pypilot 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def main():
    glutInit(sys.argv)
    app = wx.App()
    CalibrationDialog().ShowModal()
Control_Frameworks_NOT_working.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def wxPythonApp():
    import wx
    app = wx.App()
    frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150))
    frame.SetBackgroundColour('white')
    frame.CreateStatusBar()
    menu= wx.Menu()
    menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
    menuBar = wx.MenuBar()
    menuBar.Append(menu,"File") 
    frame.SetMenuBar(menuBar)     
    frame.Show()
    app.MainLoop()
Communicate.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def wxPythonApp():
        app = wx.App()      
        frame = wx.Frame(
            None, title="Python GUI using wxPython", size=(300,180))
        GUI(frame)          
        frame.Show()        
        runT = Thread(target=app.MainLoop)
        runT.setDaemon(True)    
        runT.start()
        print(runT)
        print('createThread():', runT.isAlive())

#==================================================================
Embed_wxPython.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def wxPythonApp():
    import wx
    app = wx.App()
    frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150))
    frame.SetBackgroundColour('white')
    frame.CreateStatusBar()
    menu= wx.Menu()
    menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
    menuBar = wx.MenuBar()
    menuBar.Append(menu, "File") 
    frame.SetMenuBar(menuBar)     
    frame.Show()
    app.MainLoop()
import_OpenGL_cube_and_cone.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self):
        wx.App.__init__(self, redirect=False)
Main.py 文件源码 项目:nodemcu-pyflasher 作者: marcelstoer 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
    app = App(False)
    app.MainLoop()
# ---------------------------------------------------------------------------
wxnsc.py 文件源码 项目:SameKeyProxy 作者: xzhou 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def main(argv):
   """
   The default host will be None if the environment variable
   PYRO_NS_HOSTNAME is not set.
   The default port will be 9090 (Pyro.config.PYRO_NS_PORT) if
   PYRO_NS_BC_PORT environment variable is not set.
   """
   nsHost = os.getenv('PYRO_NS_HOSTNAME')
   nsPort = os.getenv('PYRO_NS_BC_PORT') or Pyro.config.PYRO_NS_PORT
   bcAddr = Pyro.config.PYRO_NS_BC_ADDR
   if bcAddr:
      bcAddr=bcAddr.strip()
   bcAddr=bcAddr or None

   class wx_NSCApp(wx.App):
      def OnInit(self):
         Pyro.core.initClient()
         frame = wx_NSC(nsHost, nsPort, bcAddr)
         frame.SetSize(wx.Size(630,500))
         frame.Show(True)
         return True

   app = wx_NSCApp(0)
   app.MainLoop()

# allow easy usage with python -m
dfgui.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def show(df):
    """
    The main function to start the data frame GUI.
    """

    app = wx.App(False)
    frame = MainFrame(df)
    frame.Show()
    app.MainLoop()


问题


面经


文章

微信
公众号

扫码关注公众号