View Single Post
  #1  
Old 04-13-2016, 03:00 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
Vizinfopanel automatic resize problem

Hi, I've ran into an issue with an infopanel in one of my projects. The default behavior of the infopanel is that it automatically resizes to the text or objects inside, which is fine for my application. However when I want to change one of the texts during the task, the panel doesn't automatically resize.

I've isolated the problem to this. The following code works, and the infobox is wrapped nicely around the new line.
Code:
import viz, vizinfo

viz.go()

ip = vizinfo.InfoPanel('', icon=False, align=viz.ALIGN_CENTER)
text = ip.addItem(viz.addText('hi'), fontSize=18, align=viz.ALIGN_CENTER_CENTER)

def setMessage():
	text.message('this is a looooooooong line')
	
setMessage()
But the following code, when pressing spacebar, the text changes but the infobox keeps it's original width, so the new text overflows.

Code:
import viz, vizinfo, vizact

viz.go()

ip = vizinfo.InfoPanel('', icon=False, align=viz.ALIGN_CENTER)
text = ip.addItem(viz.addText('hi'), fontSize=18, align=viz.ALIGN_CENTER_CENTER)

def setMessage():
	text.message('this is a looooooooong line')

vizact.onkeydown(' ', setMessage)
I have a workaround where I just pad the original line with spaces to the length of the new line, so the infobox is always the same size (or I could do something like this), but maybe there's a different solution or maybe this is a bug that needs fixing
Reply With Quote