Forwarding to list. Please use Reply-All or Rely to List when responding to tutor messages.
You didn't mention earlier that you were using threads! That significantly complicates matters. -------- Forwarded Message -------- Subject: RE: [Tutor] Thread output to GUI Text Field Date: Tue, 12 Jan 2016 08:52:42 +0000 From: Patrycja Niewosz <pniew...@slb.com> To: Alan Gauld <alan.ga...@btinternet.com> Hi Alan, Thanks for a reply. I have found that I need to use slots and signal to pass data between Threads and hence class Panel(QtGui.QWidget): def __init__(self,master,parent=None): ..... ..... self.initUI() def initUI(self): #Build layout self.tcpControlMessages = QtGui.QPlainTextEdit() def startThreadedProcess(self): self. tcpControlMessage.clear() self.thread.start() @QtCore.Slot() def updateMessages(self, message): print message self. tcpControlMessages.appendPlainText(message) Patrycja -----Original Message----- From: Tutor [mailto:tutor-bounces+pniewosz=slb....@python.org] On Behalf Of Alan Gauld Sent: Monday, January 11, 2016 6:37 PM To: tutor@python.org Subject: Re: [Tutor] Thread output to GUI Text Field On 11/01/16 16:12, Patrycja Niewosz wrote: > Hi All, > > I use commands, > > server_address = ('134.32.45.9', 10000) > print ('starting up on port '% server_address) > sock.bind(server_address) > > the message pop ups in the window command when I run full code, > however I would like to print this message in the main GUI, where I > have defined > > tcpControlGrid.addWidget(QtGui.QLabel('TCP Server Messages'),3,0) > tcpControlGrid.addWidget(self.tcpControlMessages,4,0) > > self.tcpControlMessages = QtGui.QPlainTextEdit() > > How can I transfer messages from above code directly to the GUI interface, so > that I can see on main window. Since this is obviously a PyQt issue you would be best asking on a Qt or SIDE forum. However most UIs have a Text control(*) that you can insert text into. So look for a method of your control called something like insert() or put() or maybe even write(). (*)I'm assuming your QtGui.QPlainTextEdit() is the Qt version. What methods does it have? -- Alan G Author of the Learn to Program web site https://urldefense.proofpoint.com/v2/url?u=http-3A__www.alan-2Dg.me.uk_&d=CwICAg&c=uGuXJ43KPkPWEl2imVFDmZQlhQUET7pVRA2PDIOxgqw&r=VlCD52JbZNT0daOyAL7vAA&m=lMWz8Zwkrgc7CBzDOXEXkb8oTuIeuRsGgutRf32psIc&s=utKS1TTBmN6wmUJ4SnWJcRbNjIddYO09HyTV2cQUwj8&e= https://urldefense.proofpoint.com/v2/url?u=http-3A__www.amazon.com_author_alan-5Fgauld&d=CwICAg&c=uGuXJ43KPkPWEl2imVFDmZQlhQUET7pVRA2PDIOxgqw&r=VlCD52JbZNT0daOyAL7vAA&m=lMWz8Zwkrgc7CBzDOXEXkb8oTuIeuRsGgutRf32psIc&s=jXyzhQxcanJnO9e1u-yPXFqlRSgVfDu-CVVnYHsPrOM&e= Follow my photo-blog on Flickr at: https://urldefense.proofpoint.com/v2/url?u=http-3A__www.flickr.com_photos_alangauldphotos&d=CwICAg&c=uGuXJ43KPkPWEl2imVFDmZQlhQUET7pVRA2PDIOxgqw&r=VlCD52JbZNT0daOyAL7vAA&m=lMWz8Zwkrgc7CBzDOXEXkb8oTuIeuRsGgutRf32psIc&s=zDdjUw8RFbWAtyLe1ywjgC40UayySD5H6fzQAlZN5N8&e= _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.python.org_mailman_listinfo_tutor&d=CwICAg&c=uGuXJ43KPkPWEl2imVFDmZQlhQUET7pVRA2PDIOxgqw&r=VlCD52JbZNT0daOyAL7vAA&m=lMWz8Zwkrgc7CBzDOXEXkb8oTuIeuRsGgutRf32psIc&s=afbUD2-GlmdFUE2rIbOMtKiOxKEZSqDi0Z85FSoldpM&e= _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor