Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > Your Distro > Slackware Linux Help > Slackware 13/64 Python threads/Tkinter

Forgot Password?
 Slackware Linux Help   For help and Discussion about Slackware linux

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 10-01-2009   #1 (permalink)
Linux Enthusiast
 
Join Date: Dec 2007
Location: Canada, Prince Edward Island
Posts: 524
Slackware 13/64 Python threads/Tkinter

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 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?...Gerard4143
__________________
Make mine Mandriva Linux
gerard4143 is online now  


Reply With Quote
Old 10-01-2009   #2 (permalink)
Linux Guru
 
coopstah13's Avatar
 
Join Date: Nov 2007
Location: NH, USA
Posts: 1,759
Are the versions of python the same?
coopstah13 is offline   Reply With Quote
Old 10-01-2009   #3 (permalink)
Linux Enthusiast
 
Join Date: Dec 2007
Location: Canada, Prince Edward Island
Posts: 524
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 KDE
__________________
Make mine Mandriva Linux
gerard4143 is online now   Reply With Quote
Old 10-01-2009   #4 (permalink)
Linux Guru
 
coopstah13's Avatar
 
Join Date: Nov 2007
Location: NH, USA
Posts: 1,759
can you post the stack traces of a crash? it might be helpful
coopstah13 is offline   Reply With Quote
Old 10-01-2009   #5 (permalink)
Linux Enthusiast
 
Join Date: Dec 2007
Location: Canada, Prince Edward Island
Posts: 524
Here's the details

Quote:
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?)
And the code
Code:
#! /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 Mandriva Linux
gerard4143 is online now   Reply With Quote
Old 10-02-2009   #6 (permalink)
Linux Guru
 
coopstah13's Avatar
 
Join Date: Nov 2007
Location: NH, USA
Posts: 1,759
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?
coopstah13 is offline   Reply With Quote
Old 10-02-2009   #7 (permalink)
Linux Enthusiast
 
Join Date: Dec 2007
Location: Canada, Prince Edward Island
Posts: 524
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 Mandriva Linux
gerard4143 is online now   Reply With Quote
Old 10-04-2009   #8 (permalink)
Linux Enthusiast
 
Join Date: Dec 2007
Location: Canada, Prince Edward Island
Posts: 524
Finally dug up the Mandriva info:

Python 2.6.1
Tkinter $Revision: 67083$
__________________
Make mine Mandriva Linux
gerard4143 is online now   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 05:03 PM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2