Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'subject:file': 0.07; 'sys': 0.07; '"__main__":': 0.09; '__name__': 0.09; 'correct,': 0.09; 'tests,': 0.09; 'worked.': 0.09; 'subject:How': 0.10; 'python': 0.11; 'def': 0.12; 'random': 0.14; '.ui': 0.16; 'code?': 0.16; 'func': 0.16; 'subject:access': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'app': 0.19; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'load': 0.23; 'text.': 0.24; 'tue': 0.24; '>': 0.26; 'this:': 0.26; 'tried': 0.27; 'designer': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'doc': 0.31; 'file:': 0.31; 'skip:m 60': 0.31; 'skip:q 20': 0.31; 'url:python': 0.33; 'subject:from': 0.34; 'problem': 0.35; 'skip:u 20': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'doing': 0.36; "i'll": 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'christian': 0.38; 'skip:& 10': 0.38; 'nov': 0.38; 'to:addr :python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'signal': 0.60; 'simple': 0.61; 'more': 0.64; 'regularly.': 0.84; 'why?': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:from:date:message-id:subject:to :content-type; bh=8nU2R0pPZAbETe/J/AF/HIxKto4RMNKhN9Bg3AYawOY=; b=xsKWXc41ajmzzyUDU5bOj12O4IcADJVZXHLWhRWDaA3nIidudVPHzHqDX1qeQwRLKN O7le31mfyLv9rg3RajYh/SZ6bNwDxm7Crzrm7NmwEt56Zw2l4ii1tEbTIUqZuyFMIeqG rmo+cUrv+v/FTn+ei6+8A/zb/YcB5N0OC+dSw6IHti5Q+kYopgHusxZ0uCAksmXvg7yL CBWkuo+ejExUd5kpmPXfc9kRDdt/x8yLwloUK8tVvibc4ug/oJjOEqEnTYXfXZG1LLef 3DFO3b5jSI+ccEe5TJH+8DTY335AuZbely3njKyL3sdxqWDvNBVcJ7cCNQ3I5kAhwKga 0XPw== X-Received: by 10.153.4.2 with SMTP id ca2mr20686714lad.30.1416322144049; Tue, 18 Nov 2014 06:49:04 -0800 (PST) MIME-Version: 1.0 References: <546B3FE4.3050204@telenet.be> From: Juan Christian Date: Tue, 18 Nov 2014 14:49:03 +0000 Subject: Re: How to access Qt components loaded from file? To: python-list@python.org Content-Type: multipart/alternative; boundary=001a1134291648a96d050823324b 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: 131 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416322150 news.xs4all.nl 2914 [2001:888:2000:d::a6]:42647 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81005 --001a1134291648a96d050823324b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I was doing some tests, then I tried this: app =3D QApplication(sys.argv) MainWindow =3D 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 chec= k > the doc more regularly. ^^ > > On Tue Nov 18 2014 at 10:48:44 AM Vincent Vande Vyvre < > vincent.vande.vyvre@telenet.be> wrote: > >> Le 18/11/2014 13:18, Juan Christian a =C3=A9crit : >> > I have this simple code that load any Qt Designer .UI file: >> > >> > from PySide.QtCore import QFile >> > from PySide.QtGui import QApplication >> > from PySide.QtUiTools import QUiLoader >> > >> > >> > def loadui(file_name): >> > loader =3D QUiLoader() >> > uifile =3D QFile(file_name) >> > uifile.open(QFile.ReadOnly) >> > ui =3D loader.load(uifile) >> > uifile.close() >> > return ui >> > >> > >> > if __name__ =3D=3D "__main__": >> > import sys >> > >> > app =3D QApplication(sys.argv) >> > MainWindow =3D loadui("main.ui") >> > MainWindow.show() >> > app.exec_() >> > >> > Let's say I have a QTextEdit called txtbox. How can I access this >> > txtbox inside my Python code? >> > >> > >> How about MainWindow.txtbox ? >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > --001a1134291648a96d050823324b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I was doing some tests, then I tried this:

app =3D QApplication(sys.argv)=
MainWindow =3D loadui("main.ui")
MainWindow.btn.clicked.connect(= MainWindow.txtbox.setText(test()))

MainWindow.show()
app.exe= c_()

But I get "RuntimeError: Failed to conne= ct signal clicked().", why?

The syntax is cor= rect, 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.

--001a1134291648a96d050823324b--