Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'subject:file': 0.07; 'correct,': 0.09; 'function:': 0.09; 'tests,': 0.09; 'worked.': 0.09; 'subject:How': 0.10; 'def': 0.12; 'random': 0.14; 'from:name:vincent vande vyvre': 0.16; 'func': 0.16; 'received:195.130': 0.16; 'received:195.130.137': 0.16; 'received:telenet-ops.be': 0.16; 'subject:access': 0.16; '\xe9crit': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'app': 0.19; 'header:User-Agent:1': 0.23; 'text.': 0.24; 'tue': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'url:mailman': 0.30; 'doc': 0.31; 'skip:m 60': 0.31; 'skip:q 20': 0.31; 'slot': 0.31; 'skip:m 30': 0.32; 'url:python': 0.33; 'subject:from': 0.34; 'problem': 0.35; "can't": 0.35; 'test': 0.35; 'but': 0.35; 'url:listinfo': 0.36; 'doing': 0.36; "i'll": 0.36; 'possible': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'christian': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'signal': 0.60; 'simple': 0.61; 'more': 0.64; 'charset:windows-1252': 0.65; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'regularly.': 0.84; 'why?': 0.91 Date: Tue, 18 Nov 2014 16:48:27 +0100 From: Vincent Vande Vyvre User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: How to access Qt components loaded from file? References: <546B3FE4.3050204@telenet.be> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: vincent.vandevyvre@oqapy.eu 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416325737 news.xs4all.nl 2864 [2001:888:2000:d::a6]:53969 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81007 Le 18/11/2014 15:49, Juan Christian a écrit : > I was doing some tests, then I tried this: > > app = QApplication(sys.argv) > MainWindow = loadui("main.ui") > MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) > > MainWindow.show() > app.exec_() > > But I get "RuntimeError: Failed to connect signal clicked().", why? > > The syntax is correct, I don't know why it failed, the btn is in the > Form too, it's a QPushButton. > > The test func is just a simple func that returns a random text. > > On Tue Nov 18 2014 at 11:08:48 AM Juan Christian > > wrote: > > Many thanks, worked. The only problem now is that I don't have > auto-complete for anything, because of this approach... I'll have > to check the doc more regularly. ^^ > > .... > > https://mail.python.org/mailman/listinfo/python-list > > > You can't have a slot like this: MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) because that's mean: "connect to the return of MainWindow.txtbox.setText(test())" and it's not possible at this stage of your program. Use instead a function: MainWindow.btn.clicked.connect(my_slot) # No parenthesis ! def my_slot(): MainWindow.txtbox.setText(test())