The following works to produce a window with nothing displayed in it:

ball = sphere()
ball.visible = 0

Another scheme would be this:

scene.range = 1
ball = sphere(radius=1e-6)

The point is that Visual doesn't create a window unless there is something to display.

Bruce Sherwood

Mr Gerard Kelly wrote:
I'm trying to make this very simple program, where the idea is that you
click a tkinter button named "Ball" and then a ball will appear in the
visual window.

Problem is that the window itself doesn't pop up until the button is
pressed and the ball is created. I would like it to start out blank, and
then have the ball appear in it when the button is pressed.

I thought that having "self.display=display()" in the __init__ of the
Application would do this, but it doesn't seem to.

What do I need to add to this code to make it start out with a blank window?


from visual import *
from Tkinter import *
import sys


class Ball:
  def __init__(self):
    sphere(pos=(0,0,0))

class Application:
def __init__(self, root):
    self.frame = Frame(root)
    self.frame.pack()

    self.display=display()

    self.button=Button(self.frame, text="Ball", command=self.ball)
    self.button.pack()

  def ball(self):
    self.ball=Ball()

root=Tk()
app=Application(root)

root.mainloop()

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Visualpython-users mailing list
visualpython-us...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/visualpython-users
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to