473,416 Members | 1,504 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,416 software developers and data experts.

System Tray Icon

Hi everybody!!!!

I am developing an aplication, and i want it to stay on the system tray, i found out how to put the icon, but i can minimize it there, What do i have to do?, I'm using python(of course).

and this is the code:

Expand|Select|Wrap|Line Numbers
  1. # -*- coding: iso-8859-1 -*-
  2. # Don't modify comment 
  3.  
  4. import wx
  5. import VwXComponent
  6. ID_MENU_5 = 5
  7. #[inc]add your include files here
  8. import ingresar
  9. import os.path
  10. import time
  11. import datetime
  12. import locale
  13. import days
  14. import string
  15. import sys
  16. #[inc]end your include
  17.  
  18. class MyFrame(wx.Frame):
  19.     def __init__(self,parent,id = -1,title='',pos = wx.Point(1,1),size = wx.Size(685,525),style = wx.DEFAULT_FRAME_STYLE,name = 'frame'):
  20.         pre=wx.PreFrame()
  21.         self.OnPreCreate()
  22.         pre.Create(parent,id,title,pos,size,style,name)
  23.         self.PostCreate(pre)
  24.         self.initBefore()
  25.         self.VwXinit()
  26.         self.initAfter()
  27.  
  28.     def __del__(self):
  29.         self.Ddel()
  30.         return
  31.  
  32.  
  33.     def VwXinit(self):
  34.         self.fileImgBuf=[None] * 1
  35.         self.fileImgBuf[0] = wx.Bitmap("libe.ico",wx.BITMAP_TYPE_ICO)
  36.         self.taskbarImg4=self.fileImgBuf[0];
  37.         self.SetIcon(wx.Icon("libe.ico",wx.BITMAP_TYPE_ICO));
  38.         self.SetTitle('Femme')
  39.         self.Show(True)
  40.         self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENU))
  41.         self.menubar= wx.MenuBar()
  42.         self.archivo = wx.Menu()
  43.         self.menubar.Append(self.archivo,"Archivos")
  44.         self.ayuda = wx.Menu()
  45.         self.menubar.Append(self.ayuda,"Ayuda")
  46.         itemmenu = wx.MenuItem(self.archivo,ID_MENU_5,"Ingresar","",0)
  47.         self.archivo.AppendItem(itemmenu)
  48.         self.SetMenuBar(self.menubar)
  49.         self.Bind(wx.EVT_MENU,self.mb_ingresar,id=ID_MENU_5)
  50.         self.st3c = wx.StaticText(self,-1,"",wx.Point(10,38),wx.Size(274,18),wx.ST_NO_AUTORESIZE)
  51.         self.st3c.SetLabel("Fecha de llegada de la menstruacion:")
  52.         self.st3c.SetFont(wx.Font(10,74,90,92,0,"Verdana"))
  53.         self.st3c.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
  54.         self.lb_init_pas = wx.StaticText(self,-1,"",wx.Point(317,40),wx.Size(114,18),wx.ST_NO_AUTORESIZE)
  55.         self.lb_init_pas.SetFont(wx.Font(11,74,90,90,0,"Tahoma"))
  56.         self.lnv5c = wx.StaticLine(self,-1,wx.Point(0,320),wx.Size(687,7),wx.LI_VERTICAL)
  57.         self.lnv5c.SetForegroundColour(wx.Colour(255,0,255))
  58.         self.lnv5c.SetBackgroundColour(wx.Colour(128,0,128))
  59.         self.lnv6c = wx.StaticLine(self,-1,wx.Point(295,35),wx.Size(7,442),wx.LI_VERTICAL)
  60.         self.lnv6c.SetBackgroundColour(wx.Colour(128,0,128))
  61.         self.st3cC = wx.StaticText(self,-1,"",wx.Point(10,93),wx.Size(244,18),wx.ST_NO_AUTORESIZE)
  62.         self.st3cC.SetLabel("Primer dia de ovulacion (Dia 12):")
  63.         self.st3cC.SetFont(wx.Font(10,74,90,92,0,"Verdana"))
  64.         self.st3cC.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
  65.         self.lb_seg_ov = wx.StaticText(self,-1,"",wx.Point(317,95),wx.Size(114,18),wx.ST_NO_AUTORESIZE)
  66.         self.lb_seg_ov.SetFont(wx.Font(11,74,90,90,0,"Tahoma"))
  67.         self.lnv5cC = wx.StaticLine(self,-1,wx.Point(0,70),wx.Size(687,7),wx.LI_VERTICAL)
  68.         self.lnv5cC.SetForegroundColour(wx.Colour(255,0,255))
  69.         self.lnv5cC.SetBackgroundColour(wx.Colour(128,0,128))
  70.         self.st3cCC = wx.StaticText(self,-1,"",wx.Point(15,153),wx.Size(254,18),wx.ST_NO_AUTORESIZE)
  71.         self.st3cCC.SetLabel("Segundo dia de ovulacion (Dia 13):")
  72.         self.st3cCC.SetFont(wx.Font(10,74,90,92,0,"Verdana"))
  73.         self.st3cCC.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
  74.         self.lb_ter_ov = wx.StaticText(self,-1,"",wx.Point(317,160),wx.Size(114,18),wx.ST_NO_AUTORESIZE)
  75.         self.lb_ter_ov.SetFont(wx.Font(11,74,90,90,0,"Tahoma"))
  76.         self.lnv5cCC = wx.StaticLine(self,-1,wx.Point(0,130),wx.Size(687,7),wx.LI_VERTICAL)
  77.         self.lnv5cCC.SetForegroundColour(wx.Colour(255,0,255))
  78.         self.lnv5cCC.SetBackgroundColour(wx.Colour(128,0,128))
  79.         self.st3cCCC = wx.StaticText(self,-1,"",wx.Point(15,215),wx.Size(169,18),wx.ST_NO_AUTORESIZE)
  80.         self.st3cCCC.SetLabel("Dia mas fertil (Dia 14):")
  81.         self.st3cCCC.SetFont(wx.Font(10,74,90,92,0,"Verdana"))
  82.         self.st3cCCC.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
  83.         self.lb_cuar_ov = wx.StaticText(self,-1,"",wx.Point(317,215),wx.Size(114,18),wx.ST_NO_AUTORESIZE)
  84.         self.lb_cuar_ov.SetFont(wx.Font(11,74,90,90,0,"Tahoma"))
  85.         self.lnv5cCCC = wx.StaticLine(self,-1,wx.Point(0,195),wx.Size(687,7),wx.LI_VERTICAL)
  86.         self.lnv5cCCC.SetForegroundColour(wx.Colour(255,0,255))
  87.         self.lnv5cCCC.SetBackgroundColour(wx.Colour(128,0,128))
  88.         self.st3cCCCC = wx.StaticText(self,-1,"",wx.Point(15,285),wx.Size(254,18),wx.ST_NO_AUTORESIZE)
  89.         self.st3cCCCC.SetLabel("Cuarto dia de ovulacion (Dia 15):")
  90.         self.st3cCCCC.SetFont(wx.Font(10,74,90,92,0,"Verdana"))
  91.         self.st3cCCCC.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
  92.         self.lb_quin_ov = wx.StaticText(self,-1,"",wx.Point(317,290),wx.Size(114,18),wx.ST_NO_AUTORESIZE)
  93.         self.lb_quin_ov.SetFont(wx.Font(11,74,90,90,0,"Tahoma"))
  94.         self.lnv5cCCCC = wx.StaticLine(self,-1,wx.Point(0,255),wx.Size(687,7),wx.LI_VERTICAL)
  95.         self.lnv5cCCCC.SetForegroundColour(wx.Colour(255,0,255))
  96.         self.lnv5cCCCC.SetBackgroundColour(wx.Colour(128,0,128))
  97.         self.st3cCCCCC = wx.StaticText(self,-1,"",wx.Point(15,350),wx.Size(254,18),wx.ST_NO_AUTORESIZE)
  98.         self.st3cCCCCC.SetLabel("Quinto dia de ovulacion (Dia 16):")
  99.         self.st3cCCCCC.SetFont(wx.Font(10,74,90,92,0,"Verdana"))
  100.         self.st3cCCCCC.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
  101.         self.lb_sext_ov = wx.StaticText(self,-1,"",wx.Point(317,350),wx.Size(114,18),wx.ST_NO_AUTORESIZE)
  102.         self.lb_sext_ov.SetFont(wx.Font(11,74,90,90,0,"Tahoma"))
  103.         self.taskbar = VwXComponent.VwXtaskBar(self)
  104.         self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK,self.taskbar_VwXEvOnTaskBarLeftDClick)
  105.         self.taskbar.SetIcon(wx.Icon("libe.ico",wx.BITMAP_TYPE_ICO),"Femme")
  106.         self.Refresh()
  107.         return
  108.     def VwXDelComp(self):
  109.         if(self.taskbar != None): self.taskbar.Destroy(); self.taskbar = None
  110.         return
  111.  
  112. #[win]add your code here
  113.  
  114.     def taskbar_VwXEvOnTaskBarLeftDClick(self,event): #init function
  115.         #[550]Code event VwX...Don't modify[550]#
  116.         #add your code here
  117.         frame = MyFrame(self)
  118.         frame.Show(True)
  119.         return #end function
  120.  
  121.     def mb_ingresar(self,event): #init function
  122.         #[671]Code menu VwX...Don't modify[671]#
  123.         #add your code here
  124.         frm = ingresar.ingresar(self)
  125.         frm.Show()
  126.         return #end function
  127.  
  128.  
  129.     def OnPreCreate(self):
  130.         #add your code here
  131.  
  132.         return
  133.  
  134.     def initBefore(self):
  135.         #add your code here
  136.  
  137.         return
  138.  
  139.     def initAfter(self):
  140.         #add your code here
  141.         self.Centre() 
  142.         self.Show()
  143.         self.read()
  144.         #self.asignar()
  145.         return
  146.  
  147.     def Ddel(self): #init function
  148.         #[ f9]Code VwX...Don't modify[ f9]#
  149.         #add your code here
  150.  
  151.         return #end function
  152.  
  153.     def asignar(self):
  154.  
  155.         self.lb_init_pas.SetLabel(content[0])        
  156.         self.lb_seg_ov.SetLabel(content[1])
  157.         self.lb_ter_ov.SetLabel(content[2])
  158.         self.lb_cuar_ov.SetLabel(content[3])
  159.         self.lb_quin_ov.SetLabel(content[4])
  160.         self.lb_sext_ov.SetLabel(content[5])       
  161.  
  162.     def read(self):
  163.         today = datetime.date.today()
  164.         past = str(days.get_date(today.year, today.month-1, today.day)).split("-")
  165.  
  166.         if os.path.isfile(str(today.year) + "/" + str(today.month) + "-1" + ".data"):
  167.             f = open(str(today.year) + "/" + str(today.month) + "-1" + ".data", "r")
  168.             content = f.read()
  169.             content = content.split("\n")
  170.             self.lb_init_pas.SetLabel(content[0])        
  171.             self.lb_seg_ov.SetLabel(content[1])
  172.             self.lb_ter_ov.SetLabel(content[2])
  173.             self.lb_cuar_ov.SetLabel(content[3])
  174.             self.lb_quin_ov.SetLabel(content[4])
  175.             self.lb_sext_ov.SetLabel(content[5])         
  176.             f.close()
  177.  
  178.         elif os.path.isfile(str(today.year) + "/" + str(today.month) + ".data"):
  179.             f = open(str(today.year) + "/" + str(today.month) + ".data", "r")
  180.             content = f.read()
  181.             content = content.split("\n")
  182.             self.lb_init_pas.SetLabel(content[0])        
  183.             self.lb_seg_ov.SetLabel(content[1])
  184.             self.lb_ter_ov.SetLabel(content[2])
  185.             self.lb_cuar_ov.SetLabel(content[3])
  186.             self.lb_quin_ov.SetLabel(content[4])
  187.             self.lb_sext_ov.SetLabel(content[5])         
  188.             f.close()
  189.  
  190.         elif os.path.isfile(str(today.year) + "/" + past[1] + ".data"):
  191.             f = open(str(today.year) + "/" + past[1] + ".data", "r")
  192.             content = f.read()
  193.             content = content.split("\n")
  194.             self.lb_init_pas.SetLabel(content[0])        
  195.             self.lb_seg_ov.SetLabel(content[1])
  196.             self.lb_ter_ov.SetLabel(content[2])
  197.             self.lb_cuar_ov.SetLabel(content[3])
  198.             self.lb_quin_ov.SetLabel(content[4])
  199.             self.lb_sext_ov.SetLabel(content[5])         
  200.             f.close()
  201.         return
  202.  
  203. #[win]end your code
  204.  
