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

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

项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, pyroserver, level):
                wx.TaskBarIcon.__init__(self)
                self.pyroserver = pyroserver
                # Set the image
                self.UpdateIcon(None)
                self.level = level

                # bind some events
                self.Bind(wx.EVT_MENU, self.OnTaskBarStartPLC, id=self.TBMENU_START)
                self.Bind(wx.EVT_MENU, self.OnTaskBarStopPLC, id=self.TBMENU_STOP)
                self.Bind(wx.EVT_MENU, self.OnTaskBarChangeName, id=self.TBMENU_CHANGE_NAME)
                self.Bind(wx.EVT_MENU, self.OnTaskBarChangeInterface, id=self.TBMENU_CHANGE_INTERFACE)
                self.Bind(wx.EVT_MENU, self.OnTaskBarLiveShell, id=self.TBMENU_LIVE_SHELL)
                self.Bind(wx.EVT_MENU, self.OnTaskBarWXInspector, id=self.TBMENU_WXINSPECTOR)
                self.Bind(wx.EVT_MENU, self.OnTaskBarChangePort, id=self.TBMENU_CHANGE_PORT)
                self.Bind(wx.EVT_MENU, self.OnTaskBarChangeWorkingDir, id=self.TBMENU_CHANGE_WD)
                self.Bind(wx.EVT_MENU, self.OnTaskBarQuit, id=self.TBMENU_QUIT)
项目:Netkeeper    作者:1941474711    | 项目源码 | 文件源码
def __init__(self):
        wx.TaskBarIcon.__init__(self)
        self.SetIcon(AppResource.TaskIcon.getIcon(), C_APP_NAME)
        self.ID_NAME = wx.NewId()
        self.ID_EXIT = wx.NewId()
        self.ID_AUTHOR = wx.NewId()
        self.Bind(wx.EVT_MENU, self.OnExitEvent, id=self.ID_EXIT)
        self.Bind(wx.EVT_MENU, self.OnHelpEvent, id=self.ID_AUTHOR)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def Get(self,l,r):
        s=""+self.s_line
        for i in range(5):
            if i<(5-l):
                sl = self.sl_off
            else:
                sl = self.sl_on

            if i<(5-r):
                sr = self.sr_off
            else:
                sr = self.sr_on

            s+=self.s_border+sl+self.s_point+sr+self.s_point
            s+=self.s_border+sl+self.s_point+sr+self.s_point
            s+=self.s_line

        image = wx.EmptyImage(16,16)
        image.SetData(s)

        bmp = image.ConvertToBitmap()
        bmp.SetMask(wx.Mask(bmp, wx.WHITE)) #sets the transparency colour to white 

        icon = wx.EmptyIcon()
        icon.CopyFromBitmap(bmp)

        return icon

##
# The TaskBarIcon class
#
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, frame):
        wx.TaskBarIcon.__init__(self)
        self.frame = frame
        self.IconBar = IconBar((127,127,0),(255,255,0),(0,127,127),(0,255,255))
        self.SetIconBar(self.l,self.r)

    ##
    # \brief sets the icon timer
    #
项目:bittray    作者:nkuttler    | 项目源码 | 文件源码
def __init__(self, frame):
        self.frame = frame
        super(TaskBarIcon, self).__init__()
        # self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_click)
        self.conf = TrayConf()
        self.trayicon = TrayIcon(self.conf)
        signal.signal(signal.SIGUSR1, self.signal_handler)
        signal.signal(signal.SIGUSR2, self.signal_handler)
项目:bittray    作者:nkuttler    | 项目源码 | 文件源码
def OnInit(self):
        frame = wx.Frame(None)
        self.SetTopWindow(frame)
        self.icon = TaskBarIcon(frame)
        if not self.icon.IsAvailable():
            logger.critical("Systray not available in your environment")
            sys.exit(1)
        if not self.icon.IsOk():
            logger.critical("Unknown error, icon is not ok")
            sys.exit(2)
        self.icon.set_icon_timer()
        return True
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, frame):
        wx.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.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="TaskBarIcon Tutorial",
            size=(500,500))
        panel = wx.Panel(self)
        self.tbIcon = PythonIcon(self)
        self.Bind(wx.EVT_CLOSE, self.onClose)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, frame):
        """Constructor"""
        wx.TaskBarIcon.__init__(self)
        self.frame = frame

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

        self.SetIcon(icon, "Restore")

        self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def __init__(self, trayicon, tooltip):
        super(TaskBarIcon, self).__init__()
        self.show_no_updates = False

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

        self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade)
        self.Bind(wx.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 = ReadLastSyncTime()
            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 when WPKG-GP sucessfully synced the last time
            # Inform USER that he should upgrade the System
            last_sync = ReadLastSyncTime()
            if last_sync:
                if last_sync < (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)