tkFileDialog and locale under Linux

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthias Huening

    tkFileDialog and locale under Linux

    Hi,

    I have problems using tkFileDialog under Linux (Ubuntu 8.04 in my case, but
    other Linuxes seem to show the same behaviour).

    The following works fine:

    import tkFileDialog
    f = tkFileDialog.as kopenfilename()

    No problem, I can chose a filename.

    But when switching the locale (in my case to German) like this:

    import locale
    locale.setlocal e(locale.LC_ALL , '')

    the file dialog won't work anymore. The traceback is:

    Traceback (most recent call last):
    File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1406, in __call__
    return self.func(*args )
    File "TextSTAT.p yw", line 701, in datei_hinzu
    dateinamen = tkFileDialog.as kopenfilename(i nitialdir=cfg['FileDir'],
    filetypes= (('All', '*.*'),('Text', '*.txt'),('HTML ', '*.htm*'),('MS Word',
    '*.doc'),('MS Word 2007', '*.docx'),('Ope nOffice 1.x',
    '*.sxw'),('Open Office 2.x', '*.odt')), multiple=1)
    File "/usr/lib/python2.5/lib-tk/tkFileDialog.py ", line 125, in
    askopenfilename
    return Open(**options) .show()
    File "/usr/lib/python2.5/lib-tk/tkCommonDialog. py", line 48, in show
    s = w.tk.call(self. command, *w._options(sel f.options))
    TclError: expected floating-point number but got "0.0"


    Switching back to the C-locale solves the problem:
    locale.setlocal e(locale.LC_ALL , 'C')

    tkFileDialog will work again.

    Any ideas?

    Best, Matthias

Working...