python2.7 在windows 7 64bit上 桌面右下角弹出气泡
来源:互联网 发布:xin域名是什么意思 编辑:程序博客网 时间:2024/05/16 14:20
需要安装 pywin32-221.win-amd64-py2.7.exe
需要一个ico图标
# -- coding: utf-8 -- from win32api import *from win32gui import *import win32conimport sys, osimport structimport timeimport sysreload(sys)sys.setdefaultencoding('utf8') class WindowsBalloonTip: def __init__(self, title, msg): message_map = { win32con.WM_DESTROY: self.OnDestroy, } # Register the Window class. wc = WNDCLASS() hinst = wc.hInstance = GetModuleHandle(None) wc.lpszClassName = "PythonTaskbar" wc.lpfnWndProc = message_map # could also specify a wndproc. classAtom = RegisterClass(wc) # Create the Window. style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU self.hwnd = CreateWindow( classAtom, "Taskbar", style, \ 0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, \ 0, 0, hinst, None) UpdateWindow(self.hwnd) iconPathName = os.path.abspath(os.path.join( sys.path[0], "balloontip.ico" )) icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE try: hicon = LoadImage(hinst, iconPathName, \ win32con.IMAGE_ICON, 0, 0, icon_flags) except: hicon = LoadIcon(0, win32con.IDI_APPLICATION) flags = NIF_ICON | NIF_MESSAGE | NIF_TIP nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "tooltip") Shell_NotifyIcon(NIM_ADD, nid) Shell_NotifyIcon(NIM_MODIFY, \ (self.hwnd, 0, NIF_INFO, win32con.WM_USER+20,\ hicon, "Balloon tooltip",title,200,msg)) # self.show_balloon(title, msg) time.sleep(10) DestroyWindow(self.hwnd) def OnDestroy(self, hwnd, msg, wparam, lparam): nid = (self.hwnd, 0) Shell_NotifyIcon(NIM_DELETE, nid) PostQuitMessage(0) # Terminate the app.def balloon_tip(title, msg): w=WindowsBalloonTip(msg, title)balloon_tip('有新消息啦'.encode('gbk'),'title is tile')
阅读全文
0 0
- python2.7 在windows 7 64bit上 桌面右下角弹出气泡
- 弹出信息提示窗口的代码;在Windows系统桌面右下角弹出友情提示窗口
- python2.7在windows 64bit下的NumPy函数库的安装
- Windows(64bit)下Python2.7环境安装paramiko模块
- Extjs的Desktop弹出信息提示窗口的代码,在Windows系统桌面右下角弹出友情提示
- ItemizedOverlay的在mapview上弹出气泡
- 仿windows桌面气泡
- win7 64bit python2.7 ssh 登陆
- cocos2dx 2.2.3在Windows 7 64bit上搭建开发环境
- 在vmware fusion 8 for Mac上安装windows 7 64bit
- 在右下角弹出提示
- 在ubuntu 14.04 64bit下配置安装PyQt4(python2.7和python3.4)
- 在ubuntu 14.04 64bit下配置安装PyQt4(python2.7和python3.4)
- 桌面右下角出现“Windows 7 内部版本 7600 此Windows副本不是正版”
- 在Windows下 python2.7安装scrapy
- 如何解決启动 Windows 7 之后,桌面右下角显示【测试模式】等字样
- 如何修改手机在PC桌面右下角弹出的“MT65xx Android Phone”提示框
- WIN10 64bit python2.7 安装 numpy scipy matplotlib
- NPM简单设置
- 【Effection C++】读书笔记 条款07~条款08
- 第一天笔记 微营销实战技巧之微信、微博、微电商
- Java计算FIFO的缓存未命中数
- Qt5使用QPdfWriter方式写pdf文档
- python2.7 在windows 7 64bit上 桌面右下角弹出气泡
- 技术就是一个积累的过程
- 利用hibernate实现多条件组合查询的两种方式(2017年5月18日22:45:09)
- c++第五次上机实验
- 效率篇-定时任务管理系统,替代crontab
- C++作业6
- 最大子列和问题
- 欧拉函数
- 关于存储器按字节寻址和按字寻址的理解