From: kirby u. <kir...@gm...> - 2010-11-13 05:38:03
|
I installed the latest Visual Python 5 on a Win7 laptop a couple days ago. Everything is working great. I used the binary. However, it put Fonttools in a folder under another Foottools folder I'm pretty sure. I had to diagnose that problem manually. Apologies if the glitch was on my end. Below is one of the programs I used in my Martian Math class this summer. I used it as scaffolding, with students tweaking it to listen for more colors. Kirby Urner Portland, OR from visual import * def setscene ( ): """set the stage for our little drama""" scene2 = display(title='Pipedream 2', fullscreen= True, autoscale = True, background=color.white) return scene2 def pipedream( n ): delta_x = 0.1 # move to the right by this little amount right_limit = 30 # at this rightmost limit, remove the shape from the list scene = setscene() scene.select() leftpipe = cylinder(pos = (-35,0,0), axis = (5,0,0), radius = 1.5, color = color.green) rightpipe = cylinder(pos = (35,0,0), axis = (-5,0,0), radius = 1.5, color = color.green) theshapes = [ ] # a list of all active shapes spacer = 5 # counts down to put space between shape creation events thecolor = color.red # default color while True: "color picker -- add more options?" if scene.kb.keys: # event waiting to be processed? s = scene.kb.getkey() # get keyboard info if s in ['b' , 'B']: thecolor = color.blue if s in ['r', 'R']: thecolor = color.red if s in ['o', 'O']: thecolor = color.orange if len (theshapes ) < n and spacer <= 0: theshapes.insert (0, pickone( thecolor ) ) spacer = 5 for shape in theshapes: if shape.x > right_limit: shape.visible = False del shape theshapes.pop( ) # drop off the list else: shape.x = shape.x + delta_x # shift to the right spacer = spacer - delta_x rate(50) def pickone( c ): return sphere( pos = (-30,0,0), radius = 1, color = c) if __name__ == '__main__': pipedream( 11 ) |
From: Bruce S. <bas...@nc...> - 2010-11-13 16:43:53
|
This is an unfamiliar problem. Was this with Python 2.7 or 3.1? It is normal that in site-packages you'll see a folder FontTools (with an uppercase F), and inside that folder you'll see a folder fontTools (with a lowercase f) plus some other files. You should also see in site-packages a file FontTools.pth. Could you perhaps uninstall and reinstall VPython and then report on what you see in site-packages? A test that all is working properly is to run the example program text3D.py, which uses the FontTools module (and others) to produce 3D text. Bruce Sherwood On Fri, Nov 12, 2010 at 10:37 PM, kirby urner <kir...@gm...> wrote: > > I installed the latest Visual Python 5 on a Win7 laptop > a couple days ago. Everything is working great. I used > the binary. > > However, it put Fonttools in a folder under another > Foottools folder I'm pretty sure. I had to diagnose that > problem manually. Apologies if the glitch was on my end. > |
From: kirby u. <kir...@gm...> - 2010-11-13 17:25:47
|
On Sat, Nov 13, 2010 at 8:43 AM, Bruce Sherwood <bas...@nc...> wrote: > This is an unfamiliar problem. Was this with Python 2.7 or 3.1? It is > normal that in site-packages you'll see a folder FontTools (with an > uppercase F), and inside that folder you'll see a folder fontTools > (with a lowercase f) plus some other files. You should also see in > site-packages a file FontTools.pth. > > Win7 / Python 2.7 Oh, so that's normal. I thought because the inner folder with the __init__.py was that deep that it wasn't found on the search path, and indeed it was not as when I tried to run the code posted above, it crashed for not finding some fonttools stuff. When I moved the subdirectly to a higher level, it worked. I didn't think to look at site-packages for a FontTools.pth. I should do some more analysis and get back to ya. > Could you perhaps uninstall and reinstall VPython and then report on > what you see in site-packages? A test that all is working properly is > to run the example program text3D.py, which uses the FontTools module > (and others) to produce 3D text. > > Bruce Sherwood > > Yes I will do that. Thanks for the reply. Kirby |
From: kirby u. <kir...@gm...> - 2010-11-13 18:50:43
|
I uninstalled and reinstalled and this time had no problems this time. I had recently been adding a different .pth file to site-packages, don't see how this could have messed me up but I report it anyway. Anyway, no worries at the moment. I'm sure if this were a widespread problem you'd be getting a lot more similar reports. Kirby On Sat, Nov 13, 2010 at 9:49 AM, Bruce Sherwood <bas...@nc...> wrote: > I tried the experiment of removing FontTools.pth from site-packages > before starting up Python, and in that case I get an execution error > about not being able to find the fontTools module. > > Bruce > |
From: kirby u. <kir...@gm...> - 2010-11-13 18:57:27
|
Thank you for your advice re scene.select(). I do not bill myself as a VPython expert and tips such as yours are a primary reason why I joined this list. For more context regarding what my class setup is like, here's a link to my Martian Math table of contents: http://www.4dsolutions.net/satacad/martianmath/toc.html (you'd find some embedded Visual code) Also, I've done a fairly sophisticated intro to rendering vs. real time computer graphics for a course I called Pythonic Math: http://www.4dsolutions.net/ocn/pymath.html (viztoyz.py was the VPython module) Kirby Urner Portland, Oregon PS: I note 'Reply to' is set to your address, not to the list. Will adjust my reflexes accordingly. 8D/4D On Sat, Nov 13, 2010 at 9:39 AM, Bruce Sherwood <bas...@nc...> wrote: > If you do get the error again, I'd appreciate seeing what is reported > in the Shell window. Thanks. > > A very minor point: Perhaps it's there for a pedagogical purpose, but > "scene.select()" isn't necessary in your program, because the way the > Visual module works is that the most recent display creation governs > where objects will go. You only need scene.select() in a situation > where you have multiple displays and you want to switch to one that is > different from the currently active one. > > Bruce > > On Sat, Nov 13, 2010 at 10:20 AM, kirby urner <kir...@gm...> > wrote: > > On Sat, Nov 13, 2010 at 8:43 AM, Bruce Sherwood <bas...@nc...> > wrote: > >> > >> This is an unfamiliar problem. Was this with Python 2.7 or 3.1? It is > >> normal that in site-packages you'll see a folder FontTools (with an > >> uppercase F), and inside that folder you'll see a folder fontTools > >> (with a lowercase f) plus some other files. You should also see in > >> site-packages a file FontTools.pth. > >> > > > > Win7 / Python 2.7 > > Oh, so that's normal. > > I thought because the inner folder with the __init__.py was that deep > that > > it wasn't found on the search path, and indeed it was not as when I tried > > to run the code posted above, it crashed for not finding some fonttools > > stuff. When I moved the subdirectly to a higher level, it worked. > > I didn't think to look at site-packages for a FontTools.pth. I should do > > some more analysis and get back to ya. > > > >> > >> Could you perhaps uninstall and reinstall VPython and then report on > >> what you see in site-packages? A test that all is working properly is > >> to run the example program text3D.py, which uses the FontTools module > >> (and others) to produce 3D text. > >> > >> Bruce Sherwood > >> > > > > Yes I will do that. Thanks for the reply. > > Kirby > > > > > ------------------------------------------------------------------------------ > > Centralized Desktop Delivery: Dell and VMware Reference Architecture > > Simplifying enterprise desktop deployment and management using > > Dell EqualLogic storage and VMware View: A highly scalable, end-to-end > > client virtualization framework. Read more! > > http://p.sf.net/sfu/dell-eql-dev2dev > > _______________________________________________ > > Visualpython-users mailing list > > Vis...@li... > > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > > |
From: kirby u. <kir...@gm...> - 2010-11-14 00:55:10
|
On Sat, Nov 13, 2010 at 2:21 PM, Bruce Sherwood <bas...@nc...> wrote: > Thanks for the links. I happened to notice (in planets.py) these statements: > > from visual import * > from math import pi, sin, cos, radians > > The second import is superfluous. I found a similar situation in > vfun.py. Here is a blurb from the first page of the VPython 5.4 > on-line VPython help (the vis module is new with VPython 5.4): Yep, good pointer. > > ---------------------------------------------------------------------------------------------------------- > For experienced programmers > > As a convenience to novice programmers to provide everything needed to > get started, "from visual import *" imports all of the Visual features > and executes "from math import *" and "from numpy import *". It also > arranges that for routines common to both math and numpy such as sqrt, > the much faster math routine is used when possible (when the argument > is a scalar rather than an array). > I had a baptism by fire re NumPy this spring when I was fielded by Holden Web to do three intensive days in generic Python for some of the Hubble people (Space Telescope Science Institute -- I was at Maryland Science Center on Hubble's 20th birthday, watching the 3D IMAX movie with a few other grays). http://worldgame.blogspot.com/2010/04/python-gig.html STScI is a principal driver behind NumPy as you probably know. > If you want to import the visual objects selectively, import them from > the vis module. Two simple examples: > > import vis > vis.box(color=vis.color.orange,material=vis.materials.wood) > > from vis import (box, color, materials) > box(color=color.orange, material=materials.wood) > > There are clean modules vis.controls, vis.filedialog, and vis.graph > equivalent to the modules visual.controls, visual.filedialog, and > visual.graph. The latter versions execute "from visual import *" and > are retained because some programs expect that behavior when importing > one of these modules. > > The documentation is written assuming that "from visual import *" is used. > ---------------------------------------------------------------------------------------------------------- > > Given your teaching involving Pov-ray, I hope you're aware of the > povexport module available in the Contributed section of vpython.org, > which makes it easy to export a scene from VPython to Pov-ray, to > render with higher quality. > Yes, though only dimly. I should be pointing students to that resource way more than I do. POV-Ray is fantastic. I came to Python from Visual FoxPro, where I was doing the computations and spitting out scene description language. I even published an article about doing this in FoxPro Advisor, introducing my mostly business type readers to newfangled "quadray coordinates" (mucho esoteric). Memorabilia: http://www.flickr.com/photos/17157315@N00/5126606082/ http://www.flickr.com/photos/17157315@N00/5126606312/in/photostream/ http://en.wikipedia.org/wiki/Quadray_coordinates > Bruce > > P.S. I find it confusing that the way the mailing list works is that > Reply goes to the sender rather than to the group. Seems wrong. Dunno > if there's a way to change that. > In Majordomo and others I've administered, yes it's easy. But I have never studied the Sourceforge API so perhaps it ain't so easy with that one. List admin can be a royal pain. Only doing like two at the moment, both on Yahoo! (pretty easy). > P.P.S. I too have been deeply involved in computational education. > Ruth Chabay and I have developed an alternative to the university > intro physics course taken by engineering and science students, > treating intro physics from a 20th-century perspective (the standard > course is essentially a 19th-century course, due to enormous inertia > in physics departments). One of the many 20th-century aspects of the > course is that we've introduced serious computational modeling by the > students, who write and/or revise VPython programs to model physical > systems and/or display in 3D abstract quantities such as fields. You > can read about this at matterandinteractions.org. > I'm still kicking myself for not getting to Ruth Chabay's presentations at the most recent AAPT conference in Portland, Oregon, where I was hanging out with Dr. Bob Fuller emeritus, University of Nebraska / Lincoln. Bob seems to track your work pretty closely, but then he's an expert tracker where physics education is concerned, as I know from our collaboration on the First Person Physics project. Here's my pithy write-up of said conference -- more than one VPython talk in the catalog as I recall, dang that I missed em: http://worldgame.blogspot.com/2010/07/physics-conference.html What I'm attempting to do with movingballs2.py (just posted) right now is get it wrapped as a "local server" type COM object on Windows 7using Mark Hammond's Win32 stuff, so I can dramatically demonstrate Python running as a separate process, independently of the calling program -- which would be Microsoft Visual FoxPro 9 again (still using it). I'm pretty sure I'd need to use threading or the new multi-process API in Python 2.7. I have non-threaded COM working in the ReportLab pilot (PDF generation), but that's InProcess, not Local Server (different flavors of COM). My client would be most impressed if I could have those colored balls moving across the screen and change their color interactively by entering function calls in the FoxPro shell e.g. # COM object in Windows raygun = CREATEOBJECT("MartianMath.movingballs") raygun.start() # trigger thread or process << control returns, balls moving in VPython window >> raygun.ballcolor("red") << color changes, Vpython keeps running, control back to Fox >> raygun.ballcolor("green") etc. raygun.stop() release raygun It'd be visually cool. However the client's eventual applications are not VPythonic -- a transportation engineering company doing truck load optimization (traveling salesman / GIS type stuff), and getting impressive results (production environment, paying clients -- dang that MSFT is pulling the plug on the Fox, at one time a proud flagship -- too proud, some say). Yes, this is all rather esoteric stuff, but maybe the more generic VPython-in-its-own-process problem has been well worked in another (similar-enough) example? And/or I'll just keep plugging away with my little experiments. Can't be *that* difficult. Kirby PS: I was a debate partner vis-a-vis the late Arthur Siegel whom I see credited at your web site. We were actually pretty good buddies for all that sparring, had some cool meetups in NYC. Pygeo is a tour de force Vpython application and serious projective geometry application http://pygeo.sourceforge.net/ |