def button_load_learning_result_clicked(self):
global episode
initialdir = os.path.dirname(os.path.realpath(__file__))
while True:
if platform.system() == 'Darwin':
q_index_path = askopenfilename(initialdir=initialdir, message='Choose q_index',
filetypes=[('pickle files', '*.pickle'),
("All files", "*.*") ])
else:
q_index_path = askopenfilename(initialdir=initialdir, title='Choose q_index',
filetypes=[('pickle files', '*.pickle'),
("All files", "*.*") ])
if 'q_index' not in q_index_path:
messagebox.showwarning(message='Wrong file.')
else:
break
while True:
if platform.system() == 'Darwin':
q_table_path = askopenfilename(initialdir=initialdir, message='Choose q_table',
filetypes=[('pickle files', '*.pickle'),
("All files", "*.*") ])
else:
q_table_path = askopenfilename(initialdir=initialdir, title='Choose q_table',
filetypes=[('pickle files', '*.pickle'),
("All files", "*.*") ])
if 'q_table' not in q_table_path:
messagebox.showwarning(message='Wrong file.')
else:
break
try:
hunter.q_table = pd.read_pickle(q_table_path)
hunter.q_index = pd.read_pickle(q_index_path)
episode = [int(d) for d in q_table_path.split('_') if d.isdigit()][0]
self.label_episode_v.set('Episode: %s' % episode)
except Exception as e:
messagebox.showerror(message=e)
评论列表
文章目录