2 Entries 1 keypad - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: Jobs (https://python-forum.io/forum-6.html) +--- Thread: 2 Entries 1 keypad (/thread-9327.html) |
2 Entries 1 keypad - scarface113 - Apr-01-2018 Hello everybody, I have a problem, i want to use an onscreen keyboard for 2 entrys . i have this code from another thread and thats exactly what i want but only for one entry. can please somebody edit the code so i can use the same keyboard for both entrys ? Thank you so much import tkinter as tk from functools import partial root = tk.Tk() root.geometry("200x100") num_run = 0 btn_funcid = 0 def click(btn): global num_run text = "%s" % btn if not text == "Del" and not text == "Close": e.insert(END, text) if text == 'Del': e.delete(0, END) if text == 'Close': boot.destroy() num_run = 0 root.unbind('<Button-1>', btn_funcid) def numpad(): global num_run, boot boot = tk.Tk() boot['bg'] = 'green' lf = tk.LabelFrame(boot, text=" keypad ", bd=3) lf.pack(padx=15, pady=10) btn_list = [ '7', '8', '9', '4', '5', '6', '1', '2', '3', '0', 'Del', 'Close'] r = 1 c = 0 n = 0 btn = list(range(len(btn_list))) for label in btn_list: cmd = partial(click, label) btn[n] = tk.Button(lf, text=label, width=10, height=5, command=cmd) btn[n].grid(row=r, column=c) n += 1 c += 1 if c == 3: c = 0 r += 1 def close(event): global num_run, btn_funcid if num_run == 1: boot.destroy() num_run = 0 root.unbind('<Button-1>', btn_funcid) def run(event): global num_run, btn_funcid if num_run == 0: num_run = 1 numpad() btn_funcid = root.bind('<Button-1>', close) rand=tk.StringVar() rand1=tk.StringVar() e=tk.Entry(root, font='Verdana 8 bold',textvariable=rand, insertwidth=4, justify='right') e.bind('<Button-1>', run) e.place(x=10, y=10) secondentry= tk.Entry(root, font='Verdana 8 bold',textvariable=rand1, insertwidth=4, justify='right') secondentry.place(x=10, y=30) root.mainloop() RE: 2 Entries 1 keypad - normanfostq - Apr-02-2018 Hi @scarface113, Greetings! PM Sent! Regards, Norman F. RE: 2 Entries 1 keypad - chiragarya1992 - Aug-12-2018 Hey Hi I am also implementing same program where I have to use onscreen touch keypad for four entry. Could anyone help me out in that. |