[Tkinter-discuss] problems of Tix.FileEntry and tkMessageBox in WinXP

Ma China mdata.cn at gmail.com
Thu Jun 3 10:34:49 CEST 2010

Hi, friends
  I'm programming with Tkinter/Tix. I want to use Tix.FileEntry, and only
find fe_obj['value'] to get the selected file, is there any other way? As I
find it may cause some memory problems, while used with tkMessageBox.
  Running the following codes, if I click "Work" twice, the program will
crash before the 2nd warning sub-window pops up. Even if I comment the 2
lines of adding Label self.sflb, it still dump.

  My pc is WinXP Version 2002 Service Pack 3, CPU is Intel Core2 2-core,
with Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
(Intel)] on win32.
  I find it may be due to conflicts with Tix.FileEntry. How to fix it?

import Tkinter, Tix
import tkMessageBox, tkFileDialog
class Worker():
    def __init__(self):
        self.root = Tix.Tk()
        self.sffm = Tkinter.Frame(self.root)
        self.sflb = Tkinter.Label(self.sffm, text='Select file        :')
        self.sfft = Tix.FileEntry (self.sffm)
        self.btfm = Tkinter.Frame(self.root)
        self.gnbt = Tkinter.Button(self.btfm,text='Work', command=self.work)

    def work(self) :
        ''' do all work '''
        print 1
        value = self.sfft["value"]
        # use showwarning/showerror, if click "Work' for 2 times, will dump
        tkMessageBox.showwarning('Title', '<%s>' % value)

        print '+%s+' % value

if __name__=='__main__':
    worker = Worker()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20100603/e04de15f/attachment.html>

More information about the Tkinter-discuss mailing list