473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

wxPython cross platform taskbar

Hi All

Does anyone have any peice of wxPython code thats cross platform and
allows an app to be minimised in the system tray. I am hoping for
windows/kde/gnome/darwin if possible. I have been playing about and
have a couple of systems that nearly get there but not quite.

I would llike to create an app that does this in the way limewire/skype
etc. do it

Hope you can help
David

Heres sample code that nearly gets there I think - it appears to work
on ubuntu/gnome

import wx

ICON_STATE = 0
BLINK_STATE = 0

ID_ICON_TIMER = wx.NewId()

class TaskBarApp(wx.Frame):
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_RE SIZE)
self.tbicon = wx.TaskBarIcon()
icon = wx.Icon('yellow.ico', wx.BITMAP_TYPE_ICO)
self.tbicon.SetIcon(icon, '')
#wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon,
self.OnTaskBarLeftDClick)
#wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick)
self.tbicon.Bind(wx.EVT_TASKBAR_LEFT_DCLICK,
self.OnTaskBarLeftDClick)
self.tbicon.Bind(wx.EVT_TASKBAR_RIGHT_UP,
self.OnTaskBarRightClick)
self.Bind(wx.EVT_TIMER, self.BlinkIcon, id=ID_ICON_TIMER)
self.Show(True)

def OnTaskBarLeftDClick(self, evt):
global ICON_STATE
try:
self.icontimer.Stop()
except:
pass
if ICON_STATE == 1:
icon = wx.Icon('yellow.ico', wx.BITMAP_TYPE_ICO)
self.tbicon.SetIcon(icon, 'Yellow')
ICON_STATE = 0
else:
self.SetIconTimer()
ICON_STATE = 1

def OnTaskBarRightClick(self, evt):
try:
self.icontimer.Stop()
except:
pass
self.tbicon.Destroy()
self.Close(True)
wx.GetApp().ProcessIdle()
#def OnTaskBarRightClick(self, evt):
# self.Close(True)
# wx.GetApp().ProcessIdle()

def SetIconTimer(self):
self.icontimer = wx.Timer(self, ID_ICON_TIMER)
wx.EVT_TIMER(self, ID_ICON_TIMER, self.BlinkIcon)
self.icontimer.Start(1000)

def BlinkIcon(self, evt):
global BLINK_STATE
if BLINK_STATE == 0:
icon = wx.Icon('red.ico', wx.BITMAP_TYPE_ICO)
self.tbicon.SetIcon(icon, 'Red')
BLINK_STATE = 1
else:
icon = wx.Icon('black.ico', wx.BITMAP_TYPE_ICO)
self.tbicon.SetIcon(icon, 'Black')
BLINK_STATE = 0

class MyApp(wx.App):
def OnInit(self):
frame = TaskBarApp(None, -1, ' ')
frame.Center(wx.BOTH)
frame.Show(False)
return True

def main():
app = MyApp(0)
app.MainLoop()

if __name__ == '__main__':
main()

Mar 8 '06 #1
0 1505

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.0 release of wxPython is now available for download at http://wxpython.org/download.php. There have been many enhancements and fixes implemented in this...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.0 release of wxPython is now available for download at http://wxpython.org/download.php. There have been many enhancements and fixes implemented in this...
6
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate...
44
by: bg_ie | last post by:
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I noticed the problem for the last py file...
8
by: Janwillem | last post by:
Is there a way to force the wx.FileDialog to show as default the thumbnails vie in stead of list view? thanks, janwillem
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.8.8.1 release of wxPython is now available for download at http://wxpython.org/download.php. This is a minor bugfix release with several fixes for problems...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.8.9.1 release of wxPython is now available for download at http://wxpython.org/download.php. This release adds a quick fix for a compatibility problem with Python...
0
by: Robin Dunn | last post by:
Hi All, A set of wxPython binaries for Python 2.6 on Win32, Win64 and Mac OS X are now available at http://wxpython.org/download.php What is wxPython? ----------------- wxPython is a GUI...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.