From: Poul R. <Pou...@sk...> - 2008-10-11 15:43:20
|
What is the error in the example below? I want to make some 3D-text in the same display as the axes (and later some more objects). Apparently, another window is created automatically.... Poul Riis from visual.text import * scene=display(title="Testing text in 3D...",width=860,height=860,forward=(-2,-1,-0.5)) xakse=arrow(pos=(-3,0,0),axis=(6,0,0),color=(1,0,1),shaftwidth=0.05,fixedwidth = 1) yakse=arrow(pos=(0,-3,0),axis=(0,6,0),color=(1,1,0),shaftwidth=0.05,fixedwidth = 1) zakse=arrow(pos=(0,0,-3),axis=(0,0,6),color=(0,0,1),shaftwidth=0.05,fixedwidth = 1) homesweethome=text(pos=(0,3,0), string='HOME SWEET HOME', color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') |
From: Poul R. <Pou...@sk...> - 2008-10-11 19:17:34
|
I see... Next problem: I want to introduce some sliders but as soon as I add the line 'from visual.controls import *' I get the following error message: Traceback (most recent call last): File "C:/Python25/Lib/site-packages/visual/examples/texttest_3", line 10, in <module> homesweethome=text(display=textscene,pos=(0,3,0), string='HOME SWEET HOME', color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') TypeError: 'module' object is not callable What is wrong? Poul Riis from visual.text import * from visual.controls import * textscene=display(title="Testing text in 3D...",width=860,height=860,forward=(-2,-1,-0.5)) xakse=arrow(pos=(-3,0,0),axis=(6,0,0),color=(1,0,1),shaftwidth=0.05,fixedwidth = 1) yakse=arrow(pos=(0,-3,0),axis=(0,6,0),color=(1,1,0),shaftwidth=0.05,fixedwidth = 1) zakse=arrow(pos=(0,0,-3),axis=(0,0,6),color=(0,0,1),shaftwidth=0.05,fixedwidth = 1) homesweethome=text(display=textscene,pos=(0,3,0), string='HOME SWEET HOME', color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') |
From: Bruce S. <Bru...@nc...> - 2008-10-11 21:28:33
|
I don't fully understand this problem, but a solution is to import the controls module before importing the text module. The issue is some kind of collision between the name of a module ("text"), the name of an object in that module ("text"), and an attribute "text" of some objects in the controls module. I'm afraid that the text module is a bit of an orphan. It was created very early in the development of VPython but hasn't received much care and feeding. Bruce Sherwood Poul Riis wrote: > I see... > > Next problem: > I want to introduce some sliders but as soon as I add the line 'from > visual.controls import *' I get the following error message: > Traceback (most recent call last): > File "C:/Python25/Lib/site-packages/visual/examples/texttest_3", line > 10, in <module> > homesweethome=text(display=textscene,pos=(0,3,0), string='HOME SWEET > HOME', color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') > TypeError: 'module' object is not callable > > What is wrong? > > > Poul Riis > > > > > > > from visual.text import * > from visual.controls import * > > textscene=display(title="Testing text in > 3D...",width=860,height=860,forward=(-2,-1,-0.5)) > > xakse=arrow(pos=(-3,0,0),axis=(6,0,0),color=(1,0,1),shaftwidth=0.05,fixedwidth > = 1) > yakse=arrow(pos=(0,-3,0),axis=(0,6,0),color=(1,1,0),shaftwidth=0.05,fixedwidth > = 1) > zakse=arrow(pos=(0,0,-3),axis=(0,0,6),color=(0,0,1),shaftwidth=0.05,fixedwidth > = 1) > > homesweethome=text(display=textscene,pos=(0,3,0), string='HOME SWEET > HOME', color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |
From: Tyler B. <dan...@li...> - 2008-10-11 17:42:10
|
I'm pretty sure doing "scene=display(...)" is not considered the normal way of doing things. I can't say exactly why it matters because it does seem like that might work. But I replaced that line with: scene.title="Testing text in 3D..." scene.width=860 scene.height=860 scene.forward=(-2,-1,-0.5) and it seems to work fine. Poul Riis wrote: > What is the error in the example below? > I want to make some 3D-text in the same display as the axes (and later > some more objects). Apparently, another window is created automatically.... > > Poul Riis > > > > > from visual.text import * > > scene=display(title="Testing text in > 3D...",width=860,height=860,forward=(-2,-1,-0.5)) > > xakse=arrow(pos=(-3,0,0),axis=(6,0,0),color=(1,0,1),shaftwidth=0.05,fixedwidth > = 1) > yakse=arrow(pos=(0,-3,0),axis=(0,6,0),color=(1,1,0),shaftwidth=0.05,fixedwidth > = 1) > zakse=arrow(pos=(0,0,-3),axis=(0,0,6),color=(0,0,1),shaftwidth=0.05,fixedwidth > = 1) > > homesweethome=text(pos=(0,3,0), string='HOME SWEET HOME', > color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |
From: Bruce S. <Bru...@nc...> - 2008-10-11 21:06:01
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> This is a bug in the __init__ routine in the text module. That routine should start out like this:<br> <br> def __init__(self, pos=(0,0,0), axis=defaultdir, string='', justify='left',<br> height=1.0, width=None, depth=0, color=None, up=None, visible=1, **keywords):<br> if keywords.has_key('display'):<br> self.display = keywords('display')<br> else:<br> self.display = display.get_selected()<br> <br> Thanks for reporting this.<br> <br> Bruce Sherwood<br> <br> Tyler Breisacher wrote: <blockquote cite="mid:48F...@li..." type="cite"> <pre wrap="">I'm pretty sure doing "scene=display(...)" is not considered the normal way of doing things. I can't say exactly why it matters because it does seem like that might work. But I replaced that line with: scene.title="Testing text in 3D..." scene.width=860 scene.height=860 scene.forward=(-2,-1,-0.5) and it seems to work fine. Poul Riis wrote: </pre> <blockquote type="cite"> <pre wrap="">What is the error in the example below? I want to make some 3D-text in the same display as the axes (and later some more objects). Apparently, another window is created automatically.... Poul Riis from visual.text import * scene=display(title="Testing text in 3D...",width=860,height=860,forward=(-2,-1,-0.5)) xakse=arrow(pos=(-3,0,0),axis=(6,0,0),color=(1,0,1),shaftwidth=0.05,fixedwidth = 1) yakse=arrow(pos=(0,-3,0),axis=(0,6,0),color=(1,1,0),shaftwidth=0.05,fixedwidth = 1) zakse=arrow(pos=(0,0,-3),axis=(0,0,6),color=(0,0,1),shaftwidth=0.05,fixedwidth = 1) homesweethome=text(pos=(0,3,0), string='HOME SWEET HOME', color=color.red,height=0.1,width=0.1, depth=0.05, justify='center') ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world <a class="moz-txt-link-freetext" href="http://moblin-contest.org/redirect.php?banner_id=100&url=/">http://moblin-contest.org/redirect.php?banner_id=100&url=/</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> <pre wrap=""><!----> ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world <a class="moz-txt-link-freetext" href="http://moblin-contest.org/redirect.php?banner_id=100&url=/">http://moblin-contest.org/redirect.php?banner_id=100&url=/</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> </body> </html> |
From: Bruce S. <Bru...@nc...> - 2008-10-13 14:25:38
|
I had a typo in the correction I posted for the text.py module (I had parentheses where I should have had brackets). Here's is the corrected correction: class text: def __init__(self, pos=(0,0,0), axis=defaultdir, string='', justify='left', height=1.0, width=None, depth=0, color=None, up=None, visible=1, **keywords): if keywords.has_key('display'): self.display = keywords['display'] else: self.display = display.get_selected() |