python开发桌面时钟_python+PyQT实现系统桌面时钟

用Python + PyQT写的一个系统桌面时钟,刚学习Python,写的比较简陋,但是基本的功能还可以。

功能:

①窗体在应用程序最上层,不用但是打开其他应用后看不到时间

②左键双击全屏,可以做小屏保使用,再次双击退出全屏。

③系统托盘图标,主要参考PyQt4源码目录中的PyQt4\examples\desktop\systray下的程序

④鼠标右键,将程序最小化

使用时需要heart.svg放在源代码同级目录下,[文件可在PyQt4示例代码目录下PyQt4\examples\desktop\systray\images找到

运行需要Python2.7 + PyQt4.

__metaclass__ = type

#!coding= utf-8

#http://blog.csdn.net/gatieme/article/details/17659259

#gatieme

import sys

from PyQt4.QtCore import *

from PyQt4.QtGui import *

#--------------------------------------------------------------------------------

class SystemTrayIcon(QSystemTrayIcon):

"""

The systemTrayIcon which uesd to connect the clock

"""

#----------------------------------------------------------------------------

def __init__(self, mainWindow, parent = None):

"""

mainWindow : the main window that the system tray icon serves to

"""

super(SystemTrayIcon, self).__init__(parent)

self.window = mainWindow

self.setIcon(QIcon("heart.svg")) # set the icon o

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值