Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'attribute': 0.07; 'skip:p 60': 0.07; 'string': 0.09; 'main()': 0.09; 'skip:# 30': 0.09; 'skip:# 60': 0.09; 'val': 0.09; 'skip:p 90': 0.16; 'skip:q 30': 0.16; 'subject:object': 0.16; 'all,': 0.19; 'print': 0.22; 'code:': 0.26; 'function': 0.29; 'code': 0.31; "skip:' 10": 0.31; 'file': 0.32; 'another': 0.32; '(most': 0.33; 'subject:from': 0.34; 'skip:u 20': 0.35; 'but': 0.35; 'skip:" 50': 0.36; 'yours,': 0.36; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'numbers': 0.61; 'dear': 0.65; 'caused': 0.69; 'dict.': 0.84; 'subject:add': 0.91 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pahlevanzadeh.org; s=default; h=Content-Transfer-Encoding:Mime-Version:Content-Type:Date:To:From:Subject:Message-ID; bh=5P3/+VJKOqcWCxJBRyuX98v+Phrx5ftfmtb0225aEoQ=; b=jQYivgZREi8unJKHq0uPq6X+NLYupUP/urgFWj1yWKt9RjJtu7R3FPEmzpBmxc690ZE8aPM2zxAjDcnnZLLdcYSJAqUIEBsYDcnTIuZA+sNwfBGBJ4wNkcH5Fnal7YSn2JjzEOlf9DkziyEJ4rrLYl5hesc6jomGyfkA8+0eAkc=; Subject: how to add object from dict From: Mohsen Pahlevanzadeh To: python-list@python.org Date: Thu, 17 Oct 2013 01:44:54 +0330 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.8.5-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - part7.royal-servers.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pahlevanzadeh.org X-Get-Message-Sender-Via: part7.royal-servers.com: authenticated_id: mohsen@pahlevanzadeh.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381965677 news.xs4all.nl 15870 [2001:888:2000:d::a6]:39770 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56906 Dear all, I have the following code in projects.py: ##################################################33 for row in xrange(len(uniqueFields)): instance = QtGui.QCheckBox(uniqueFields[row]) projectsFindInstance.projectsInstance.addOnFieldsInstance.update({"%s" % uniqueFields[row]:instance}) projectsFindInstance.tableWidget.setCellWidget(row,0,instance) projectsFindInstance.tableWidget.setRowCount(projectsFindInstance.tableWidget.rowCount()+1) ############################################################### about code caused i fill up a QTableWidget from QChekBox, and i store string of QCheckBox and its Object in dict. and another file,(projectsFind.py) i have the following code: #################################################################3 for key, val in self.projectsInstance.addOnFieldsInstance.items(): instance = getattr(self,"%s" % val) print val #QtCore.QObject.connect(instance, QtCore.SIGNAL(_fromUtf8("stateChanged (int)")), #lambda: self.projectsInstance.setFilterDict_Find("TWCH",self,"addonfields",instance.CheckState(),instance)) ######################################################################3 I want to generate connect function accroding to numbers of obbjects. But i get the following traceback: ################################################################3 Traceback (most recent call last): File "./main.py", line 117, in main() File "./main.py", line 104, in main x.showFindProjects() File "/home/mohsen/codes/amlak/amlak/src/UIInterface.py", line 101, in showFindProjects self.uiProjectsFind.setupUi(self.projectsFind) File "/home/mohsen/codes/amlak/amlak/src/projectsFind.py", line 271, in setupUi instance = getattr(self,"%s" % val) AttributeError: 'Ui_ProjectsFind' object has no attribute '' ############################################################# Help needed...... Yours, Mohsen