1

I Have created 2 scripts.

1.rec.py uses tkinter to enter user input

2.classify.py uses input from rec.py to perform transformations

What I want to achieve:

  1. call user input from rec.py and make it a variable in classify.py

  2. use variable to perform tranformations in classify.py

  3. print output of classify.py

What i did:

rec.py:

def click(text_user_example):
    text_user = text_user_example
    os.system("classify.py")

#create a text entry box
text_user = Entry(window, width=20, bg="white")
text_user.grid(row=2, column=0, sticky=W)

#add a submit button
Button(window, text="SUBMIT", width=6, command = lambda: 
click(text_user)).grid(row=3, column=0,  sticky=W)

classify.py:

from rec import text_user #this is the only variable i want from "rec.py"
--other tranformations using text_user
print(text_user) 

Unfortunately, every time i run classify.py the tkinter interface pops up even after i have submitted my input(the interface should not pop up after text-user has been entered).

What am i doing wrong?

Mbali_c
  • 47
  • 6
  • 1
    *"What am i doing wrong?"*: Your `rec.py` is **not** a `module`. Read [what-does-if-name-main-do](https://stackoverflow.com/questions/419163/what-does-if-name-main-do) – stovfl Feb 13 '19 at 19:31
  • 1
    `classify.py` uses `rec.py` and `rec.py` calls `classify.py` -> infinite loop. – acw1668 Feb 14 '19 at 02:37

0 Answers0