how to keep a wxpython app "always on top"?

2,009 views
Skip to first unread message

DomB

unread,
Aug 5, 2009, 1:36:53 PM8/5/09
to wxPython-users
Hi All

I would like set things up so that my wxpython app can be set so that
it is never covered by other windows - I want it always on top- is
this possible?

I'm not concerned about cross platform issues as my app will only
ever run on a ms windows machine.


Dominic

C M

unread,
Aug 5, 2009, 1:52:59 PM8/5/09
to wxPytho...@googlegroups.com
On Wed, Aug 5, 2009 at 1:36 PM, DomB<dominic.b...@gmail.com> wrote:
>
> Hi All
>
> I would like set things up so that  my wxpython app can be set so that
> it is never covered by other windows - I want it always on top- is
> this possible?

Yes, you can use the style flag style=wx.STAY_ON_TOP in the
constructor of your frame.

Che

DomB

unread,
Aug 5, 2009, 2:29:40 PM8/5/09
to wxPython-users
Hi Che,

Thank you for the rapid response- is it possible to toggle between
"stay on top" and normal behavior once the frame is up?

Dominic

On Aug 5, 1:52 pm, C M <cmpyt...@gmail.com> wrote:

C M

unread,
Aug 5, 2009, 3:15:13 PM8/5/09
to wxPytho...@googlegroups.com
On Wed, Aug 5, 2009 at 2:29 PM, DomB<dominic.b...@gmail.com> wrote:
>
> Hi Che,
>
> Thank you for the rapid response- is it possible to toggle between
> "stay on top" and normal behavior once the frame is up?
>

I don't know. Good question. I suppose you could destroy and
recreate the frame with that style, but I'm sure someone will be along
to answer if you can just dynamically change the style.

Che

Mike Driscoll

unread,
Aug 6, 2009, 9:40:21 AM8/6/09
to wxPython-users


On Aug 5, 2:15 pm, C M <cmpyt...@gmail.com> wrote:
> On Wed, Aug 5, 2009 at 2:29 PM, DomB<dominic.barraclo...@gmail.com> wrote:
>
> > Hi Che,
>
> > Thank you for the rapid response- is it possible to toggle between
> > "stay on top" and normal behavior once the frame is up?
>
> I don't know.  Good question.  I suppose you could destroy and
> recreate the frame with that style, but I'm sure someone will be along
> to answer if you can just dynamically change the style.
>
> Che

I can't remember if this topic was just on the list or someone asked
something similar on IRC, but I think Robin said that it depends on
the platform. Some will allow changes and some will not. I don't think
Windows does, so destroying and recreating is the way to go on that.

- Mike

Dietmar Schwertberger

unread,
Aug 6, 2009, 10:23:50 AM8/6/09
to wxPytho...@googlegroups.com
Mike Driscoll schrieb:

> On Aug 5, 2:15 pm, C M <cmpyt...@gmail.com> wrote:
>> On Wed, Aug 5, 2009 at 2:29 PM, DomB<dominic.barraclo...@gmail.com> wrote:
>>> Thank you for the rapid response- is it possible to toggle between
>>> "stay on top" and normal behavior once the frame is up?
>> I don't know. Good question. I suppose you could destroy and
>> recreate the frame with that style, but I'm sure someone will be along
>> to answer if you can just dynamically change the style.
> I can't remember if this topic was just on the list or someone asked
> something similar on IRC, but I think Robin said that it depends on
> the platform. Some will allow changes and some will not. I don't think
> Windows does, so destroying and recreating is the way to go on that.
Just tried with a frame on windows.
Changing on the fly is possible:


import wx
# self is a frame
style = self.GetWindowStyle()
# stay on top
self.SetWindowStyle( style | wx.STAY_ON_TOP )
# normal behaviour again
self.SetWindowStyle( style )


Regards,

Dietmar


Mike Driscoll

unread,
Aug 6, 2009, 2:04:24 PM8/6/09
to wxPython-users


On Aug 6, 9:23 am, Dietmar Schwertberger <maill...@schwertberger.de>
wrote:
Cool! Next time I'll have to try it too.

Mike

DomB

unread,
Aug 7, 2009, 9:21:32 AM8/7/09
to wxPython-users
Hi All,

Thank you for the feed back much appreciated

Dominic

On Aug 6, 2:04 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
> On Aug 6, 9:23 am, Dietmar Schwertberger <maill...@schwertberger.de>
> wrote:
>
>
>
> > Mike Driscoll schrieb:> On Aug 5, 2:15 pm, C M <cmpyt...@gmail.com> wrote:
> > >> On Wed, Aug 5, 2009 at 2:29 PM, DomB<dominic.barraclo...@gmail.com> wrote:
> > >>> Thank you for the rapid response- is it possible to toggle between
> > >>> "stay ontop" and normal behavior once the frame is up?
Reply all
Reply to author
Forward
0 new messages