-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
Option for hide App menubar #733
Comments
Thanks for the suggestion! This is an interesting idea, but it has some complications. In particular, in the macOS context, it's impossible for an application to not have a menu. At the very least, every application has an Application menu (with an About and Quit item). This is required by the macOS style guide. Part of the broader Toga "idea" is to build applications that appear native, and adhere to local platform style guides; any API design we come up with needs to ultimately be rendered as an application that still adheres to those style guides. One thought is that we have a concept of a Toga "SimpleApp" - an application that has no special capabilities (like toolbars and menus); On Windows and Linux, that means no toolbar is created; on macOS, you get the minimal legal menu. Any attempt to define and add additional commands would raise an error (as the API endpoints won't exist). An alternative approach would be to adapt to usage, and (on Windows/Linux) only create a menubar if the user manually adds commands. That is, if you don't add a command to your app, you don't get a menubar; as soon as you do, you get a menu (including the extra "default" menu items like Quit and Help). On macOS, you'll always have the menubar, so there's no real change. Thoughts? Which of these makes more sense to you as an end user of the API? Or can you think of something else? |
Thanks for complete summary.
I like the second approach more. It feels native and it would be the
default if the mac wouldnt exists I suppse. It doesnt make sense for Window
and Linux to add a menubar just for Exit. Or alternatively menubar can be
still a default, but additional argument disable_menubar("do not work for
macos") should be available for App class.
The SimpleApp appoarch looks also legit, but IMO it is a redundant layer.
People will think "about what should i use"? And it will be still better to
teach in tutorials the standard App as it is immediately extendable if user
is ready for for providing more features. There is already 2 ways to create
app - pass args woth startup method or overwrite the App class.
On the other hand my case is just to show simple gui window with one
information and button. Just like info or error prompt window.
If it make sens, maybe this case should be covered by such SimpleApp or
SimpleWindow instance?
|
A workaround that works on windows...currently... import toga
class MainWindow(toga.App):
def startup(self):
self._impl.create_menus = lambda *x, **y: None
# Rest of application setup....
MainWindow('Name', 'com.oracle.java.nameing').main_loop() |
The above also works on linux (gtk) |
Closing in favour of #1870 so that there's a clearer description of the feature request in a form that is likely to be merged. |
Expected Behavior
Option to remove menubar. If workaround works for all systems, I can live with current implementation, if not IMO it is still a minor issue
Current Workaround
(tested on windows10 only)
Overwrite toga.App method
Your Environment
Python Version (list the specific version number)
3.7.2
Operating System and Version (select from the following and list the specific version number; if your OS is not listed, list that as well)
Know about Windows but probably all systems have kind of menus.
Toga Version (list the specific version number or git hash)
0.3.0.dev14
Toga Target (the type of app you are trying to generate)
The text was updated successfully, but these errors were encountered: