WinPython 2.7.9.3: First guidata example doesn't work?

69 views
Skip to first unread message

xyz.a...@arcor.de

unread,
May 17, 2015, 3:29:03 AM5/17/15
to guidata...@googlegroups.com
Hello to everyone,

some problems here to run the first guidata example

import guidata
guidata.qapplication() # not required if a QApplication has already been created

import guidata.dataset.datatypes as dt
import guidata.dataset.dataitems as di

class Processing(dt.DataSet):
    """Example"""
    a = di.FloatItem("Parameter #1", default=2.3)
    b = di.IntItem("Parameter #2", min=0, max=10, default=5)
    type = di.ChoiceItem("Processing algorithm",
                         ("type 1", "type 2", "type 3"))

param = Processing()
param.edit()


from
https://pythonhosted.org/guidata/examples.html

The following 2 configurations
(1) WinPython-64bit-2.7.9.3.exe, installed on a Win7SP1x64 Computer
(2) WinPython-32bit-2.7.9.3.exe, installed on a Win7SP1x32 Computer
lead to the same message
'QWidget: Must construct a QApplication before a QPaintDevice'
in spyders python console and the examples guidata dialog doesn't appear.

The example works fine on a Windows XPSP3x32 Computer with Python(x,y) 2.6.2.0 installed.

Any ideas to solve this?
Thanks in advance.

Big Stone

unread,
May 17, 2015, 4:32:27 AM5/17/15
to guidata...@googlegroups.com
I guess the Qt application is created, then destroyed before use as not referenced.

Change One line:

app = guidata.qapplication() 

xyz.a...@arcor.de

unread,
May 18, 2015, 5:39:52 PM5/18/15
to guidata...@googlegroups.com
Thank you very much, now it works :-)
So without an object reference (as in the guidata example) Python 2.6.2 doesn't destroy the application but the newer Python 2.7.9 does.
I will keep it in mind.

Big Stone

unread,
May 19, 2015, 2:07:17 PM5/19/15
to guidata...@googlegroups.com
Yes,

The legacy code example was playing "russian roulette" by not keeping a reference to the created object.

Reply all
Reply to author
Forward
0 new messages