|
#1
|
|||
|
|||
wxPython with Vizard
This thread explains how to install wxPython on your computer and getting it to work with Vizard.
Step 1: Install Vizard on your computer Step 2: Download the script RegisterVizardWithPython.py. Open it with Vizard and run it. It should print out "--- Python 2.3 is now registered!" when successfully finished. Step 3: Go to http://www.wxpython.org Under the download section click on Binaries Under Win32 click on the link to download wxPython for Python 2.3. There will be an ansi version and a Unicode version, download the ansi version. Follow the link and download the file to your computer. There will also be a link to download the documentation and demos called "win32-docs-demos". Download this also. Step 4: Once the files are downloaded, run the main installer. The installer should automatically detect where Vizard is installed and select it as the install directory. When the main installer has finished, run the installer for the documentation and demos. Step 5: To test out whether wxPython works, click on the Start menu -> Programs -> wxPython2.6 Docs Demos and Tools -> Sample Apps. Open the doodle folder then open superdoodle.py in Vizard. If you are able to make doodles, then you successfully installed wxPython. !!!!!!IMPORTANT - READ THIS!!!!!!! Running wxPython scripts multiple times in the Vizard GUI may cause crashes. This is because most of the wxPython scripts do not clean up after themselves. Most wxPython scripts have the following code at the end which basically runs the main application: Code:
if __name__ == '__main__': app = SomeApp() app.MainLoop() Code:
del app |
#2
|
|||
|
|||
Some problems getting wxPython to work with Vizard
Hi Farshid,
I followed your instructions on installing wxPython but am unable to run the wxPython demo program that comes with wxPython. I am able to open specific files in the demo folder, but can't run the actual demo.py script. A splash screen appears when the application begins, but it never goes away and so the program locks up. The only way I can find to get out of it is to kill the Vizard program completely using the Task manager. When I had wxPython installed in the Python 2.2 path, however, I was able to run the demo.py script fine. So that appears to somehow be interacting with Vizard. On a related note, I really want to be able to use Boa Constructor along with wxPython to create my GUI's. I uninstalled python 2.2 to test whether I could get wxPython to run under Vizard, but now when I go to reinstall Boa, it won't let me because it can't find Python 2.2. Do you think it's possible to get Boa to work with Vizard? Or am I going to have to reinstall Python separately? Any help you can provide is greatly appreciated! Kim Swinth Anacapa Sciences Santa Barbara, CA |
#3
|
|||
|
|||
Hi Kim,
I tried the running demo.py and it works fine on the machine here. The splash screen doesn't go away until you click on it. Did you try this? I haven't tried installing Boa Constructor with Vizard yet. I'll try it soon and get back to you on it. -- Farshid |
#4
|
|||
|
|||
Demo.py
Hi Farshid,
Yes, I tried clicking on it, but all it get is an error tone. I can't close the program or anything. I can only get out by switching to the Task Manager and killing the Vizard application. As I mentioned in my other post, when I run demo.py directly through Python, the splash screen goes away automatically and I can then use the demo program. But I it doesn't want to work here. I did completely uninstall python, wxPython, and Boa and then reinstalled wxPython according to your installation instructions. But no matter what I do, I keep getting the hanging problem. Kim |
#5
|
|||
|
|||
Hi Kim,
Are you getting any error messages in the Interactive Window when you run demo.py? If you are, type the following commands in the interactive window before running demo.py: import os os.environ['HOME'] = '' (those are two single quote characters at the end) import sys sys.argv = [] Let me know if this helps. -- Farshid |
#6
|
|||
|
|||
Hi Farshid,
Well, we're making a little progress. When I type in the code you sent in the interactive window, I get the following error when I try to type in the first part: Traceback (most recent call last): File "<string>", line 1, in ? File "C:\Program Files\Vizard\bin\lib\os.py", line 387, in __getitem__ return self.data[key.upper()] KeyError: HOME But the second part does get accepted and when I run demo.py, the splash screen goes away and the program is no longer locking. However, I can't navigate to the various demo programs. When I click on one, I get an error message like this: Traceback (most recent call last): File ".\Main.py", line 467, in OnSelChanged self.RunDemo(itemText) File ".\Main.py", line 490, in RunDemo if os.path.exists(itemText + '.py'): File "C:\Program Files\Vizard\bin\lib\ntpath.py", line 247, in exists st = os.stat(path) LookupError: no codec search functions registered: can't find encoding Any other ideas? Kim |
#7
|
|||
|
|||
Hi Kim,
I've tested this out on a machine which doesn't have Python 2.2 installed and on a machine which does have Python 2.2 installed and it works on both of them. Will you double check to see that you typed in the first part correctly. It should be: import os os.environ['HOME'] = '' I think you may have typed: os.environ['HOME'] Thanks, Farshid |
#8
|
|||
|
|||
Ok, tried that. You're right that I had a typo, and with that fixed, the demo.py program loads ok. But I still can't get any of the subprograms to work. If I click on any of the scripts off the menu tree, nothing happens. Although I'm not seeing any errors either. Are you able use the demo.py program completely? (i.e., if you click on the different scrips on the left, do you have stuff happening in the program?)
Kim |
#9
|
|||
|
|||
Hi Kim,
All the demos on the left menu work fine, (except a couple that require additional libraries). Are you expanding the menus on the left and clicking on the sub-items? If you are, then I'm not sure what the problem is. Does the superdoodle.py example work? -- Farshid |
#10
|
|||
|
|||
Hi Farshid,
Yes, the superdoodle example works fine. When I run the demo.py, however, I can expand the menus on the left, but if I double click on a menu item, the name at the top of the tabs changes (sometimes I have to click a couple of times and wait a while for it to happen though), but the actual demo itself doesn't run. Nor does the the demo code update to show the code for that item and the overview text doesn't change. I'm also getting the following errors whenever I try to click on a menu item. Traceback (most recent call last): File "C:\PROGRA~1\Python\Lib\site-packages\wxPython\demo\Main.py", line 467, in OnSelChanged self.RunDemo(itemText) File "C:\PROGRA~1\Python\Lib\site-packages\wxPython\demo\Main.py", line 490, in RunDemo if os.path.exists(itemText + '.py'): File "C:\Program Files\Vizard\bin\lib\ntpath.py", line 247, in exists st = os.stat(path) LookupError: no codec search functions registered: can't find encoding I did reinstall python and installed a second copy of wxPython in the python path. When I run demo.py through python, everything works perfectly. But I can not get it work run properly with Vizard. Kim |
#11
|
|||
|
|||
Hi Kim,
I'm pretty sure the problem is that you installed the unicode version of wxPython. Uninstall wxPython then download and install the normal version. Here's a screenshot of the download page, I highlighted the version you should download. After that everything should work fine. -- Farshid |
#12
|
|||
|
|||
Hi Farshid,
Sorry I didn't get back to you sooner, I'm only in here 2 days a week. I reinstalled wxPython based on your last instructions, and things seem to be working properly now. So I must have downloaded the unicode version by mistake (as you suggested). However, I still have to type in the: import os os.environ['HOME'] = '' import sys sys.argv = [] before I can run demo.py. I don't have to do this when I run wxPython directly through python 2.2, however. I realize I can modify the demo.py script to include this information, but do you know why those parameters must be set to get the demo.py to work? And is there a setting I can change in Vizard so I don't have to type this stuff in? Kim |
#13
|
|||
|
|||
Hi Kim,
For some reason wxPython requires that those variables are set, or else it will give errors. However, i modified the latest version of Vizard so that it automatically sets this for you at startup. So if you have version 1.097 or below, you will have to do this manually. The next version will be released in about a month, and you won't have to do this anymore. -- Farshid |
#14
|
|||
|
|||
One more thing...
Have you had a chance to look at Boa Constructor and see if it can be installed without having a version of Python 2.2 installed? The way things are now, I've installed a version of wxPython in the Vizard/Bin/Dlls folder plus another version of it in the Python 2.2 folder ... which is where Boa also installs. It seems "wasteful" to have to have 2 copies of wxPython plus a copy of Python just to get Boa to work. Kim |
#15
|
|||
|
|||
Hello,
I'm working with the trail and I need a proper interface, so I tried installing wxPython following your instructions, but all that happens is this error: ImportError: no mudule named wx And of course I de-installed vizard and wxPython and re-installed both. Searsky ps: the demos and docs are in a different file now, so I had to install that one as well in order to run superdoodle. |
#16
|
|||
|
|||
Hi,
I reinstalled wxPython with Vizard from scratch and updated the instructions at the top of this thread. Let me know if something doesn't work or is not clear. |
#17
|
|||
|
|||
Hello,
Thanks for the help. wxPython works just fine now, but I installed it a little different. Instead of using the RegisterVizardWithPython.py script I selected the vizard25\bin folder and added the \lib\site-packages which wxPyhton wants to add automaticaly itself at the beginning. In other words, just type [YourPath]\vizard25\bin as the location of python23 and wxPython will installs a charm. Searsky Last edited by searsky; 12-23-2005 at 03:37 AM. |
#18
|
|||
|
|||
Intergrating vizard in wxPython
Hello,
At the moment I don't know how to communicate between the wxPython GUI and my vizard script. I am able to run my script from within the wxPython file usingthe code from this thread: http://www.worldviz.com/forum/showth...light=wxPython But I don't see a straightforward way of communication between the two, so as I searched the forum further I stumbled upon this thread: http://www.worldviz.com/forum/showth...light=wxPython In which you state that you have some examples of vizard working within wxPython. So I was wondering if you would share with me, that would be of some great help. Tnx in advance, Searsky |
#19
|
|||
|
|||
Hi,
Send me an email at lashkari@worldviz.com and I will provide you with some examples of embedding Vizard within a wxPython GUI. |
Thread Tools | |
Display Modes | Rate This Thread |
|
|