[visionegg] Re: VisionEgg with wxPython on Windows

  • From: Simeon Fitch <simeon.fitch@xxxxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Thu, 3 Nov 2005 08:27:44 -0500

Andrew,

Fantastic help! Your example worked, so I started tweaking it to be more
like my setup until it stopped working. From the best I can tell there is
some weird bug in pygame triggered by a combination of using a Dialog
instead of a Frame, and having the reference to the Dialog go out of scope
before creating the Screen object. If you change the four lines starting
with the wx.PYSimpleApp() call to this:

--------------------Bad---------------------
def showWin():
app = wx.PySimpleApp()
dialog = wx.Dialog(None, -1, "Hello World")
dialog.ShowModal()

showWin()
--------------------Bad---------------------

The program crashes (without an error message!!).

But this is OK:

--------------------OK---------------------
app = wx.PySimpleApp()
dialog = wx.Dialog(None, -1, "Hello World")
dialog.ShowModal()
--------------------OK---------------------


as is this:

--------------------OK---------------------
def showWin():
app = wx.PySimpleApp()
dialog = wx.Frame(None, -1, "Hello World")
dialog.Show(1)
app.MainLoop()

showWin()
--------------------OK---------------------


At any rate, it points to some bug in pygame, rather than VisionEgg. I now
have a work-around. I hope this saves others some time when in a similar
situation.

Just out of curiosity, does anyone know if pygame offers significant
benefits over straight pyOpenGL or wxGLCanvas? I've had to jump through a
lot of hoops to access the OpenGL buffer initialization, like enabling the
stencil and multi-sample buffers, and would have preferred a GLUT-like
interface.

Many thanks,

Simeon




On 11/2/05, Andrew Straw <astraw@xxxxxxxxxxx> wrote:
>
> Hi Simeon,
>
> I'm also no Windows whiz, but trying the simple program below results in
> no problems for me... Have you been able to track yours down any
> further? What do you think may be different between your setup and mine?
>
> Here's what check-config.py says:
>
> Python version 2.4.2 (OK)
> extra Python info: (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit
> (Intel)]
> Numeric version 23.8 (OK)
> PyOpenGL (package "OpenGL") version 2.0.2.01 <http://2.0.2.01> (OK)
> pygame version 1.7.1release (OK)
> Python Imaging Library (package "Image") version 1.1.5 (OK)
>
> Here's the program that works for me:
>
> import wx
>
> import VisionEgg
> VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
>
> from VisionEgg.Core import *
> from VisionEgg.FlowControl import Presentation
> from VisionEgg.Gratings import *
>
> app = wx.PySimpleApp()
> frame = wx.Frame(None, -1, "Hello World")
> frame.Show(1)
> app.MainLoop()
>
> screen = Screen()
>
> stimulus = SinGrating2D(position = ( screen.size[0]/2.0,
> screen.size[1]/2.0 ),
> anchor = 'center',
> size = ( 300.0 , 300.0 ),
> spatial_freq = 10.0 / screen.size[0], #
> units of cycles/pixel
> temporal_freq_hz = 1.0,
> orientation = 45.0 )
>
> viewport = Viewport( screen=screen, stimuli=[stimulus] )
>
> p = Presentation(go_duration=(5.0,'seconds'),viewports=[viewport])
> p.go()
>
>
>
--
Simeon H.K. Fitch, Owner
Mustard Seed Software

Other related posts: