How to access Qt components loaded from file?

Juan Christian juan0christian at gmail.com
Wed Nov 19 21:47:31 CET 2014


Let's say that I want to call the site in a 5min interval. I'm currently
getting the info this way just for testing and to know that the 'core
engine' is working, and indeed, it's working:

if __name__ == "__main__":
import sys

app = QApplication(sys.argv)
MainWindow = loadui("main.ui")

def output_slot():
MainWindow.txtbox.setText(call_site())

MainWindow.btn.clicked.connect(output_slot)

MainWindow.show()
app.exec_()

How can I proceed if I want the txtbox to automatically do the
'setText(call_site())' in a X defined interval? The final app will have not
only a txtbox, but a complete interface with buttons, avatar image, some
txtboxes, and all that stuff. If I know how to "call the site" in a defined
interval, I can get all the info that I need and set them one by one.

If I'm not mistaken my app is locked in the app.exec_() loop, so I need to
have a trigger configured that will be called in a defined interval, then
inside this trigger I configure the "set_avatar", "set_text",
"set_btn_link", etc, is that right?

On Tue Nov 18 2014 at 9:37:21 PM Chris Angelico <rosuav at gmail.com> wrote:

> On Wed, Nov 19, 2014 at 5:15 AM, Juan Christian
> <juan0christian at gmail.com> wrote:
> >
> > Thanks, it's working. What would be a "professional" approach if I want
> to
> > constantly call a URL to get it's content and access this data within the
> > GUI?
> >
>
> "Constantly" doesn't make much sense when you're talking about network
> operations. There are two basic approaches: either you re-fetch
> periodically and update the GUI (in which case you have to decide how
> frequently), or you re-fetch on some trigger (when it's changed, or
> when the user's about to need it, or something). Either way, you have
> to balance network traffic versus promptness of update, and it's
> nearly impossible to pick perfectly. But if you don't mind it being a
> little clunky, you should be able to pick something fairly simple and
> deploy it, and then maybe refine it a bit afterward.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141119/d0d93f84/attachment.html>


More information about the Python-list mailing list