Gtk multiple screens - python

I have a Gtk window that I fill with different grids. I notice that my code is starting to become a huge mess!
Basically I have 1 window with buttons. On button click, I want the Gtk Window to display a different grid. But the more screens I get, the messier my code gets.
What is the best way to do this?

Related

How would I go about making a overlay widget

How would I go about making a overlay widget with qt?
I've considered using a QPaintEvent or a QGraphicsScene, but I want to be able to add widgets and for the widget to not occupy space in a layout, causing other widgets to shift when the popup appears.
I believe the best solution is to parent the so called overlay widget to the window or even have the overlay widget be in its own window.
The first solution might be easier to do, but the overlay widget is bound to the inside of the window.
If you go with the second solution, you will have to play with the windows flags to make it borderless.
In both cases, you may have to use the raise() function to make sure your overlay widget is on top.
Discussing "using a QPaintEvent or a QGraphicsScene" is off-topic. How you draw the widget does not impact how the widget will interact with the widget stack.
If you want an example, you can take a look at the code of QCompleter which does something similar. In particular look for QCompleter::setPopup() and QCompleterPrivate::showPopup().

Python GTK 3 Popover off window?

So basically I have a window thats just a vertical list of buttons. I want to create a dropdown menu that goes off to the side without changing the size of the window. I am trying to do this with popover, but now I have the problem where my popover gets cut off by the window. Is there a way I can make it bleed past the window boundaries?
Popovers don't go wider than the parent window. You could have a try at a GtkMenu. They are allowed to go wider than the window, up to the width of the monitor.

Tkinter application topmost, even over fullscreen

I'm using tkinter on Ubuntu.
I'd like my application to be on top of the screen, all the time. I'm aware of, and am currently using, wm_attributes("-topmost", 1). I've discovered that this is equal to right clicking on the menu bar of an application and selecting 'Always On Top', which works fine for most applications. However, this doesn't work when full-screen applications are launched (specifically, TF2). In such cases, my widget lies behind the game.
I'm also aware of overrideredirect(True), and this stays on top of the game even over full-screen, but this is not viable as the menu bar and being able to move the window are central to my application.
Is there a way to have tkinter remain on top of every application, including those that are full-screen? Basically the functionality of overrideredirect, but keeping the menu bar and the ability to move the window.

Most effective way to split a GUI screen with PySide?

I'm writing a PySide application with a GUI meant for a touch screen. It has a main window that covers 75% of the screen and a 25% vertical panel that has buttons that control the content displayed on the main window (several widgets/screens should appear on the main window).
I've seen several different ways for doing this "split": QFrame, QStackedLayout, QStackedWidget. Being a beginner with PySide/Qt, I couldn't figure out which one is the best way to go for my specific case. Any suggestions or example applications?
QFrame with a QVBoxLayout and specify the stretch factor: (C++ code)
MainWidget main = new MainWidget();
ButtonWidget buttons = new ButtonWidget();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(buttons);
layout->addWidget(main);
layout->setStretch(0,25);
layout->setStretch(1,75);
form->setLayout(layout);

Creating multiple screens in pygame

Is there any way way to create multiple screens in Pygame without redrawing to the screen every time. For example, if we want to create a splash screen, then a main menu with buttons. On clicking the 'Start Game' button, it would go to a new screen which is the actual game. What I mean is anything similar to the 'Form' on Visual Studio or the Activites on Android.
Depends on what you mean.
If you mean making multiple windows at the same time, no, you can't do that--it's a limitation of SDL (although you CAN fake it by using multiprocessing (not multithreading)).
If you mean changing one screen around, yes, you can do that, with multiple calls to pygame.display.set_mode(...). You can change the resolution, arguments, etc. If you're doing OpenGL stuff, that will remake the context too.
If you just mean drawing different things to the same window, of course! That's sorta the point of PyGame.
Other than that, you'll have to clarify.
Just fill the screen with white and then draw the second screen onto the main screen. Then when you need the other screen, just refill the screen with black and then continue. It would help if both of your screens a function and you used a key like tab to "switch" between screens.

Categories