PDA

View Full Version : Displaying Text on new Window


chris2307
04-24-2014, 09:00 AM
Hi all,

I have an application which can either run in single screen mode or three screen mode.

Single screen mode uses viz.MainView only and three screen mode, I use three custom windows.

My only problem is when I attempt to display text in the centre of the application. The parent of the text by default is viz.SCREEN. I attempt to reset this if I am in three screen mode to the centre screen.

Unfortunately, I don't see the text. I don't get errors either.

Screen Code:


# The following is also done for the left window and right window.

centreWindow = viz.add(viz.WINDOW)
centreWindow.setPosition(1.0/3, 1.0)
centreWindow.setSize(1.0/3, 1.0)
centreWindow.visible(0,viz.SCREEN)
centreWindow.fov(fieldOfView,aspectRatio)
centreView = viz.add(viz.VIEWPOINT)
centreWindow.setView(centreView)

def returnScreen():
if(threeScreen):
return centreWindow
else:
return False


Here is my default text code:

self.trialInstructions = "TEXT"
self.text = viz.addText(self.trialInstructions, parent=viz.SCREEN)
self.text.color(viz.WHITE)
self.text.setPosition(0.5,0.5)
self.text.alignment(viz.ALIGN_CENTER_CENTER)
self.text.fontSize(40)
self.text.visible(viz.OFF)


During three screen mode, I run this code:

if not(screen.returnScreen() == False):
print otherScreen
self.text.setParent(otherScreen)

self.text.visible(viz.ON)


Can anyone see the mistake I am making?

Thanks

farshizzo
04-25-2014, 09:03 AM
If you only want the object to show up on a specific window, then use the renderOnlyToWindows command. Example:
self.text.renderOnlyToWindows([centreWindow])