tix.FileSelectBox causes crash: was A newbie question about using tix

David Sumbler david at aeolia.co.uk
Fri May 3 11:10:40 EDT 2019


On Wed, 2019-05-01 at 19:11 +0100, MRAB wrote:
> On 2019-05-01 17:44, David Sumbler wrote:
>  >
>  > On Tue, 2019-04-30 at 20:46 +0100, MRAB wrote:
    <snip>...</snip>
>  > > For some reason, tix widgets don't work with normal tkinter
> widgets,
>  > > so
>  > > you can't put a tix FileSelectBox on a tkinter.Tk widget.
>  > >
>  > > There is, however, a tix.Tk widget that you can use instead:
>  > >
>  > > import tkinter.tix as tix
>  > > root = tix.Tk()
>  > > f = tix.FileSelectBox(root)
>  > > f.pack()
>  >
>  > Thanks for that.
>  >
>  > When I ran the above, I got:
>  >
>  >      Traceback (most recent call last):
>  >        File "/home/david/bin/GradientProfile_v2.py", line 2, in
> <module>
>  >          root = tix.Tk()
>  >        File "/usr/lib/python3.6/tkinter/tix.py", line 214, in
> __init__
>  >          self.tk.eval('package require Tix')
>  >      _tkinter.TclError: can't find package Tix
>  >
>  > After an internet search, I tried:
>  >
>  >     sudo apt install tix-dev tk-dev tk8.6-dev libxft-dev 
> libfontconfig1-dev libfreetype6-dev libpng-dev
>  >
>  > Now when I run the file the program just exits quickly, with no
>  > reported errors, but no window(s).  If I add 'root.mainloop()' at
> the
>  > end, I get an empty root window for a fraction of a second, then
> the
>  > program exits with:
>  >
>  >      Segmentation fault (core dumped)
>  >
>  > Any suggestions as to where to go from here?
>  >
> Tested on Raspbian in a terminal window:
> 
> sudo apt-get install tix
> 
> python3
> 
> import tkinter.tix as tix
> root = tix.Tk()
> f = tix.FileSelectBox(root)
> f.pack()
> 
> At this point there's a GUi window filled with a file section box.

When I enter the above lines in python 3.6.7 on my desktop computer,
running Ubuntu 18.04, the final line causes Python to crash with the
message:

     Segmentation fault (core dumped)

I also tried this in python 2.7.15rc1 with the same result.

I then tried it on my HP laptop computer, also running Ubuntu 18.04. 
Again, it produced a segmentation fault.

However, on my partner's computer, which is running Ubuntu 16.04, the
code works as it should.

It looks as if perhaps there is some bug in Ubuntu 18.04 which, so far
as my experience goes, only manifests itself when using tix in Python
(either version 2 or 3).  I have run most of the files in Mark Lutz's
Programming Python (including most of the tkinter chapters) without any
problem.

I can find no reference to a bug of this sort when doing an internet
search, so perhaps there could be some other explanation.

Does anyone else see the same crash when trying to use
tix.FileSelectionBox?

David


More information about the Python-list mailing list