How can I combine tkinter GUI and pyglet graphics? - python-3.x

I am trying to combine tkinter and pyglet into one application. Using tkinter for the gui, one component of which is a canvas and I would like to use pyglet to paint/draw on that canvas. Is this possible? Examples I found show two separate windows. That's not what I'm looking for.

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.

Styling options in Tkinter

Is there any options available in Python tkinter that can be used to build a modern-day GUI. For instance, we can change the style of a button, etc. In short, I want to change the whole look & feel of the GUI.
Regards.

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

Is there a specialized stacked widget layout in gtk?

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.

Resources