[PyQt] Simple Window Problem
felix-biz at felixlovesliz.com
Mon Mar 23 16:50:03 GMT 2015
Thanks so much for your reply.
1. As you noted, the MainWindow was generated from pyuic5 after using
the QtCreator. No changes were made to the resulting mainwindow.py file.
2. Regarding your question, the Menu Bar is at the upper left. The
"File" menu only has an "Exit" entry which works correctly. The
Title bar is missing at the very top.
3. I tried both of your suggestions with no changes.
4. The application was tried under both LDXE and GNOME and responded
the same way.
5. I plan to change the specification of the menu bar today to see if
that affects anything. I did notice that there were indications of
an error (slashed 0) in the Object window on the QtCreator window,
but could not find out why.
6. Will also report on the print statement to show geometry.
7. If I can't resolve the problem with those means, I will try either a
cross compile of Qt5 or recompiling it on the RPi with the resulting
48 hours keeping the RPi busy. Maybe I will get a Pi 2, which is
considerable faster, before I start that phase.
On 03/22/2015 01:53 PM, David Cortesi wrote:
> Interesting. I always find the proper use of the pyuic5 output
> confusing, despite the relatively clear documentation here:
> You appear to be using the "second approach" shown there exactly.
> In the class Ui_MainWindow(object) I see,
> MainWindow.resize(400, 300)
> so it should not be more than 400px across and 300 high plus the menu
> bar. I also see
> self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 22))
> which suggests the menu bar will be at 0,0, that is, upper left
> corner. Is it?
> All I can suggest is that you temporarily insert something like,
> self.resize(200,100) after the call to setupUi() to force the window
> to be
> smaller.Or you could use self.*setGeometry*(50,50,200,100) to ensure
> that the upper left corner is on the screen.
> And add a temporary print before the exit to show the current geometry,
> self.geometry().y(),self.geometry().width(),self.geometry().height() )
> Then drag the window to a desirable starting size and position; quit;
> and the print tells you how to set the geometry on startup. Later you
> can add code to save the current geometry in your Settings on exit and
> load it on startup.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt