Hello!

Michael Lange <[EMAIL PROTECTED]> wrote:
> I guess the tkFileDialog.Directory class isn't intended to be used
directly.
> Try tkFileDialog.askdirectory() instead.
> If there are problems with the grab state, try passing "parent=self.top"
to askdirectory().

That did it! Thanks a lot!

I would like to ask another question. I don't understand the exception
mechanism
of Python when running a Tkinter app. If an exception happens (it does
happen quite often
at the moment..), a traceback is written to the console while the Tk window
remains open
and the application is still running. This is not what I expected -- I
expected the application
would end. Why is that?

Is there a way to create an error handler for uncaught exceptions in Tkinter
apps?
In other words, can I change the behaviour from writing a traceback to the
console to
something else? Can I, for example, show a message box instead?

Here is a small example:

--- snip ---  
import Tix

def raise_exception():
  print 1/0
  
if __name__ == '__main__':
    root = Tix.Tk()
    root.title("Exception demo")

    Tix.Button(root, text = "Don't press", command = raise_exception).pack()

    try:
      root.mainloop()
    except:
      print "An error has occured."
--- snip ---

The except part gets never executed.

Kind regards,
Karsten.

-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to