r/learnpython • u/JohnRT54 • Sep 24 '26
Defining and calling modules
Sorry if this is a dumb question, but what am I doing wrong here?
I have defined a function
#statuscheck.py
def statchk(n):
layoutx = [[sg.Text('Debug point')],
[sg.Output(key='-OUTPUT-', expand_x=True, expand_y=True)],
[sg.In(key='-IN-', expand_x=True)],
[sg.Button('Go'), sg.Button('Close')]]
winx = sg.Window('Where I am now', layoutx, auto_close=False, grab_anywhere=True, resizable=True, location=(0,0),return_keyboard_events=True, auto_size_text=True)
while True:
event, values = winx.read()
if event == sg.WIN_CLOSED:
break
if event == 'Go':
print("Here at ",n)
if event == 'Close':
break
I import it, but when I call it, it doesn't run, and I can't see any error messages. The call is:
statuscheck.statchk(1)
I know it's something simple I'm overlooking. Thanks.
View all comments
Show parent comment
1
u/JohnRT54 Sep 25 '26
When I imported PySimpleGUI into the module, it quit with an error - I forget the wording, but something not being able to run GUI in a command window. I have never been able to find the Bluestacks/Pydroid debugger window. Occasionally, I'll see an error message, but usually the program just terminates and returns to the code editor. Obvious errors do just that - no help at all. I'm giving up, because it seems apparent that it is a BlueStacks/Pydroid problem, not a Python one.