[Tutor] Segmentation Fault Problem
Michael Lange
klappnase at freenet.de
Fri Jan 2 16:09:43 EST 2004
On Fri, 02 Jan 2004 13:41:49 -0600
Anschau Gesicht <anschau at shaw.ca> wrote:
> I continue on my endless(and seemingly futile)attempt to learn a
> programming language. Currently I'm attempting small scripts in
> Python/Tkinter. The particular script is a textbox script at follows
>
> #!/usr/lib/python2.2
>
> from Tkinter import *
> from ScrolledText import *
> import sys
>
> def die(event):
> sys.exit(0)
>
> root = Tk()
> f = Frame(root)
> f.pack(expand=1, fill=BOTH)
> button = Button(f, width=25)
> button["text"] = "Button"
> button.bind("<Button>",die)
> button.pack()
>
> st = ScrolledText(f,background="white")
> st.pack()
>
> root.mainloop()
>
> Very simple and straight forward but if I mouseclick in the text window
> the program seg faults. Can anyone tell me why? As an aside, I cannot
> use idle (a text editor) because it seg faults everytime I try to
> initialize.
>
> Eve
>
> P.S. My platform is RedHat Linux v 9 and Python v2.2
>
Hi,
there is obviously something wrong with your python and/or tk installation;
might this have something to do with the shebang line you use here??
Maybe it is just a typo, the shebang should point to your python executable,
probably #!/usr/bin/python or if you don't know the exact path #!/usr/bin/env python .
Anyway, your code should work (so should IDLE); do you use RedHat's default tk version
(which?)? Just a guess, it looks to me a little like python was trying to use another
tk version as it has been compiled for, maybe there's a problem with python2.2 and tk8.4?
I have also heard of people having problems with multiple tk versions installed.
Good luck
Michael
More information about the Tutor
mailing list