Using widgets intregrated. PyQT with Tkinter - python

I have an image editor created in tkinter. However, I would add a floating widgets that exist in PyQt. Is there any way to run integrated tkinter with PyQt?

I make a workaround that solved the problem. I used python subprocess for call the PyQT instance and the option QtCore.Qt.WindowStaysOnTopHint for app running on top of tkinter. It´s work.
but the best solution is to create a thread in python and call PyQt in this thread. In this case it is possible to pass an instance of tk for PyQt and make communication between the two. It´s work too. It´s fine.

No, there is no way to combine widgets from PyQt and Tkinter in a single app. At least, not without resorting to running each toolkit in a separate thread or process. You can't embed the widgets of one into the widgets of the other.

Related

Using cv2.WINDOW_GUI_EXPANDED to be able to use zoom with imshow()

I need to be able to zoom in and out of an image I show using cv2.imshow().
I read that this can be done by adding a flag that enables an expanded gui display.
cv2.namedWindow('image',cv2.WINDOW_GUI_EXPANDED)
However, running this does not seem to make a difference, and I don't see any buttons on the gui window I create. Is there anything I need to install and how should I run it? I'm not getting any errors.
Thank you.
imshow zooming should work via built-in mouse events without WINDOW_GUI_EXPANDED.
For imshow or your particular use case, there are two requirements for zooming to work:
OpenCV is compiled with Qt library support
A thread is currently free to handle the window events (cv.waitKey(0) blocking in the main thread, or cv.startWindowThread() to spool up a background thread for window events)
I was never able to get QT support to work in windows with python. It works seamlessly in linux. And by building from source on windows with c++, it also works.
I believe that for python you need to install by copying the pyd file in C:\opencv\build\python\cv2\python-3 to your packages folder. Or you need to compile with the global python directories specified in the cmake config.

Embedding IPython console in Tkinter frame

I was working on a PyQt application that had an embedded JupyterWidget that would allow a user to use an IPython console to interact with certain variables that were being displayed. However, it was recently suggested that we switch to Tkinter graphics instead of Qt because of Tkinter's out of the box support in Python.
Is there a Tkinter equivalent implementation of the JupyterWidget in PyQt? The best I can seem to find is https://github.com/ipython/ipython/wiki/Trash:-Old-Embedding-Tkinter but this uses a very old version of IPython where almost all of the function calls are deprecated or removed entirely.
I had also tried this but was unable to make it so that changes in the subprocess' variables were reflected in the overall program.

Is there a way to get the labels of running GTK applications?

I am trying to extract labels of widgets of running GTK applications. I tried using GtkParasite but I have no idea how to get it working in my python program.
I want to be able to get the widgets and their labels of a gtk application that is running on my computer. It means that if I run gedit on my system then i want to get the labels of the widgets at run time. I hope this makes sense.
Is there a way to use the C library of GTK to get an instance of a running GTK application?
Thanks in advance.
You probably should use accessibility libraries - those are tools that allow eg. screen readers to read GUI labels for visually impaired users. On Linux, at-spi2 seems to be the de-facto standard.
For Python, take look at at-spi examples:
https://github.com/infapi00/at-spi2-examples

Modern tkinter menus in Windows

Is it possible, using tkinter, to create a modern menu with a divider on the left for icons?
It was introduced in Windows Vista, if I'm not mistaken.
Tkinter can not provide native looking windows. If you're looking to make a more modern program, I'd suggest using wxPython or PyQt.
You could probably just use the menu from either and attach it to a Tk window somehow, but it's not recommended.

PyGTK and visual-python

I'm developing an application with PyGTK that will make use of visual-python's 3d drawings and animations, but I can't get both libraries to work together: they either hung up when I close the Gtk window or they get stuck when I run the application.
I've tried with threads and they run side-by-side, but when I close visual-python's window this kills python's interpreter, raising a Segmentation Fault.
Has anyone been able to use visual-python from a PyGtk app?
This is a non-trivial problem given the way that VPython wants to work, but there is an example in the contributed programs section of the VPython web site that shows how to embed VPython into a wxPython application, so perhaps you can look over that code and determine what you would need to do to perform the same magic in PyGTK.

Categories