Entery Text功能

时间:2018-04-11 22:09:36

标签: python-3.x tkinter tkinter-entry tkinter-layout

我想知道tkinter中的entery文本是否可以使用多个函数?如果没有,还有其他办法吗?

这是我的代码:

        self.UI_lbl = tk.Label(self, text="Choose Piece: ")
        self.UI_lbl.grid(row=1, column=0, sticky="e")
        self.UI_entry1 = tk.Entry(self)
        self.UI_entry1.grid(row=1, column=1, sticky="w")

        self.UI_lbl = tk.Label(self, text="Choose Row: ")
        self.UI_lbl.grid(row=2, column=0, sticky="e")
        self.UI_entry2 = tk.Entry(self)
        self.UI_entry2.grid(row=2, column=1, sticky="w")

        self.UI_lbl2 = tk.Label(self, text="Choose Column: ")
        self.UI_lbl2.grid(row=3, column=0, sticky="e")
        self.UI_entry3 = tk.Entry(self)
        self.UI_entry3.grid(row=3, column=1, sticky="w")

        self.UI_lbl = tk.Label(self, text="Move Row: ")
        self.UI_lbl.grid(row=4, column=0, sticky="e")
        self.UI_entry4 = tk.Entry(self)
        self.UI_entry4.grid(row=4, column=1, sticky="w")

        self.UI_lbl2 = tk.Label(self, text="Move Column: ")
        self.UI_lbl2.grid(row=5, column=0, sticky="e")
        self.UI_entry5 = tk.Entry(self)
        self.UI_entry5.grid(row=5, column=1, sticky="w")

        self.UI_entry1.bind("<Return>", self.Player1)
        self.UI_entry2.bind("<Return>", self.Player1)
        self.UI_entry3.bind("<Return>", self.Player1)
        self.UI_entry4.bind("<Return>", self.Player1)
        self.UI_entry5.bind("<Return>", self.Player1)

我想在多功能中使用这些条目,但目前有一个大的,因为我无法分配多个参数,我将如何解决这个问题?

0 个答案:

没有答案