Results 1 to 8 of 8
Hi everyone, I recently installed Slackware 13/x86_64 on one of my boxes and now I'm having troubles with Python code that uses threading and Tkinter. This problem never existed on ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-01-2009 #1
Slackware 13/64 Python threads/Tkinter
I recently installed Slackware 13/x86_64 on one of my boxes and now I'm having troubles with Python code that uses threading and Tkinter. This problem never existed on other Linux distro's, it just appeared with Slackware.
The box in question
Acer Athlon x86_64 single core used to run Mandriva/64 and the Python code worked fine.
Now it runs Slackware13/64 and Python threading and Tkinter are not getting along at all(program crashes with out of stack space infinite loop for the thread).
Any suggestion?...Gerard4143Make mine Arch Linux
- 10-01-2009 #2
- 10-01-2009 #3
Both are Python 2.6.2
The only real difference, besides one is Mandriva and one is Slackware, is the window mangers, Mandriva was Gnome and Slackware is KDEMake mine Arch Linux
- 10-01-2009 #4
can you post the stack traces of a crash? it might be helpful
- 10-01-2009 #5
Here's the details
Unhandled exception in thread started by
Traceback (most recent call last):
File"./testing.py", line 30, in marquee
self.text = self.mylabel['text'][-1] + self.mylabel['text'][:-1]
File "/usr/lib64/python2.6/lib-tk/Tkinter.py", line 1206, in cget
return self.tk.call(self._w, 'cget','-' + key)
tkinter.TclError: out of stack space(infinite loop?)
#! /usr/bin/python import Tkinter, thread, time class MyLab: DATA = 'this is the marquee message! ' START = 'start marquee' STOP = 'stop marquee' def __init__(self, master): self.looping = 1 self.frame = Tkinter.Frame(master) self.mylabel = Tkinter.Label(self.frame, text = MyLab.DATA, background = 'white') self.start = Tkinter.Button(self.frame, text = MyLab.START, command = self.startit) self.mylabel.pack() self.start.pack() self.frame.pack() def startit(self): if (self.start['text'] == MyLab.START): self.looping = 1 self.start['text'] = MyLab.STOP thread.start_new_thread(self.marquee, ()) else: self.looping = 0 self.start['text'] = MyLab.START def marquee(self): while self.looping: self.text = self.mylabel['text'][-1] + self.mylabel['text'][:-1] self.mylabel['text'] = self.text time.sleep(.2) root = Tkinter.Tk() mymar = MyLab(root) root.mainloop()Make mine Arch Linux
- 10-02-2009 #6
What about the version of tk? Is that different? I'm just throwing things out there because what you are experiencing is odd. I am running your code on my machine (arch x64) and it works just fine. How quickly does it throw that exception?
- 10-02-2009 #7
The exception is thrown as soon as I click the start button.i.e the thread doesn't appear to run at all(or the text marquee message doesn't scroll at all)...
If I take out the Tkinter object reference and print the data to the terminal then the thread works great.
The Tkinter version for Slackware is Tkinter.__version__ = "$Revision: 70220 $"
I'll have to dig to find Mandriva's Tkinter version...Make mine Arch Linux
- 10-04-2009 #8
Finally dug up the Mandriva info:
Tkinter $Revision: 67083$Make mine Arch Linux