Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

error

 
Jump to:  
 
Anish Chapagain
PostPosted: Mon Jul 21, 2008 12:30 pm    Post subject: error
       
from Tkinter import *
root=Tk()
f=Frame(root,height=200,width=200)
b=Button(f,text="quit",command=f.quit)
f.pack()
root.mainloop()

--------------------------------------------------
from Tkinter import *
import sys
root=Tk()
f=Frame(root,height=200,width=200)
b=Button(f,text="quit",command=sys.exit)
f.pack()
root.mainloop()

I am wondering that why the button after clikcing is not closing the
window..please any suggestion..
i tries command=f.quit, sys.quit also..
if there is something i'm missing please help
 

 
Fredrik Lundh
PostPosted: Mon Jul 21, 2008 12:30 pm    Post subject: Re: error
       
Anish Chapagain wrote:

Quote:
from Tkinter import *
root=Tk()
f=Frame(root,height=200,width=200)
b=Button(f,text="quit",command=f.quit)
f.pack()
root.mainloop()

--------------------------------------------------
from Tkinter import *
import sys
root=Tk()
f=Frame(root,height=200,width=200)
b=Button(f,text="quit",command=sys.exit)
f.pack()
root.mainloop()

I am wondering that why the button after clikcing is not closing the
window..please any suggestion..
i tries command=f.quit, sys.quit also..
if there is something i'm missing please help

Assuming you accidentally left out the line where you're displaying the
button (e.g. "b.pack()"), both your samples work when running this from
the command line.

Are you perhaps running this code from inside IDLE? IDLE is itself
written in Tkinter, and it doesn't always shut down the Tkinter
subsystem properly.

.... and I have to admit that I don't know what the currently recommended
workaround is -- you'll find plenty of documentation on the net that
just says "don't do that" (run Tkinter programs from within IDLE, that
is), but surely someone should have fixed that issue by now?.

</F>
 

 
Fredrik Lundh
PostPosted: Mon Jul 21, 2008 12:30 pm    Post subject: Re: error
       
Anish Chapagain wrote:

Quote:
hi thank's i probably missed the b.pack() but it's till the window is
not closed and error message of Windows Appear

what does that error message say?

</F>
 

 
Anish Chapagain
PostPosted: Mon Jul 21, 2008 1:11 pm    Post subject: Re: error
       
On Jul 21, 1:47 pm, Fredrik Lundh <fred...@pythonware.com> wrote:
Quote:
Anish Chapagain wrote:
from Tkinter import *
root=Tk()
f=Frame(root,height=200,width=200)
b=Button(f,text="quit",command=f.quit)
f.pack()
root.mainloop()

--------------------------------------------------
from Tkinter import *
import sys
root=Tk()
f=Frame(root,height=200,width=200)
b=Button(f,text="quit",command=sys.exit)
f.pack()
root.mainloop()

I am wondering that why the button after clikcing is not closing the
window..please any suggestion..
i tries command=f.quit, sys.quit also..
if there is something i'm missing please help

Assuming you accidentally left out the line where you're displaying the
button (e.g. "b.pack()"), both your samples work when running this from
the command line.

Are you perhaps running this code from inside IDLE?  IDLE is itself
written in Tkinter, and it doesn't always shut down the Tkinter
subsystem properly.

... and I have to admit that I don't know what the currently recommended
workaround is -- you'll find plenty of documentation on the net that
just says "don't do that" (run Tkinter programs from within IDLE, that
is), but surely someone should have fixed that issue by now?.

/F>- Hide quoted text -

- Show quoted text -

hi thank's i probably missed the b.pack() but it's till the window is
not closed and error message of Windows Appear
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

Są pewne sprawy - Grzegorz Turnau rtv obciążenie Może się wydawać - Ewelina Flinta clarocode.biz