PyGTK menu doesn't display under Ubuntu Unity? - python

I have a PyGTK application, and it works fine in Gnome, but under Unity (ubuntu 10.10+) the global menu bar doesn't work - the menus are not displayed in the application window or the top bar. Is there a way to force the menu to either skip the global menu bar or display in it?
Edit:
Minimal sample added.
#! /usr/bin/python
import GUI
from GUI import Window
app = GUI.Application()
window = Window()
window.show()
app.run()

I had similar problems with simple programs created using pygtk. I believe the situation is:
pygtk works with gtk2.x
Unity uses gtk3
pygtk does not work with gtk3
python-gobject is the gtk3 equivalent of pygtk
You have an extra layer of complexity since you're using pyGUI. Most likely, pyGUI uses pygtk, which will not work with GTK3 / Unity. You can either persuade the people at pyGUI to release a GTK3-compatible version, or re-write your app from scratch using python-gobject.

Related

PyQt5 UI is inconsistent across different platforms

I'm trying to make a desktop application using pyqt5 because I need it to be cross platform but the UI is very inconsistent from a platform to another (the position of the widgets on the screen is different and sometimes they're on top of other widgets).
I'm new to pyqt5 and python in general so can you tell me why this is happening and how to fix it if possible?
PS: i'm using Qt designer to generate the UI and you can find all the code here
here are some examples:
on windows 10
on linux mint (ignore the missing images)

Using widgets intregrated. PyQT with Tkinter

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.

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.

Change Design of the buttons

I'm developing a program in python with a gui in pyqt4.
Now i have some porblem with the design of my buttons.
They have some style like windows 98 and i don't like that.
I have change my theme of my raspberry but nothing changed in my python application.
The theme changed my raspberry but not my application.
I use LXDE on my raspberry.
Do have anybody some solution?
Thanks,
You can change style of the Qt Application using one of the built in styles from Qt, for example you can use:
app.setStyle('plastique')
There are QWindowsStyle, QPlastiqueStyle, QCleanlooksStyle, QGtkStyle, QMotifStyle, QCDEStyle...
or you can use QSS (Qt Style Sheets) to theme your application, docs are here: http://qt-project.org/doc/qt-4.8/stylesheet.html

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