Jump to content

Running a simple python program using GOM IDE


---
 Share

Recommended Posts

I have little knowledge of Python, but I am learning. I need to do something simple, but when I test a program out in GOM's IDE workspace it just stalls out inside the program.

For example....I wrote this quick program

[quote]

user_name = input('Enter User Name: ')

print(user_name)

wait = input('Press Enter to Continue')

[/quote]

What happens is when I right click and select > Run the program puts 'Enter User Name' in the bottom pane window, but the curser just circles and the program does not let me enter in my name?  If I run the program in the command prompt it works.

 

Any help is appreciated....thanks.

Link to comment
Share on other sites

I dont know if GOM's interface will let you input responses like that. You can try using a dialog box that will prompt the user to input a value-

# -*- coding: utf-8 -*-

import gom


def input_box(prompt=''):
	
	input=gom.script.sys.create_user_defined_dialog (content='<dialog>' \
	'<title>*</title>' \
	'<control id="Close"/>' \
	'<position>center</position>' \
	'<sizemode>fixed</sizemode>' \
	'<size width="350" height="100"/>' \
	'<content columns="1" rows="2">' \
	'<widget rowspan="1" row="0" type="label" columnspan="1" column="0">' \
	'<name>prompt</name>' \
	'<tooltip></tooltip>' \
	'<text></text>' \
	'<word_wrap>false</word_wrap>' \
	'</widget>' \
	'<widget rowspan="1" row="1" type="input::string" columnspan="1" column="0">' \
	'<name>input_text</name>' \
	'<tooltip></tooltip>' \
	'<value></value>' \
	'<read_only>false</read_only>' \
	'</widget>' \
	'</content>' \
	'</dialog>')
	
	input.prompt.text = prompt
	
	gom.script.sys.show_user_defined_dialog(dialog=input)
	
	return input.input_text.value


user_name = input_box('Enter User Name:')

print(user_name)

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...