Python中的简单Gnome面板小程序 [英] Simple Gnome Panel Applet in Python

查看:111
本文介绍了Python中的简单Gnome面板小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在火车上班时,我将上网本连接到Nexus One的wifi热点.当我经过一条隧道时,我的电话显然失去了3G连接,一旦火车出现,要花一些时间才能重新建立.但是上网本wifi徽标仍保持不变,因为它仍与电话本身相连.

When I'm on the train to work I connect my netbook to my Nexus One's wifi hotspot. As I go through a tunnel my phone obviously loses it's 3G connection and takes a while to re-establish once the train emerges. But the netbook wifi logo stays constant as it's still connected to the phone itself.

我编写了一个小python程序,尝试对服务器进行ping操作,从而确定Internet是否可用(随意建议一种检测Internet连接的方法,因为我每月受到上限的限制,该方法可以更快或更省带宽).

I've written a little python program that attempts to ping a server and thus decides if internet is available (feel free to suggest a method of detecting internet connection that would be either quicker or use less bandwidth as I am capped per month).

我的问题是:如何在Python中为GNOME Panel 2.30.2创建一个applet,以图形方式显示此状态,以便我决定何时继续单击链接并期望Internet能够正常工作.

My question is: how can I create an applet for GNOME Panel 2.30.2 in Python, to graphically display this status, so I can decide when to continue clicking links and expecting internet to work.

我得到了这个示例,该按钮带有面板按钮可以工作,但希望图标会根据情况而变化.

I got this example with a panel button to work but would like an icon that changes depending on the situation.

我已经使用Python几年了,但是以前没有编码过gnome.我使用的是ubuntu桌面版(而不是统一版本)作为10.04版.

I've used Python for a few years haven't but coded gnome before. I'm using the ubuntu desktop edition as my login rather than unity, on 10.04.

推荐答案

查看我制作的这个简单小程序.它具有一个图标,该图标根据事件而变化.只需用您的逻辑替换逻辑,它就可以解决问题.更好的是,它应该与所有与freedesktop兼容的环境兼容.

Check out this simple applet I made. It has an icon that changes depending on events. Simply replace the logic with your logic and it should do the trick. Even better, it should be compatible with all freedesktop-compatible environments.

这篇关于Python中的简单Gnome面板小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