0

I read this tutorial- https://python-gtk-3-tutorial.readthedocs.io/en/latest/application.html

It says in the first para -

Gtk.Application encompasses many repetitive tasks that a modern application needs such as handling multiple instances, D-Bus activation, opening files, command line parsing, startup/shutdown, menu management, window management, and more.

How do I do startup/shutdown, window management and menu management using Gtk.Application? I could not find any tutorials, examples or API documentation. Can anyone suggest how to do this? I am using Python 2.7.14 and Pygobject(pygi-aio-3.24.1_rev1-setup). Thank in Advance.

4
  • I have multiple windows which reside in multiple glade files which are expected to be loaded as needed. Commented Jan 7, 2018 at 8:23
  • On the previous question, you said you don't want the app to appear to switch windows. Is this still true, or are you dealing with a different problem? Commented Jan 7, 2018 at 13:32
  • Nope same problem. I am taking change = switch meaning here. I dont want it look like different window opened. Just want it to change windows like any normal simple application. Nothing more. Commented Jan 7, 2018 at 14:49
  • Ok, it seems like you are used to something different than Gtk. In Gtk, if you change windows, it will look exactly that. Now, like JoseFonte said in Gtk chat, you can switch widgets within a Gtk window. But a GtkApplication is not going to help you do that. Commented Jan 8, 2018 at 0:13

1 Answer 1

1

startup/shutdown means to start or shut down the app. Which makes it easier to launch your app by double clicking a file that would normally be used in said app. Simple example

menu management This can create a global, identical menu for all windows within your GtkApplication. It can also make Mac menus easier. Since it looks like you are using Windows, this won't really help you. docs

window management You can control and monitor which windows are opened or being used, and then reopen those windows next time your app is launched. docs

Some of these features can be used for other purposes, but most GtkApplication features only are useful for advanced programming requirements.

Sign up to request clarification or add additional context in comments.

4 Comments

I saw the documentation you linked. But it is not making any sense. Specifically for one there is a function to add window but there is no direct function to show a specific window. Then do I show window with just show() method by getting that specific window? Is this correct way to use it? I couldnt figure out myself and also didnt find any examples where this particular point is covered.
You probably won't find examples, as I have yet to see somebody need/use it. It is there for edge cases. Yes, I assume after you get the window object, you would show() it.
Ok. I will try that approach.
check GNOME HowDoI and GtkWindow present / present_with_time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.