This may not be entirely relevant, but I note that Visual is not as
flexible as it ought to be in specifying x and y in a gdisplay. Your
program works on my Windows machine only after changing x=0.0 to x=0 and
y-0.0 to y=0 in display1 = gdisplay(.....). It makes sense for these
pixel arguments to be integers, but it's silly/wrong not to accept 0.0.
However, I don't see how this issue relates to the problems you're
seeing. The only thing I can think of would be that you could try
updating the graphics driver on your machine. Sometimes an old driver
has problems with OpenGL.
Bruce Sherwood
Fred Sells wrote:
> I'm running XP with all patches uptodate. Same problem with python
> 2.4.4 and 2.5.1.
>
> A simple demo program crashes python. I checked site-packages and it
> has numarray, numpy, Numeric and visual folders
>
> I'm trying some sample code from the web site (attached) and get this
> useless error (attached) to notify microsoft of the crash. It's greek
> to me, but perhaps it means something to the guru's here.
> I also get this erroneous python error, so I wonder if the python.exe is
> hosed. but I've installed/reinstalled several times. I've tried running
> from within Eclipse and from command line with the same results.
>
> On my computer at work, no problem with python 2.4.4. I don't know what
> to try next. I'm running this on an older laptop PIII 1.2Ghz with 512M
> RAM if that matters.
>
> for x in range(x_start, x_end, 0.1):
> Traceback (most recent call last):
> File "C:\all\projects\calculus\src\chartfunction.py", line 20, in <module>
> for x in range(x_start, x_end, 0.1):
> ValueError: range() step argument must not be zero
>
>
>
> ------------------------------------------------------------------------
>
> from visual.graph import * # import graphing features
> import sys
> display1 = gdisplay(x=0.0, y=0.0, width=300, height=200,
> title='Cos Graph', xtitle='X', ytitle='Y',
> xmax=10., xmin=-10., ymax=3., ymin=-3.,
> foreground=color.black, background=color.white)
>
> #display2 = gdisplay(x=0, y=200, width=300, height=200,
> # title='Sin Graph', xtitle='X', ytitle='Y',
> # xmax=10., xmin=-10., ymax=3., ymin=-3.,
> # foreground=color.black, background=color.white)
>
> graph = gcurve(gdisplay=display1,color=color.cyan) # a connected curve object
> #graph2 = gcurve(gdisplay=display2,color=color.blue)
>
>
> x_start= -8. # graph starting from this x value
> x_end = 8. # graph ending at this x value
>
> for x in range(x_start, x_end, 0.1):
> y = cos(x) # the function we want to graph
> print x,y
> continue
> graph.plot(pos=(x,y)) # plots a point
>
> # y = sin(x) # the function we want to graph
> # graph2.plot(pos=(x,y)) # plots a point
>
|