Dec 18 '06 #1
2 5358
bartonc
6,596 Expert 4TB
What should we do first, guys? Give him the system tray thing or a lesson on refactoring?
Dec 18 '06 #2
bartonc
6,596 Expert 4TB
flaper87, was this code generated by some GUI builder?
Can you point out the system tray parts for us?
Thanks.
Dec 18 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nicolas Poirier | last post by:
I successfully made a system tray application. When I do shut down the computer, how does the computer can instruct my application to shut down? For the moment, if I don't quit my application,...
10
by: One Handed Man [ OHM ] | last post by:
If this is duplicated, I'm sorry because I cant find the original post I made today Anyway . . Now its my turn to ask a question I want to develop an app which will run in the system tray....
5
by: BJ | last post by:
I am trying to add my application to the system tray. I am not using the built in control becuase of the limitation that you can not use the balloon tool tip feature. I have done this succesfully...
4
by: Tom | last post by:
Hello, System tray icon informs users that the apps is running in the background. However, there are instances that the app might crash and after that the app icon in the system tray is still...
3
by: Stanley | last post by:
Hi all the helpful people out there! I want to dectect system tray so that when an icon is added to the tray, it will alert me! Just like the Printer icon appear with someone prints! Thanks in...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
3
by: Joseph Geretz | last post by:
The conventional approach is easy enough; drop a NotifyIcon onto a Form. When the form is loaded - bingo - the icon appears in the System Tray. I can't use this approach though. I'm writing a...
1
by: =?Utf-8?B?RW5naW5lZXJpaw==?= | last post by:
I have an application which uses a notification icon in the system tray. When the application is closed the notification icon remains in the system tray until I hover over it with the mouse. How...
3
by: holaboxdotcom | last post by:
Hey I'm pretty new to C# (started few hours ago) but i learn extremly fast, i have previous knowledge of php, javascript and flash. I have made my first simple application the way i want it,...
1
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, how can i remove/disable the tray icon for the started Express Edition from the system tray. Te icon directs me to the express editons website after clicking on it. I dont want these tray...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.