[PyKDE] First script after 'hello world', cant get it to resize properly

Nigel Rowe rho at bigpond.com
Mon Mar 3 05:23:00 GMT 2003


Greetings all,
	I've just started to use PyQt, next script after 'hello world' is to display 
fortune cookies in a window, with 'Get another' and 'Quit' buttons.

I cannot get it to resize to the size of the currently displayed cookie.  It 
seems to resize to max(previous_minimum_size, current_minimum_size).

For example (just using the height)

Cookie	Window
height	height
lines	lines
  3       3
  1       3
  2       2
  1       2
  3       3

I've tried all the seemingly appropriate methods (see commented out lines) to 
no effect.

I assume I'm missing something basic, could someone point me in the right 
direction?

Thanks
	Nigel




class FortuneForm(fortuneFormBase):

    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        fortuneFormBase.__init__(self,parent,name,modal,fl)
        self.getFortune()

    def getFortune(self):
        cmd = "/usr/games/fortune"
        if self.obsceneCheckBox.isChecked():
            cmd += " -o"
        cookie = os.popen(cmd).read()

        #self.fortuneTextLabel.clear()
        #self.fortuneTextLabel.adjustSize()

        self.fortuneTextLabel.setText(cookie)

        #self.fortuneTextLabel.adjustSize()
        #self.fortuneTextLabel.resize(self.fortuneTextLabel.minimumSizeHint())
        #self.resize(QSize(0,0).expandedTo(self.minimumSizeHint()))
        #self.repaint()
        #self.show()

        self.resize(self.minimumSizeHint())

        #self.repaint()
        #self.adjustSize()




More information about the PyQt mailing list