Re: [PyQt] From/Import, proper namespace,etc
Thanks Phil, ...(yes, I see the design flaw you speak of...was doing a bit of testing) Just to add for prosterity,...your answer had a small typo...just needs a ".connect" statement in thereso for others who may find this later,..the statement is: self.button.clicked.connect(lambda checked: DoTest2(self)) I did find another method (better design? dunno ;-) and that is to have the button connect statement call a local (in file A) function which in turn calls B.function() Using, from B import * . self.Button_02.clicked.connect(self.DoTest1) def DoTest1(self): print("DoTest1") status = DoTest2(self) print status Thanks again, -- View this message in context: http://python.6.n6.nabble.com/From-Import-proper-namespace-etc-tp4975143p4975428.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] From/Import, proper namespace,etc
I think I figured this out once, lol...but can't seem to recall... Consider you have two python files,..."a" and "b"...where you "launch a" and "import b". But inside "b" is a PyQt call back to a control defined in "a". I keep getting a "not defined" error... So,... === File "A" === #!/usr/bin/env python import os import sys from PyQt4 import QtCore, QtGui, uic *from b import ** class MainWindow(QtGui.QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setGeometry(520, 285, 640, 480) self.Button = QtGui.QPushButton(self) self.Button.setGeometry(QtCore.QRect(105, 140, 151, 66)) self.Button.setObjectName("Button") self.Label = QtGui.QLabel(self) self.Label.setGeometry(QtCore.QRect(350, 250, 101, 21)) self.Label.setObjectName("Label") self.Button.setText("Test 1") self.Label.setText("AAA") self.Button.clicked.connect(DoTest2) def main(): app = QtGui.QApplication(sys.argv) global form form = MainWindow() form.show() app.exec_() if __name__ == '__main__': main() = and File "B" = #!/usr/bin/env python def DoTest2(self): print("DoTest2") *self.Label.setText("BBB")* return("Done") == So,...to launch prompt>> python a.py Then, hit the button...the button calls a function in File-B, which tries to modify text in a Label that is defined in File-A. prompt -> python a.py DoTest2 Traceback (most recent call last): File "b.py", line 7, in DoTest2 self.Label.setText("BBB") AttributeError: 'bool' object has no attribute 'Label' So,..what's the proper way to do this?...I've tried every which way but nada... Thank you, -- View this message in context: http://python.6.n6.nabble.com/From-Import-proper-namespace-etc-tp4975143.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Animate text in QLabel
Check out Wilbert's excellent reply to a similar question I had a month or so ago.. http://python.6.n6.nabble.com/Text-quot-write-on-quot-effect-td4518350.html http://python.6.n6.nabble.com/Text-quot-write-on-quot-effect-td4518350.html -- View this message in context: http://python.6.n6.nabble.com/Animate-text-in-QLabel-tp4671287p4687402.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] need to install multiple versions of PyQt on each laptop at work
...understood, Thanks... Btw,...just for prosterity, The install went pretty well...on WinXP 32bit, 1) Installed newer version of Python (2.7) 2) Checked Env variables,etc. 3) Installed Qt Libs (minGW) only with downloaded installer (4.7.1) 4) Checked Env variables.etc 5) ran "qtvars.bat" ( or it won't compile correctly) 6) Installed Sip, adding extra flag arg ( --platform win32-g++ ) 7) installed PyQt4 (4.9.1) normally Now what was curious,...is that when I went to use, it err'd out, saying it could not perform the command "import PyQt4.QtCore" ...saying couldn't find DLL. So, to test, I copied cp C:/Qt/4.7.1/bin/*.dll C:/Python27/Lib/site-packages/PyQt4/ and then everything worked... And to add to Phil's note of caution above...when using one version or the other, you'll need to modify at least one (I do more than one) environment variable.. So, when I go back and forthI check and modify PATH PYTHONPATH QTDIR If you're using a shell environment like Cygwin, then this can be done at the individual shell window level, but that'll be only temporary. Thanks Phil for your help, Cheers, -- View this message in context: http://python.6.n6.nabble.com/need-to-install-multiple-versions-of-PyQt-on-each-laptop-at-work-tp4342310p4641482.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] need to install multiple versions of PyQt on each laptop at work
...mmm, I was about tois that unstable or problematic ? -- View this message in context: http://python.6.n6.nabble.com/need-to-install-multiple-versions-of-PyQt-on-each-laptop-at-work-tp4342310p4638573.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] need to install multiple versions of PyQt on each laptop at work
I also need to install another version of Qt/PyQt,... Currently, I have these versions installed on my Windows box,.. Qt 4.5.3 PyQt 4.7.3 living under Python 2.6.x, in C:/Python26/Lib/site-packages/ All that needs to stay intact,so if I: 1) install Python 2.7 2) install Qt 4.7.1 3) install PyQt (latest version??) under C:/Python27/etc... Will they live happily together?...or will there be mischief?...lol Thanks!! reason for two versions... Maya2011 requires Qt 4.5.3 Maya2012 requires Qt 4.7.1 -- View this message in context: http://python.6.n6.nabble.com/need-to-install-multiple-versions-of-PyQt-on-each-laptop-at-work-tp4342310p4638267.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] File Filtering using QFileSystemModel & QTreeView
...looking at my old code,...I also do a ".setRootIndex"like so: libmodel1 = QtGui.QFileSystemModel() libmodel1.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot | QDir.AllEntries) libmodel1.setNameFilters(filter) libmodel1.setNameFilterDisables(False) *libmodel1.setRootPath(QDir.rootPath() ) libmodel1.setRootPath(startDir)* self.model1 = libmodel1 self.Shader1_TreeView.setModel(libmodel1) *self.Shader1_TreeView.setRootIndex(libmodel1.index(startDir) )* self.Shader1_TreeView.setAnimated(True) self.view1.setSelectionMode(1) self.selectionModel1 = self.view1.selectionModel() self.selectionModel1.selectionChanged.connect(self.TreeViewSelectionChanged) -- View this message in context: http://python.6.n6.nabble.com/File-Filtering-using-QFileSystemModel-QTreeView-tp1917066p4563859.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Designer source
...'cause it would make it easier for me to merge Designer with Maya ;-) -- View this message in context: http://python.6.n6.nabble.com/Designer-source-tp4556647p4556938.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Designer source
...I think I know the answer to this already, but just to be sure,... Does Designer only exist as a C or C++ source program?... Meaning, has anybody ported this over into the Python language? Thanks, Jim -- View this message in context: http://python.6.n6.nabble.com/Designer-source-tp4556647p4556647.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Gui best practice
I also use the second method...for me, it's more direct...and let's me make very small tweeks to the UI (via the .ui file) without requiring modifying any source code...unless it needs it of course,... -- View this message in context: http://python.6.n6.nabble.com/Gui-best-practice-tp4516518p4529195.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Text "write on" effect
Bravo Wilbert!...pure genius!that solution never occurred to meThank you very much! -- View this message in context: http://python.6.n6.nabble.com/Text-write-on-effect-tp4518350p4523288.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Text "write on" effect
okay, this may seem a bit superfluous, but would be a very nice animation effect to have in one's toolbox.. For those that don't know what a "write on" animation is,...you probably see them on TV everyday,.. but it's when a whole sentence is displayed a character at time, with just a fraction of a second delay in-between each character... Thought this would be trivial at first,...but there's something going on in Qt that senses there's about to be a bunch of fast updates, so it waits until everything is done and updates *once*, which defeats the purpose Here's how the madness unfolds,.. text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet" accum = QString("") for i in range(0, len(text)): accum = accum + text[i] self.label.setText(accum) self.label.update() sleep(.1) So, I accumulate the string char by char calling update() and sleep() at each interval,...a button triggers this function. But instead of seeing the effect progress as expected, it just display the whole string at once... Anybody got any ideas how to achieve this effect ? I've attached a short example script... Cheers, Jim http://python.6.n6.nabble.com/file/n4518350/writeon_v01.py writeon_v01.py -- View this message in context: http://python.6.n6.nabble.com/Text-write-on-effect-tp4518350p4518350.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDockWidget issue in Linux, but not Windows, OSX
Hey Pete, Well I did try your technique, but the problem still exists. As I said, it's my bad that the example I gave you, while showing the bug, was not totally representative of the real program. I figured that solving it on a small scale, if you will, would yield a solution that would work in the real thing. Unfortunately, and like you said, kinda' rare, that it doesn't. I'm in the process of creating a more simpler version of the larger program, that won't be as simple as the first, lol...but more complex, so that if you or someone finds a solution, then it'lll have a greater chance of mapping over to the real thing. Thanks again for your help and input on this,...I will post a new example script as soon as possible, Cheers, Jim -- View this message in context: http://python.6.n6.nabble.com/QDockWidget-issue-in-Linux-but-not-Windows-OSX-tp4374122p4466862.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDockWidget issue in Linux, but not Windows, OSX
Thanks for your help, Pete While your example does indeed fix the problem that my example code showed, unfortunately, when plugging it in to the real program, the problem persists. However, I have been able to reproduce this bug using just Designer. On Windows here,...run Designer Create a MainWindow (default one do) Drop in a QFrame and pull it to just shy of MainWindow Drop in a QDockWidget Select dockWidget Cut Select QFrame Paste and then "run it" doing a Form->Preview, ...clicked "undock" button, behaviour is Normal Did the same thing on Linux, but when I click the "undock" button, the button is stuck at top, just like our problem. Can anyone else confirm this on Linux ? So that's definitely gotta be a Qt bug, right? Any advice about how to fix ? Thanks! -- View this message in context: http://python.6.n6.nabble.com/QDockWidget-issue-in-Linux-but-not-Windows-OSX-tp4374122p4466498.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDockWidget issue in Linux, but not Windows, OSX
Here is a simplified example of the bug... Again, this behaviour only happens in Linux, not WinXP or OSX...Anybody have any idea or thoughts on this? #= #!/usr/bin/python # On linux, when you undock the widget, the resulting window can't be moved (only resized). # import sys from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) # Window win = QtGui.QWidget() win.setWindowTitle("Test") win.resize(400,300) win.show() # Dock dock = QtGui.QDockWidget(win) dock.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetClosable | QtGui.QDockWidget.DockWidgetMovable ) dock.setGeometry(0,0,400,300) dock.show() sys.exit(app.exec_()) #= The Linux Env Centos 5.7 Python 2.6.6 Qt 4.7.4 (qt-everywhere-opensource-src-4.7.4.tar.gz) Sip 4.13.1 PyQt 4.9(PyQt-x11-gpl-4.9.tar.gz) Thank you, -- View this message in context: http://python.6.n6.nabble.com/QDockWidget-issue-in-Linux-but-not-Windows-OSX-tp4374122p4384646.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QDockWidget issue in Linux, but not Windows, OSX
I have a really weird phenomena here, and am hoping somebody can shed some light on this... Before posting code, thought I would briefly describe,... Using a treeWidget, expanding an item presents us a tableWidget whose parent is a tabWidget, whose parent in turn is a dockWidget,... dockWidget | tabWidget | tableWidget In Windows and OSX, undocking the dockWidget, results in normal behaviour, It is moveable, closeable, and floatable. However, in Centos5.6 Linux, when doing same, the dockWidget un-docks normally, and shows correct data, but it is *un-moveable* (This is same code as from Win,OSX) It is *hard* docked to top of OS window manager, but I can see the titleBar of the dockWidget. Using Alt-F7->Move, the dockWidget window can be moved, and now acts normally. I searched documentation and the internets, but can't resolve... Anyone have any ideas on this one? Thanks! Jim -- View this message in context: http://python.6.n6.nabble.com/QDockWidget-issue-in-Linux-but-not-Windows-OSX-tp4374122p4374122.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Can DockWidgets be docked onto anything else except MainWindows?
Thanks for your reply, Andreas -- View this message in context: http://python.6.n6.nabble.com/Can-DockWidgets-be-docked-onto-anything-else-except-MainWindows-tp4357906p4359825.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
LOL, no, not my cup of tea, thank you... But I appreciate all work that goes into making this PyQt thing fun to use! And you correctly surmise, that 'setGeom' in there was just for testing,.. Cheers! -- View this message in context: http://python.6.n6.nabble.com/Parent-Child-widget-clipping-tp4352146p4359822.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Can DockWidgets be docked onto anything else except MainWindows?
Can DockWidgets be docked onto anything else except MainWindows ? Supposed you have either a layout or a widget that's "mid-page" in a window and want to dock/undock from that layout/widget and not the MainWindow... Doesn't look to be possible,...Can anyone confirm this? Thanks! -- View this message in context: http://python.6.n6.nabble.com/Can-DockWidgets-be-docked-onto-anything-else-except-MainWindows-tp4357906p4357906.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
...not sure if this is the proper or elegant way, but I found a workaroundby setting minWidth and minHeight self.widget.setMinimumWidth(minW) self.widget.setMinimumHeight(minH) ...then, once inserted into the TreeWidget, it retains it's height, and isn't clipped... -- View this message in context: http://python.6.n6.nabble.com/Parent-Child-widget-clipping-tp4352146p4357177.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
So after tinkering with this a bit more, I'm in another conundrum, lol... When I replace the 'child-table' (QTableWidget) with another kind of widget, and give a size using 'setGeometry'...the solution no longer works... Why is that? What am I doing wrong, Pete? # #!/usr/bin/env python import sys from PyQt4 import QtGui, QtCore class MainExample(QtGui.QWidget): def __init__(self, pParent=None): super(MainExample, self).__init__(pParent) scrX = 2048 scrY = 1152 winX = 550 winY = 400 pX = (scrX - winX) / 2 pY = (scrY - winY) / 2 self.setGeometry(pX, pY, winX, winY) self.setLayout(QtGui.QVBoxLayout()) self.LargeTable = QtGui.QTreeWidget() self.LargeTable.setColumnCount(3) self.layout().addWidget(self.LargeTable) *self.widget = QtGui.QWidget(self) self.widget.setGeometry(QtCore.QRect(10, 10, 400, 300))* for i in range(0, 2): parent = QtGui.QTreeWidgetItem(self.LargeTable, ['Parent %s' % i] ) for j in range(0, 3): child = QtGui.QTreeWidgetItem(parent, ['Child %s' % j]) * self.LargeTable.setItemWidget(self.LargeTable.topLevelItem(0).child(1), 0, self.widget)* self.LargeTable.setFirstItemColumnSpanned(self.LargeTable.topLevelItem(0).child(1), True) self.LargeTable.expandAll() if __name__ == '__main__': app = QtGui.QApplication(sys.argv) form = MainExample() form.show() form.raise_() sys.exit(app.exec_()) # -- View this message in context: http://python.6.n6.nabble.com/Parent-Child-widget-clipping-tp4352146p4355087.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
Whoo! That did it, Peter!! Thank you, Sir! I owe you another beer! -- View this message in context: http://python.6.n6.nabble.com/Parent-Child-widget-clipping-tp4352146p4352262.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt