使用windows api

workarea = win32api.GetMonitorInfo(1)['Work']
pos=(workarea[2]-280,workarea[3]-180)

这两句 来得到 屏幕右下角的坐标

AnimateWindow来执行 弹出动作


  1. # -*- coding: gbk -*-

  2. #!/bin/env python

  3. # Author: 许刚

  4. # Created: 2012/1/1

  5. import wx,os,win32api

  6. from res import *

  7. from common import RoleStr,GetIconByFileExt,FileExt

  8. from win32con import AW_ACTIVATE, AW_BLEND, AW_CENTER, AW_HIDE, AW_HOR_NEGATIVE, \

  9.      AW_HOR_POSITIVE, AW_SLIDE, AW_VER_NEGATIVE, AW_VER_POSITIVE,SPI_GETWORKAREA

  10. import win32api

  11. from ctypes import windll, c_int

  12. ########################################################################

  13. class Popup(wx.MiniFrame):

  14.     def __init__(self, label, parent=None,title=""):

  15.         wx.MiniFrame.__init__(self, parent, -1, title, wx.DefaultPosition,size=(280,180),style=wx.DEFAULT_FRAME_STYLE| wx.STAY_ON_TOP)

  16.         workarea = win32api.GetMonitorInfo(1)['Work']

  17.         pos=(workarea[2]-280,workarea[3]-180)

  18.         bg=wx.Colour(255, 255, 225)

  19.         self.SetBackgroundColour(bg)

  20.         self.SetPosition(pos)

  21.         text = wx.StaticText(self, -1, label)

  22.         #font = wx.Font(13, wx.FONTENCODING_SYSTEM, wx.NORMAL, wx.NORMAL)

  23.         #text.SetFont(font)

  24.         text.SetBackgroundColour(bg)

  25.         flags = AW_SLIDE | AW_VER_NEGATIVE | AW_ACTIVATE

  26.         windll.user32.AnimateWindow(c_int(self.GetHandle()), c_int(600), c_int(flags))

  27.         self.Refresh()

  28.         self.Bind(wx.EVT_CLOSE,self.RemovePopup)


  29.     def RemovePopup(self, evt=None):

  30.         flags = AW_BLEND | AW_HIDE

  31.         windll.user32.AnimateWindow(c_int(self.GetHandle()), c_int(600), c_int(flags))

  32.         self.Destroy()


  33. ########################################################################

  34. if __name__=='__main__':

  35.     app=wx.PySimpleApp()



  36.     f=Popup('测试右下角弹出框\n测试右下角弹出框\n\n')

  37.     f.Show()

  38.     app.MainLoop()


转自:http://blog.csdn.net/xugangjava/article/details/7478139