I wanted to make a Simple gui with wxpython (In python 3.6.1) because i didn't want to use the commandline for this project anymore.
I have a big file for the Logic in another file, that is also used by other non wxpython files.
But when I try to import my Logic class I Get this error :
ImportError: cannot import name 'QuestionAsk'
I use this Line to import the Logic class :
from Get import QuestionAsk
The file "Get.py" is in the same directory as the gui file. Here
But it dosen't work why and how can I import this file ?
By the way I call the gui.py file from the get.py file and import the get.py file from the Asker.py file.
ps : Pleas try to not answer :" just copy the content of that class into your gui file" because i use this class elsewhere if there is no other solution then that's ok but that's just ugly and unefficient.
Edit Here is code from the Get file that starts the Gui :
def graphical_start():
app = wx.App(False) # int app
frame = GuiVocCard() # set frame (GuiVocCard is in the main Gui File)
frame.Show() # show frame
app.MainLoop() # execute loop
And here is The Start of the main Gui class "GuiVocCard" :
class GuiVocCard(wx.Frame):
def __init__(self):
self.language = "es"
self.transList = "C:\\Users\\Justus\\Desktop\\Schule\\spa\VocabGeter\\translations\\big_translation.json"
self.verb_forms = [0,2]
self.High_Score = 0
self.s_file = "scores.json"
self.S_chunk = 40
self.chunk_file = "chunks.json"
self.load_config()
self.q_ask = QuestionAsk(lan=self.language, trans=self.transList, verb_forms=self.verb_forms,
scores_file=self.s_file, chunks_file=self.chunk_file, chunk_size=self.S_chunk)
...
Edit 2 :
The QuestionAsk is defined here in the Get.py file:
class QuestionAsk:
def __init__(self,lan="es",trans="C:\\Users\\Justus\\Desktop\\Schule\\spa\VocabGeter\\translations\\translation.json"
,verb_forms=[0,2],scores_file="scores.json",chunks_file="chunks.json",chunk_size=40):
self.language = lan
self.transList = trans
self.verb_forms = verb_forms
self.High_Score = 0
self.s_file = scores_file
self.S_chunk = chunk_size
self.chunk_file = chunks_file
Fixed it (yay) :
I removed the graphical_start function from the Get.py file and pasted it into the gui.py file . I now import the Gui.py file directly from the Asker.py file .