Tkinter: focus/text selection problem with tkFileDialog

From: Irmen de Jong (irmen_at_-nospam-remove-this-xs4all.nl)
Date: 04/30/04


Date: Fri, 30 Apr 2004 15:51:40 +0200

Hi,
I'm having trouble with the code below.
It's just a regular Tk text widget in which you can type and
select text as expected, however the call to tkFileDialog.askopenfilename()
seems to screw things up. After the file dialog, I can no longer use
the Text widget (typing, selecting, it doesn't work anymore!)
What am I doing wrong?

TIA,
--Irmen de Jong

-----test.py----
import Tkinter, tkFileDialog

window=Tkinter.Tk()
txt=Tkinter.Text(window)
txt.insert(Tkinter.END,"Choose a file, then try to select me")
txt.pack()

name=tkFileDialog.askopenfilename()
txt.insert(Tkinter.END,"\nFile chosen: "+name)
window.mainloop()



Relevant Pages

  • Re: Tkinter: focus/text selection problem with tkFileDialog
    ... >>I'm having trouble with the code below. ... >>It's just a regular Tk text widget in which you can type and ... >>dialog, I can no longer use the Text widget (typing, selecting, it doesn't ... >>work anymore!) ...
    (comp.lang.python)
  • Re: Tkinter: focus/text selection problem with tkFileDialog
    ... > I'm having trouble with the code below. ... > It's just a regular Tk text widget in which you can type and ... > dialog, I can no longer use the Text widget (typing, selecting, it doesn't ... > work anymore!) ...
    (comp.lang.python)
  • Re: executing shell commands
    ... destination is a widget. ... If it's a terminal>@stdout is perfect and much ... less trouble. ...
    (comp.lang.tcl)
  • Re: [Tk] Scrollbar, placer, packer, size...
    ... > them work with other widgets is not worth the trouble when you ... > can put your unusual widget into a supported widget like canvas. ... I wonder what the cost of using a canvas instead of a dedicated ... scrollable-frame widget is? ...
    (comp.lang.tcl)
  • iWidgets scrolledtext: "tabs" option available?
    ... Is this option (or a compatible option) available for the scrooledtext ... widget in iWidgets? ... It exists for the regular tk text widget ...
    (comp.lang.tcl)