You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(1) |
Aug
|
Sep
(15) |
Oct
(32) |
Nov
(35) |
Dec
(48) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(46) |
Feb
(22) |
Mar
(65) |
Apr
(49) |
May
(22) |
Jun
(29) |
Jul
(51) |
Aug
(34) |
Sep
(32) |
Oct
(46) |
Nov
(30) |
Dec
(32) |
2002 |
Jan
(48) |
Feb
(4) |
Mar
(20) |
Apr
(28) |
May
(13) |
Jun
(34) |
Jul
(51) |
Aug
(15) |
Sep
(15) |
Oct
(35) |
Nov
(15) |
Dec
(20) |
2003 |
Jan
(31) |
Feb
(111) |
Mar
(41) |
Apr
(28) |
May
(36) |
Jun
(29) |
Jul
(27) |
Aug
(29) |
Sep
(47) |
Oct
(28) |
Nov
(7) |
Dec
(26) |
2004 |
Jan
(44) |
Feb
(9) |
Mar
(17) |
Apr
(26) |
May
(58) |
Jun
(13) |
Jul
(44) |
Aug
(64) |
Sep
(30) |
Oct
(11) |
Nov
(21) |
Dec
(28) |
2005 |
Jan
(29) |
Feb
(11) |
Mar
(11) |
Apr
(22) |
May
(85) |
Jun
(46) |
Jul
(17) |
Aug
(18) |
Sep
(14) |
Oct
(22) |
Nov
(1) |
Dec
(45) |
2006 |
Jan
(20) |
Feb
(36) |
Mar
(18) |
Apr
(24) |
May
(21) |
Jun
(48) |
Jul
(23) |
Aug
(20) |
Sep
(10) |
Oct
(41) |
Nov
(46) |
Dec
(40) |
2007 |
Jan
(40) |
Feb
(20) |
Mar
(13) |
Apr
(6) |
May
(24) |
Jun
(31) |
Jul
(30) |
Aug
(11) |
Sep
(11) |
Oct
(10) |
Nov
(56) |
Dec
(64) |
2008 |
Jan
(64) |
Feb
(22) |
Mar
(63) |
Apr
(28) |
May
(25) |
Jun
(36) |
Jul
(11) |
Aug
(9) |
Sep
(14) |
Oct
(41) |
Nov
(46) |
Dec
(130) |
2009 |
Jan
(95) |
Feb
(41) |
Mar
(24) |
Apr
(35) |
May
(53) |
Jun
(67) |
Jul
(48) |
Aug
(48) |
Sep
(86) |
Oct
(75) |
Nov
(64) |
Dec
(52) |
2010 |
Jan
(57) |
Feb
(31) |
Mar
(28) |
Apr
(40) |
May
(25) |
Jun
(42) |
Jul
(79) |
Aug
(31) |
Sep
(49) |
Oct
(66) |
Nov
(38) |
Dec
(25) |
2011 |
Jan
(29) |
Feb
(18) |
Mar
(44) |
Apr
(6) |
May
(28) |
Jun
(31) |
Jul
(36) |
Aug
(24) |
Sep
(30) |
Oct
(23) |
Nov
(21) |
Dec
(27) |
2012 |
Jan
(14) |
Feb
(11) |
Mar
(2) |
Apr
(48) |
May
(7) |
Jun
(32) |
Jul
(22) |
Aug
(25) |
Sep
(31) |
Oct
(32) |
Nov
(21) |
Dec
(17) |
2013 |
Jan
(44) |
Feb
(27) |
Mar
(3) |
Apr
(1) |
May
|
Jun
|
Jul
(3) |
Aug
(4) |
Sep
(1) |
Oct
(7) |
Nov
(5) |
Dec
(5) |
2014 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Young-Jin L. <yl...@ui...> - 2002-01-21 18:53:39
|
Hi, I'd like to know if there's any way to call a method when a vpython window is closed. I want to have multiple vpython windows open and to do something each of them is closing. I read through the reference document including "controlling one or more visual display window" section, but I couldn't find what I need. Is there any way to hook a method to the close box (or anything equivalent to it) of a vpython window? Any comment will be greatly appreciated. Thanks. YJ |
From: David S. <dsc...@vi...> - 2002-01-18 20:43:26
|
I do not think the backslashes you deleted were "stray backslashes". They continue a line in a macro expansion by "escaping" the subsequent line feed character. What you are probably seeing is a file with Windows \r\n line terminators. The preprocessor sees "\\\r" and complains. You can probably fix this by replacing the backslashes and fixing the line terminators. There's a script that comes with Python to do it; there are also common tools like 'dos2unix'; and in a pinch you can roll your own with something like x = re.sub(r'\r\n',r'\n',open('cvisual.cpp','rb').read()) open('cvisual.cpp','wb').write(x) In a pinch, just delete the backslashes and cram the whole CALLF macro onto one line. Dave > -----Original Message----- > From: vis...@li... > [mailto:vis...@li...] On > Behalf Of Coleman Mosley MD FACP > Sent: Friday, January 18, 2002 3:30 PM > To: David Andersen; Andy Dougherty; Kevin Cole; Andrew > Williams; Konrad Piwowarczyk > Cc: vis...@li... > Subject: Re: [Visualpython-users] gtkgl library > > > Thanks to all of you for your replies. I'm closer but is is > not working yet. > With rpm2cpio, it did not seem to translate. I donwloaded > the ...src.rpm > and converted it. The original make produced an error that > there were stray > "\" in the file cvisual.cpp. This was actually a problem > listed on the > vpython archives from last Nov, unfortunately the solution > for that person > was to use the binary code. Catch-22 for me. > So I edited the file mad delted the stray backslashes. > Below is the new > error message. I do not know c,c++ beyond minial use so do > not know how to > correct the source file. > Ths current version of this file is also attached. > Any suggestions or corrections would be appreciated. It > seems that this is a > bug for any linux OS (see the nov message if interested) > trying to compile > from source rather than binary. > Thanks for the assistance. > Coleman > > > Error message: > g++ -g -I. -I./CXX/Include -I/usr/include/python2.1 > -I/usr/include/python2.1/Numeric `gtk-config --cflags gtk > gthread` -w -c -o > cvisual.o cvisual.cpp > cvisual.cpp: In method `cvisual_module::cvisual_module()': > cvisual.cpp:111: `create_vector' is not a member of type > `cvisual_module' > cvisual.cpp:112: `create_immutableVector' is not a member of type > `cvisual_module' > cvisual.cpp:113: `vector_mag' is not a member of type `cvisual_module' > cvisual.cpp:114: `vector_norm' is not a member of type > `cvisual_module' > cvisual.cpp:115: `vector_cross' is not a member of type > `cvisual_module' > cvisual.cpp:116: `vector_rotate' is not a member of type > `cvisual_module' > cvisual.cpp:124: `create_box' is not a member of type `cvisual_module' > cvisual.cpp:125: `create_sphere' is not a member of type > `cvisual_module' > cvisual.cpp:126: `create_ring' is not a member of type > `cvisual_module' > cvisual.cpp:127: `create_cylinder' is not a member of type > `cvisual_module' > cvisual.cpp:128: `create_cone' is not a member of type > `cvisual_module' > cvisual.cpp:129: `create_arrow' is not a member of type > `cvisual_module' > cvisual.cpp:130: `create_hexahedron' is not a member of type > `cvisual_module' > cvisual.cpp:131: `create_curve' is not a member of type > `cvisual_module' > cvisual.cpp:132: `create_convex' is not a member of type > `cvisual_module' > cvisual.cpp:133: `create_frame' is not a member of type > `cvisual_module' > cvisual.cpp:134: `create_label' is not a member of type > `cvisual_module' > cvisual.cpp:135: `create_faces' is not a member of type > `cvisual_module' > make: *** [cvisual.o] Error 1 > > cvisual.cpp (the stray \ 's removed from the Object what in > CALLF): #include "cvisual.h" #include "display.h" #include > "mouseobject.h" #include "gldevice.h" #include "prim.h" > #include "arrprim.h" #include "label.h" #include "rate.h" > > const char * copyright = "Copyright 2000 David Scherer. All Rights > Reserved."; > > Object create_sphere(const Tuple& args, const Dict& kwargs); > Object create_ring(const Tuple& args, const Dict& kwargs); > Object create_box(const Tuple& args, const Dict& kwargs); > Object create_cylinder(const Tuple& args, const Dict& > kwargs); Object create_cone(const Tuple& args, const Dict& > kwargs); Object create_arrow(const Tuple& args, const Dict& > kwargs); Object create_hexahedron(const Tuple& args, const > Dict& kwargs); Object create_curve(const Tuple& args, const > Dict& kwargs); Object create_convex(const Tuple& args, const > Dict& kwargs); Object create_frame(const Tuple& args, const > Dict& kwargs); Object create_label(const Tuple& args, const > Dict& kwargs); Object create_faces(const Tuple& args, const > Dict& kwargs); > > #define CALLF(what) > Object what(const Tuple& args, const Dict& kwargs) { > return ::what(args,kwargs); > } > > #define CREATEF(what) CALLF(create_##what) > > class cvisual_module : public ExtensionModule<cvisual_module> { > public: > cvisual_module(); > > virtual ~cvisual_module() {} > > private: > Object create_display(const Tuple& args, const Dict& kwargs) { > Display *d = new Display(*new GLDevice()); > return init(d,args,kwargs); > } > > Object handle_event(const Tuple& args, const Dict& kwargs) { > return Int(::handle_event(*args[0])); > } > > Object shutdown(const Tuple& args, const Dict& kwargs) { > Display::shutdown(); > return Nothing(); > } > > Object waitclose(const Tuple& args, const Dict& kwargs) { > Display::waitclose(); > return Nothing(); > } > > Object allclosed(const Tuple& args, const Dict& kwargs) { > return Int( Display::allclosed() ? 1 : 0 ); > } > > Object rate(const Tuple& args, const Dict& kwargs) { > if (args.length() != 1) throw TypeError("Incorrect number of > arguments."); > > float freq = Float(args[0]); > if (freq<=0.0) throw ValueError("Frequency must be positive."); > > static rate_timer *rt; > if (!rt) rt = new rate_timer(); > > rt->delay(1.0 / freq); > > return Nothing(); > } > > CREATEF(hexahedron); > CREATEF(curve); > CREATEF(convex); > CREATEF(frame); > CREATEF(label); > CREATEF(box); > CREATEF(sphere); > CREATEF(ring); > CREATEF(cylinder); > CREATEF(cone); > CREATEF(arrow); > CREATEF(faces); > CREATEF(vector); > CREATEF(immutableVector); > CALLF(vector_mag); > CALLF(vector_norm); > CALLF(vector_cross); > CALLF(vector_rotate); > }; > > cvisual_module::cvisual_module() > : ExtensionModule<cvisual_module>("cvisual") > { > init_platform(); > > import_array(); > > Vector::init_type(); > clickObject::init_type(); > mouseObject::init_type(); > Display::init_type(); > Primitive::init_type(); > ArrayPrimitive::init_type(); > Label::init_type(); > > add_keyword_method("vector", &cvisual_module::create_vector, > "vector([x,y[,z]]) = [x,y,z]"); > add_keyword_method("constant_vector", > &cvisual_module::create_immutableVector, > "constant_vector([x,y[,z]]) = > (x,y,z)"); > add_keyword_method("mag", &cvisual_module::vector_mag, > "mag(v) = |v|"); > add_keyword_method("norm", &cvisual_module::vector_norm, > "norm(v) = v/|v|"); > add_keyword_method("cross", &cvisual_module::vector_cross, > "cross(a,b) = a > x b"); > add_keyword_method("rotate", > &cvisual_module::vector_rotate, "rotate(v, > angle=radians, axis=[0,0,1]) rotates v angle radians around axis"); > > add_keyword_method("shutdown", &cvisual_module::shutdown, ""); > add_keyword_method("waitclose", &cvisual_module::waitclose, ""); > add_keyword_method("allclosed", &cvisual_module::allclosed, ""); > add_keyword_method("rate", &cvisual_module::rate, ""); > > add_keyword_method("display", &cvisual_module::create_display, ""); > add_keyword_method("box", &cvisual_module::create_box, ""); > add_keyword_method("sphere", &cvisual_module::create_sphere, ""); > add_keyword_method("ring", &cvisual_module::create_ring, ""); > add_keyword_method("cylinder", > &cvisual_module::create_cylinder, ""); > add_keyword_method("cone", &cvisual_module::create_cone, ""); > add_keyword_method("arrow", &cvisual_module::create_arrow, ""); > add_keyword_method("hexahedron", > &cvisual_module::create_hexahedron, ""); > add_keyword_method("curve", &cvisual_module::create_curve, ""); > add_keyword_method("convex", &cvisual_module::create_convex, ""); > add_keyword_method("frame", &cvisual_module::create_frame, ""); > add_keyword_method("label", &cvisual_module::create_label, ""); > add_keyword_method("faces", &cvisual_module::create_faces, ""); > add_keyword_method("_handleevent", > &cvisual_module::handle_event, ""); > > initialize("cvisual module - visual implementation in C++"); > > Dict d = moduleDictionary(); > d["VectorType"] = Type((PyObject*)Vector::type_object()); > } > > > extern "C" > void cvisual_DLL initcvisual() { > new cvisual_module(); > } > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |
From: Coleman M. MD F. <cm...@pa...> - 2002-01-18 20:26:02
|
Thanks to all of you for your replies. I'm closer but is is not working yet. With rpm2cpio, it did not seem to translate. I donwloaded the ...src.rpm and converted it. The original make produced an error that there were stray "\" in the file cvisual.cpp. This was actually a problem listed on the vpython archives from last Nov, unfortunately the solution for that person was to use the binary code. Catch-22 for me. So I edited the file mad delted the stray backslashes. Below is the new error message. I do not know c,c++ beyond minial use so do not know how to correct the source file. Ths current version of this file is also attached. Any suggestions or corrections would be appreciated. It seems that this is a bug for any linux OS (see the nov message if interested) trying to compile from source rather than binary. Thanks for the assistance. Coleman Error message: g++ -g -I. -I./CXX/Include -I/usr/include/python2.1 -I/usr/include/python2.1/Numeric `gtk-config --cflags gtk gthread` -w -c -o cvisual.o cvisual.cpp cvisual.cpp: In method `cvisual_module::cvisual_module()': cvisual.cpp:111: `create_vector' is not a member of type `cvisual_module' cvisual.cpp:112: `create_immutableVector' is not a member of type `cvisual_module' cvisual.cpp:113: `vector_mag' is not a member of type `cvisual_module' cvisual.cpp:114: `vector_norm' is not a member of type `cvisual_module' cvisual.cpp:115: `vector_cross' is not a member of type `cvisual_module' cvisual.cpp:116: `vector_rotate' is not a member of type `cvisual_module' cvisual.cpp:124: `create_box' is not a member of type `cvisual_module' cvisual.cpp:125: `create_sphere' is not a member of type `cvisual_module' cvisual.cpp:126: `create_ring' is not a member of type `cvisual_module' cvisual.cpp:127: `create_cylinder' is not a member of type `cvisual_module' cvisual.cpp:128: `create_cone' is not a member of type `cvisual_module' cvisual.cpp:129: `create_arrow' is not a member of type `cvisual_module' cvisual.cpp:130: `create_hexahedron' is not a member of type `cvisual_module' cvisual.cpp:131: `create_curve' is not a member of type `cvisual_module' cvisual.cpp:132: `create_convex' is not a member of type `cvisual_module' cvisual.cpp:133: `create_frame' is not a member of type `cvisual_module' cvisual.cpp:134: `create_label' is not a member of type `cvisual_module' cvisual.cpp:135: `create_faces' is not a member of type `cvisual_module' make: *** [cvisual.o] Error 1 cvisual.cpp (the stray \ 's removed from the Object what in CALLF): #include "cvisual.h" #include "display.h" #include "mouseobject.h" #include "gldevice.h" #include "prim.h" #include "arrprim.h" #include "label.h" #include "rate.h" const char * copyright = "Copyright 2000 David Scherer. All Rights Reserved."; Object create_sphere(const Tuple& args, const Dict& kwargs); Object create_ring(const Tuple& args, const Dict& kwargs); Object create_box(const Tuple& args, const Dict& kwargs); Object create_cylinder(const Tuple& args, const Dict& kwargs); Object create_cone(const Tuple& args, const Dict& kwargs); Object create_arrow(const Tuple& args, const Dict& kwargs); Object create_hexahedron(const Tuple& args, const Dict& kwargs); Object create_curve(const Tuple& args, const Dict& kwargs); Object create_convex(const Tuple& args, const Dict& kwargs); Object create_frame(const Tuple& args, const Dict& kwargs); Object create_label(const Tuple& args, const Dict& kwargs); Object create_faces(const Tuple& args, const Dict& kwargs); #define CALLF(what) Object what(const Tuple& args, const Dict& kwargs) { return ::what(args,kwargs); } #define CREATEF(what) CALLF(create_##what) class cvisual_module : public ExtensionModule<cvisual_module> { public: cvisual_module(); virtual ~cvisual_module() {} private: Object create_display(const Tuple& args, const Dict& kwargs) { Display *d = new Display(*new GLDevice()); return init(d,args,kwargs); } Object handle_event(const Tuple& args, const Dict& kwargs) { return Int(::handle_event(*args[0])); } Object shutdown(const Tuple& args, const Dict& kwargs) { Display::shutdown(); return Nothing(); } Object waitclose(const Tuple& args, const Dict& kwargs) { Display::waitclose(); return Nothing(); } Object allclosed(const Tuple& args, const Dict& kwargs) { return Int( Display::allclosed() ? 1 : 0 ); } Object rate(const Tuple& args, const Dict& kwargs) { if (args.length() != 1) throw TypeError("Incorrect number of arguments."); float freq = Float(args[0]); if (freq<=0.0) throw ValueError("Frequency must be positive."); static rate_timer *rt; if (!rt) rt = new rate_timer(); rt->delay(1.0 / freq); return Nothing(); } CREATEF(hexahedron); CREATEF(curve); CREATEF(convex); CREATEF(frame); CREATEF(label); CREATEF(box); CREATEF(sphere); CREATEF(ring); CREATEF(cylinder); CREATEF(cone); CREATEF(arrow); CREATEF(faces); CREATEF(vector); CREATEF(immutableVector); CALLF(vector_mag); CALLF(vector_norm); CALLF(vector_cross); CALLF(vector_rotate); }; cvisual_module::cvisual_module() : ExtensionModule<cvisual_module>("cvisual") { init_platform(); import_array(); Vector::init_type(); clickObject::init_type(); mouseObject::init_type(); Display::init_type(); Primitive::init_type(); ArrayPrimitive::init_type(); Label::init_type(); add_keyword_method("vector", &cvisual_module::create_vector, "vector([x,y[,z]]) = [x,y,z]"); add_keyword_method("constant_vector", &cvisual_module::create_immutableVector, "constant_vector([x,y[,z]]) = (x,y,z)"); add_keyword_method("mag", &cvisual_module::vector_mag, "mag(v) = |v|"); add_keyword_method("norm", &cvisual_module::vector_norm, "norm(v) = v/|v|"); add_keyword_method("cross", &cvisual_module::vector_cross, "cross(a,b) = a x b"); add_keyword_method("rotate", &cvisual_module::vector_rotate, "rotate(v, angle=radians, axis=[0,0,1]) rotates v angle radians around axis"); add_keyword_method("shutdown", &cvisual_module::shutdown, ""); add_keyword_method("waitclose", &cvisual_module::waitclose, ""); add_keyword_method("allclosed", &cvisual_module::allclosed, ""); add_keyword_method("rate", &cvisual_module::rate, ""); add_keyword_method("display", &cvisual_module::create_display, ""); add_keyword_method("box", &cvisual_module::create_box, ""); add_keyword_method("sphere", &cvisual_module::create_sphere, ""); add_keyword_method("ring", &cvisual_module::create_ring, ""); add_keyword_method("cylinder", &cvisual_module::create_cylinder, ""); add_keyword_method("cone", &cvisual_module::create_cone, ""); add_keyword_method("arrow", &cvisual_module::create_arrow, ""); add_keyword_method("hexahedron", &cvisual_module::create_hexahedron, ""); add_keyword_method("curve", &cvisual_module::create_curve, ""); add_keyword_method("convex", &cvisual_module::create_convex, ""); add_keyword_method("frame", &cvisual_module::create_frame, ""); add_keyword_method("label", &cvisual_module::create_label, ""); add_keyword_method("faces", &cvisual_module::create_faces, ""); add_keyword_method("_handleevent", &cvisual_module::handle_event, ""); initialize("cvisual module - visual implementation in C++"); Dict d = moduleDictionary(); d["VectorType"] = Type((PyObject*)Vector::type_object()); } extern "C" void cvisual_DLL initcvisual() { new cvisual_module(); } |
From: Young-Jin L. <yl...@ui...> - 2002-01-18 17:10:49
|
Hi, I found out why I didn't see the VPython simulation window except the first time. I set scene.exit to 0 because I wanted to close only the VPython simulation window rather than the whole application. I expected "scene.exit = 0" to a "REAL" clsoing, but apparently it is not. It seems like it just set scene.visible to "0". When I manually set "scene.visible" to "1" for later simulation, the VPython simulation window appeared. But VPython objects created in the previous simulation were still there. I tried to set all the spheres created in the previous simulation by setting them to None, it didn't work. Is there any way to clear all the objects in the scene when it is closed? Thanks. YJ # Button ID BT_START = 10 from wxPython.wx import * from wxPython.html import wxHtmlWindow from visual import * class CPFreeFall1D_InitialPane( wxHtmlWindow ): def __init__( self, parent, id, **kwargs ): wxHtmlWindow.__init__( self, parent, id, **kwargs ) wxButton( self, BT_START, "Start Simulation", wxPoint( 100, 100 ) ) EVT_BUTTON( self, BT_START, self.OnClickStart ) def OnClickStart( self, event ): # read the configuration file import ConfigParser cfg = ConfigParser.ConfigParser() cfg.read( 'freefall1d.cfg' ) self.startSimulation( cfg ) def startSimulation( self, cfg ): print 'start simulation' scene.width = scene.height = 500. scene.x = scene.y = 0 scene.forward = ( -0.2, -0.5, -1 ) scene.autoscale = 0 scene.userzoom = 0 scene.range = ( 15, 15, 15 ) scene.exit = 0 # only close the simulation window # clean up the previous simulation result, but it didn't work. for obj in scene.objects: if obj.__class__ == 'sphere': print obj obj = None # start an actual simulation scene.select() xmax = 10 dx = xmax / 5 grid = [] gravity = cfg.get( 'Characteristics', 'gravity' ) r = float( cfg.get( 'Characteristics', 'diameter' ) ) / 2 # make the scene visible # it should be done automatically, but it is not the case. # So I call it by myself. scene.visible = 1 for x in arange( -xmax, xmax+dx, dx ): grid.append( curve( pos = [(x, 0, -xmax), (x, 0, xmax)], color = ( .7, .7, .7 ) ) ) for z in arange( -xmax, xmax+dx, dx ): grid.append( curve( pos = [(-xmax, 0, z), (xmax, 0, z)], color = (.7, .7, .7) ) ) ball = sphere(pos=(0,8,0), radius=r, color=color.red) ball.selected = 0 ball.velocity = vector(0,-1,0) dt = 0.1 ballPosition = [] ballVelocity = [] t = [] currentT = 0 while ball.y > ball.radius: rate(10) ball.pos = ball.pos + ball.velocity*dt ball.velocity.y = ball.velocity.y - float(gravity)*dt wake = sphere( pos = ball.pos, radius = 0.1, color = color.blue ) t.append( currentT + dt ) ballPosition.append( ball.pos.y ) ballVelocity.append( ball.velocity.y ) currentT = currentT + dt print 'end simulation' |
From: Young-Jin L. <yl...@ui...> - 2002-01-18 02:47:37
|
Hi, I have a question how to repeat the same vpython scripts. I was implementing physics simulation software with vpython and wxpython and I wanted to repeat vpython simulation when a button is clicked. The following is what I tried. This is not runnable because I was using wxPython, not a Tkinter. But I don't think you would have problem understanding my intention. When I first clicked the "Start Simulation", it worked as I expected. But when I closed the VPython window and clicked again the "Start Simulation", I didn't see anything. But 'start simulation' and 'end simulation' debug straings appeared in the command window. Any ideas what I did wrong? Thanks in advance. Young-Jin Lee # initial review of 1d free fall example # Button ID BT_START = 10 from wxPython.wx import * from wxPython.html import wxHtmlWindow from visual import * class CPFreeFall1D_InitialPane( wxHtmlWindow ): def __init__( self, parent, id, **kwargs ): wxHtmlWindow.__init__( self, parent, id, **kwargs ) wxButton( self, BT_START, "Start Simulation", wxPoint( 100, 100 ) ) EVT_BUTTON( self, BT_START, self.OnClickStart ) def OnClickStart( self, event ): # read the configuration file import ConfigParser cfg = ConfigParser.ConfigParser() cfg.read( 'freefall1d.cfg' ) self.startSimulation( cfg ) # When "Start Simulation" button is clicked, VPython simulatoin starts. def startSimulation( self, cfg ): # Body of VPython simulation print 'start simulation' scene.width = scene.height = 500. scene.x = scene.y = 0 scene.forward = ( -0.2, -0.5, -1 ) scene.autoscale = 0 scene.userzoom = 0 scene.range = ( 15, 15, 15 ) scene.exit = 0 # only close the simulation window # start an actual simulation scene.select() xmax = 10 dx = xmax / 5 grid = [] gravity = cfg.get( 'Characteristics', 'gravity' ) r = float( cfg.get( 'Characteristics', 'diameter' ) ) / 2 for x in arange( -xmax, xmax+dx, dx ): grid.append( curve( pos = [(x, 0, -xmax), (x, 0, xmax)], color = ( .7, .7, .7 ) ) ) for z in arange( -xmax, xmax+dx, dx ): grid.append( curve( pos = [(-xmax, 0, z), (xmax, 0, z)], color = (.7, .7, .7) ) ) ball = sphere(pos=(0,8,0), radius=r, color=color.red) ball.selected = 0 ball.velocity = vector(0,-1,0) dt = 0.1 ballPosition = [] ballVelocity = [] t = [] currentT = 0 while ball.y > ball.radius: rate(10) ball.pos = ball.pos + ball.velocity*dt ball.velocity.y = ball.velocity.y - float(gravity)*dt wake = sphere( pos = ball.pos, radius = 0.1, color = color.blue ) t.append( currentT + dt ) ballPosition.append( ball.pos.y ) ballVelocity.append( ball.velocity.y ) currentT = currentT + dt print 'end simulation' |
From: Bruce S. <ba...@an...> - 2002-01-16 03:46:53
|
In working on preparing a Python 2.2 version for VPython on Linux, David Andersen found and fixed a significant bug: the mouse object (as in scene.mouse) was not initialized properly. We believe that this explains a low-frequency bug on Windows, where you found yourself in spin mode even though the mouse buttons were up. (The problem wasn't low-frequency on Linux; scene.mouse was initially wrong on every run.) New version for Windows. If you have already installed the Python 2.2 version of VPython on Windows, all you need to install is the new DLL. Bruce Sherwood |
From: dman <ds...@ri...> - 2002-01-15 20:06:16
|
On Tue, Jan 15, 2002 at 12:57:35PM -0500, Andy Dougherty wrote: | On Tue, 15 Jan 2002, David Andersen wrote: | | > I've never built it myself but I did look to see if it was available: | > www.rpmfind.net has a gtkglarea-1.2.3-2.src.rpm, which I assume is the | > latest version. | | Does anyone know how to unpack a source rpm if you don't have an rpm | command? (E.g. Debian .debs are ar(1) archives containing .tar.gz | archives.) Use 'alien' to turn it into a .deb or whatever. Better yet, just go to the upstream site and get the source tarball from them. -D -- Microsoft is to operating systems & security .... .... what McDonald's is to gourmet cooking |
From: Andrew W. <an...@ph...> - 2002-01-15 18:38:35
|
On Tue, 15 Jan 2002 12:35:36 -0500, David Andersen wrote: >I've never built it myself but I did look to see if it was available: >www.rpmfind.net has a gtkglarea-1.2.3-2.src.rpm, which I assume is the >latest version. You can extract, compile, and install directly with the 'rpm' command once you have the archive: rpm --rebuild gtkglarea-1.2.3-2.src.rpm That will not only extract, compile and install it, it will also leave a binary package (gtkglarea-1.2.3-2.rpm) sitting in a directory under /usr/src/redhat somewhere. The extraction and compilation gets done under there too, but I can never remember exactly where, it's not hard to find. Not that I've actually managed to get Visual working under linux - I tried ages ago with older versions of Visual and Redhat, and gave up after hitting a morass of dependencies. I already had it working under windows anyway... On the topic of extracting the contents of RPM's without 'rpm' or 'rpm2cpio', I'd say it would be tricky without digging through source code for the file format. Easiest just to extract a source rpm on a redhat box using rpm, then find and copy the sources off from /usr/src/redhat to wherever you want them. Andrew -- Dr Andrew Williams an...@ph... Perth Observatory, an...@uc... Walnut rd, Bickley, Western Australia. an...@lo... |
From: Kevin C. <kj...@gr...> - 2002-01-15 18:19:34
|
On Tue, 15 Jan 2002, David Andersen wrote: > I've only worked with RedHat and Mandrake distributions - I've no > idea what to do with a *.rpm in the absence of rpm .. Follow-up: I just did a quick check... Apparently there's a program called rpm2cpio that converts for you. The example I've found shows: rpm2cpio package.i386.rpm | cpio -ivd dir/subdir/filename it creates the path structure in your current directory and extracts the file to that (i.e. "filename" ends up in "./dir/subdir" as you'd expect). -- Kevin Cole, RHCE, Linux Admin | E-mail: kj...@gr... Gallaudet Research Institute | WWW: http://gri.gallaudet.edu/~kjcole/ Hall Memorial Bldg S-419 | Voice: (202) 651-5135 Washington, D.C. 20002-3695 | FAX: (202) 651-5746 |
From: Kevin C. <kj...@gr...> - 2002-01-15 18:13:43
|
On Tue, 15 Jan 2002, David Andersen wrote: > I've only worked with RedHat and Mandrake distributions - I've no > idea what to do with a *.rpm in the absence of rpm .. I seem to remember something about cpio... Never used it myself, but I thought that was the animal under RPM's skin. -- Kevin Cole, RHCE, Linux Admin | E-mail: kj...@gr... Gallaudet Research Institute | WWW: http://gri.gallaudet.edu/~kjcole/ Hall Memorial Bldg S-419 | Voice: (202) 651-5135 Washington, D.C. 20002-3695 | FAX: (202) 651-5746 |
From: David A. <dm...@an...> - 2002-01-15 18:04:34
|
I've only worked with RedHat and Mandrake distributions - I've no idea what to do with a *.rpm in the absence of rpm .. |
From: Andy D. <dou...@la...> - 2002-01-15 17:56:26
|
On Tue, 15 Jan 2002, David Andersen wrote: > I've never built it myself but I did look to see if it was available: > www.rpmfind.net has a gtkglarea-1.2.3-2.src.rpm, which I assume is the > latest version. Does anyone know how to unpack a source rpm if you don't have an rpm command? (E.g. Debian .debs are ar(1) archives containing .tar.gz archives.) Thanks, -- Andy Dougherty dou...@la... Dept. of Physics Lafayette College, Easton PA 18042 |
From: David A. <dm...@an...> - 2002-01-15 17:35:48
|
I've never built it myself but I did look to see if it was available: www.rpmfind.net has a gtkglarea-1.2.3-2.src.rpm, which I assume is the latest version. |
From: Coleman M. <cm...@uc...> - 2002-01-15 17:15:35
|
David- Thanks for the suggestion. As I am new to Linux, how would I do that. Is the source available on the redhat site? Thanks. ocleman David Andersen wrote: > I don't know anything about Yellow Dog Linux, but perhaps you could compile > gtkglarea from source? |
From: David A. <dm...@an...> - 2002-01-15 13:48:52
|
I don't know anything about Yellow Dog Linux, but perhaps you could compile gtkglarea from source? |
From: Coleman M. <cm...@uc...> - 2002-01-14 21:16:39
|
Greetings- I am running Yellowdoglinux(a redhat variant for powerpc) and am trying to use Vpython. My version of linux does not have the gtkgl. The FAQs for Vpython point to the redhat site. From a CD of the most recent redhat, I used the gtkglarea.... but that needs the ld.linux.so.2 which is not present. Any suggestions? Is there a version of these libraries that i can use without this dependency? I have downloaded the python 2.2, and found the other modules needed, but cannot seem to get around this one. Thanks. Coleman Mosley |
From: David A. <dm...@an...> - 2002-01-14 14:02:46
|
tkr.mainloop runs processing events for the TK window until the TK window is closed - at which time the run flag is set to stop, stoping the other thread. |
From: Bruce S. <ba...@an...> - 2002-01-13 17:29:22
|
--On Saturday, January 12, 2002 22:47 +0000 Do...@ao... wrote: > OK, I'll be a good straight man. What do you want me to do with this > transparency patch. (Phrase your answer as something anatomically > possible for an intellectually challenged physicist) > > Wayne Keen The short answer is, "You don't have to do anything!" Here's the long answer: What dman was doing was proposing new C++ code for the Visual module. Here's a very brief sketch of the way open-source development works, using Visual as an example. SourceForge (sf.net) is a repository for open-source development projects, one of which is VPython. You can see this by going to sf.net and typing "vpython" into the search box. Housed there is a "CVS" repository ("Concurrent Versions System") which holds not only the most recent version of each and every C++ file in the Visual project, but all previous versions as well. There exist (freeware) CVS programs for checking out any or all files from the CVS repository. Having checked them out (which does not lock out anyone else from checking them out), you make changes in one or more files, recompile Visual (the files include project compilation files for Microsoft Visual Studio and makefiles for Linux), and test your changes. When you're satisfied, you run a "diff" program whose input is a current CVS file and your changed version, and whose output is a "patch" file of the kind that dman posted, listing all of the differences between the two files in a standardized form. Next a "gatekeeper" (one of the small number of people responsible for maintaining the integrity of the project) can use a "patch manager" program to apply the patch file to the current CVS version to produce a new version of the file. There may be other patches to the file, from other people. With all patches applied, the gatekeeper tests the changes. If the gatekeeper agrees that the new version should become part of the project, the new version is checked into the CVS repository, using a CVS program that leaves the previous version in place. With all previous versions kept in CVS, it is possible to backtrack when something goes awry, retreating to a point when some feature worked. (Actually, I believe the multiple versions are themselves stored as something like incremental patch files based on previous versions, and these patch files take up little space.) As you can see, these mechanisms make it possible for many people to work together. However, there does need to be good communication among contributors to avoid duplication and collisions of certain kinds. CVS doesn't automatically resolve conflicts involving overlapping patches; that has to be done by a knowledgeable human. One other mechanism provided by CVS is a "branch", where someone starts a major project that will take a long time and doesn't want to interfere with ongoing work. When the branched version is ready, that person has the responsibility to merge the side branch into the main branch. Python itself is a big open source development project that works in this way. However, it is so big that it has fairly elaborate additional mechanisms for planning, documenting changes, etc. Bruce |
From: <Do...@ao...> - 2002-01-13 03:49:29
|
OK, I'll be a good straight man. What do you want me to do with this transparency patch. (Phrase your answer as something anatomically possible for an intellectually challenged physicist) Wayne Keen |
From: dman <ds...@ri...> - 2002-01-12 18:39:09
|
On Sat, Jan 12, 2002 at 08:37:06AM -0500, Do...@ao... wrote: | The new version does what I need PERFECTLY. Thank you. | | I am amazed. I sent a somewhat vague description of a problem at 8:30 PM | EST, and by the next morning there is a new release with the problem fixed. | Imagine that happening with Micro$oft! Here's a quote I got from Bram Moolenaar's sig (he's the vim creator nad maintainer) : Q: What is the difference betwee open-source and commercial software? A: If you have a problem with commercial software you can call a phone number and they will tell you it might be solved in a future version. For open-source sofware there isn't a phone number to call, but you get the solution within a day. Funny, and also rather realistic. -D -- Through love and faithfulness sin is atoned for; through the fear of the Lord a man avoids evil. Proverbs 16:6 |
From: <Do...@ao...> - 2002-01-12 13:37:13
|
The new version does what I need PERFECTLY. Thank you. I am amazed. I sent a somewhat vague description of a problem at 8:30 PM EST, and by the next morning there is a new release with the problem fixed. Imagine that happening with Micro$oft! I am currently using VPython to do some data analysis for a paper for the SPIE Thermosense conference in April. I'll make sure to mention you guys and VPython in my acks... Thanks A blown away user! |
From: dman <ds...@ri...> - 2002-01-11 04:09:52
|
Attached is a patch that is a first step towards transparency. It adds an alpha channel to 'rgb' objects that defaults to 1.0 if it isn't specified. It also turns on alpha blending for spheres. I haven't started to touch the ordering issue yet. I can put two spheres slightly overlapping and see one inside the other (the one created is inside). I have a question regarding style, sub-object construction and the 'rgb' class. There are two constructors there : ~~~~~~~~~~~~~~~~~~ rgb::rgb() { r = g = b = 1.0; a = ALPHA_DEFAULT ; } rgb::rgb(float _r, float _g, float _b, float _a) : r(_r), g(_g), b(_b), a(_a) { } ~~~~~~~~~~~~~~~~~~ Why is sub-object construction used for one and not the other? I think that one style should be chosed and used consistently. In this case, just ints, it doesn't matter which one. -D -- A wise servant will rule over a disgraceful son, and will share the inheritance as one of the brothers. Proverbs 17:2 |
From: dman <ds...@ri...> - 2002-01-11 03:03:15
|
Attached is a patch for the Makefile. The first difference is that the clean target wasn't working for me. "rm *.{o,d}" wasn't removing the files, so I changed it to "rm *.o *.d". I also made a couple of changes that will reduce the overhead of the build process. Unlike a shell script, a Makefile works by textual substitution. So, a line like GTK_INCLUDES = `gtk-config --cflags gtk gthread` doesn't execute gtk-config but simply puts that whole string in a variable. When this variable is expanded in a shell command (when gcc is run) _then_ the shell creates the subshell to run gtk-config in. This means that gtk-config is run once for every file that is compiled. I changed this to instead run the script in a subshell once and use the result repeatedly. The other change restricts the Makefile to work only with GNU make (but since 'gcc' and 'g++' are explicitly used I don't think this is a problem). The change is the ":=" operator. As stated above, make operates on textual substitution. Thus lines like : VAR=value VAR2=${VAR} VAR2 gets the value "${VAR}". ${VAR} isn't expanded until ${VAR2} is expanded. Then it is expanded every time ${VAR2} is expanded. The ":=" operator expands the string immediately and binds that result to VAR2. This reduces the number of lookups and expansions that make has to do. For a project as small as vpython is right now these changes are likely to be insignificant. The final change I made was to make PYTHON_INCLUDES work for my system. (I don't expect that to be included in cvs, but I don't want to butcher the patch so that it doesn't work :-)) I thought there was a way to override this in the environment without changing the Makefile, but it didn't work when/how I tried it. HAND, -D PS. Is there a -dev list? I didn't see one. -- Pleasant words are a honeycomb, sweet to the soul and healing to the bones. Proverbs 16:24 |
From: Bruce S. <ba...@an...> - 2002-01-11 02:58:00
|
I also updated the file Visual-2001-11-18.zip at vpython.org by replacing the graph.py module, to fix ghistogram. This is the visual folder used by pre-Python 2.2. Bruce Sherwood |
From: Bruce S. <ba...@an...> - 2002-01-11 02:29:35
|
Many thanks for this detailed report! It turns out that there were several different things wrong with the ghistogram machinery in the graph module, which are now fixed in graph.py in the zip file Visual-2002-01-10.zip at vpython.org, and also incorporated into the VPython installer for Python 2.2. With the fixes, the following routine plots correctly: from visual.graph import * agelist1 = [-5, 37, -12, 21, -8, 63, 52, 75, -7] ages = ghistogram(bins=arange(-20, 80, 20), color=color.red, delta=5) ages.plot(data=agelist1) # plot the age distribution Note too the use of delta to specify the width of the bar, a feature not previously mentioned in the documentation. Bruce Sherwood --On Thursday, January 10, 2002 20:29 +0000 Do...@ao... wrote: > I have been running into some problems with the ghistogram routine. I > have some data, which includes negative and positive values. When I set > the bins and xmin, xmax to allow for this, the distribution ends up > piled up on the xmax side of the plot. If I offset the data to be just > positive, it works, but the plot is not as clear. Did I miss something > and this feature only allows for positive values? |