Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97281 > unrolled thread
| Started by | Hedieh Ebrahimi <hemla21@gmail.com> |
|---|---|
| First post | 2015-10-01 06:44 -0700 |
| Last post | 2015-10-05 11:28 -0700 |
| Articles | 11 — 5 participants |
Back to article view | Back to comp.lang.python
PySide window does not resize to fit screen Hedieh Ebrahimi <hemla21@gmail.com> - 2015-10-01 06:44 -0700
Re: PySide window does not resize to fit screen Chris Warrick <kwpolska@gmail.com> - 2015-10-01 17:07 +0200
Re: PySide window does not resize to fit screen Laura Creighton <lac@openend.se> - 2015-10-01 18:19 +0200
Re: PySide window does not resize to fit screen Hedieh Ebrahimi <hemla21@gmail.com> - 2015-10-02 06:10 -0700
Re: PySide window does not resize to fit screen Chris Warrick <kwpolska@gmail.com> - 2015-10-02 15:25 +0200
Re: PySide window does not resize to fit screen Hedieh Ebrahimi <hemla21@gmail.com> - 2015-10-05 01:18 -0700
Re: PySide window does not resize to fit screen Laura Creighton <lac@openend.se> - 2015-10-05 12:51 +0200
Re: PySide window does not resize to fit screen Hedieh Ebrahimi <hemla21@gmail.com> - 2015-10-05 04:20 -0700
Re: PySide window does not resize to fit screen Chris Warrick <kwpolska@gmail.com> - 2015-10-05 15:32 +0200
Re: PySide window does not resize to fit screen Michael Torrie <torriem@gmail.com> - 2015-10-05 10:28 -0600
Re: PySide window does not resize to fit screen wxjmfauth@gmail.com - 2015-10-05 11:28 -0700
| From | Hedieh Ebrahimi <hemla21@gmail.com> |
|---|---|
| Date | 2015-10-01 06:44 -0700 |
| Subject | PySide window does not resize to fit screen |
| Message-ID | <24851466-7de1-408f-a0a0-548d42d21ab4@googlegroups.com> |
Dear all, I am using Pyside to create a user interface for my app. The app works fine on my computer with big screen, but when I take it to my laptop with smaller screen size, it does not resize to match the screen size. How can I make my main widget get some information about the screen size and resize automatically? Thanks in Advance for your answers.
[toc] | [next] | [standalone]
| From | Chris Warrick <kwpolska@gmail.com> |
|---|---|
| Date | 2015-10-01 17:07 +0200 |
| Message-ID | <mailman.297.1443712037.28679.python-list@python.org> |
| In reply to | #97281 |
On 1 October 2015 at 15:44, Hedieh Ebrahimi <hemla21@gmail.com> wrote:
> Dear all,
>
> I am using Pyside to create a user interface for my app.
> The app works fine on my computer with big screen, but when I take it to my laptop with smaller screen size, it does not resize to match the screen size.
>
> How can I make my main widget get some information about the screen size and resize automatically?
>
> Thanks in Advance for your answers.
> --
> https://mail.python.org/mailman/listinfo/python-list
The correct way to do this is to lay your application out using a
layout. The available layouts are:
* QHBoxLayout
* QVBoxLayout
* QGridLayout
* QFormLayout
The exact layout to use depends on your needs.
What are you using to create your Qt code? Are you using Qt Designer
or are you writing the code by hand? If you are using Qt Designer,
use the “Lay Out…” buttons in the Form menu or on the tool bar. If
you are writing Qt code by hand, it looks roughly like this (for a
VBox; Grid and Form are more complicated as they involve positioning):
lay = QtGui.QVBoxLayout(self) # your central widget, dialog, main
window — whichever one exists
btn = QtGui.QButton("Hello", lay)
lay.addWidget(btn)
Please check with Qt documentation for more details
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
[toc] | [prev] | [next] | [standalone]
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Date | 2015-10-01 18:19 +0200 |
| Message-ID | <mailman.299.1443716363.28679.python-list@python.org> |
| In reply to | #97281 |
In a message of Thu, 01 Oct 2015 06:44:25 -0700, Hedieh Ebrahimi writes: >Dear all, > >I am using Pyside to create a user interface for my app. >The app works fine on my computer with big screen, but when I take it to my laptop with smaller screen size, it does not resize to match the screen size. > >How can I make my main widget get some information about the screen size and resize automatically? > >Thanks in Advance for your answers. screenGeometry = QApplication.instance().desktop().screenGeometry() to find out your desktop size in pixels. availGeometry = QApplication.instance().desktop().availableGeometry() is the same thing minus the space for the task bar, so maybe more useful. width, height = availGeometry.width(), availGeometry.height() Finding out what pyside thinks the size is can be useful for debugging problems, but this stuff should already be happening automatically. There is something not quite right with your layout, and brutally resizing things by hand is treating the symptom, not the cause. Laura
[toc] | [prev] | [next] | [standalone]
| From | Hedieh Ebrahimi <hemla21@gmail.com> |
|---|---|
| Date | 2015-10-02 06:10 -0700 |
| Message-ID | <0536254e-4101-4b7c-a848-61a5c3e1a064@googlegroups.com> |
| In reply to | #97287 |
Thanks Laura, In my user interface I have many group boxes that are located inside the main widget. All the group boxes and their child widgets have fixed sizes. How can I use the width and height I get from availableGeometry or ScreenGeometry to multiply screenGeometry = QApplication.instance().desktop().screenGeometry() availGeometry = QApplication.instance().desktop().availableGeometry() width, height = availGeometry.width(), availGeometry.height() to resize my geometry by a ratio? Is this a good approach?
[toc] | [prev] | [next] | [standalone]
| From | Chris Warrick <kwpolska@gmail.com> |
|---|---|
| Date | 2015-10-02 15:25 +0200 |
| Message-ID | <mailman.339.1443792347.28679.python-list@python.org> |
| In reply to | #97335 |
On 2 October 2015 at 15:10, Hedieh Ebrahimi <hemla21@gmail.com> wrote: > Thanks Laura, > > In my user interface I have many group boxes that are located inside the main widget. All the group boxes and their child widgets have fixed sizes. > > How can I use the width and height I get from availableGeometry or ScreenGeometry to multiply > > screenGeometry = QApplication.instance().desktop().screenGeometry() > availGeometry = QApplication.instance().desktop().availableGeometry() > width, height = availGeometry.width(), availGeometry.height() > > to resize my geometry by a ratio? Is this a good approach? > -- > https://mail.python.org/mailman/listinfo/python-list This is NOT a good approach. A good approach involves using a layout. See my previous e-mail for details. Geometry is not going to help you here, especially since you would need a ton of code to resize everything on **any** window size change event. And you especially do not need the screen size, because it would still hinder changing window sizes. -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16
[toc] | [prev] | [next] | [standalone]
| From | Hedieh Ebrahimi <hemla21@gmail.com> |
|---|---|
| Date | 2015-10-05 01:18 -0700 |
| Message-ID | <ed4e0666-4cfc-4061-82b0-64e2aa857c16@googlegroups.com> |
| In reply to | #97336 |
Hi Chris, Thanks for your answer. I get your point now. Unfortunately there are not layouts in my user interface. Smaller widget have been grouped using group boxes and then all these group boxes are put on the central widget. I would like to recreate my user interface using one of the designer software that exist. Could you recommend any free designer software that I can create my user interface with? Thank you
[toc] | [prev] | [next] | [standalone]
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Date | 2015-10-05 12:51 +0200 |
| Message-ID | <mailman.382.1444042277.28679.python-list@python.org> |
| In reply to | #97400 |
In a message of Mon, 05 Oct 2015 01:18:33 -0700, Hedieh Ebrahimi writes: >Could you recommend any free designer software that I can create my user interface with? > >Thank you Qt Designer works with PySide. http://doc.qt.io/qt-5/designer-quick-start.html Laura
[toc] | [prev] | [next] | [standalone]
| From | Hedieh Ebrahimi <hemla21@gmail.com> |
|---|---|
| Date | 2015-10-05 04:20 -0700 |
| Message-ID | <b855667a-c5cc-45bb-a93f-01f5b2778a0c@googlegroups.com> |
| In reply to | #97405 |
is this free to use for commercial use?
[toc] | [prev] | [next] | [standalone]
| From | Chris Warrick <kwpolska@gmail.com> |
|---|---|
| Date | 2015-10-05 15:32 +0200 |
| Message-ID | <mailman.388.1444051962.28679.python-list@python.org> |
| In reply to | #97406 |
On 5 October 2015 at 13:20, Hedieh Ebrahimi <hemla21@gmail.com> wrote: > is this free to use for commercial use? > -- > https://mail.python.org/mailman/listinfo/python-list Yeah, you can use Qt Designer to create a nice layout and the pyside-uic tool to generate code (that you will need to clean up later). -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16
[toc] | [prev] | [next] | [standalone]
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Date | 2015-10-05 10:28 -0600 |
| Message-ID | <mailman.402.1444062528.28679.python-list@python.org> |
| In reply to | #97406 |
On 10/05/2015 05:20 AM, Hedieh Ebrahimi wrote: > is this free to use for commercial use? Yes of course. There's also the newer Qt Creator program if you want to use Qt 5. The license of the Designer and Creator programs does not apply to the output of these programs (the .ui XML files). You'll want to read up on the documentation. Here's a couple of links for starters: http://doc.qt.io/qt-4.8/designer-layouts.html https://wiki.qt.io/QtCreator_and_PySide (works with .ui files from Designer also) Even if you don't use a GUI designer, you should construct your GUI with layout managers so that your interfaces can adjust and look good on a variety of screen sizes and DPI. It's pretty simple once you wrap your brain around the idea. Another method of working with .ui files it to load them at runtime: https://srinikom.github.io/pyside-docs/PySide/QtUiTools/QUiLoader.html
[toc] | [prev] | [next] | [standalone]
| From | wxjmfauth@gmail.com |
|---|---|
| Date | 2015-10-05 11:28 -0700 |
| Message-ID | <2a082305-37a7-4801-96cb-288696060896@googlegroups.com> |
| In reply to | #97405 |
Le lundi 5 octobre 2015 12:51:31 UTC+2, Laura Creighton a écrit : > In a message of Mon, 05 Oct 2015 01:18:33 -0700, Hedieh Ebrahimi writes: > >Could you recommend any free designer software that I can create my user interface with? > > > >Thank you > > Qt Designer works with PySide. > http://doc.qt.io/qt-5/designer-quick-start.html > > Laura And PySide does not work properly with Python 3.3+.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web