473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

tkinter button disappears after execution of execfile.

'''on execution of button.py a button appears ,after clicking on the button it calls bounce.py but after closing bounce.py the button also closes...but i want the button to remain open...please help. im posting both the programs button.py and bounce.py NOTE: im using vpython in bounce.py and windows os'''

button.py
-------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2. import fileinput
  3.  
  4. root = Tk()
  5. root.title("Note Taker")
  6. def Button1():
  7.     execfile('bounce.py',{})
  8.  
  9. button1 = Button(root, text="bounce", command = Button1)
  10. text = Entry(root)
  11. button1.pack()
  12. root.mainloop()
----------------------------------------------------------------------------------------------------------------
bounce.py
-----------------------------------------------------------------------------------------------------------------

Expand|Select|Wrap|Line Numbers
  1. from visual import *
  2.  
  3. floor = box(length=4, height=0.5, width=4, color=color.blue)
  4.  
  5. ball = sphere(pos=(0,4,0), color=color.red)
  6. ball.velocity = vector(0,-1,0)
  7.  
  8. dt = 0.01
  9. while 1:
  10.     rate(100)
  11.     ball.pos = ball.pos + ball.velocity*dt
  12.     if ball.y < 1:
  13.         ball.velocity.y = -ball.velocity.y
  14.     else:
  15.         ball.velocity.y = ball.velocity.y - 9.8*dt
Mar 28 '10 #1

✓ answered by bvdet

Are you wanting to embed VPython in a Tkinter application? I don't know if it is possible. I found an example where someone as done it with wxPython:
http://mientki.ruhosting.nl/data_www...n_docking.html

You could try using os.popen() to call a visual window instead of execfile().

3 3540
bvdet
2,851 Expert Mod 2GB
Are you wanting to embed VPython in a Tkinter application? I don't know if it is possible. I found an example where someone as done it with wxPython:
http://mientki.ruhosting.nl/data_www...n_docking.html

You could try using os.popen() to call a visual window instead of execfile().
Mar 28 '10 #2
Glenton
391 Expert 256MB
Or maybe use threads?
Mar 28 '10 #3
thanks a lot...it works
Mar 29 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF...
2
by: Paul A. Wilson | last post by:
I'm new to Tkinter programming and am having trouble creating a reusable button bar... I want to be able to feed my class a dictionary of button names and function names, which the class will make....
4
by: Jeffrey Barish | last post by:
I'm confused about how to use the update_idletasks method. In my program, I have a handler for a button in which execution will linger. During that time, I would like for the GUI to continue to...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
1
by: Michael Yanowitz | last post by:
Hello: Below I have included a stripped down version of the GUI I am working on. It contains 2 dialog boxes - one main and one settings. It has the following problems, probably all related, that...
5
by: H J van Rooyen | last post by:
Hi, I am struggling to get the pack method to do what I intend. I am trying to display user input in a seperate window, along with a little description of the field, something like this: ...
0
luke14free
by: luke14free | last post by:
Hello, I want to develop a Windows Mobile application with Python and Tkinter (because it doesn't seem that other guy have been ported). I'm working on a Wm 5.0 pda, hp rx1955, using the pythonce...
3
by: J-Burns | last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in programming itself... :P. Need some help here. Problem 1: How do I make something appear on 2 separate windows using Tkinter? By...
0
by: nicstel | last post by:
Hello. My script run fine within python but not in my program(SDS/2 wich is a software like Autocad). The problem is I got an error when the time comes to read the line14 to 19. (Source code come...
1
by: Francesco Bochicchio | last post by:
Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: Uhm, I don't think you should use the grid manager to obtain a window like that. The grid manager is for equally distributing...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.