Is there a specialized stacked widget layout in gtk? - layout

I want to have two (or more) sets of widgets which are switched to each other in the same window.
Is there a specialized stacked widget layout in GTK?
If not, what is the shortest way to implement this behavior?
Thanks

There is a widget for this: GtkStack, available in GTK 3.10 and later.
If you don't have GTK 3.10, you can do much the same thing (but without animations) by putting the widgets in a GtkNotebook and making the notebook tabs invisible.

Related

Non rectangular shape or transparent background tkinter or any other library python?

Here is my problem. I developed a tkinter GUI for my project. However I am stuck with tkinter limitations. I developed python gui to create a virtual view for a red table as below. The window does not have any border or title. It is just put on the a picture background which is outside of the code.
However as you can see it is not lively enough for me. I want it to look like this:
Is there a way to do this in tkinter? I tried transparent backgrounds, however in Ubuntu transparent background with visible object is not possible. Also You cannot make different window shapes other than rectangle. What is your suggestions? Should I use another library. I really need an expert opinion about this.
Transparent background reference
Different window shape other than rectangle
My environment : Ubuntu 16.04 Python 3.5.2
You can't specifically change the shape of a Tkinter Window, but you can create a canvas and design your own shape (then add your buttons and labels on this canvas if needed).
You can also take a look at PyQt or Kivy, but if you are confortable with Tkinter go with Canvas.
So to solve my issue I found a python library wxPython:
You can check this link it creates Wx non rectangular shape
It creates the the window using inheritence. I tried selected answer and It solved my question.
Btw I tried QTPython, Kivy, tkinter. Non of them had straight example such wxPython.

Layout management inside Cairo DrawingArea/Context?

I have a window in mono gtk#, which has lot of VBoxes & HBoxes. These boxes contain some buttons, labels, and some other widgets also. Now I need to make this window alone to transparent.
I created one drawingArea by referring zetcode page.
But inside this drawing area I'm not able to do the arrangements of my widgets, one Move function is available, but it is not much use for me. So how do I do widget arrangement neatly inside a drawingArea?

Tkinter contents of both widgets visible when overlapping

So, I am trying to make a video game in Tkinter (no, I don't want to use PyGame), but I have ran into a bit of a problem.
I have realized that sometimes you may want to have two widgets overlap (e.g. sprite on top of background) but have the contents of both widgets to be visible. For example, I might have a sprite with transparent sections.
How do I set the "background" option of a widget so that there is no visible background?
Note: "you can't do this" answers are acceptable.
This is not really posible in Tkinter. But you can set the transparency of the whole window with root.attributes('-alpha', 0.5)
For windows, you can do root.attributes("-transparentcolor", "red"), but again it will be applied to the whole window, not just the single widget.

How to make graphic with python, Tkinter or not, not inside the rectangular window?

For example like those gadget where is a figure walking around the screen, or any graphics not bounded inside rectangular window, and even is interactive ?
The trick is to do a transparent window and hide the title bar
both are feasible with most graphic library but will be rarely cross platform
I will advise you to look at this question to hide the title bar with tkinter
Tkinter doesn't support transparency so you may need to use wxPython instead

wx Python Menu affecting display

I have two fairly large python apps using wx python for the gui. The menu bar seems to affect the display in a way that I cannot understand. In one, the menu bar appears on Show, but it pushes down the remaining controls, and the bottom ones are half off the screen. I.e. Fit() does not seem to take the menubar into account.
On the second I have a similar problem, but here the menu bar does not appear until the cursor is placed on the main panel. Then the menubar appears and pushes down the remaining controls.
I've tried to produce a skeleton screen that duplicates the problem, but I cannot, so I'm looking for pointers as to the possible cause of the problem. Can anyone suggest where to try to solve it?

Resources