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

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

项目:cebl    作者:idfah    | 项目源码 | 文件源码
def updateStatusBar(self, event=None):
        src = self.mgr.getSource()

        if src is None:
            curRollCount, curBuffFill = 0, 0.0
            sampRate = 0.0
        else:
            curRollCount, curBuffFill = src.getBufferStats()
            sampRate = src.getEffectiveSampRate()

        self.statusBar.SetStatusText('Source: %s' % str(src), 0)
        self.statusBar.SetStatusText('Running Pages: %d' % self.mgr.getNRunningPages(), 1)
        self.statusBar.SetStatusText('Buffer: %d/%d%%' % (curRollCount, int(curBuffFill*100)), 2)
        self.statusBar.SetStatusText('Sampling Rate: %.2fHz' % sampRate, 3)
        self.statusBar.SetStatusText('Version: 3.0.0a', 4)

#class Splash(wx.adv.SplashScreen): # wxpython3
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def create_page1(self):
        page1 = MyWizardPage(self, "Page 1")
        d = wx.StaticText(page1, label="test")
        page1.addWidget(d, (2, 1), (1,5))

        self.text1 = wx.TextCtrl(page1)
        page1.addWidget(self.text1, (3,1), (1,5))

        self.text2 = wx.TextCtrl(page1)
        page1.addWidget(self.text2, (4,1), (1,5))

        page2 = MyWizardPage(self, "Page 2")
        page2.SetName("page2")
        self.text3 = wx.TextCtrl(page2)
        self.Bind(wx.adv.EVT_WIZARD_PAGE_CHANGED, self.onPageChanged)

        page3 = MyWizardPage(self, "Page 3")

        # Set links
        page2.SetPrev(page1)
        page1.SetNext(page2)
        page3.SetPrev(page2)
        page2.SetNext(page3)

        return page1
