WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #1  
Old 06-04-2003, 11:34 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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()
To force wxPython to cleanup, add the following line after the mainloop:
Code:
del app
This will delete the application from memory and hopefully prevent crashes from occuring next time you run the script.
Reply With Quote
  #2  
Old 06-05-2003, 04:32 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #3  
Old 06-05-2003, 04:40 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #4  
Old 06-05-2003, 04:48 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #5  
Old 06-05-2003, 04:55 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #6  
Old 06-05-2003, 05:02 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #7  
Old 06-05-2003, 05:17 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #8  
Old 06-05-2003, 05:30 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #9  
Old 06-05-2003, 05:57 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #10  
Old 06-05-2003, 06:18 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #11  
Old 06-05-2003, 07:08 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Attached Images
File Type: jpg wxpy.jpg (51.9 KB, 5487 views)
Reply With Quote
  #12  
Old 06-10-2003, 04:14 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #13  
Old 06-10-2003, 04:20 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #14  
Old 06-10-2003, 04:21 PM
kim_swinth kim_swinth is offline
Member
 
Join Date: Jun 2003
Posts: 18
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
Reply With Quote
  #15  
Old 09-27-2005, 04:26 AM
searsky searsky is offline
Member
 
Join Date: Sep 2005
Posts: 6
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.
Reply With Quote
  #16  
Old 09-27-2005, 11:30 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #17  
Old 09-28-2005, 02:24 AM
searsky searsky is offline
Member
 
Join Date: Sep 2005
Posts: 6
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 04:37 AM.
Reply With Quote
  #18  
Old 09-29-2005, 05:48 AM
searsky searsky is offline
Member
 
Join Date: Sep 2005
Posts: 6
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
Reply With Quote
  #19  
Old 09-29-2005, 09:49 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Send me an email at lashkari@worldviz.com and I will provide you with some examples of embedding Vizard within a wxPython GUI.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:59 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC