{"id":56981,"date":"2025-08-15T04:04:40","date_gmt":"2025-08-14T20:04:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/56981.html"},"modified":"2025-08-15T04:04:40","modified_gmt":"2025-08-14T20:04:40","slug":"tkinter-%e5%85%a8%e8%83%bd%e7%a9%bf%e6%a2%ad%e6%a1%86%e7%bb%84%e4%bb%b6-transfercomponent","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/56981.html","title":{"rendered":"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"426\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250814200435-689e41539ab4c.png\" width=\"613\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"412\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250814200437-689e41557e2a0.png\" width=\"1082\" \/><\/p>\n<p>\u57fa\u4e8e tkinter \u7684 TransferComponent&#xff0c;\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u3001\u754c\u9762\u7f8e\u89c2\u3001\u64cd\u4f5c\u6d41\u7545\u7684\u53cc\u5217\u8868\u7a7f\u68ad\u9009\u62e9\u5668&#xff01;\u65e0\u8bba\u662f\u7528\u6237\u6743\u9650\u7ba1\u7406\u3001\u5546\u54c1\u5206\u7c7b\u9009\u62e9\u3002<\/p>\n<p>TransferComponent \u7684\u6838\u5fc3\u5728\u4e8e\u5176 pick \u7c7b\u65b9\u6cd5&#xff0c;\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u6d01\u7684\u63a5\u53e3\u6765\u5f39\u51fa\u7a7f\u68ad\u6846\u5e76\u83b7\u53d6\u7528\u6237\u7684\u9009\u62e9\u7ed3\u679c\u3002<\/p>\n<\/p>\n<h2>1\u3001\u4f7f\u7528\u5b9e\u4f8b<\/h2>\n<p>import tkinter as tk<br \/>\nfrom component import TransferComponent<\/p>\n<p>def main():<br \/>\n    root &#061; tk.Tk()<br \/>\n    root.geometry(&#034;700&#215;550&#034;)<\/p>\n<p>    def open_transfer():<br \/>\n        candidates &#061; [<br \/>\n            &#034;\u5468\u6770\u4f26&#034;, &#034;\u6613\u70ca\u5343\u73ba&#034;, &#034;\u738b\u4fca\u51ef&#034;, &#034;\u738b\u6e90&#034;, &#034;\u5218\u5fb7\u534e&#034;, &#034;\u5f20\u5b66\u53cb&#034;, &#034;\u9ece\u660e&#034;, &#034;\u90ed\u5bcc\u57ce&#034;,<br \/>\n            &#034;\u8c22\u9706\u950b&#034;, &#034;\u5f20\u56fd\u8363&#034;, &#034;\u6881\u671d\u4f1f&#034;, &#034;\u5468\u661f\u9a70&#034;, &#034;\u6210\u9f99&#034;, &#034;\u674e\u8fde\u6770&#034;, &#034;\u7504\u5b50\u4e39&#034;, &#034;\u5434\u4eac&#034;,<br \/>\n            &#034;\u5468\u8fc5&#034;, &#034;\u5de9\u4fd0&#034;, &#034;\u7ae0\u5b50\u6021&#034;, &#034;\u8d75\u4e3d\u9896&#034;, &#034;\u6768\u5e42&#034;, &#034;\u8fea\u4e3d\u70ed\u5df4&#034;, &#034;\u5218\u8bd7\u8bd7&#034;, &#034;\u9ad8\u5706\u5706&#034;,<br \/>\n            &#034;\u738b\u4e00\u535a&#034;, &#034;\u8096\u6218&#034;, &#034;\u9093\u7d2b\u68cb&#034;, &#034;\u5f20\u9753\u9896&#034;, &#034;\u90a3\u82f1&#034;, &#034;\u97e9\u7ea2&#034;, &#034;\u674e\u5b87\u6625&#034;,<br \/>\n        ]<br \/>\n        selected &#061; TransferComponent.pick(<br \/>\n            master&#061;root,<br \/>\n            source_items&#061;candidates,<br \/>\n            initial_selected&#061;[&#034;\u5468\u6770\u4f26&#034;, &#034;\u8521\u5f90\u5764&#034;, &#034;\u6c6a\u5cf0&#034;, &#034;\u859b\u4e4b\u8c26&#034;, &#034;\u534e\u6668\u5b87&#034;], # \u521d\u59cb\u5df2\u9009<br \/>\n            left_title&#061;&#034;\u660e\u661f&#034;,<br \/>\n            right_title&#061;&#034;\u83b7\u5956\u660e\u661f&#034;,<br \/>\n            window_title&#061;&#034;\u660e\u661f\u9881\u5956\u9009\u62e9&#034;,<br \/>\n            list_width&#061;160,<br \/>\n            list_height&#061;200,<br \/>\n        )<br \/>\n        print(&#034;\u6700\u7ec8\u9009\u62e9&#xff1a;&#034;, selected)<br \/>\n    tk.Button(root, text&#061;&#034;\u6253\u5f00\u660e\u661f\u7a7f\u68ad\u6846&#034;, command&#061;open_transfer).pack(pady&#061;20)<\/p>\n<p>    root.mainloop()<\/p>\n<p>if __name__ &#061;&#061; &#039;__main__&#039;:<br \/>\n    main()<\/p>\n<h2><\/h2>\n<h2>2\u3001\u7ec4\u4ef6\u53c2\u6570\u4ecb\u7ecd<\/h2>\n<p>pick \u65b9\u6cd5\u4f1a\u521b\u5efa\u4e00\u4e2a\u6a21\u6001\u7684\u7a7f\u68ad\u6846\u7a97\u53e3&#xff0c;\u5e76\u7b49\u5f85\u7528\u6237\u64cd\u4f5c\u5b8c\u6210\u540e\u8fd4\u56de\u6700\u7ec8\u9009\u62e9\u7684\u5217\u8868\u3002\u5b83\u63a5\u53d7\u4ee5\u4e0b\u53c2\u6570&#xff1a;<\/p>\n<ul>\n<li>\n<p>master (\u53ef\u9009): \u7236\u7a97\u53e3&#xff0c;\u901a\u5e38\u662f tk.Tk() \u5b9e\u4f8b\u3002<\/p>\n<\/li>\n<li>\n<p>source_items (\u5fc5\u586b): \u521d\u59cb\u5de6\u4fa7\u5217\u8868&#xff08;\u5f85\u9009&#xff09;\u7684\u6240\u6709\u6570\u636e\u9879&#xff0c;\u7c7b\u578b\u4e3a List[str]\u3002<\/p>\n<\/li>\n<li>\n<p>initial_selected (\u53ef\u9009): \u521d\u59cb\u53f3\u4fa7\u5217\u8868&#xff08;\u5df2\u9009&#xff09;\u7684\u6570\u636e\u9879&#xff0c;\u7c7b\u578b\u4e3a Optional[List[str]]\u3002\u8fd9\u4e9b\u9879\u4f1a\u81ea\u52a8\u4ece source_items \u4e2d\u79fb\u9664\u3002<\/p>\n<\/li>\n<li>\n<p>left_title (\u53ef\u9009): \u5de6\u4fa7\u5217\u8868\u7684\u6807\u9898&#xff0c;\u9ed8\u8ba4\u4e3a &#034;\u5f85\u9009\u5217\u8868&#034;\u3002<\/p>\n<\/li>\n<li>\n<p>right_title (\u53ef\u9009): \u53f3\u4fa7\u5217\u8868\u7684\u6807\u9898&#xff0c;\u9ed8\u8ba4\u4e3a &#034;\u5df2\u9009\u5217\u8868&#034;\u3002<\/p>\n<\/li>\n<li>\n<p>window_title (\u53ef\u9009): \u7a7f\u68ad\u6846\u7a97\u53e3\u7684\u6807\u9898&#xff0c;\u9ed8\u8ba4\u4e3a &#034;\u7a7f\u68ad\u6846&#034;\u3002<\/p>\n<\/li>\n<li>\n<p>list_width (\u53ef\u9009): \u5217\u8868\u7684\u5bbd\u5ea6&#xff08;\u50cf\u7d20&#xff09;&#xff0c;\u9ed8\u8ba4\u4e3a 180\u3002<\/p>\n<\/li>\n<li>\n<p>list_height (\u53ef\u9009): \u5217\u8868\u7684\u9ad8\u5ea6&#xff08;\u50cf\u7d20&#xff09;&#xff0c;\u9ed8\u8ba4\u4e3a 220\u3002<\/p>\n<\/li>\n<\/ul>\n<h2>3\u3001\u5b8c\u6574\u7ec4\u4ef6\u4ee3\u7801<\/h2>\n<p>\u5c06\u4e0b\u9762\u4ee3\u7801\u4fdd\u5b58\u4e3apy\u6587\u4ef6&#xff0c;\u5728\u5176\u4ed6\u4f4d\u7f6e\u5f15\u5165\u5373\u53ef\u3002<\/p>\n<p>import tkinter as tk<br \/>\nfrom typing import List, Dict, Callable, Optional<\/p>\n<p>class _CheckList(tk.Frame):<br \/>\n    def __init__(<br \/>\n        self,<br \/>\n        master&#061;None,<br \/>\n        items: Optional[List[str]] &#061; None,<br \/>\n        *,<br \/>\n        width: int &#061; 180,<br \/>\n        height: int &#061; 220,<br \/>\n        **kwargs,<br \/>\n    ):<br \/>\n        super().__init__(master, **kwargs)<br \/>\n        self.config(highlightbackground&#061;&#034;#DDDDDD&#034;, highlightcolor&#061;&#034;#DDDDDD&#034;, highlightthickness&#061;1, bd&#061;0)<\/p>\n<p>        self._all_items: List[str] &#061; list(items or [])<br \/>\n        self._vars: Dict[str, tk.BooleanVar] &#061; {}<\/p>\n<p>        search_frame &#061; tk.Frame(self)<br \/>\n        search_frame.pack(fill&#061;tk.X, padx&#061;2, pady&#061;(0, 2))<br \/>\n        tk.Label(search_frame, text&#061;&#034;&#x1f50d;&#034;).pack(side&#061;tk.LEFT)<br \/>\n        self._search_var &#061; tk.StringVar()<br \/>\n        entry &#061; tk.Entry(search_frame, textvariable&#061;self._search_var)<br \/>\n        entry.pack(side&#061;tk.LEFT, fill&#061;tk.X, expand&#061;True)<br \/>\n        entry.bind(&#034;&lt;KeyRelease&gt;&#034;, lambda e: self._render_items())<\/p>\n<p>        self._canvas &#061; tk.Canvas(self, width&#061;width, height&#061;height, highlightthickness&#061;0)<br \/>\n        vsb &#061; tk.Scrollbar(self, orient&#061;&#034;vertical&#034;, command&#061;self._canvas.yview)<br \/>\n        self._inner &#061; tk.Frame(self._canvas)<br \/>\n        self._inner.bind(<br \/>\n            &#034;&lt;Configure&gt;&#034;, lambda e: self._canvas.configure(scrollregion&#061;self._canvas.bbox(&#034;all&#034;))<br \/>\n        )<br \/>\n        self._canvas.create_window((0, 0), window&#061;self._inner, anchor&#061;&#034;nw&#034;)<br \/>\n        self._canvas.configure(yscrollcommand&#061;vsb.set)<\/p>\n<p>        self._canvas.pack(side&#061;tk.LEFT, fill&#061;tk.BOTH, expand&#061;True)<br \/>\n        vsb.pack(side&#061;tk.RIGHT, fill&#061;tk.Y)<\/p>\n<p>        self._render_items()<\/p>\n<p>    def items(self) -&gt; List[str]:<br \/>\n        return list(self._all_items)<\/p>\n<p>    def add_items(self, items: List[str]):<br \/>\n        for it in items:<br \/>\n            if it not in self._all_items:<br \/>\n                self._all_items.append(it)<br \/>\n        self._render_items()<\/p>\n<p>    def remove_items(self, items: List[str]):<br \/>\n        self._all_items &#061; [it for it in self._all_items if it not in items]<br \/>\n        self._render_items()<\/p>\n<p>    def get_checked_items(self) -&gt; List[str]:<br \/>\n        return [it for it, v in self._vars.items() if v.get()]<\/p>\n<p>    def _render_items(self):<br \/>\n        for child in self._inner.winfo_children():<br \/>\n            child.destroy()<br \/>\n        self._vars.clear()<\/p>\n<p>        keyword &#061; self._search_var.get().strip()<br \/>\n        for idx, txt in enumerate(self._all_items):<br \/>\n            if keyword and keyword not in txt:<br \/>\n                continue<br \/>\n            var &#061; tk.BooleanVar(value&#061;False)<br \/>\n            cb &#061; tk.Checkbutton(self._inner, text&#061;txt, variable&#061;var, anchor&#061;&#034;w&#034;)<br \/>\n            cb.pack(fill&#061;tk.X, anchor&#061;&#034;w&#034;)<br \/>\n            self._vars[txt] &#061; var<\/p>\n<p>    def set_all_checked(self, status: bool):<br \/>\n        for v in self._vars.values():<br \/>\n            v.set(status)<\/p>\n<p>    def all_selected(self) -&gt; bool:<br \/>\n        return bool(self._vars) and all(v.get() for v in self._vars.values())<\/p>\n<p>class TransferComponent(tk.Toplevel):<br \/>\n    def __init__(<br \/>\n        self,<br \/>\n        master&#061;None,<br \/>\n        *,<br \/>\n        source_items: Optional[List[str]] &#061; None,<br \/>\n        target_items: Optional[List[str]] &#061; None,<br \/>\n        left_title: str &#061; &#034;\u5f85\u9009\u5217\u8868&#034;,<br \/>\n        right_title: str &#061; &#034;\u5df2\u9009\u5217\u8868&#034;,<br \/>\n        window_title: str &#061; &#034;\u7a7f\u68ad\u6846&#034;,<br \/>\n        list_width: int &#061; 180,<br \/>\n        list_height: int &#061; 220,<br \/>\n        on_ok: Optional[Callable[[List[str]], None]] &#061; None,<br \/>\n        **kwargs,<br \/>\n    ):<br \/>\n        super().__init__(master, **kwargs)<br \/>\n        self.title(window_title)<br \/>\n        self.resizable(False, False)<br \/>\n        self.wm_attributes(&#034;-toolwindow&#034;, True)<\/p>\n<p>        self._on_ok_user &#061; on_ok<\/p>\n<p>        src_items &#061; list(source_items or [])<br \/>\n        tgt_items &#061; list(target_items or [])<br \/>\n        seen &#061; set()<br \/>\n        tgt_items &#061; [x for x in tgt_items if not (x in seen or seen.add(x))]<br \/>\n        src_items &#061; [it for it in src_items if it not in tgt_items]<\/p>\n<p>        body &#061; tk.Frame(self)<br \/>\n        body.pack(padx&#061;10, pady&#061;10)<\/p>\n<p>        left_frame &#061; tk.Frame(body)<br \/>\n        left_frame.grid(row&#061;0, column&#061;0, sticky&#061;&#034;nsew&#034;)<br \/>\n        left_frame.config(highlightbackground&#061;&#034;#DDDDDD&#034;, highlightcolor&#061;&#034;#DDDDDD&#034;, highlightthickness&#061;1, bd&#061;0)<br \/>\n        self._left_all_var &#061; tk.BooleanVar(value&#061;False)<br \/>\n        tk.Checkbutton(<br \/>\n            left_frame,<br \/>\n            text&#061;left_title,<br \/>\n            variable&#061;self._left_all_var,<br \/>\n            command&#061;self._toggle_left_all,<br \/>\n            anchor&#061;&#034;w&#034;,<br \/>\n        ).pack(anchor&#061;&#034;w&#034;)<br \/>\n        self._left_list &#061; _CheckList(left_frame, items&#061;src_items, width&#061;list_width, height&#061;list_height)<br \/>\n        self._left_list.pack()<\/p>\n<p>        btn_frame &#061; tk.Frame(body)<br \/>\n        btn_frame.grid(row&#061;0, column&#061;1, padx&#061;10)<br \/>\n        btn_right &#061; tk.Button(btn_frame, text&#061;&#034;\u226b&#034;, width&#061;4, command&#061;self._move_right)<br \/>\n        btn_left &#061; tk.Button(btn_frame, text&#061;&#034;\u226a&#034;, width&#061;4, command&#061;self._move_left)<br \/>\n        btn_right.pack(pady&#061;(40, 5))<br \/>\n        btn_left.pack(pady&#061;5)<\/p>\n<p>        right_frame &#061; tk.Frame(body)<br \/>\n        right_frame.grid(row&#061;0, column&#061;2, sticky&#061;&#034;nsew&#034;)<br \/>\n        right_frame.config(highlightbackground&#061;&#034;#DDDDDD&#034;, highlightcolor&#061;&#034;#DDDDDD&#034;, highlightthickness&#061;1, bd&#061;0)<br \/>\n        self._right_all_var &#061; tk.BooleanVar(value&#061;False)<br \/>\n        tk.Checkbutton(<br \/>\n            right_frame,<br \/>\n            text&#061;right_title,<br \/>\n            variable&#061;self._right_all_var,<br \/>\n            command&#061;self._toggle_right_all,<br \/>\n            anchor&#061;&#034;w&#034;,<br \/>\n        ).pack(anchor&#061;&#034;w&#034;)<br \/>\n        self._right_list &#061; _CheckList(right_frame, items&#061;tgt_items, width&#061;list_width, height&#061;list_height)<br \/>\n        self._right_list.pack()<\/p>\n<p>        bottom &#061; tk.Frame(self)<br \/>\n        bottom.pack(fill&#061;tk.X, pady&#061;(5, 10))<br \/>\n        tk.Button(bottom, text&#061;&#034;\u53d6\u6d88&#034;, width&#061;8, command&#061;self.destroy).pack(side&#061;tk.RIGHT, padx&#061;5)<br \/>\n        tk.Button(bottom, text&#061;&#034;\u786e\u5b9a&#034;, width&#061;8, command&#061;self._on_ok).pack(side&#061;tk.RIGHT)<\/p>\n<p>        self.transient(master)<br \/>\n        self.grab_set()<br \/>\n        self.protocol(&#034;WM_DELETE_WINDOW&#034;, self.destroy)<\/p>\n<p>        self.update_idletasks()<br \/>\n        win_w &#061; self.winfo_width()<br \/>\n        win_h &#061; self.winfo_height()<br \/>\n        scr_w &#061; self.winfo_screenwidth()<br \/>\n        scr_h &#061; self.winfo_screenheight()<br \/>\n        pos_x &#061; (scr_w &#8211; win_w) \/\/ 2<br \/>\n        pos_y &#061; (scr_h &#8211; win_h) \/\/ 2<br \/>\n        self.geometry(f&#034;{win_w}x{win_h}&#043;{pos_x}&#043;{pos_y}&#034;)<\/p>\n<p>    def _move_right(self):<br \/>\n        items &#061; self._left_list.get_checked_items()<br \/>\n        if not items:<br \/>\n            return<br \/>\n        self._left_list.remove_items(items)<br \/>\n        self._right_list.add_items(items)<br \/>\n        self._left_all_var.set(False)<br \/>\n        self._right_all_var.set(False)<\/p>\n<p>    def _move_left(self):<br \/>\n        items &#061; self._right_list.get_checked_items()<br \/>\n        if not items:<br \/>\n            return<br \/>\n        self._right_list.remove_items(items)<br \/>\n        self._left_list.add_items(items)<br \/>\n        self._left_all_var.set(False)<br \/>\n        self._right_all_var.set(False)<\/p>\n<p>    def _on_ok(self):<br \/>\n        if callable(self._on_ok_user):<br \/>\n            self._on_ok_user(self._right_list.items())<br \/>\n        self.destroy()<\/p>\n<p>    def _toggle_left_all(self):<br \/>\n        self._left_list.set_all_checked(self._left_all_var.get())<\/p>\n<p>    def _toggle_right_all(self):<br \/>\n        self._right_list.set_all_checked(self._right_all_var.get())<\/p>\n<p>    &#064;classmethod<br \/>\n    def pick(<br \/>\n        cls,<br \/>\n        master&#061;None,<br \/>\n        *,<br \/>\n        source_items: List[str],<br \/>\n        initial_selected: Optional[List[str]] &#061; None,<br \/>\n        left_title: str &#061; &#034;\u5f85\u9009\u5217\u8868&#034;,<br \/>\n        right_title: str &#061; &#034;\u5df2\u9009\u5217\u8868&#034;,<br \/>\n        window_title: str &#061; &#034;\u7a7f\u68ad\u6846&#034;,<br \/>\n        list_width: int &#061; 180,<br \/>\n        list_height: int &#061; 220,<br \/>\n    ) -&gt; List[str]:<br \/>\n        res: Dict[str, List[str]] &#061; {&#034;sel&#034;: []}<\/p>\n<p>        def _ok(items: List[str]):<br \/>\n            res[&#034;sel&#034;] &#061; items<\/p>\n<p>        inst &#061; cls(<br \/>\n            master,<br \/>\n            source_items&#061;source_items,<br \/>\n            target_items&#061;initial_selected,<br \/>\n            left_title&#061;left_title,<br \/>\n            right_title&#061;right_title,<br \/>\n            window_title&#061;window_title,<br \/>\n            list_width&#061;list_width,<br \/>\n            list_height&#061;list_height,<br \/>\n            on_ok&#061;_ok,<br \/>\n        )<br \/>\n        inst.wait_window()<br \/>\n        return res[&#034;sel&#034;]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb165\u6b21\u3002TransferComponent\u662f\u4e00\u4e2a\u57fa\u4e8etkinter\u5f00\u53d1\u7684\u53cc\u5217\u8868\u7a7f\u68ad\u9009\u62e9\u5668\u7ec4\u4ef6\uff0c\u9002\u7528\u4e8e\u7528\u6237\u6743\u9650\u7ba1\u7406\u3001\u5546\u54c1\u5206\u7c7b\u9009\u62e9\u7b49\u573a\u666f\u3002\u8be5\u7ec4\u4ef6\u63d0\u4f9bpick\u7c7b\u65b9\u6cd5\u4f5c\u4e3a\u4e3b\u8981\u63a5\u53e3\uff0c\u652f\u6301\u81ea\u5b9a\u4e49\u6807\u9898\u3001\u5217\u8868\u5c3a\u5bf8\u7b49\u53c2\u6570\uff0c\u5b9e\u73b0\u6570\u636e\u9879\u5728\u5de6\u53f3\u5217\u8868\u95f4\u7684\u53cc\u5411\u8f6c\u79fb\u3002\u6838\u5fc3\u529f\u80fd\u5305\u62ec\uff1a\u5173\u952e\u5b57\u641c\u7d22\u3001\u5168\u9009\/\u53d6\u6d88\u5168\u9009\u3001\u5355\u9009\/\u591a\u9009\u64cd\u4f5c\uff0c\u5e76\u8fd4\u56de\u6700\u7ec8\u9009\u62e9\u7ed3\u679c\u3002\u7ec4\u4ef6\u91c7\u7528\u6a21\u6001\u7a97\u53e3\u8bbe\u8ba1\uff0c\u5c01\u88c5\u4e86\u5b8c\u6574\u7684UI\u4ea4\u4e92\u903b\u8f91\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u8c03\u7528pick\u65b9\u6cd5\u5373\u53ef\u5feb\u901f\u96c6\u6210\u7a7f\u68ad\u9009\u62e9\u529f\u80fd\u3002<\/p>\n","protected":false},"author":2,"featured_media":56979,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,5936],"topic":[],"class_list":["post-56981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python","tag-tkinter"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent - \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\/56981.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb165\u6b21\u3002TransferComponent\u662f\u4e00\u4e2a\u57fa\u4e8etkinter\u5f00\u53d1\u7684\u53cc\u5217\u8868\u7a7f\u68ad\u9009\u62e9\u5668\u7ec4\u4ef6\uff0c\u9002\u7528\u4e8e\u7528\u6237\u6743\u9650\u7ba1\u7406\u3001\u5546\u54c1\u5206\u7c7b\u9009\u62e9\u7b49\u573a\u666f\u3002\u8be5\u7ec4\u4ef6\u63d0\u4f9bpick\u7c7b\u65b9\u6cd5\u4f5c\u4e3a\u4e3b\u8981\u63a5\u53e3\uff0c\u652f\u6301\u81ea\u5b9a\u4e49\u6807\u9898\u3001\u5217\u8868\u5c3a\u5bf8\u7b49\u53c2\u6570\uff0c\u5b9e\u73b0\u6570\u636e\u9879\u5728\u5de6\u53f3\u5217\u8868\u95f4\u7684\u53cc\u5411\u8f6c\u79fb\u3002\u6838\u5fc3\u529f\u80fd\u5305\u62ec\uff1a\u5173\u952e\u5b57\u641c\u7d22\u3001\u5168\u9009\/\u53d6\u6d88\u5168\u9009\u3001\u5355\u9009\/\u591a\u9009\u64cd\u4f5c\uff0c\u5e76\u8fd4\u56de\u6700\u7ec8\u9009\u62e9\u7ed3\u679c\u3002\u7ec4\u4ef6\u91c7\u7528\u6a21\u6001\u7a97\u53e3\u8bbe\u8ba1\uff0c\u5c01\u88c5\u4e86\u5b8c\u6574\u7684UI\u4ea4\u4e92\u903b\u8f91\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u8c03\u7528pick\u65b9\u6cd5\u5373\u53ef\u5feb\u901f\u96c6\u6210\u7a7f\u68ad\u9009\u62e9\u529f\u80fd\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/56981.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-14T20:04:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250814200435-689e41539ab4c.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=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/56981.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/56981.html\",\"name\":\"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-14T20:04:40+00:00\",\"dateModified\":\"2025-08-14T20:04:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/56981.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/56981.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/56981.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent\"}]},{\"@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":"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent - \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\/56981.html","og_locale":"zh_CN","og_type":"article","og_title":"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb165\u6b21\u3002TransferComponent\u662f\u4e00\u4e2a\u57fa\u4e8etkinter\u5f00\u53d1\u7684\u53cc\u5217\u8868\u7a7f\u68ad\u9009\u62e9\u5668\u7ec4\u4ef6\uff0c\u9002\u7528\u4e8e\u7528\u6237\u6743\u9650\u7ba1\u7406\u3001\u5546\u54c1\u5206\u7c7b\u9009\u62e9\u7b49\u573a\u666f\u3002\u8be5\u7ec4\u4ef6\u63d0\u4f9bpick\u7c7b\u65b9\u6cd5\u4f5c\u4e3a\u4e3b\u8981\u63a5\u53e3\uff0c\u652f\u6301\u81ea\u5b9a\u4e49\u6807\u9898\u3001\u5217\u8868\u5c3a\u5bf8\u7b49\u53c2\u6570\uff0c\u5b9e\u73b0\u6570\u636e\u9879\u5728\u5de6\u53f3\u5217\u8868\u95f4\u7684\u53cc\u5411\u8f6c\u79fb\u3002\u6838\u5fc3\u529f\u80fd\u5305\u62ec\uff1a\u5173\u952e\u5b57\u641c\u7d22\u3001\u5168\u9009\/\u53d6\u6d88\u5168\u9009\u3001\u5355\u9009\/\u591a\u9009\u64cd\u4f5c\uff0c\u5e76\u8fd4\u56de\u6700\u7ec8\u9009\u62e9\u7ed3\u679c\u3002\u7ec4\u4ef6\u91c7\u7528\u6a21\u6001\u7a97\u53e3\u8bbe\u8ba1\uff0c\u5c01\u88c5\u4e86\u5b8c\u6574\u7684UI\u4ea4\u4e92\u903b\u8f91\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u8c03\u7528pick\u65b9\u6cd5\u5373\u53ef\u5feb\u901f\u96c6\u6210\u7a7f\u68ad\u9009\u62e9\u529f\u80fd\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/56981.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-14T20:04:40+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250814200435-689e41539ab4c.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/56981.html","url":"https:\/\/www.wsisp.com\/helps\/56981.html","name":"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-14T20:04:40+00:00","dateModified":"2025-08-14T20:04:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/56981.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/56981.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/56981.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Tkinter \u5168\u80fd\u7a7f\u68ad\u6846\u7ec4\u4ef6 TransferComponent"}]},{"@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\/56981","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=56981"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/56981\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/56979"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=56981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=56981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=56981"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=56981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}