项目:MaTags    作者:hastelloy    | 项目源码 | 文件源码
def __init__(self, parent, title):
        style = wx.DEFAULT_FRAME_STYLE & ~(
            wx.RESIZE_BORDER | wx.MAXIMIZE_BOX |
            wx.MINIMIZE_BOX|wx.CLOSE_BOX)

        wx.Frame.__init__(self, parent, title=title, 
            style=style, size=(400,60))
        self.textbox = wx.TextCtrl(self)

        img = wx.Image("matags.png", wx.BITMAP_TYPE_ANY)
        bmp = wx.Bitmap(img)
        self.icon = wx.Icon()
        self.icon.CopyFromBitmap(bmp)
        self.SetIcon(self.icon)

        self.tbIcon = wx.adv.TaskBarIcon()
        self.tbIcon.SetIcon(self.icon)

        self.Show(True)
        self.Centre()

        self.reg_hot_keys()        
        self.Bind(wx.EVT_HOTKEY, self.on_extract_tag, 
            id=self.hotkeys['extract_tag'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_close, 
            id=self.hotkeys['quit'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_activate, 
            id=self.hotkeys['activate'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_refresh, 
            id=self.hotkeys['refresh'][0])
        self.textbox.Bind(wx.EVT_CHAR, self.check_key)
        # do not use EVT_KEY_DOWN, 
        # it becomes difficult to get lower case
        # self.textbox.Bind(wx.EVT_KEY_DOWN, self.check_key)
        # self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(wx.EVT_ICONIZE, self.on_iconify)
        self.matags = MaTags()
        # try:
        # except Exception as e:
        #     self.textbox.ChangeValue(e.args[0].decode('utf8', 'ignore'))
        #     self.textbox.Disable()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def __init__(self, parent):
        logo = wx.Image(os.path.dirname(__file__) + '/images/CEBL3_splash.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        #wx.adv.SplashScreen.__init__(self, # wxpython3
        wx.SplashScreen.__init__(self,
            parent=parent, milliseconds=2000, bitmap=logo,
            #splashStyle=wx.adv.SPLASH_CENTER_ON_SCREEN | wx.adv.SPLASH_TIMEOUT) # wxpython3
            splashStyle=wx.SPLASH_CENTER_ON_SCREEN | wx.SPLASH_TIMEOUT)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def about_dialog(parent):
    """An about dialog

    Args:
        parent (wx.Window): The parent window
    """
    license_text = """
    Copyright (C) 10se1ucgo 2016

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>."""

    about_info = wx.adv.AboutDialogInfo()
    about_info.SetName("pyjam")
    about_info.SetVersion("v{v}".format(v=__version__))
    about_info.SetCopyright("Copyright (C) 10se1ucgo 2016")
    about_info.SetDescription("An open source, cross-platform audio player for Source and GoldSrc engine based games.")
    about_info.SetWebSite("https://github.com/10se1ucgo/pyjam", "GitHub repository")
    about_info.AddDeveloper("10se1ucgo")
    about_info.AddDeveloper("Dx724")
    about_info.AddArtist("Dx724 - Icon")
    about_info.SetLicense(license_text)
    wx.adv.AboutBox(about_info, parent)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, frame):
        wx.adv.TaskBarIcon.__init__(self)
        self.frame = frame

        # Set the image
        icon = wx.Icon('python.ico', wx.BITMAP_TYPE_ICO)

        self.SetIcon(icon, "Python")

        # bind some events
        self.Bind(wx.EVT_MENU, self.OnTaskBarClose, id=self.TBMENU_CLOSE)
        self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def onAboutDlg(self, event):
        info = wx.adv.AboutDialogInfo()
        info.Name = "My About Box"
        info.Version = "0.0.1 Beta"
        info.Copyright = "(C) 2008 Python Geeks Everywhere"
        info.Description = wordwrap(
            "This is an example application that shows how to create "
            "different kinds of About Boxes using wxPython!",
            350, wx.ClientDC(self.panel))
        info.WebSite = ("http://www.pythonlibrary.org", "My Home Page")
        info.Developers = ["Mike Driscoll"]
        info.License = wordwrap("Completely and totally open source!", 500,
                                wx.ClientDC(self.panel))
        # Show the wx.AboutBox
        wx.adv.AboutBox(info)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, frame):
        """Constructor"""
        wx.adv.TaskBarIcon.__init__(self)
        self.frame = frame

        icon = wx.Icon('python.ico', wx.BITMAP_TYPE_ICO)

        self.SetIcon(icon, "Restore")

        self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
项目:wxWize    作者:AndersMunch    | 项目源码 | 文件源码
def create_wxwindow(self):
        try:
            from wx.adv import CommandLinkButton # Phoenix
        except ImportError:
            CommandLinkButton = wx.CommandLinkButton # Classic
        return self.initfn(CommandLinkButton)(self.parent, self.id, self.mainLabel, self.note, self.pos, self.size, self.style, self.validator, self.name)
项目:wxWize    作者:AndersMunch    | 项目源码 | 文件源码
def create_wxwindow(self):
        try:
            from wx.adv import DatePickerCtrl
        except ImportError:
            DatePickerCtrl = wx.DatePickerCtrl
        return self.initfn(DatePickerCtrl)(self.parent, self.id, self.dt, self.pos, self.size, self.style, self.validator, self.name)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def OnAbout(self,e):
        description =\
        """Bonsu is a collection of tools and algorithms primarily for the reconstruction of phase information from diffraction intensity measurements."""
        licence =\
        """This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>."""
        if IsNotWX4():
            info = wx.AboutDialogInfo()
        else:
            info = wx.adv.AboutDialogInfo()
        info.SetIcon(wx.Icon(os.path.join(os.path.dirname(os.path.dirname(__file__)),'image',  'bonsu.ico'), wx.BITMAP_TYPE_ICO))
        info.SetName('Bonsu')
        info.SetVersion(__version__)
        info.SetDescription(description)
        info.SetCopyright('Copyright (C) 2011-2017 Marcus C. Newton')
        info.SetWebSite('github.com/bonsudev/bonsu')
        info.SetLicence(licence)
        info.AddDeveloper('Marcus C. Newton')
        self.version_str_list = []
        self.version_str_list.append("Python "+str(sys.version_info.major)+"."+str(sys.version_info.minor)+"."+str(sys.version_info.micro))
        self.version_str_list.append("wxPython "+wx.version())
        self.version_str_list.append("NumPy "+numpy.version.version)
        self.version_str_list.append("VTK "+vtk.vtkVersion().GetVTKVersion())
        self.version_str_list.append("PIL "+Image.VERSION)
        try:
            import h5py
            self.version_str_list.append("h5Py "+h5py.version.version)
        except:
            pass
        self.version_str_list.append("Build date: "+__builddate__)
        info.SetArtists(self.version_str_list)
        dialog = CustomAboutDialog(self,info)
        dialog.ShowModal()
        dialog.Destroy()
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def __init__(self, trayicon, tooltip):
        super(TaskBarIcon, self).__init__()
        self.show_no_updates = False

        # Set trayicon and tooltip
        icon = wx.Icon(wx.Bitmap(trayicon))
        self.SetIcon(icon, tooltip)

        self.Bind(wx.adv.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade)
        self.Bind(wx.adv.EVT_TASKBAR_BALLOON_CLICK, self.on_bubble)
        self.upd_error_count = 0
        self.checking_updates = False
        self.updates_available = False
        self.shutdown_scheduled = False
        self.reboot_scheduled = False
        self.bootup_time = getBootUp()
        if update_interval and update_method:
            self.timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
            self.timer.Start(update_interval)
            if update_startup:
                self.on_timer(None)
        if check_bootup_log:
            last_check = check_file_date(xml_file)
            now = datetime.datetime.now()
            if (self.bootup_time + datetime.timedelta(hours=1) > now) and \
               (self.bootup_time + datetime.timedelta(minutes=30) > last_check):
                log, errorlog, reboot = check_eventlog(self.bootup_time)
                if errorlog:
                    error_str = _(u"Update error detected\n"
                                  u"during system start up.")
                    self.ShowBalloon(title=_(u'WPKG Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                    title = _(u"System start error")
                    dlg = ViewLogDialog(title=title,log=errorlog)
                    dlg.ShowModal()
        if check_last_upgrade:
            # Check if the last changes to the local wpkg.xml are older than a specific time
            # Inform USER that he should upgrade the System
            last_check = check_file_date(xml_file)
            if last_check < (datetime.datetime.now() - datetime.timedelta(days=last_upgrade_interval)):
                dlg_str = _(u"System should be updated!\n\n"
                            u"System wasn't updated in over {} days.").format(str(last_upgrade_interval))
                dlg = wx.MessageDialog(None, dlg_str, _(u"Attention!"), wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
                self.on_upgrade(None)