[Tutor] Thread output to GUI Text Field

Alan Gauld alan.gauld at btinternet.com
Mon Jan 11 13:36:54 EST 2016


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
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list