WIP add gui elements

This commit is contained in:
LSaldyt
2017-09-27 12:30:42 -06:00
parent 9a2a30ea4c
commit ae24034288
3 changed files with 262 additions and 106547 deletions

106792
copycat.log

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,10 @@ class Copycat(object):
self.reporter.report_workspace(self.workspace)
if self.showgui:
self.gui.update()
self.gui.update(
self.temperature.value(),
self.slipnet.slipnodes
)
return lastUpdate
def runTrial(self):

View File

@ -1,15 +1,19 @@
#!/usr/bin/env python3
import sys
import time
import tkinter as tk
import tkinter.ttk as ttk
from tkinter import scrolledtext
from tkinter import filedialog
class MainApplication(ttk.Frame):
def __init__(self, parent, *args, **kwargs):
ttk.Frame.__init__(self, parent, *args, **kwargs)
self.widgets = dict()
self.parent = parent
self.create_widgets()
self.columnconfigure(0, weight=1)
@ -20,8 +24,10 @@ class MainApplication(ttk.Frame):
main_label = tk.Label(self, text="abc:abd::ijk:?", background='black', foreground='white')
main_label.grid(column=0, row=0, columnspan=9, rowspan=4)
self.widgets['main'] = main_label
temp_label = tk.Label(self, text='temp')
temp_label.grid(column=9, row=0, rowspan=1, sticky=tk.E)
self.widgets['temp'] = temp_label
example_net = [
('left', 100),
@ -43,6 +49,7 @@ class MainApplication(ttk.Frame):
break
l = tk.Label(self, text='{}\n({})'.format(name, amount))
l.grid(column=column, row=row, sticky=tk.SE)
self.widgets[str(column) + ',' + str(row)] = l
class GUI(object):
def __init__(self, title):
@ -51,6 +58,9 @@ class GUI(object):
self.app = MainApplication(self.root)
self.app.pack(side='top', fill='both', expand=True)
def update(self):
def update(self, temp, slipnodes):
self.root.update_idletasks()
self.root.update()
self.app.widgets['temp']['text'] = 'Temp:({})'.format(temp)
print(slipnodes)
time.sleep(.01)