Writing in a Panel Field child of a Layer

29 views
Skip to first unread message

joaomesq

unread,
Jan 21, 2012, 9:03:25 PM1/21/12
to NodeBox for OpenGL
Hello,

I'm trying to use layers in order to design the several game modes of
my game and something weird is happening. If I append a Panel to a
Layer, I can interact with the Panel elements with the mouse, but I
can't write anything on the Field control. No problem if the Panel is
appended directly on the Canvas.

Below the code I'm using. Any help appreciated.

from nodebox.graphics import *
from nodebox.gui import *

def show_main_panel(layer,mouse):
main_panel.open()

main_screen = Layer( x = 0, y = 0, width = 1024, height = 768, origin
= (0,0), scale = 1.0, rotation = 0, opacity = 1.0, duration = 0.0,
name = None, parent = None)
main_screen.enabled = True
main_screen.set_method(show_main_panel, name="on_mouse_press")

main_panel = Panel("Panel", width=200,
height=200,fixed=False,modal=True,id="main_panel")
main_panel.append( Rows(controls=[ Field(value="", hint="Username",
id="insert_username",width=140) ]))
main_panel.pack()
main_screen.append(main_panel)
canvas.append(main_screen)

main_panel.close()

def draw(canvas):
background(1)

canvas.fps = 30
canvas.size = 1024, 768
canvas.run(draw)
Reply all
Reply to author
Forward
0 new messages