LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 09-26-2009, 05:12 AM   #1
threaderslash
Member
 
Registered: Dec 2008
Location: HongKong
Distribution: Fedora/Centos/RedHat
Posts: 109

Rep: Reputation: 15
Cool Qt Python - AttributeError


Hello Everybody,

I have a nice small program that I am working to include as part of a project...

Code:
def __init__(self):
...
self.connect(insert, QtCore.SIGNAL('triggered()'), self.showDialog)
self.setFocus()
...

def showDialog(self):
    	text, ok = QtGui.QInputDialog.getText(self, 'Input Dialog','Enter your name:')

    	if ok:
        	self.label.setText(unicode(text))
It runs, open the mainwindow, the menu, etc... but gives me the following error when I press OK after informing the name.

Code:
Traceback (most recent call last):
  File "C:\dev\testsubCode\src\pytest.py", line 45, in showDialog
	self.label.setText(unicode(text))
AttributeError: label
I guess it might be a simple detail, but I couldn't figure out what. Any suggestions?

All comments and suggestion are welcome.
 
Old 09-26-2009, 09:35 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 2,094

Rep: Reputation: 104Reputation: 104
dont expect a fast response
the forums are dead right now and your the only one that posted in the last 6 hours
 
Old 09-27-2009, 09:21 AM   #3
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 223Reputation: 223Reputation: 223
Are you actually setting self.label to anything? It looks like you're not. Try setting it in the __init__ something like this - obviously replacing Label_goes_here with the actual value of your label :
Code:
 
self.label = QtGui.QLabel(Label_goes_here)
self.label.setObjectName("label")
You may find Mark Summerfield's book - Rapid Gui programming with Python and QT to be useful. I would recommend it myself as there's not that much information available on PyQt development.
 
Old 10-14-2009, 01:17 PM   #4
threaderslash
Member
 
Registered: Dec 2008
Location: HongKong
Distribution: Fedora/Centos/RedHat
Posts: 109

Original Poster
Rep: Reputation: 15
I already got the book. Thanks.
 
  


Reply

Tags
member


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AttributeError: 'module' object has no attribute 'error' cmnorton Programming 1 04-09-2009 05:45 PM
python: AttributeError: 'list' object has no attribute 'Append' browny_amiga Programming 3 01-12-2009 04:58 AM
gentoo env-update AttributeError: 'module' object has no attribute 'env_update' linux_mopper Linux - Newbie 2 08-06-2008 01:20 PM
yum update ===> AttributeError: CHECKSUM_VALUE PrimeMogul Linux - Software 14 05-26-2008 11:26 AM
Tkinter Attributeerror : Entry has no __call__ method jeffsouza Programming 0 02-05-2004 07:57 AM


All times are GMT -5. The time now is 02:58 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration