带屏幕键盘的python多输入
我正试图用按钮输入一些内容,但我必须先使用键来创建一个InterAction to entry小部件。我想让它没有它,但问题是当你做多个条目时,有没有办法用鼠标点击和光标来选择那个条目? 这是我的密码带屏幕键盘的python多输入,python,user-interface,tkinter,Python,User Interface,Tkinter,我正试图用按钮输入一些内容,但我必须先使用键来创建一个InterAction to entry小部件。我想让它没有它,但问题是当你做多个条目时,有没有办法用鼠标点击和光标来选择那个条目? 这是我的密码 # -*- coding: utf-8 -*- from Tkinter import* import sys pencere = Tk() #pencere.overrideredirect(1)#başlıksız pencere boyut = pencere.geometry ("400
# -*- coding: utf-8 -*-
from Tkinter import*
import sys
pencere = Tk()
#pencere.overrideredirect(1)#başlıksız pencere
boyut = pencere.geometry ("400x400+250+150")#x*y +x+y boyut ve konum
baslik = pencere.title("guc hesaplama programi") #pencere başlığı
say=0
def click(key):
global say
if say==0:
if key == 'C':
joule_entry.delete(0, END) # clear entry
else:
joule_entry.insert(END, key)
if say==1:
if key == 'C':
time_entry.delete(0, END) # clear entry
else:
time_entry.insert(END, key)
if say==2:
if key == 'C':
power_entry.delete(0, END) # clear entry
else:
power_entry.insert(END, key)
def write_joule():
global say
say=0
def write_time():
global say
say=1
def write_power():
global say
say=2
def joule_find():
joule_entry.delete(0,END)
power_t = power_entry.get()
power = float(power_t)
time_t = time_entry.get()
time = float(time_t)
joule = time*power/1000
if 0 <= power <= 1500 and 0 <= time <= 9999: #sınırlamalarımız
joule_entry.insert(0,str(round(joule,3)))
else:
joule_entry.insert(0,"error")
def time_find():
time_entry.delete(0,END)
power_t = power_entry.get()
power = float(power_t)
joule_t = joule_entry.get()
joule = float(joule_t)
time = joule/(power/1000)
if 0 <= power <= 1500 and 0 <= time <= 9999: #sınırlamalarımız
time_entry.insert(0,str(round(time,3)))
else:
time_entry.insert(0,"error")
def power_find():
power_entry.delete(0,END)
joule_t = joule_entry.get()
joule = float(joule_t)
time_t = time_entry.get()
time = float(time_t)
guc = 1000*joule/time
if 0 <= guc <= 1500 and 0 <= time <= 9999: #sınırlamalarımız
power_entry.insert(0,str(round(guc,3)))
else:
power_entry.insert(0,"error")
joule_button = Button(text="ENERGY\t:" ,font="arial 14 bold", command = joule_find) #
joule_button.grid(row=0, column=0, sticky="w", pady=10)
joule_entry = Entry()
joule_entry.grid(row=0, column=1, pady=10,sticky="news")
joule_button2 = Button(text="key" ,font="arial 14 bold", command = write_joule) #
joule_button2.grid(row=0, column=3, sticky="w", pady=10)
joule_label = Label(text="Joule" ,font="arial 14 bold")
joule_label.grid(row=0, column=2, sticky="w", pady=10)
time_button = Button(text="TIME\t:",font="arial 14 bold", command = time_find )
time_button.grid(row=1, column=0, sticky="w", pady=10)
time_entry= Entry()
time_entry.grid(row=1, column=1, pady=10,sticky="news")
time_button2 = Button(text="key",font="arial 14 bold", command = write_time )
time_button2.grid(row=1, column=3, sticky="w", pady=10)
time_label= Label(text="Second",font="arial 14 bold" )
time_label.grid(row=1, column=2, sticky="w")
power_button = Button(text="Power\t:",font="arial 14 bold", command = power_find )
power_button.grid(row=2, column=0, sticky="w", pady=10)
power_entry= Entry()
power_entry.grid(row=2, column=1, pady=10,sticky="news")
power_button2 = Button(text="key",font="arial 14 bold", command = write_power )
power_button2.grid(row=2, column=3, sticky="w", pady=10)
power_label= Label(text="milli Watt",font="arial 14 bold" )
power_label.grid(row=2, column=2, sticky="w")
close = Button(text = "CLOSE",command = pencere.destroy)
close.grid(row=40,column=2,sticky="news")
btn_list = [
'7', '8', '9',
'4', '5', '6',
'1', '2', '3',
'0', '.', 'C',]
# create all buttons with a loop
r = 5
c = 0
for b in btn_list:
rel = 'ridge'
cmd = lambda x=b: click(x)
Button(text=b,width=5,relief=rel,command=cmd).grid(row=r,column=c,sticky="news")
c += 1
if c > 2:
c = 0
r += 1
mainloop()
#-*-编码:utf-8-*-
从Tkinter进口*
导入系统
pencere=Tk()
#铅笔。超控直接(1)铅笔
boyut=pencere.geometry(“400x400+250+150”)#x*y+x+y boyut ve konum
baslik=pencere.title(“guc hesaplama计划”)şpencere başlıı
say=0
def单击(键):
全球话语权
如果say==0:
如果键=='C':
焦耳输入。删除(0,结束)#清除输入
其他:
焦耳输入。插入(结束,键)
如果say==1:
如果键=='C':
时间\输入。删除(0,结束)\清除输入
其他:
时间\输入。插入(结束,键)
如果say==2:
如果键=='C':
电源输入。删除(0,结束)#清除输入
其他:
电源输入。插入(结束,键)
def write_joule():
全球话语权
say=0
def write_time():
全球话语权
say=1
def write_power():
全球话语权
say=2
定义焦耳查找()
焦耳输入。删除(0,结束)
power\u t=power\u entry.get()
功率=浮动(功率)
time\u t=time\u entry.get()
时间=浮动(时间)
焦耳=时间*功率/1000
如果0,请您更好地解释您的问题好吗?我不明白,我要做个节目。但我需要使用屏幕键盘。每次我点击输入框,我都想让程序打开屏幕键盘。但对于多输入框,如果使用尖叫键盘,即使单击了另一个输入框,也会在第一个输入框中写入。