How to access Qt components loaded from file?

Juan Christian juan0christian at gmail.com
Wed Nov 19 21:53:49 EST 2014


Thanks, it's working using QTimer. The thing is that whenever the program
is going to do something, in my case, draw a new QGroupBox with some
components inside and put it in the Form (I'm using VBoxLayout in the main
form) the program freezes, and I'm using very simple components just for
testing.This shouldn't be normal, right?

Am I doing something wrong?

On Wed Nov 19 2014 at 7:00:43 PM Rob Gaddi
<rgaddi at technologyhighland.invalid> wrote:

> On Wed, 19 Nov 2014 20:47:31 +0000
> Juan Christian <juan0christian at gmail.com> wrote:
>
> > 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
> > >
> >
> You'd use a QTimer to do that.  Once you .start(5*60*1000) the
> timer, it'll fire a timeout signal every 5 minutes.  You connect that
> timeout to the slots you want to execute if you don't care about order,
> or to a single slot function that runs the things that you want to do in
> some defined order.
>
> --
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order.  See above to fix.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141120/dafbd18a/attachment.html>


More information about the Python-list mailing list