neues chemikalien handling
This commit is contained in:
parent
c7cf5d2f0d
commit
d114e6a175
@ -35,9 +35,10 @@ class LabPip(LabPis):
|
|||||||
self.fe = fe
|
self.fe = fe
|
||||||
self.hub = hub
|
self.hub = hub
|
||||||
self.top = top
|
self.top = top
|
||||||
|
self.aktvol = 0
|
||||||
|
|
||||||
def __str__(self) -> str:
|
#def __str__(self) -> str:
|
||||||
return super().__str__()[:-1]+f'|top={self.top}|hub={self.hub}|vol={self.vol}|fe={self.fe}>'
|
# return super().__str__()[:-1]+f'|top={self.top}|hub={self.hub}|vol={self.vol}|fe={self.fe}>'
|
||||||
|
|
||||||
def sendE(self):
|
def sendE(self):
|
||||||
return f'<G1 P{self.e} F{self.fe}>\n'
|
return f'<G1 P{self.e} F{self.fe}>\n'
|
||||||
@ -60,6 +61,12 @@ class LabPip(LabPis):
|
|||||||
self.e = self.top + self.hub
|
self.e = self.top + self.hub
|
||||||
return self.sendE()
|
return self.sendE()
|
||||||
|
|
||||||
|
def amIdown(self):
|
||||||
|
if self.e == seft.top +self.hub :
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def up(self):
|
def up(self):
|
||||||
return f'<G1 Z0 F{self.fe}>\n'
|
return f'<G1 Z0 F{self.fe}>\n'
|
||||||
|
|
||||||
@ -73,6 +80,33 @@ class LabPip(LabPis):
|
|||||||
def setZ(self,z):
|
def setZ(self,z):
|
||||||
self.z = z
|
self.z = z
|
||||||
|
|
||||||
|
def getVol(self):
|
||||||
|
return self.aktvol
|
||||||
|
|
||||||
|
def setVol(self,v):
|
||||||
|
self.aktvol =v
|
||||||
|
|
||||||
|
def setVolMax(self):
|
||||||
|
self.aktvol = self.vol
|
||||||
|
self.e = self.top
|
||||||
|
|
||||||
|
def dispenseVol(self,vol):
|
||||||
|
ok = True
|
||||||
|
if self.aktvol >= vol :
|
||||||
|
self.aktvol = self.aktvol - vol
|
||||||
|
dx = (self.hub * vol)/self.vol
|
||||||
|
self.e = self.e + dx
|
||||||
|
else:
|
||||||
|
ok = False
|
||||||
|
return ok
|
||||||
|
|
||||||
|
def clearVol(self):
|
||||||
|
self.dispenseVol(self.aktvol)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LabPipBlock():
|
class LabPipBlock():
|
||||||
@ -92,6 +126,7 @@ class LabPipBlock():
|
|||||||
self.deltax = deltax
|
self.deltax = deltax
|
||||||
self.deltay = deltay
|
self.deltay = deltay
|
||||||
self.z = z
|
self.z = z
|
||||||
|
|
||||||
self.akt = 0
|
self.akt = 0
|
||||||
|
|
||||||
|
|
||||||
@ -100,15 +135,22 @@ class LabPipBlock():
|
|||||||
print(f'akt ={self.akt} anz= {self.anz}')
|
print(f'akt ={self.akt} anz= {self.anz}')
|
||||||
return f'No more tips !!'
|
return f'No more tips !!'
|
||||||
else :
|
else :
|
||||||
r = self.anz / self.rows
|
|
||||||
m = self.akt % r # column
|
|
||||||
c = self.akt // r # row
|
|
||||||
self.akt += 1
|
self.akt += 1
|
||||||
x = self.xoffset + (m * self.deltax)
|
r = (self.akt -1) % self.columns
|
||||||
|
c = (self.akt -1) // self.columns
|
||||||
|
x = self.xoffset + (r * self.deltax)
|
||||||
y = self.yoffset + (c * self.deltay)
|
y = self.yoffset + (c * self.deltay)
|
||||||
print(f'x={x} y= {y} akt= {self.akt}')
|
print(f'x={x} y= {y} akt= {self.akt}')
|
||||||
return x,y,self.z
|
return x,y,self.z
|
||||||
|
|
||||||
|
def same(self):
|
||||||
|
r = (self.akt -1) % self.columns
|
||||||
|
c = (self.akt -1) // self.columns
|
||||||
|
x = self.xoffset + (r * self.deltax)
|
||||||
|
y = self.yoffset + (c * self.deltay)
|
||||||
|
print(f'x={x} y= {y} akt= {self.akt}')
|
||||||
|
return x,y,self.z
|
||||||
|
|
||||||
def say_ok(self):
|
def say_ok(self):
|
||||||
print('ok')
|
print('ok')
|
||||||
|
|
||||||
@ -123,13 +165,14 @@ class ChemLoc():
|
|||||||
vol of chemical
|
vol of chemical
|
||||||
change of surface per ml """
|
change of surface per ml """
|
||||||
|
|
||||||
def __init__(self,xloc,yloc,zloc,vol,deltaz,tauch):
|
def __init__(self,xloc,yloc,zloc,vol,deltaz,tauch,chemvol):
|
||||||
self.xloc = xloc
|
self.xloc = xloc
|
||||||
self.yloc = yloc
|
self.yloc = yloc
|
||||||
self.zloc = zloc
|
self.zloc = zloc
|
||||||
self.vol = vol
|
self.vol = vol
|
||||||
self.deltaz = deltaz
|
self.deltaz = deltaz
|
||||||
self.tauch = tauch
|
self.tauch = tauch
|
||||||
|
self.chemvol = chemvol
|
||||||
|
|
||||||
def getXY(self):
|
def getXY(self):
|
||||||
return self.xloc,self.yloc
|
return self.xloc,self.yloc
|
||||||
@ -152,7 +195,7 @@ class ChemLoc():
|
|||||||
#a1 = LabPis(100,100,100,1)
|
#a1 = LabPis(100,100,100,1)
|
||||||
#p1 = LabPis()
|
#p1 = LabPis()
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
lpb = LabPipBlock(16,1,78,20,5,108,86)
|
lpb = LabPipBlock(16,1,78,4,6,108,86)
|
||||||
pip = LabPip(vol=500)
|
pip = LabPip(vol=500)
|
||||||
pip.fe =5000
|
pip.fe =5000
|
||||||
for i in range(20):
|
for i in range(20):
|
||||||
|
|||||||
100
gui/ser_one.py
100
gui/ser_one.py
@ -10,6 +10,7 @@ import threading
|
|||||||
|
|
||||||
# commands
|
# commands
|
||||||
command = []
|
command = []
|
||||||
|
infoline = []
|
||||||
# serial ports
|
# serial ports
|
||||||
ports = serial.tools.list_ports.comports()
|
ports = serial.tools.list_ports.comports()
|
||||||
serialObj = serial.Serial()
|
serialObj = serial.Serial()
|
||||||
@ -24,6 +25,7 @@ def on_select(event=None):
|
|||||||
|
|
||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
|
infobar = tk.StringVar()
|
||||||
#configue root
|
#configue root
|
||||||
root.title("Jfs Labrobot")
|
root.title("Jfs Labrobot")
|
||||||
root.geometry('800x500+300+300')
|
root.geometry('800x500+300+300')
|
||||||
@ -62,6 +64,10 @@ cb =ttk.Combobox(leftframe,values=serial_ports())
|
|||||||
cb.grid(row=0,column=0,stick="nwe")
|
cb.grid(row=0,column=0,stick="nwe")
|
||||||
cb.bind('<<ComboboxSelected>>',on_select)
|
cb.bind('<<ComboboxSelected>>',on_select)
|
||||||
|
|
||||||
|
info = ttk.Label(textvariable=infobar)
|
||||||
|
info.grid(row=99,column=0,sticky='ew',padx=5)
|
||||||
|
infobar.set('Info Bar')
|
||||||
|
|
||||||
scb =tk.Scrollbar(leftframe)
|
scb =tk.Scrollbar(leftframe)
|
||||||
scb.grid(row=1,column=1,sticky='ns')
|
scb.grid(row=1,column=1,sticky='ns')
|
||||||
#txt = tk.Text(leftframe,height=30,width=50)
|
#txt = tk.Text(leftframe,height=30,width=50)
|
||||||
@ -107,12 +113,22 @@ b15 = ttk.Button(downrightframe,text='Next Vessel')
|
|||||||
b15.grid(row=2,column=1,sticky='ne')
|
b15.grid(row=2,column=1,sticky='ne')
|
||||||
b16 = ttk.Button(downrightframe,text='Load Next')
|
b16 = ttk.Button(downrightframe,text='Load Next')
|
||||||
b16.grid(row=2,column=2,sticky='ne')
|
b16.grid(row=2,column=2,sticky='ne')
|
||||||
|
ttk.Label(downrightframe,text='Start Vessel').grid(row=3,column=0,sticky='e')
|
||||||
|
e2 =ttk.Entry(downrightframe,width=5)
|
||||||
|
e2.grid(row=3,column=1,sticky='w')
|
||||||
|
ttk.Label(downrightframe,text='Last Vessel').grid(row=4,column=0,sticky='e')
|
||||||
|
e3 =ttk.Entry(downrightframe,width=5)
|
||||||
|
e3.grid(row=4,column=1,sticky='w')
|
||||||
|
b17 = ttk.Button(downrightframe,text='Load All')
|
||||||
|
b17.grid(row=4,column=2,sticky='e')
|
||||||
|
b18 = ttk.Button(downrightframe,text='Clear Tip')
|
||||||
|
b18.grid(row=3,column=2,sticky='e')
|
||||||
|
|
||||||
|
|
||||||
###################### Parts
|
###################### Parts
|
||||||
## init Labrobot
|
## init Labrobot
|
||||||
|
startVessel = tk.IntVar()
|
||||||
|
lastVessel = tk.IntVar()
|
||||||
## Top Block
|
## Top Block
|
||||||
xoffset = tk.DoubleVar()
|
xoffset = tk.DoubleVar()
|
||||||
yoffset = tk.DoubleVar()
|
yoffset = tk.DoubleVar()
|
||||||
@ -127,6 +143,7 @@ tipvol = tk.IntVar()
|
|||||||
tipup = tk.DoubleVar()
|
tipup = tk.DoubleVar()
|
||||||
tiphub = tk.DoubleVar()
|
tiphub = tk.DoubleVar()
|
||||||
tipspeed = tk.IntVar()
|
tipspeed = tk.IntVar()
|
||||||
|
aktvol = tk.DoubleVar()
|
||||||
## Chemicals
|
## Chemicals
|
||||||
chemX = tk.DoubleVar()
|
chemX = tk.DoubleVar()
|
||||||
chemY = tk.DoubleVar()
|
chemY = tk.DoubleVar()
|
||||||
@ -134,6 +151,7 @@ chemVol = tk.DoubleVar()
|
|||||||
chemZ = tk.DoubleVar()
|
chemZ = tk.DoubleVar()
|
||||||
deltaz = tk.DoubleVar()
|
deltaz = tk.DoubleVar()
|
||||||
tauch = tk.DoubleVar()
|
tauch = tk.DoubleVar()
|
||||||
|
reaPart = tk.DoubleVar()
|
||||||
## ReactionSpace
|
## ReactionSpace
|
||||||
rxoffset = tk.DoubleVar()
|
rxoffset = tk.DoubleVar()
|
||||||
ryoffset = tk.DoubleVar()
|
ryoffset = tk.DoubleVar()
|
||||||
@ -146,6 +164,7 @@ rzlevel = tk.DoubleVar()
|
|||||||
rakt = tk.IntVar()
|
rakt = tk.IntVar()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def conf_read():
|
def conf_read():
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.read(os.path.join(os.path.dirname(__file__), "config.ini"),)
|
config.read(os.path.join(os.path.dirname(__file__), "config.ini"),)
|
||||||
@ -166,6 +185,7 @@ def conf_read():
|
|||||||
chemZ.set(float(config.get('chemblock','chemz',fallback=0)))
|
chemZ.set(float(config.get('chemblock','chemz',fallback=0)))
|
||||||
deltaz.set(float(config.get('chemblock','deltaz',fallback=0)))
|
deltaz.set(float(config.get('chemblock','deltaz',fallback=0)))
|
||||||
tauch.set(float(config.get('chemblock','tauch',fallback=0)))
|
tauch.set(float(config.get('chemblock','tauch',fallback=0)))
|
||||||
|
reaPart.set(float(config.get('chemblock','reapart',fallback=0)))
|
||||||
rxoffset.set(float(config.get('reacblock','rxoffset',fallback=0)))
|
rxoffset.set(float(config.get('reacblock','rxoffset',fallback=0)))
|
||||||
ryoffset.set(float(config.get('reacblock','ryoffset',fallback=0)))
|
ryoffset.set(float(config.get('reacblock','ryoffset',fallback=0)))
|
||||||
rrows.set(int(config.get('reacblock','rrows',fallback=0)))
|
rrows.set(int(config.get('reacblock','rrows',fallback=0)))
|
||||||
@ -193,7 +213,8 @@ def conf_write():
|
|||||||
config.set('chemblock','chemvol',str(chemVol.get()))
|
config.set('chemblock','chemvol',str(chemVol.get()))
|
||||||
config.set('chemblock','chemz',str(chemZ.get()))
|
config.set('chemblock','chemz',str(chemZ.get()))
|
||||||
config.set('chemblock','deltaz',str(deltaz.get()))
|
config.set('chemblock','deltaz',str(deltaz.get()))
|
||||||
config.set('chemblock','tauch',str(tauch.get()))
|
config.set('chemblock','tauch',str(tauch.get()))
|
||||||
|
config.set('chemblock','reapart',str(reaPart.get()))
|
||||||
config.set('reacblock','rxoffset',str(rxoffset.get()))
|
config.set('reacblock','rxoffset',str(rxoffset.get()))
|
||||||
config.set('reacblock','ryoffset',str(ryoffset.get()))
|
config.set('reacblock','ryoffset',str(ryoffset.get()))
|
||||||
config.set('reacblock','rrows',str(rrows.get()))
|
config.set('reacblock','rrows',str(rrows.get()))
|
||||||
@ -207,7 +228,7 @@ conf_read()
|
|||||||
|
|
||||||
lpb = lrb.LabPipBlock(xoffset.get(),yoffset.get(),zlevel.get(),rows.get(),cols.get(),xspace.get(),yspace.get())
|
lpb = lrb.LabPipBlock(xoffset.get(),yoffset.get(),zlevel.get(),rows.get(),cols.get(),xspace.get(),yspace.get())
|
||||||
pip = lrb.LabPip(vol=tipvol.get(),top=tipup.get(),hub=tiphub.get(),fe=tipspeed.get())
|
pip = lrb.LabPip(vol=tipvol.get(),top=tipup.get(),hub=tiphub.get(),fe=tipspeed.get())
|
||||||
chem = lrb.ChemLoc(chemX.get(),chemY.get(),chemZ.get(),chemVol.get(),deltaz.get(),tauch.get())
|
chem = lrb.ChemLoc(chemX.get(),chemY.get(),chemZ.get(),chemVol.get(),deltaz.get(),tauch.get(),chemVol.get())
|
||||||
react = lrb.LabReactBlock(rxoffset.get(),ryoffset.get(),rzlevel.get(),rrows.get(),rcols.get(),rxspace.get(),ryspace.get())
|
react = lrb.LabReactBlock(rxoffset.get(),ryoffset.get(),rzlevel.get(),rrows.get(),rcols.get(),rxspace.get(),ryspace.get())
|
||||||
|
|
||||||
partframe = ttk.Frame(notebook)
|
partframe = ttk.Frame(notebook)
|
||||||
@ -255,6 +276,9 @@ ttk.Separator(pipblockframe, orient=tk.HORIZONTAL).grid(row=80,sticky='ew')
|
|||||||
pl12 = ttk.Label(pipblockframe,text='Akt Tip').grid(column=0,row=81,padx=5)
|
pl12 = ttk.Label(pipblockframe,text='Akt Tip').grid(column=0,row=81,padx=5)
|
||||||
pe12 = ttk.Entry(pipblockframe,textvariable=akttip)
|
pe12 = ttk.Entry(pipblockframe,textvariable=akttip)
|
||||||
pe12.grid(column=1,row=81,sticky='e')
|
pe12.grid(column=1,row=81,sticky='e')
|
||||||
|
pl13 = ttk.Label(pipblockframe,text='Akt Volumne').grid(column=0,row=82,padx=5)
|
||||||
|
pe13 = ttk.Entry(pipblockframe,textvariable=aktvol)
|
||||||
|
pe13.grid(column=1,row=82,sticky='e')
|
||||||
ttk.Separator(pipblockframe, orient=tk.HORIZONTAL).grid(row=98,sticky='ew')
|
ttk.Separator(pipblockframe, orient=tk.HORIZONTAL).grid(row=98,sticky='ew')
|
||||||
pb1 = ttk.Button(pipblockframe,text='Set')
|
pb1 = ttk.Button(pipblockframe,text='Set')
|
||||||
pb1.grid(column=0,row=99,sticky='e')
|
pb1.grid(column=0,row=99,sticky='e')
|
||||||
@ -278,7 +302,9 @@ ce4.grid(column=1,row=3,sticky='e')
|
|||||||
cl5 = ttk.Label(chemframe,text='DeltaZ/ml').grid(column=0,row=4,padx=5)
|
cl5 = ttk.Label(chemframe,text='DeltaZ/ml').grid(column=0,row=4,padx=5)
|
||||||
ce5 = ttk.Entry(chemframe,textvariable=deltaz)
|
ce5 = ttk.Entry(chemframe,textvariable=deltaz)
|
||||||
ce5.grid(column=1,row=4,sticky='e')
|
ce5.grid(column=1,row=4,sticky='e')
|
||||||
|
cl6 = ttk.Label(chemframe,text='React Vol').grid(column=0,row=5,padx=5)
|
||||||
|
ce6 = ttk.Entry(chemframe,textvariable=reaPart)
|
||||||
|
ce6.grid(column=1,row=5,sticky='e')
|
||||||
reactframe =ttk.LabelFrame(partframe,text='Reaction Vessels')
|
reactframe =ttk.LabelFrame(partframe,text='Reaction Vessels')
|
||||||
reactframe.grid(column=2,row=0,sticky='wns',padx=5,pady=5)
|
reactframe.grid(column=2,row=0,sticky='wns',padx=5,pady=5)
|
||||||
rl1 = ttk.Label(reactframe,text='X offset').grid(column=0,row=0,padx=5)
|
rl1 = ttk.Label(reactframe,text='X offset').grid(column=0,row=0,padx=5)
|
||||||
@ -334,6 +360,7 @@ def set_tipblock():
|
|||||||
chem.zloc = float(chemZ.get())
|
chem.zloc = float(chemZ.get())
|
||||||
chem.deltaz = float(deltaz.get())
|
chem.deltaz = float(deltaz.get())
|
||||||
chem.tauch = float(tauch.get())
|
chem.tauch = float(tauch.get())
|
||||||
|
chem.chemvol = float(chemVol.get())
|
||||||
global react
|
global react
|
||||||
react.xoffset = float(rxoffset.get())
|
react.xoffset = float(rxoffset.get())
|
||||||
react.yoffset = float(ryoffset.get())
|
react.yoffset = float(ryoffset.get())
|
||||||
@ -383,7 +410,7 @@ def upTip():
|
|||||||
b9.configure(command=upTip)
|
b9.configure(command=upTip)
|
||||||
|
|
||||||
def downTip():
|
def downTip():
|
||||||
command.append(pip.down().encode('utf-8'))
|
command.append(pip.down().encode('utf-8'))
|
||||||
b10.configure(command=downTip)
|
b10.configure(command=downTip)
|
||||||
|
|
||||||
def nextTip():
|
def nextTip():
|
||||||
@ -394,13 +421,31 @@ def nextTip():
|
|||||||
b8.configure(command=nextTip)
|
b8.configure(command=nextTip)
|
||||||
|
|
||||||
def load():
|
def load():
|
||||||
command.append(pip.go_top().encode('utf-8'))
|
if pip.amIdown() == False:
|
||||||
command.append(pip.go_down().encode('utf-8'))
|
command.append(pip.go_top().encode('utf-8'))
|
||||||
command.append(pip.go_top().encode('utf-8'))
|
command.append(pip.go_down().encode('utf-8'))
|
||||||
|
else:
|
||||||
|
command.append(pip.go_top().encode('utf-8'))
|
||||||
|
pip.setVolMax()
|
||||||
|
aktvol.set(pip.getVol())
|
||||||
b13.config(command=load)
|
b13.config(command=load)
|
||||||
|
|
||||||
def dispense():
|
def dispense():
|
||||||
command.append(pip.go_down().encode('utf-8'))
|
v = reaPart.get()
|
||||||
|
if pip.dispenseVol(v):
|
||||||
|
command.append(pip.sendE().encode('utf-8'))
|
||||||
|
else :
|
||||||
|
takeChem()
|
||||||
|
upTip()
|
||||||
|
command.append(pip.get_tip(react.same()).encode('utf-8'))
|
||||||
|
downTip()
|
||||||
|
if pip.dispenseVol(v):
|
||||||
|
command.append(pip.sendE().encode('utf-8'))
|
||||||
|
else:
|
||||||
|
print('Error')
|
||||||
|
aktvol.set(pip.getVol())
|
||||||
|
print(pip.getVol())
|
||||||
|
|
||||||
b12.config(command=dispense)
|
b12.config(command=dispense)
|
||||||
|
|
||||||
def top():
|
def top():
|
||||||
@ -411,10 +456,11 @@ def takeChem():
|
|||||||
upTip()
|
upTip()
|
||||||
pip.setXY(chem.getXY())
|
pip.setXY(chem.getXY())
|
||||||
command.append(pip.sendXY().encode('utf-8'))
|
command.append(pip.sendXY().encode('utf-8'))
|
||||||
pip.setZ(chem.load(1))
|
pip.setZ(chem.load(pip.vol/1000)) #load 1ml
|
||||||
command.append(pip.down().encode('utf-8'))
|
command.append(pip.down().encode('utf-8'))
|
||||||
load()
|
load()
|
||||||
command.append(pip.up().encode('utf-8'))
|
command.append(pip.up().encode('utf-8'))
|
||||||
|
chemVol.set(chem.vol)
|
||||||
b14.config(command=takeChem)
|
b14.config(command=takeChem)
|
||||||
|
|
||||||
def nextVessel():
|
def nextVessel():
|
||||||
@ -430,9 +476,38 @@ def loadNext():
|
|||||||
nextVessel()
|
nextVessel()
|
||||||
dispense()
|
dispense()
|
||||||
upTip()
|
upTip()
|
||||||
|
|
||||||
b16.config(command=loadNext)
|
b16.config(command=loadNext)
|
||||||
|
|
||||||
|
def loadSerie():
|
||||||
|
takeChem()
|
||||||
|
p = startVessel.get()
|
||||||
|
q = lastVessel.get() + 1
|
||||||
|
for i in range(p,q):
|
||||||
|
print(i)
|
||||||
|
react.akt = i
|
||||||
|
rakt.set(react.akt)
|
||||||
|
upTip()
|
||||||
|
command.append(pip.get_tip(react.same()).encode('utf-8'))
|
||||||
|
downTip()
|
||||||
|
dispense()
|
||||||
|
upTip()
|
||||||
|
b17.config(command=loadSerie)
|
||||||
|
|
||||||
|
def clearTip():
|
||||||
|
upTip()
|
||||||
|
pip.setXY(chem.getXY())
|
||||||
|
command.append(pip.sendXY().encode('utf-8'))
|
||||||
|
pip.clearVol()
|
||||||
|
command.append(pip.sendE().encode('utf-8'))
|
||||||
|
|
||||||
|
b18.config(command=clearTip)
|
||||||
|
|
||||||
|
### Init Vars
|
||||||
|
startVessel.set(1)
|
||||||
|
e2.config(textvariable=startVessel)
|
||||||
|
lastVessel.set(6)
|
||||||
|
e3.config(textvariable=lastVessel)
|
||||||
|
|
||||||
weiter = True
|
weiter = True
|
||||||
def checkSerialPort():
|
def checkSerialPort():
|
||||||
global weiter
|
global weiter
|
||||||
@ -446,6 +521,7 @@ def checkSerialPort():
|
|||||||
txt.insert('0.1',x,'small')
|
txt.insert('0.1',x,'small')
|
||||||
serialObj.write(x)
|
serialObj.write(x)
|
||||||
weiter=False
|
weiter=False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
39
gui/test.ini
Normal file
39
gui/test.ini
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
[Water]
|
||||||
|
x = 50
|
||||||
|
y =
|
||||||
|
z =
|
||||||
|
volume =
|
||||||
|
z/ml = 1
|
||||||
|
reakvolume = 100
|
||||||
|
|
||||||
|
[Propanol]
|
||||||
|
x = 100
|
||||||
|
y =
|
||||||
|
z =
|
||||||
|
volume =
|
||||||
|
z/ml = 1
|
||||||
|
reakvolume = 200
|
||||||
|
|
||||||
|
[Aceton]
|
||||||
|
x = 150
|
||||||
|
y =
|
||||||
|
z =
|
||||||
|
volume =
|
||||||
|
z/ml = 1
|
||||||
|
reakvolume = 500
|
||||||
|
|
||||||
|
[Mausi]
|
||||||
|
x = 200
|
||||||
|
y =
|
||||||
|
z =
|
||||||
|
volume =
|
||||||
|
z/ml = 1
|
||||||
|
reakvolume = 1000
|
||||||
|
|
||||||
|
[Hasi]
|
||||||
|
x = 200
|
||||||
|
y =
|
||||||
|
z =
|
||||||
|
volume =
|
||||||
|
z/ml = 1
|
||||||
|
reakvolume = 1000
|
||||||
75
gui/testtk.py
Normal file
75
gui/testtk.py
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
import tkinter.ttk as ttk
|
||||||
|
import os
|
||||||
|
from configparser import ConfigParser
|
||||||
|
|
||||||
|
substances = ['Water','Propanol','Aceton']
|
||||||
|
labels = ['x','y','z','volume','z/ml','reakVolume']
|
||||||
|
entrys = []
|
||||||
|
|
||||||
|
config = ConfigParser()
|
||||||
|
|
||||||
|
def load_config():
|
||||||
|
config.read(os.path.join(os.path.dirname(__file__), "test.ini"),)
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
infobar = tk.StringVar()
|
||||||
|
#configue root
|
||||||
|
root.title("Jfs Labrobot")
|
||||||
|
root.geometry('800x500+300+300')
|
||||||
|
|
||||||
|
load_config()
|
||||||
|
substances = config.sections()
|
||||||
|
|
||||||
|
|
||||||
|
def init_chem():
|
||||||
|
c =0
|
||||||
|
r = 0
|
||||||
|
for p in substances:
|
||||||
|
frame = ttk.LabelFrame(root,text=p)
|
||||||
|
frame.grid(column=c,row=r)
|
||||||
|
c +=1
|
||||||
|
if c > 3:
|
||||||
|
c=0
|
||||||
|
r +=1
|
||||||
|
|
||||||
|
for i in range(len(labels)):
|
||||||
|
tk.Label(frame,text=labels[i]).grid(row=i,column=0)
|
||||||
|
var = tk.StringVar()
|
||||||
|
entry = tk.Entry(frame,width=10,textvariable=var)
|
||||||
|
var.set(config[p][labels[i]])
|
||||||
|
entry.grid(row=i,column=1,sticky='w')
|
||||||
|
entrys.append([p,labels[i],entry])
|
||||||
|
|
||||||
|
init_chem()
|
||||||
|
|
||||||
|
def showit():
|
||||||
|
for x in entrys:
|
||||||
|
for p in substances:
|
||||||
|
for x in entrys:
|
||||||
|
if x[0] == p :
|
||||||
|
print(f'{x[1]} : {x[2].get()} ')
|
||||||
|
#print(x[0],x[1],x[2].get())
|
||||||
|
|
||||||
|
btn =tk.Button(root,text='Ok',command=showit)
|
||||||
|
btn.grid(row=99,column=0,sticky='we')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tk.Button(root,text='Load',command = load_config).grid(row=100,column=0,sticky='ew')
|
||||||
|
|
||||||
|
|
||||||
|
def conf_write():
|
||||||
|
config = ConfigParser()
|
||||||
|
#config.read(os.path.join(os.path.dirname(__file__), "test.ini"),)
|
||||||
|
for p in substances:
|
||||||
|
config[p] = {}
|
||||||
|
for x in entrys:
|
||||||
|
if x[0] == p:
|
||||||
|
config[p][x[1]] = x[2].get()
|
||||||
|
with open(os.path.join(os.path.dirname(__file__), "test.ini"),'w') as f:
|
||||||
|
config.write(f)
|
||||||
|
tk.Button(root,text='Save',command = conf_write).grid(row=100,column=1,sticky='ew')
|
||||||
|
|
||||||
|
|
||||||
|
root.mainloop()
|
||||||
Loading…
Reference in New Issue
Block a user