launching animated window from already open window
I managed to animate open a window on startup, but I want to open a different window from already open window by pressing the button, in my case already open window is open in fullscreen mode with window.raise_()
Not sure but is this why the window I am trying to animate open by pressing a button is not opening
Code:
from PyQt4 import QtCore,QtGui
import sys
""" docstring for WindLauncher
"""
def __init__(self):
super(WindLauncher, self).__init__()
self.btn.clicked.connect(self.launchWin)
self.setCentralWidget(self.btn)
def launchWin(self):
main = MyTableView()
animation = QtCore.QPropertyAnimation(main, "geometry")
animation.setDuration(500);
animation.
setStartValue(QtCore.
QRect(0,
-(sh
), sw, sh
));
animation.
setEndValue(QtCore.
QRect(0,
0, sw, sh
));
animation.start();
self.show()
self.raise_()
"""docstring for MyTableView"""
def __init__(self, parent=None):
super(MyTableView, self).__init__(parent)
if __name__ == "__main__":
main = WindLauncher()
main.show()
main.raise_()
sys.exit(application.exec_())
Re: launching animated window from already open window
What are the values of sw and sh at lines 17 and 18? What screen is an unshown widget on?
Re: launching animated window from already open window
Quote:
Originally Posted by
ChrisW67
What are the values of sw and sh at lines 17 and 18? What screen is an unshown widget on?
Looking at that I updated my code but still it seems doesn't work, I just see a flickr
Code:
from PyQt4 import QtCore,QtGui
from functools import partial
import sys
"""docstring for MyTableView"""
def __init__(self, parent=None):
super(MyTableView, self).__init__(parent)
self.showFullScreen()
self.
setGeometry(QtCore.
QRect(0,
-(sh
), sw, sh
))
""" docstring for WindLauncher
"""
def __init__(self):
super(WindLauncher, self).__init__()
callLaunch = partial(self.launchWin, sw, sh)
self.btn.clicked.connect(callLaunch)
self.setCentralWidget(self.btn)
def launchWin(self, sw, sh):
main = MyTableView()
animation = QtCore.QPropertyAnimation(main, "geometry")
animation.setDuration(500);
animation.
setStartValue(QtCore.
QRect(0,
-(sh
), sw, sh
));
animation.
setEndValue(QtCore.
QRect(0,
0, sw, sh
));
animation.start();
main.show()
main.raise_()
if __name__ == "__main__":
main = WindLauncher()
main.show()
main.raise_()
sys.exit(application.exec_())
Re: launching animated window from already open window
I am not a Python programmer but I expect that the local variable "main" in goes out of scope at the end of the function taking the table widget with it. Same for the "animation" object. Try "self.main" and "self.animation"
Re: launching animated window from already open window
yes, thats it. thanks. however why does the window that has button stays on top , when i have self.main.raise_() for new animating window ?
Re: launching animated window from already open window
Take a look at QWidget::activateWindow() and the notes about Windows
Re: launching animated window from already open window
I have got things working but animation doesn't seems to be smooth, is it because the new window is accessing the same QAbstractListModel or something else I need to add to QPropertyAnimation ?