- 浏览: 297022 次
- 性别:
- 来自: 合肥
文章分类
最新评论
-
Xiaoanemy:
我怎么就是不行Error opening zip file o ...
javarebel不用再反复重启tomcat -
fly_hyp:
lvwenwen 写道相对hessian来说有其他什么优势?应 ...
一个很牛的架构组件(Dubbo) -
lvwenwen:
相对hessian来说有其他什么优势?
一个很牛的架构组件(Dubbo) -
dj4307665:
想了解下,相对hessian来说有其他什么优势?
一个很牛的架构组件(Dubbo) -
fly_hyp:
sweat89 写道怎么解决的啊?忘了。怎么说呢?自己写的代码 ...
Spring之恶心错误记录
python system tray icon
一个简单的,一个完整的。
1 #!/usr/bin/env python
2 #-*- encoding:utf-8 -*-
3
4 import gtk
5
6 def on_activate(data):
7 print 'active'
8
9 def on_popup_menu(status, button, time):
10 print 'popup menu'
11
12 tr=gtk.StatusIcon()
13 tr.set_from_file("1.gif")
14 tr.set_tooltip('test tray in python')
15 tr.set_visible(True)
16 tr.connect('activate', on_activate)
17 tr.connect('popup-menu', on_popup_menu)
18
19 gtk.main()
====================
1 #!/usr/bin/env python
2 #-*- encoding:utf-8 -*-
3
4 import os
5 import gtk
6
7 class MyStatusIcon(gtk.StatusIcon):
8 def __init__(self):
9 gtk.StatusIcon.__init__(self)
10 menu = '''
11 <ui>
12 <menubar name="Menubar">
13 <menu action="Menu">
14 <menuitem action="action1"/>
15 <menuitem action="action2"/>
16 <separator/>
17 <menuitem action="About"/>
18 <separator/>
19 <menuitem action="Quit"/>
20 </menu>
21 </menubar>
22 </ui>
23 '''
24 actions = [
25 ('Menu', None, 'Menu'),
26 ('action1', None, 'action1', None, 'action1 for test', self.on_action),
27 ('action2', None, 'action2', None, 'action2 for test', self.on_action),
28 ('About', gtk.STOCK_ABOUT, 'About', None, 'About', self.on_about),
29 ('Quit', gtk.STOCK_QUIT, 'Quit', None, 'Quit', self.on_quit)
30 ]
31
32 ag = gtk.ActionGroup('Actions')
33 ag.add_actions(actions)
34 self.manager = gtk.UIManager()
35 self.manager.insert_action_group(ag, 0)
36 self.manager.add_ui_from_string(menu)
37 self.menu = self.manager.get_widget('/Menubar/Menu/About').props.parent
38 self.set_from_file('1.gif')
39 self.set_tooltip('kf701 python tray use gtk statusicon')
40 self.set_visible(True)
41 self.connect('activate', self.on_activate)
42 self.connect('popup-menu', self.on_popup_menu)
43
44 def on_activate(self, data):
45 print 'on_activate'
46
47 def on_popup_menu(self, status, button, time):
48 self.menu.popup(None, None, None, button, time)
49
50 def on_action(self, data):
51 print 'on_action'
52
53 def on_about(self, data):
54 dialog = gtk.AboutDialog()
55 dialog.set_name('kf701 python tray test')
56 dialog.set_version('0.1')
57 dialog.set_comments('Use gtk statusicon in python')
58 dialog.set_website('http://kf701.cublog.cn')
59 dialog.run()
60 dialog.destroy()
61
62 def on_quit(self, data):
63 print 'Exit'
64 gtk.main_quit()
65
66 if __name__ == '__main__':
67 MyStatusIcon()
68 gtk.main()
发表评论
-
10 个非常重要的 HotSpot JVM 参数
2013-08-17 20:42 7951) 跟 Java 堆大小相关的 JVM 内存参数 下 ... -
A JSP to print all the stacks
2013-06-19 17:29 803A JSP to print all the stacks ... -
Ubuntu11.10下解决 jmap等jdk工具attach pid错误
2013-05-13 18:05 8011.错误案例 java] view plaincop ... -
GlusterFS集群文件系统研究
2013-02-26 11:17 950http://blog.csdn.net/liuben/ar ... -
云中的数据岌岌可危 储存毫无保密性?
2013-02-26 11:05 775想想也是,从构架角度考虑,不加密的数据放在别人的服 ... -
7条工作晋升建议
2013-01-21 16:13 7071. 观察:学习他人如何获得提升; 2. 多做:体现 ... -
几个软件研发团队管理的小问题
2012-12-13 10:23 924几个软件研发团队管理的小问题 最近在与一位总经理交流 ... -
身体的秘密大全
2011-08-25 15:27 983眼睛告诉你的6个 ... -
关于编程,大学没有传授的十件事
2011-08-17 17:17 741笔者依然记得当年完成学业时,深信自己已经准备好进入任何一家 ... -
做人 做事 做架构师 架构师能力模型解析
2011-08-16 10:35 816究竟是什么让你在同 ... -
介绍山寨android的文章
2011-06-10 08:41 930摘录一篇介绍山寨Andro ... -
Susie WEE's Top 10 Career Tips
2011-04-26 09:59 875Susie WEE's Top 10 Career Tips ... -
Eclipse Tomcat远程调试配置
2011-02-17 17:54 2964第一步、配置tomcat 一、在windows系统中: 打开% ... -
网站开发人员应该知道的61件事
2011-02-16 16:00 938网站开发人员应该知 ... -
学之者生,用之者死——ACE历史与简评
2010-08-25 10:34 981之所以摘录,是因为感动。 学之者生,用之者死——A ... -
老板的10个错误,描述的真生动
2010-07-02 21:49 1022摘自:http://www.cecon ... -
jspwiki中文问题的解决
2010-04-21 18:35 1309操作方法修改tomcat < ... -
怎么做code review
2010-03-15 16:20 1105hi, 同事推荐 Review Board 应该不错, ... -
在 Windows 系統掛載 UNIX NFS 分享目錄
2010-02-16 21:25 2216摘自:http://cha.homeip.net/blog/a ... -
iptable相关资料
2009-12-31 15:08 773http://hi.baidu.com/davyu ...
相关推荐
AIR systemTrayIcon sample code how to set systemTrayIcon and how to change the app screen solution
使用Qt/QML创建程序小托盘,方便用户操作。实用、简介。
Delphi7 开发的 系统托盘控件: 由于一个项目用到,今天下午等人,又参考网上关于V5的新东东,整理成一个控件.大家来评评吧.
这个是原版官方修改的Hide图标版,用于Windows 8/7/Vista/XP/2012/2008/2003/2000/NT/ME/9x(32位和64位)的Radmin 3.5远程控制技术
动态Tray Icon的例程。
This shows you how to add your icon to the system tray without any third-party controls.
操作系统托盘图标,显示/删除/隐藏系统托盘图标。 这是我很早以前不知道在哪里找的源代码,不是原创。但我在里面添加上了 Hide Tray Icon和Delete Tray Icon的功能。
minimize program to systray
A framework for system tray applets(32KB)
Applications which adds an item to the system tray.
一个简单的vb环境中system tray 编程例子.
PS Soft Lab presents tool for handling icons in taskbar's system tray area - PS Tray Factory. PS Tray Factory allows you to: ? move low-activity icons from the system tray into the menu, ? quickly ...
A class for adding icons to the system tray(120KB)
VB托盘动画图标编程设计经典代码VB Programming tray icon animation classic code
Labview程序
system tray (sort tray), - to restore system tray icons after Explorer.exe crash, - to replace the original tray icons with your own icons, - to quickly access hidden icons, - to hide seldom used...
NULL 博文链接:https://syxc.iteye.com/blog/777260
system tray demo BOOL SetIcon(HICON hIcon); BOOL SetIcon(LPCTSTR lpIconName); BOOL SetIcon(UINT nIDResource); BOOL SetStandardIcon(LPCTSTR lpIconName); BOOL SetStandardIcon(UINT nIDResource); ...
PS Tray Factory is a powerful and handy tool meant to flexibly control ALL the other icons in the system tray of the taskbar. PS Tray Factory will help you to manage all the applications that place ...
VB窗体系统托盘编程设置经典代码VB classic form programmed code system tray