Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always-in-front / Always-on-top window, on Windows #476

Closed
tscizzlebg opened this issue Feb 26, 2020 · 11 comments
Closed

Always-in-front / Always-on-top window, on Windows #476

tscizzlebg opened this issue Feb 26, 2020 · 11 comments

Comments

@tscizzlebg
Copy link
Contributor

Specification

  • pywebview version: 3.2
  • platform / version: Windows 10

Description

Not an issue so much as a question. Is it possible to keep a window in front of all other windows, for example for a small control panel in the corner? tkinter has something like .wm_attributes("-topmost", 1) to keep a window in front. Maybe Python has a way to do this via some Windows api, even if it's not part of pywebview api.

Practicalities

  • YES/NO I am willing to work on this issue myself.

  • YES/NO I am prepared to support this issue financially.

N/A just asking a question.

@tscizzlebg
Copy link
Contributor Author

def toggle_fullscreen(self):

In winforms.py, in BrowserForm.toggle_fullscreen, it sets self.TopMost, but nowhere else do I see TopMost referenced. That suggests to me that it's not currently an option, but that it would be possible.

Is that an accurate evaluation of the current status?

If so, I perhaps would be down to contribute, but would need some guidance. Is this feature even a candidate for you to accept a PR about? If so, how would you want this feature designed, for you to accept such a PR?

@r0x0r
Copy link
Owner

r0x0r commented Feb 26, 2020

This feature is not implemented, but I gladly welcome a PR.
It can be implemented as an argument to create_window, eg. create_window(..., on_top=False). Window object should be update to expose on_top status as well. Changing it during runtime can be a plus, but it can be done without.
An examples, documentation update and a test case should be tackled as well. Most window feature tests are rather dumb and do not actually test for the behaviour, but rather verify that no errors occur during run.

@tscizzlebg
Copy link
Contributor Author

Fantastic, thanks!

@tscizzlebg
Copy link
Contributor Author

tscizzlebg commented Feb 26, 2020

If I implement this for Windows-only and document that it's Windows-only for now, is that fine?

I think I can bang it out on Windows no problem, but researching and testing on other OSes will be more of a hassle (I don't even have a Mac for example)

EDIT:
And is it preferred for other platforms to pass, or raise NotImplementedError?

@tscizzlebg tscizzlebg changed the title Always-in-front / Always-on-top window Always-in-front / Always-on-top window, on Windows Feb 26, 2020
@tschnibo
Copy link

tschnibo commented Mar 3, 2020

Hey, thank you for this great package!

I followed this issue with great interest. I am looking for a solution (on Windows, non-fullscreen), to implement:

  • show window after window beeing hidden.
    and (simultaneously)
  • Bring window to Front (but just until the user clicks next to the window)

I think I can implement this with the topmost solution. Or is there a better way to do this?

Edit: I just saw, that there is a "bring_to_front" method in winforms. Thats maybe closer to what I need.

My appologies if I overlooked this in the documentation!
Many Thanks!

@r0x0r
Copy link
Owner

r0x0r commented Mar 5, 2020

@tschnibo What are you trying to achieve exactly?

@tschnibo
Copy link

@r0x0r Sorry for the late reply.
I would like to be able to 'unhide' a hidden pywebview window and in the same or subsequent step bring the window to front. But without forcing the window to stay on top - thus allowing the user to bring another window to front again.

So the essential problem I'd like to solve is the 'bring to front' for a pywebview window. The unhiding part is already working.

@r0x0r
Copy link
Owner

r0x0r commented Mar 11, 2020 via email

@tschnibo
Copy link

Hey, I used pywebview together with pysimplegui and wanted to enable the user to show the pywebview window when clicked on a button in pysimplegui then, when the pywebview window was closed again, in the background a new pywebview window would be created as "hidden" and shown again when the button is clicked.

This sort of worked, but the window did not come to front but just opened behind the pysimplegui window and other open windows.

Now I moved on to a completely different solution without pywebview and pysimplegui.

I'm sure I'll be using your package another time again - thank you very much!

@r0x0r
Copy link
Owner

r0x0r commented Apr 3, 2020

Implemented Cocoa.

@r0x0r
Copy link
Owner

r0x0r commented Apr 9, 2020

PR here. I will keep it open for a couple of days, if somebody would like to take a look.
#497

@r0x0r r0x0r closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants