tkinter
This commit is contained in:
parent
6d85eae4fd
commit
a155303c40
|
@ -1,7 +1,7 @@
|
|||
import socket
|
||||
import json
|
||||
from pprint import pprint
|
||||
from tkinter import ttk
|
||||
import tkinter
|
||||
|
||||
from func import *
|
||||
|
||||
|
@ -33,28 +33,52 @@ class SocketRobotArm:
|
|||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.close()
|
||||
|
||||
def update_text(self, m, text):
|
||||
label = tkinter.Label(m, text=text)
|
||||
label.pack()
|
||||
m.update()
|
||||
|
||||
def connect(self):
|
||||
self.socket.connect((self.host, self.port))
|
||||
|
||||
m = tkinter.Tk()
|
||||
m.geometry("500x500")
|
||||
|
||||
self.get_axis()
|
||||
self.update_text(m, text=f"Координаты осей {self.start_axis_coordinates}")
|
||||
|
||||
self.get_world()
|
||||
self.update_text(m, text=f"Мировые координаты {self.start_world_coordinates}")
|
||||
|
||||
self.get_command_count()
|
||||
self.update_text(m, text=f"Команд в очереди {self.remote_command_count}")
|
||||
|
||||
self.send_data(self.set_global_speed())
|
||||
self.update_text(m, text=f"Установили глобальную скорость {self.global_speed}")
|
||||
|
||||
self.send_data(self.start_cycle())
|
||||
self.update_text(m, text=f"Старт одиночного цикла")
|
||||
|
||||
self.add_rcc_list = (
|
||||
[self.set_physical_speed(True), self.set_output_laser(True)]
|
||||
+ self.steps_from_file()
|
||||
+ [self.set_physical_speed(False), self.set_output_laser(False)]
|
||||
)
|
||||
|
||||
my_label = tkinter.Label(m, text=f"Отправка данных")
|
||||
my_label.pack()
|
||||
m.update()
|
||||
step = 2
|
||||
for i in range(0, len(self.add_rcc_list), step):
|
||||
print(self.add_rcc_list[i : i + step])
|
||||
print(f"Отправка данных {i}...{i+step-1}")
|
||||
# self.update_text(m, text=f"Отправка данных {i}...{i+step-1}")
|
||||
my_label.config(text=f"Отправка данных {i}...{i+step-1}")
|
||||
m.update()
|
||||
|
||||
self.send_data(
|
||||
make_addrcc_data(self.add_rcc_list[i : i + step], int(not i))
|
||||
)
|
||||
|
||||
self.send_data(self.start_cycle())
|
||||
time.sleep(0.5)
|
||||
|
||||
def send_data(self, data):
|
||||
response = None
|
||||
|
|
File diff suppressed because it is too large
Load Diff
10964
data/half-sphere.nc
10964
data/half-sphere.nc
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@ all_files = glob.glob("data/*.nc")
|
|||
def get_value(c, s):
|
||||
[x] = [item.replace(s, '') for item in c if item.startswith(s)] or [0]
|
||||
return float(x)
|
||||
|
||||
for file in all_files:
|
||||
with open(file, 'r') as fp:
|
||||
lines = fp.readlines()
|
||||
|
@ -37,4 +38,5 @@ for file in all_files:
|
|||
result.append([f"{p}{filtered_prep[p]}" for p in filtered_prep])
|
||||
|
||||
with open(f"{file}.result", 'w') as fp:
|
||||
print(f"save to {file}.result")
|
||||
fp.write('\n'.join(' '.join(str(i) for i in x) for x in result))
|
Loading…
Reference in New Issue