Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81041
| From | Rob Gaddi <rgaddi@technologyhighland.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: How to access Qt components loaded from file? |
| Date | 2014-11-19 12:56 -0800 |
| Organization | Highland Technology, Inc. |
| Message-ID | <20141119125612.1f834ad5@rg.highlandtechnology.com> (permalink) |
| References | (3 earlier) <CAAp0bGu5z-jPm4cgm1u1CfwQPpDqy9G1A3ciwmaaSJcCrBeSPA@mail.gmail.com> <546B6A4B.90107@telenet.be> <CAAp0bGttSSzLL_K_vzWRb+E+mAHdSYVk-8PSARFKG=JWJ4rMng@mail.gmail.com> <CAPTjJmpxbnMKFwcb+JFZtCS2yFTEWK7M58NdPUMNPmxLqFw0dQ@mail.gmail.com> <mailman.16000.1416430060.18130.python-list@python.org> |
On Wed, 19 Nov 2014 20:47:31 +0000
Juan Christian <juan0christian@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@gmail.com> wrote:
>
> > On Wed, Nov 19, 2014 at 5:15 AM, Juan Christian
> > <juan0christian@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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: How to access Qt components loaded from file? Juan Christian <juan0christian@gmail.com> - 2014-11-19 20:47 +0000
Re: How to access Qt components loaded from file? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-11-19 12:56 -0800
Re: How to access Qt components loaded from file? Juan Christian <juan0christian@gmail.com> - 2014-11-20 02:53 +0000
Re: How to access Qt components loaded from file? Michael Torrie <torriem@gmail.com> - 2014-11-20 08:37 -0700
Re: How to access Qt components loaded from file? Michael Torrie <torriem@gmail.com> - 2014-11-20 08:41 -0700
Re: How to access Qt components loaded from file? Juan Christian <juan0christian@gmail.com> - 2014-11-20 17:57 +0000
Re: How to access Qt components loaded from file? Michael Torrie <torriem@gmail.com> - 2014-11-20 12:06 -0700
Re: How to access Qt components loaded from file? Juan Christian <juan0christian@gmail.com> - 2014-11-20 19:36 +0000
Re: How to access Qt components loaded from file? Juan Christian <juan0christian@gmail.com> - 2014-11-20 19:37 +0000
Re: How to access Qt components loaded from file? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-20 21:06 +0000
Re: How to access Qt components loaded from file? Juan Christian <juan0christian@gmail.com> - 2014-11-20 21:19 +0000
Re: How to access Qt components loaded from file? Rustom Mody <rustompmody@gmail.com> - 2014-11-22 18:15 -0800
csiph-web