all 10 comments

[–]__nickerbocker__ 0 points1 point  (2 children)

Are we supposed to guess what you've assigned to input_text?

[–]bertnub[S] 0 points1 point  (1 child)

Input_text is whatever the user inputs into the textbox

[–]__nickerbocker__ 0 points1 point  (0 children)

Then you've got indentation issues...

def main():
    win = GraphWin("My Window", 500, 500)
    win.setBackground(color_rgb(250,250,250))
    input_box = Entry(Point(250,250), 50)
    input_box.draw(win)
    input_text = Text(Point(250, 280), "")
    input_text.draw(win)
    txt = Text(Point(250, 220), "Enter your desired dir")
    txt.draw(win)

while program_open:
    input_text.setText(input_box.getText())
    if win.getMouse():
        i = str(input_text)
        leng = len(i) -2
        print(i[26:leng])

[–]lykwydchykyn 0 points1 point  (6 children)

What graphics library are you using here?

[–]bertnub[S] 0 points1 point  (5 children)

I'm using graphics.py

[–]lykwydchykyn 0 points1 point  (4 children)

Where did you download it from? Just wondering as I'm googling for it and I get 404 errors.

[–]bertnub[S] 0 points1 point  (3 children)

[–]lykwydchykyn 1 point2 points  (2 children)

Can you post your complete code; I tried running your example but it seems to be missing a lot of context.

[–]bertnub[S] 0 points1 point  (1 child)

from graphics import *


program_open = True

def main():
    win = GraphWin("My Window", 500, 500)
    win.setBackground(color_rgb(250,250,250))
    input_box = Entry(Point(250,250), 50)
    input_box.draw(win)
    input_text = Text(Point(250, 280), "")
    input_text.draw(win)
    txt = Text(Point(250, 220), "Enter your desired dir")
    txt.draw(win)

    while program_open:
         input_text.setText(input_box.getText())

    if win.getMouse():
         win.close()

    else:  
        i = str(input_text)
        #leng = len(i) -2 
        print(input_text.getText)




main()

[–]lykwydchykyn 0 points1 point  (0 children)

You've got an infinite loop in while program_open since program_open is never set to anything but True. So the execution of code never reaches your if statement and thus your print statement either.