python pyqt實現右下角彈出框

2022-10-04 20:48:19 字數 1811 閱讀 7355

建構函式中:

self.desktop=qdesktopwidget()

self.move((self.desktop.**ailablegeometry().width()-self.width()),self.desktop.**ailablegeometry().height()) #初始化位置到右下角

self.showanimation()

#彈出動畫

def showanimation(self):

#顯示彈出框動畫

self.animation=qpropertyanimation(self,"pos")

self.animation.setduration(1000)

self.animation.setstartvalue(qpoint(self.x(),self.y()))

self.animation.setendvalue(qpoint((self.desktop.**ailablegeometry().width()-self.widthwww.cppcns.com()),(self.desktop.**ailablegeometry().height()-self.height()+self.shadow_width)))

self.animation.start()

#設定彈出框1秒彈出,然後漸隱

self.remaintimer=qtimer()

self.connect(self.remaintimer,signal("timezzeolhjuout()"),self,slot("closeanimation()"))

self.remaintimer.start(10000) #定時器10秒

#關閉動畫

@pyqtslot()

def closeanimation(self):

#清除timer和訊號槽

self.remaintimer.stop()

self.disconnect(self.remaintimer,signal("timeout()"),self,slot("closeanimation()"))

self.remaintimer.deletelater()

self.remaintimer=none

#彈出框漸隱

self.animation =qpropertyanimation(self,"windowopacity")

self.animation.setduration(1000)

self.animation.setstartvalue(1)

self.animation.setendvalue(0)

self.animation.start()

#動畫完成後清理

self.connect(self.animation,signal("finished()"),self,slot("clearall()"))

#清理及退出

@pyqtslot()

def clearall(self):

self.disconnect(self.animatio程式設計客棧n,signal("finished()"),self,slot("clearall()"))

sys.exit() #退出

或者直接: self.connect(self.animation,signal("finished()"),self,slot("close()"))

效果如下:

本文標題: python+pyqt實現右下角彈出框

本文位址: /jiaoben/python/209132.html

右下角開啟窗體

using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.text using system.window...

winform右下角彈窗

網頁是否經常在電腦右下角彈窗顯示訊息?其實winform也是可以實現的。下面介紹兩種方法。第一步 設計窗體 第二步 實現 第一種方法 引用user32 宣告常量 窗體load事件 窗體formclosing事件?1 2345 6789 1011 1213 1415 1617 1819 2021 22...

右下角彈出視窗(C )

using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.linq using system.text u...