使用windows api
workarea = win32api.GetMonitorInfo(1)['Work']
pos=(workarea[2]-280,workarea[3]-180)
这两句 来得到 屏幕右下角的坐标
AnimateWindow来执行 弹出动作
-
# -*- coding: gbk -*-
-
#!/bin/env python
-
# Author: 许刚
-
# Created: 2012/1/1
-
import wx,os,win32api
-
from res import *
-
from common import RoleStr,GetIconByFileExt,FileExt
-
from win32con import AW_ACTIVATE, AW_BLEND, AW_CENTER, AW_HIDE, AW_HOR_NEGATIVE, \
-
AW_HOR_POSITIVE, AW_SLIDE, AW_VER_NEGATIVE, AW_VER_POSITIVE,SPI_GETWORKAREA
-
import win32api
-
from ctypes import windll, c_int
-
########################################################################
-
class Popup(wx.MiniFrame):
-
def __init__(self, label, parent=None,title=""):
-
wx.MiniFrame.__init__(self, parent, -1, title, wx.DefaultPosition,size=(280,180),style=wx.DEFAULT_FRAME_STYLE| wx.STAY_ON_TOP)
-
workarea = win32api.GetMonitorInfo(1)['Work']
-
pos=(workarea[2]-280,workarea[3]-180)
-
bg=wx.Colour(255, 255, 225)
-
self.SetBackgroundColour(bg)
-
self.SetPosition(pos)
-
text = wx.StaticText(self, -1, label)
-
#font = wx.Font(13, wx.FONTENCODING_SYSTEM, wx.NORMAL, wx.NORMAL)
-
#text.SetFont(font)
-
text.SetBackgroundColour(bg)
-
flags = AW_SLIDE | AW_VER_NEGATIVE | AW_ACTIVATE
-
windll.user32.AnimateWindow(c_int(self.GetHandle()), c_int(600), c_int(flags))
-
self.Refresh()
-
self.Bind(wx.EVT_CLOSE,self.RemovePopup)
-
-
def RemovePopup(self, evt=None):
-
flags = AW_BLEND | AW_HIDE
-
windll.user32.AnimateWindow(c_int(self.GetHandle()), c_int(600), c_int(flags))
-
self.Destroy()
-
-
########################################################################
-
if __name__=='__main__':
-
app=wx.PySimpleApp()
-
-
-
f=Popup('测试右下角弹出框\n测试右下角弹出框\n\n')
-
f.Show()
-
app.MainLoop()
转自:http://blog.csdn.net/xugangjava/article/details/7478139
阅读(3670) | 评论(0) | 转发(0) |