Python wx 模块,PySimpleApp() 实例源码

我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用wx.PySimpleApp()

项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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()
项目:ChiantiPy    作者:chianti-atomic    | 项目源码 | 文件源码
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()
项目:Taigabot    作者:FrozenPigs    | 项目源码 | 文件源码
def _test():
    class TestDialog(wxSpellCheckerDialog):
        def __init__(self,*args):
            wxSpellCheckerDialog.__init__(self,*args)
            wx.EVT_CLOSE(self,self.OnClose)
        def OnClose(self,evnt):
            chkr = dlg.GetSpellChecker()
            if chkr is not None:
                printf(["AFTER:", chkr.get_text()])
            self.Destroy()
    from enchant.checker import SpellChecker
    text = "This is sme text with a fw speling errors in it. Here are a fw more to tst it ut."
    printf(["BEFORE:", text])
    app = wx.PySimpleApp()
    dlg = TestDialog()
    chkr = SpellChecker("en_US",text)
    dlg.SetSpellChecker(chkr)
    dlg.Show()
    app.MainLoop()
项目:ChiantiPy    作者:chianti-atomic    | 项目源码 | 文件源码
def __do_layout(self):
        # begin wxGlade: ui_choice2Dialog.__do_layout
        sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_3 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.numListBox, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 20)
        sizer_2.Add(self.button_ok, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 10)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_3.Add(self.denListBox, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 20)
        sizer_3.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 10)
        sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        self.Layout()
        # end wxGlade

# end of class ui_choice2Dialog


#if __name__ == "__main__":
    #app = wx.PySimpleApp(0)
    #wx.InitAllImageHandlers()
    #ChiantiPy = ui_choice2Dialog(None, -1, "")
    #app.SetTopWindow(ChiantiPy)
    #ChiantiPy.Show()
    #app.MainLoop()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def send_sms(self):


        print "sending",self.NO_MOBILE_LIST

        if  self.NO_MOBILE_LIST:



            msg="The following Student(s) got no valid mobile numbers. Go to Student Profile to add/edit mobile numbers\n"

            no=0

            for pupil in self.NO_MOBILE_LIST:
                no+=1
                msg+=str(no)+".  "+str(pupil)+"\n"

            #app = wx.PySimpleApp(0)

            dlg = wx.MessageDialog(None, msg,"No Mobile Number",wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def Failed_Report(self):

        if len(self.Failed_List)==0:
            msg="All Students Passed"
        else:
            msg="The following Student(s) detained\n"
            no=0
            for pupil in self.Failed_List:
                no+=1
                msg+=str(no)+".  "+str(pupil)+"\n"

        #app = wx.PySimpleApp(0)

        dlg = wx.MessageDialog(None, msg,str(self.class_)+self.div,wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def do(self):
        #app = wx.PySimpleApp(0)


        wcd="Excel Files(*.xls)|*.xls|"
        dir = "/home"
        save_dlg = wx.FileDialog(self.parent, message='Choose File to be Imported', defaultDir=dir, defaultFile= '', wildcard=wcd, style=wx.OPEN)
        if save_dlg.ShowModal() == wx.ID_OK:
            path = save_dlg.GetPath()


            self.book = open_workbook(path)
            self.current_sheet=self.book.sheet_by_index(0)
            self.rown=self.current_sheet.nrows
            self.DB=db_operations()
            self.write_to_db()
        save_dlg.Destroy()
        print "extd"
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def insureWxApp():
    """Create an instance of PySimpleApp if there is no app already.
    This is required by wxPython before creating any GUI objects.
    """
    global _wxApp
    _wxApp = wx.GetApp()
    if not _wxApp:
        _wxApp = wx.PySimpleApp()
    return _wxApp
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def get_app_wx(*args, **kwargs):
    """Create a new wx app or return an exiting one."""
    import wx
    app = wx.GetApp()
    if app is None:
        if 'redirect' not in kwargs:
            kwargs['redirect'] = False
        app = wx.PySimpleApp(*args, **kwargs)
    return app
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def get_app_wx(*args, **kwargs):
    """Create a new wx app or return an exiting one."""
    import wx
    app = wx.GetApp()
    if app is None:
        if 'redirect' not in kwargs:
            kwargs['redirect'] = False
        app = wx.PySimpleApp(*args, **kwargs)
    return app
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def getlanguageDict():
    languageDict = {}

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

    for lang in [x for x in dir(wx) if x.startswith("LANGUAGE")]:
        i = wx.Locale(wx.LANGUAGE_DEFAULT).GetLanguageInfo(getattr(wx, lang))
        if i:
            languageDict[i.CanonicalName] = i.Description

    return languageDict
项目:multiplierz    作者:BlaisProteomics    | 项目源码 | 文件源码
def __init__(self):
        #self.app = wx.PySimpleApp()
        self.app = wx.App(False)
项目:blender    作者:gastrodia    | 项目源码 | 文件源码
def get_app_wx(*args, **kwargs):
    """Create a new wx app or return an exiting one."""
    import wx
    app = wx.GetApp()
    if app is None:
        if 'redirect' not in kwargs:
            kwargs['redirect'] = False
        app = wx.PySimpleApp(*args, **kwargs)
    return app
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def get_app_wx(*args, **kwargs):
    """Create a new wx app or return an exiting one."""
    import wx
    app = wx.GetApp()
    if app is None:
        if 'redirect' not in kwargs:
            kwargs['redirect'] = False
        app = wx.PySimpleApp(*args, **kwargs)
    return app