qt - How can I set just `Widget` size? -


how can set widget size?

my code:

from pyside.qtgui import qapplication, qwidget, qlabel import sys app = qapplication(sys.argv)  mainwindow = qwidget() gamewidget = qwidget(mainwindow)  #gamewidget.setgeometry(gamewidth, gameheight) <-- want set size of gamewidget such this. how can this. gamewidget.move(100,0) gamelabel = qlabel("this game widget", gamewidget)  mainwindow.show() 

output:

enter image description here

description:

this create window contain widget. want set widget size. know there method widget.setgeometry, takes 4 parameter (x, y, width, height). want method widget.setgeometry takes size parameter (width, height).

p.s. feel free modify question. because i'm learning english!!

thanks.

just use qwidget.resize(weight, height).

for example:

gamelabel.resize(200, 100); 

besides, can use qwidget.sizehint() proper size automatically, example:

gamelabel.resize(gamelabel.sizehint()); 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -