tags:

views:

38

answers:

0

I have a gui interface in blender and the following should be the scenario for the user :

after pressing the button "Run" then the user could enter sentences in the input text box such that each sentence should be ended with a dot point '.' then if the user enter a sentence then the input box should be cleared and the entered sentence should be displayed in the output text box.

The problem is in the following part of code :

while 1:
  input = Textbox1.val
  if input.__contains__('.'):
    Textbox1.val = ''
    Textbox2.val = input

And here is all of my code:

import Blender

from Blender.BGL import *

from Blender.Draw import *

def draw_gui():

global Textbox1, Textbox2

Textbox1 = Create('input')

Textbox2 = Create('output')

glClearColor(0.753, 0.753, 0.753, 0.0)

glClear(GL_COLOR_BUFFER_BIT)

glColor3f(0.000, 0.000, 0.627)

glRecti(20, 150, 730,500)

Button('Exit', 1, 450, 220, 87, 31)

Button('Quit', 2, 350, 220, 87, 31)

Button('Run', 3, 250, 220, 87, 31)

Textbox1 = String('', 4, 50, 400, 650, 50, Textbox1.val, 399, '')

Textbox2 = String('', 4, 50, 300, 650, 50, Textbox2.val, 399, '')

def event(evt, val):

  if (evt==QKEY and not val): Exit()

def bevent(evt):

  if evt == 1: #cmdExit

              Exit()

   elif evt == 2 : #cmdQuit

           Blender.Quit()

   elif evt == 3 : #cmdRun

########################### from here the problem starts

           while 1:

               input =Textbox1.val

               if input.__contains__('.'):

                   Textbox1.val=''

                   Textbox2.val=input

#################### and here is the end of it

   Blender.Redraw()

Register(draw_gui, event, bevent)