From: Symion <kn...@ip...> - 2010-07-18 05:17:24
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> On 18/07/2010 8:39 AM, Robert French wrote: <blockquote cite="mid:4E3...@rf..." type="cite"> <pre wrap="">Yes, C Anthony is correct. I want it to stay at an absolute pixel coordinate (2-D) in the window. Completely unaffected by any rotations or zooms. The existing objects all move with the frame. I had thought about the constantly-reposition option but was hoping there was something easier. This seems like it would be a common desire. For example, to put a title or timestamp or something in the display window. I'll try those suggestions and see if I can get it to work BTW, my application is orbit visualization of spacecraft. I just want the date and time to stay in one place. Thanks. On Jul 17, 2010, at 11:20 AM, C Anthony Risinger <a class="moz-txt-link-rfc2396E" href="mailto:an...@ex..."><an...@ex...></a> wrote: </pre> <blockquote type="cite"> <pre wrap=""> On Sat, Jul 17, 2010 at 1:07 PM, Bruce Sherwood <a class="moz-txt-link-rfc2396E" href="mailto:bas...@nc..."><bas...@nc...></a> wrote: </pre> <blockquote type="cite"> <pre wrap="">The current version of VPython (5.32) offers a text object as well as a label object. The label object always faces the viewer, independent of rotation, whereas the (new) text object is extruded text that behaves like all other objects. Seems like one of these two should do what you want. The text object can have zero thickness. I'm not sure what you mean by a "time" display, but presumably you know about the graphing option. Bruce Sherwood </pre> </blockquote> <pre wrap=""> i think what the OP is looking for is HUD functionality, ie. the "time" display stays locked to the viewport, regardless of zoom or rotation. AFIAK this is not currently supported in vpython. however, the same effect can be achieved by using a "HUD frame" and constantly recomputing it's position/zoom/rotation as the main frame moves. the other option is to put your app into a "container" frame, and ensure the main frame never moves... anything added to the main frame is a part of the HUD; i think the issue with this was mouse grabs are sent to the main frame (IIRC). sorry, i don't have any code examples on hand :-( C Anthony ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/sprint-com-first">http://p.sf.net/sfu/sprint-com-first</a> _______________________________________________ Visualpython-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Vis...@li...">Vis...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/visualpython-users">https://lists.sourceforge.net/lists/listinfo/visualpython-users</a> -- Limited filtering has been provided due to external email forwarding. For details please review: <a class="moz-txt-link-freetext" href="http://www.onlymyemail.com/faqs/forwarding.html">http://www.onlymyemail.com/faqs/forwarding.html</a> </pre> </blockquote> <pre wrap=""> ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/sprint-com-first">http://p.sf.net/sfu/sprint-com-first</a> _______________________________________________ Visualpython-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Vis...@li...">Vis...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/visualpython-users">https://lists.sourceforge.net/lists/listinfo/visualpython-users</a> </pre> </blockquote> Hi there,<br> Is this what you are looking for?<br> <br> ***********************<br> from visual import *<br> <br> move = {'up': (0,1,0), 'down': (0,-1,0),<br> 'left': (-1,0,0), 'right': (1,0,0)}<br> # Preset pos<br> loc = (0.0, 180.0, 0.0)<br> cli = label(pos=scene.center,<br> color=color.yellow,<br> opacity=0, box=0, line=0)<br> scene.show_rendertime=True<br> scene.visible = True<br> <br> scene.autoscale = False<br> scene.range = 10<br> box(color=color.red)<br> while 1:<br> cli.pos = scene.center # Maintain object pos<br> cli.xoffset = loc[0] # Constantly monitor<br> cli.yoffset = loc[1] # scene.size<br> cli.text = 'Time=%s' %(time.ctime())<br> if scene.mouse.events>0:<br> mk = scene.mouse.getevent()<br> if mk.release:<br> scene.center = scene.mouse.pos<br> elif scene.kb.keys>0:<br> km = scene.kb.getkey()<br> if move.has_key(km):<br> new = move.get(km)<br> loc = (new[0]+loc[0],new[1]+loc[1],0)<br> print 'Position = (%0.2f,%0.2f,%0.2f)' %(loc[0],loc[1],loc[2])<br> <br> ****************<br> <br> Use cursor keys to reposition time/date message.<br> I'm sure there is a better way of calculating the position but I<br> think you get the idea.<br> Note that show_rendertime places a message that is Really fixed,<br> even when changing window size!<br> I would like to know how That is achieved.<br> <br> Symion<br> <br> </body> </html> |