{"id":18311,"date":"2025-04-19T00:42:26","date_gmt":"2025-04-18T16:42:26","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/18311.html"},"modified":"2025-04-19T00:42:26","modified_gmt":"2025-04-18T16:42:26","slug":"%e4%bb%a5python-%e5%81%9a%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%8cn-robot-%e5%81%9a%e5%ae%a2%e6%88%b7%e7%ab%af%ef%bc%8c%e5%b0%8f%e5%b0%8fui%ef%bc%8c%e6%8b%bf%e6%8d%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/18311.html","title":{"rendered":"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f"},"content":{"rendered":"<\/p>\n<p>\u5148Show \u7ed3\u679c&#xff5e;<\/p>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418164224-680280f07282c.png\" \/><\/p>\n<p style=\"text-align:center\">\n<h2>\u865a\u62df\u5f00\u8db3 \u00a0<\/h2>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418164225-680280f12372c.jpg\" \/><\/p>\n<p style=\"text-align:center\">\n<p style=\"text-align:center\">\n<p style=\"text-align:center\">\n<p style=\"text-align:center\">\n<p>import socket<br \/>\nimport threading<br \/>\nimport logging<br \/>\nfrom tkinter import Tk, Canvas, BOTH, YES, NW, N, mainloop, font as tkfont<br \/>\nfrom tkinter.constants import S, E, W<br \/>\nfrom datetime import datetime<br \/>\nimport os<\/p>\n<p># \u5b9a\u4e49\u6587\u4ef6\u5939\u8def\u5f84<br \/>\nfolder_path &#061; r&#039;c:\\\\Log6&#039;<br \/>\n# \u68c0\u67e5\u6587\u4ef6\u5939\u662f\u5426\u5b58\u5728&#xff0c;\u5982\u679c\u4e0d\u5b58\u5728\u5219\u521b\u5efa<br \/>\nif not os.path.exists(folder_path):<br \/>\n    os.makedirs(folder_path)<\/p>\n<p>class RobotServer:<br \/>\n    def __init__(self, host, port, canvas):<br \/>\n        self.host &#061; host<br \/>\n        self.port &#061; port<br \/>\n        self.server_socket &#061; None<br \/>\n        self.clients &#061; {}<br \/>\n        self.lock &#061; threading.Lock()<br \/>\n        self.canvas &#061; canvas<br \/>\n        self.A &#061; 0<br \/>\n        self.B &#061; 4<br \/>\n        self.R1_LS &#061; []<br \/>\n        self.R2_LS &#061; []<br \/>\n        self.R3_LS &#061; []<br \/>\n        self.R4_LS &#061; []<\/p>\n<p>        logging.basicConfig(level&#061;logging.INFO, format&#061;&#039;%(asctime)s &#8211; %(levelname)s &#8211; %(message)s&#039;)<\/p>\n<p>        # \u521d\u59cb\u5316\u753b\u5e03\u5185\u5bb9<br \/>\n        self.init_canvas()<\/p>\n<p>    def init_canvas(self):<br \/>\n        w &#061; self.canvas.winfo_width()<br \/>\n        h &#061; self.canvas.winfo_height()<br \/>\n        L_w, M_w, R_w &#061; w\/\/3, w\/\/3, w &#8211; (w\/\/3 * 2)<br \/>\n        L_h, M_h, R_h &#061; h, h, h<\/p>\n<p>        # \u663e\u793a\u6574\u4f53\u3001\u66f2\u7ebf\u3001\u8ba1\u5212\u7684\u6587\u672c\u6807\u7b7e&#xff0c;\u5b57\u4f53\u4e3a60&#xff0c;\u80cc\u666f\u4e3a\u7acb\u4f53\u611f<br \/>\n        titles &#061; [&#034;\u6574\u4f53&#034;]<br \/>\n        for i, title in enumerate(titles):<br \/>\n            x &#061; 130<br \/>\n            shadow_offset &#061; 4<br \/>\n            #self.canvas.create_rectangle(x-100&#043;shadow_offset, 20&#043;shadow_offset, x&#043;100&#043;shadow_offset, 80&#043;shadow_offset, fill&#061;&#034;darkgray&#034;, outline&#061;&#034;&#034;)<br \/>\n            #self.canvas.create_rectangle(x-100, 20, x&#043;100, 80, fill&#061;&#034;lightgray&#034;, outline&#061;&#034;gray&#034;)<br \/>\n            self.canvas.create_text(x, 50, text&#061;title, anchor&#061;N, font&#061;tkfont.Font(size&#061;60))<\/p>\n<p>        titles &#061; [&#034;Remark:\\\\r\\\\n\u5206\u5b50\u4e3a\u5728\u7ebf\u6570\u91cf,\\\\r\\\\n\u5206\u6bcd\u4e3aTotal \u6570\u91cf&#xff0c;\\\\r\\\\n\u5c0f\u4e8e55%&#xff0c;\u663e\u793a\u7ea2\u8272,\\\\r\\\\n50%&#xff5e;75%&#xff0c;\u663e\u793a\u9ec4\u8272,\\\\r\\\\n\u5927\u4e8e75%&#xff0c;\u663e\u793a\u7eff\u8272&#034;]<br \/>\n        for i, title in enumerate(titles):<br \/>\n            self.canvas.create_text(130, 400, text&#061;title, anchor&#061;N, font&#061;tkfont.Font(size&#061;16))<\/p>\n<p>        titles &#061; [&#034;\u66f2\u7ebf&#034;]<br \/>\n        for i, title in enumerate(titles):<br \/>\n            x &#061; (i&#043;0.5) * w\/3 &#043;300<br \/>\n            shadow_offset &#061; 4<br \/>\n            #self.canvas.create_rectangle(x-100&#043;shadow_offset, 20&#043;shadow_offset, x&#043;100&#043;shadow_offset, 80&#043;shadow_offset, fill&#061;&#034;darkgray&#034;, outline&#061;&#034;&#034;)<br \/>\n            #self.canvas.create_rectangle(x-100, 20, x&#043;100, 80, fill&#061;&#034;lightgray&#034;, outline&#061;&#034;gray&#034;)<br \/>\n            self.canvas.create_text(x, 50, text&#061;title, anchor&#061;N, font&#061;tkfont.Font(size&#061;60))<\/p>\n<p>        titles &#061; [&#034;\u8ba1\u5212&#034;]<br \/>\n        for i, title in enumerate(titles):<br \/>\n            x &#061; 1080<br \/>\n            shadow_offset &#061; 4<br \/>\n            #self.canvas.create_rectangle(x-100&#043;shadow_offset, 20&#043;shadow_offset, x&#043;100&#043;shadow_offset, 80&#043;shadow_offset, fill&#061;&#034;darkgray&#034;, outline&#061;&#034;&#034;)<br \/>\n            #self.canvas.create_rectangle(x-100, 20, x&#043;100, 80, fill&#061;&#034;lightgray&#034;, outline&#061;&#034;gray&#034;)<br \/>\n            self.canvas.create_text(x, 50, text&#061;title, anchor&#061;N, font&#061;tkfont.Font(size&#061;60))<\/p>\n<p>        titles &#061; [&#034;R1_Data&#034;]<br \/>\n        for i, title in enumerate(titles):<br \/>\n            x &#061; 350<br \/>\n            self.canvas.create_rectangle(x-70, 160, x&#043;60, 160&#043;30, fill&#061;&#034;lightgray&#034;, outline&#061;&#034;gray&#034;)<br \/>\n            self.canvas.create_text(x, 160, text&#061;title, anchor&#061;N, font&#061;tkfont.Font(size&#061;20))<\/p>\n<p>        titles &#061; [&#034;R2_Data&#034;]<br \/>\n        for i, title in enumerate(titles):<br \/>\n            x &#061; 350<br \/>\n            self.canvas.create_rectangle(x-70, 460, x&#043;60, 460&#043;30, fill&#061;&#034;darkgray&#034;, outline&#061;&#034;gray&#034;)<br \/>\n            self.canvas.create_text(x, 460, text&#061;title, anchor&#061;N, font&#061;tkfont.Font(size&#061;20))<\/p>\n<p>        self.draw_ring(90, 300, 70, 40)<br \/>\n        self.update_connection_status()<br \/>\n        self.draw_table(w, h)         <\/p>\n<p>        # \u4f7f\u7528 after \u65b9\u6cd5\u66f4\u65b0\u66f2\u7ebf<br \/>\n        self.update_scatter_plots()<\/p>\n<p>    def draw_ring(self, x, y, outer_radius, inner_radius):<br \/>\n        ratio &#061; self.A \/ self.B if self.B !&#061; 0 else 0<br \/>\n        color &#061; &#034;red&#034; if ratio &lt; 0.5 else &#034;yellow&#034; if ratio &lt;&#061; 0.75 else &#034;green&#034;<br \/>\n        self.canvas.create_oval(x-outer_radius, y-outer_radius, x&#043;outer_radius, y&#043;outer_radius, fill&#061;color)<br \/>\n        self.canvas.create_oval(x-inner_radius, y-inner_radius, x&#043;inner_radius, y&#043;inner_radius, fill&#061;&#034;white&#034;)<br \/>\n        self.connection_text &#061; self.canvas.create_text(x, y, text&#061;f&#034;{self.A}\/{self.B}&#034;, fill&#061;&#034;black&#034;)<\/p>\n<p>    def update_connection_status(self):<br \/>\n        ratio &#061; self.A \/ self.B if self.B !&#061; 0 else 0<br \/>\n        color &#061; &#034;red&#034; if ratio &lt; 0.5 else &#034;yellow&#034; if ratio &lt;&#061; 0.75 else &#034;green&#034;<br \/>\n        self.canvas.itemconfig(self.connection_text, text&#061;f&#034;{self.A}\/{self.B}&#034;)<br \/>\n        self.canvas.itemconfig(self.connection_text, fill&#061;&#034;black&#034;)<br \/>\n        self.canvas.itemconfig(self.connection_text, state&#061;&#039;normal&#039;)<br \/>\n        self.draw_ring(90, 300, 70, 40)<\/p>\n<p>    def draw_table(self, w, h):<br \/>\n        # \u8ba1\u5212\u533a\u57df\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6<br \/>\n        plan_area_width &#061; w \/\/ 3<br \/>\n        plan_area_height &#061; h<\/p>\n<p>        # \u8868\u683c\u5e94\u8be5\u5360\u7528\u8ba1\u5212\u533a\u57df\u7684\u5927\u90e8\u5206\u7a7a\u95f4&#xff0c;\u4f46\u8981\u7559\u51fa\u4e00\u4e9b\u8fb9\u8ddd<br \/>\n        margin &#061; 20<br \/>\n        table_width &#061; plan_area_width &#8211; 2 * margin<br \/>\n        table_height &#061; min(150, plan_area_height &#8211; 2 * margin)  # \u786e\u4fdd\u8868\u683c\u4e0d\u4f1a\u8fc7\u9ad8<\/p>\n<p>        # \u8868\u683c\u8d77\u59cb\u5750\u6807&#xff0c;\u4f7f\u5f97\u8868\u683c\u5c45\u4e2d\u4e8e\u8ba1\u5212\u533a\u57df<br \/>\n        table_x &#061; w &#8211; plan_area_width &#043; margin<br \/>\n        table_y &#061; (h &#8211; table_height) \/\/ 2 -30<\/p>\n<p>        row_height &#061; 40<br \/>\n        col_width &#061; table_width \/\/ 4  # \u6bcf\u4e00\u5217\u7684\u5bbd\u5ea6\u7b49\u4e8e\u8868\u683c\u5bbd\u5ea6\u7684\u56db\u5206\u4e4b\u4e00<\/p>\n<p>        # \u6e05\u9664\u65e7\u8868\u683c<br \/>\n        self.canvas.delete(&#034;table&#034;)<\/p>\n<p>        # \u4f7f\u7528\u201c&#043;\u201d\u7ed8\u5236\u8868\u683c<br \/>\n        for j in range(6):  # \u5305\u62ec\u8868\u5934\u548c\u56db\u884c\u6570\u636e  6<br \/>\n            self.canvas.create_line(table_x, table_y &#043; j * row_height, table_x &#043; table_width, table_y &#043; j * row_height, fill&#061;&#034;black&#034;, tags&#061;&#034;table&#034;)<br \/>\n            for i in range(table_width \/\/ col_width &#043; 1):<br \/>\n                self.canvas.create_text(table_x &#043; i * col_width, table_y &#043; j * row_height, text&#061;&#034;&#043;&#034;, fill&#061;&#034;black&#034;, font&#061;tkfont.Font(size&#061;10), tags&#061;&#034;table&#034;)<br \/>\n        for i in range(6):  # \u5305\u62ec\u8fb9\u754c\u7ebf\u548c\u56db\u4e2a\u5206\u9694\u7ebf  6                                           ##       5   ##<br \/>\n            self.canvas.create_line(table_x &#043; i * col_width, table_y, table_x &#043; i * col_width, table_y &#043; 5 * row_height, fill&#061;&#034;black&#034;, tags&#061;&#034;table&#034;)<\/p>\n<p>        # \u7ed8\u5236\u8868\u5934&#xff08;\u5217\u6807\u7b7e&#xff09;<br \/>\n        for j, quarter in enumerate([&#039;&#039;, &#039;Q1&#039;, &#039;Q2&#039;, &#039;Q3&#039;, &#039;Q4&#039;]):<br \/>\n            self.canvas.create_text(table_x &#043; j * col_width &#043; col_width \/\/ 2, table_y &#8211; 10, text&#061;quarter, font&#061;tkfont.Font(size&#061;30), anchor&#061;N, tags&#061;&#034;table&#034;)<\/p>\n<p>        # \u7ed8\u5236\u8868\u683c\u5185\u5bb9&#xff08;\u884c\u6807\u7b7e\u4e0eX\u6807\u8bb0&#xff09;<br \/>\n        for i, row in enumerate([&#039;R1&#039;, &#039;R2&#039;, &#039;R3&#039;, &#039;R4&#039;]):<br \/>\n            self.canvas.create_text(table_x &#043; col_width \/\/ 2, table_y &#043; (i &#043; 1) * row_height, text&#061;row, font&#061;tkfont.Font(size&#061;30), anchor&#061;N, tags&#061;&#034;table&#034;)<br \/>\n            self.canvas.create_text(table_x &#043; (i &#043; 1) * col_width &#043; col_width \/\/ 2, table_y &#043; (i &#043; 1) * row_height, text&#061;&#034;X&#034;, font&#061;tkfont.Font(size&#061;30), anchor&#061;N, tags&#061;&#034;table&#034;)<\/p>\n<p>    def update_scatter_plots(self):<br \/>\n        self.draw_scatter_plot(&#039;R1&#039;, self.R1_LS[-30:], 270, 250, 500, 100)<br \/>\n        self.draw_scatter_plot(&#039;R2&#039;, self.R2_LS[-30:], 270, 350, 500, 100)<br \/>\n        self.draw_scatter_plot(&#039;R3&#039;, self.R3_LS[-30:], 270, 550, 500, 100)<br \/>\n        self.draw_scatter_plot(&#039;R4&#039;, self.R4_LS[-30:], 270, 650, 500, 100)<br \/>\n        self.canvas.after(500, self.update_scatter_plots)  <\/p>\n<p>    def draw_scatter_plot(self, prefix, data_list, start_x, start_y, width, height):<br \/>\n        scale &#061; width \/ max(len(data_list), 1)<br \/>\n        self.canvas.delete(f&#034;{prefix}_scatter&#034;)  # \u5220\u9664\u65e7\u7684\u6563\u70b9\u56fe\u5143\u7d20<\/p>\n<p>        # \u589e\u52a0\u5706\u70b9\u5927\u5c0f<br \/>\n        dot_size &#061; 6  # \u5706\u70b9\u76f4\u5f84\u53d8\u4e3a\u539f\u6765\u7684\u4e09\u500d\u5927<\/p>\n<p>        for i, value in enumerate(data_list):<br \/>\n            x &#061; start_x &#043; i * scale<br \/>\n            y &#061; start_y &#8211; int(value) * (height \/ 100)<br \/>\n            color &#061; &#034;green&#034; if 23 &lt;&#061; int(value) &lt;&#061; 29 else &#034;red&#034;<br \/>\n            self.canvas.create_oval(x &#8211; dot_size, y &#8211; dot_size, x &#043; dot_size, y &#043; dot_size, fill&#061;color, tags&#061;f&#034;{prefix}_scatter&#034;)  <\/p>\n<p>        # \u6e05\u9664\u65e7\u7684\u6587\u672c\u6807\u7b7e<br \/>\n        self.canvas.delete(f&#034;{prefix}_text&#034;)<\/p>\n<p>        # \u53ea\u663e\u793a\u6700\u8fd1\u8fdb\u6765\u76842\u4e2a\u6570\u5b57&#xff0c;\u84dd\u8272\u663e\u793a\u503c<br \/>\n        for i, value in enumerate(data_list[-2:]):<br \/>\n            text_color &#061; &#034;blue&#034;<br \/>\n            self.canvas.create_text(start_x &#043; len(data_list) * scale &#8211; i * scale, start_y &#8211; height \/ 2 &#8211; 10,<br \/>\n                                    text&#061;value, font&#061;tkfont.Font(size&#061;12), anchor&#061;S, fill&#061;text_color, tags&#061;f&#034;{prefix}_text&#034;)<\/p>\n<p>        # \u4e2d\u95f4\u6c34\u5e73\u7ebf<br \/>\n        self.canvas.create_line(start_x, start_y, start_x &#043; width, start_y, fill&#061;&#034;black&#034;, tags&#061;f&#034;{prefix}_line&#034;)<br \/>\n        # \u4e2d\u95f4\u5206\u5272\u7ebf<br \/>\n        self.canvas.create_line(start_x, start_y &#8211; height \/ 2, start_x &#043; width, start_y &#8211; height \/ 2, fill&#061;&#034;black&#034;, tags&#061;f&#034;{prefix}_line&#034;)<\/p>\n<p>    def start_server(self):<br \/>\n        try:<br \/>\n            self.server_socket &#061; socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br \/>\n            self.server_socket.bind((self.host, self.port))<br \/>\n            self.server_socket.listen(5)<br \/>\n            logging.info(f&#034;Server started at {self.host}:{self.port}&#034;)<br \/>\n            while True:<br \/>\n                client_socket, client_address &#061; self.server_socket.accept()<br \/>\n                with self.lock:<br \/>\n                    self.clients[client_address] &#061; client_socket<br \/>\n                    self.A &#043;&#061; 1<br \/>\n                    self.update_connection_status()<br \/>\n                logging.info(f&#034;Accepted connection from {client_address}&#034;)<br \/>\n                threading.Thread(target&#061;self.handle_client, args&#061;(client_socket, client_address), daemon&#061;True).start()<br \/>\n        except Exception as e:<br \/>\n            logging.error(f&#034;Failed to start server: {e}&#034;)<br \/>\n        finally:<br \/>\n            if self.server_socket:<br \/>\n                self.server_socket.close()<\/p>\n<p>    def handle_client(self, client_socket, client_address):<br \/>\n        try:<br \/>\n            while True:<br \/>\n                current_time &#061; datetime.now().strftime(&#034;%H:%M:%S&#034;)<br \/>\n                data &#061; client_socket.recv(1024)<br \/>\n                if not data:<br \/>\n                    break<br \/>\n                decoded_data &#061; data.decode(&#039;utf-8&#039;)<br \/>\n                logging.info(f&#034;{current_time} &#8212; Received from {client_address}: {decoded_data}&#034;)<br \/>\n                response &#061; current_time<br \/>\n                client_socket.sendall(response.encode(&#039;utf-8&#039;))<br \/>\n                logging.info(f&#034;{current_time} &#8212; response to RobotServer(&#039;192.168.0.109&#039;, 7777): {response}&#034;)<\/p>\n<p>                # \u89e3\u6790\u6570\u636e\u5e76\u66f4\u65b0\u6563\u70b9\u56fe\u6570\u636e<br \/>\n                if decoded_data.startswith(&#039;R1&#039;):<br \/>\n                    self.R1_LS.append(decoded_data[2:4])<br \/>\n                elif decoded_data.startswith(&#039;R2&#039;):<br \/>\n                    self.R2_LS.append(decoded_data[2:4])<br \/>\n                elif decoded_data.startswith(&#039;R3&#039;):<br \/>\n                    self.R3_LS.append(decoded_data[2:4])<br \/>\n                elif decoded_data.startswith(&#039;R4&#039;):<br \/>\n                    self.R4_LS.append(decoded_data[2:4])<\/p>\n<p>                log_entry &#061; f&#034;[{current_time}]-Recive:{data}&#8212;Response:{response}\\\\n&#034;<br \/>\n                with open(r&#034;c:\\\\Log6\\\\log.txt&#034;, &#034;a&#034;) as log_file:<br \/>\n                    log_file.write(log_entry)  <\/p>\n<p>        except Exception as e:<br \/>\n            logging.error(f&#034;Error handling client {client_address}: {e}&#034;)<br \/>\n        finally:<br \/>\n            client_socket.close()<br \/>\n            with self.lock:<br \/>\n                del self.clients[client_address]<br \/>\n                self.A -&#061; 1<br \/>\n                self.update_connection_status()<br \/>\n            logging.info(f&#034;Closed connection from {client_address}&#034;)<\/p>\n<p>def on_resize(event):<br \/>\n    global server<br \/>\n    w &#061; event.width<br \/>\n    h &#061; event.height<br \/>\n    canvas &#061; event.widget<br \/>\n    canvas.delete(&#034;all&#034;)<br \/>\n    server.init_canvas()<\/p>\n<p>def main():<br \/>\n    global server<br \/>\n    root &#061; Tk()<br \/>\n    root.title(&#034;Design By Tim&#034;)<br \/>\n    root.geometry(&#034;800&#215;600&#034;)<\/p>\n<p>    canvas &#061; Canvas(root, bg&#061;&#034;white&#034;)<br \/>\n    canvas.pack(fill&#061;BOTH, expand&#061;YES)<\/p>\n<p>    server &#061; RobotServer(&#039;192.168.0.109&#039;, 7788, canvas)<\/p>\n<p>    threading.Thread(target&#061;server.start_server, daemon&#061;True).start()<\/p>\n<p>    canvas.bind(&#034;&lt;Configure&gt;&#034;, on_resize)<\/p>\n<p>    root.mainloop()<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    main() <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb882\u6b21\u3002UI \u673a\u68b0\u624b\u53c2\u6570\u6536\u96c6<\/p>\n","protected":false},"author":2,"featured_media":18309,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,780,43],"topic":[],"class_list":["post-18311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python","tag-ui","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/18311.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb882\u6b21\u3002UI \u673a\u68b0\u624b\u53c2\u6570\u6536\u96c6\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/18311.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T16:42:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418164224-680280f07282c.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/18311.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/18311.html\",\"name\":\"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T16:42:26+00:00\",\"dateModified\":\"2025-04-18T16:42:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/18311.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/18311.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/18311.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/18311.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb882\u6b21\u3002UI \u673a\u68b0\u624b\u53c2\u6570\u6536\u96c6","og_url":"https:\/\/www.wsisp.com\/helps\/18311.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T16:42:26+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418164224-680280f07282c.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/18311.html","url":"https:\/\/www.wsisp.com\/helps\/18311.html","name":"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T16:42:26+00:00","dateModified":"2025-04-18T16:42:26+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/18311.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/18311.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/18311.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4ee5Python \u505a\u670d\u52a1\u5668\uff0cN Robot \u505a\u5ba2\u6237\u7aef\uff0c\u5c0f\u5c0fUI\uff0c\u62ff\u634f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/18311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=18311"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/18311\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/18309"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=18311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=18311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=18311"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=18311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}