Jump to content
gallows

Insert em entry!

Recommended Posts

gallows

Ola, estou com uma certa dificuldade em fazer uma entrada receber o valor de outra, alguém poderia me dar uma exemplo de como utilizar o mesmo por favor?

from Tkinter import *
class novo:
  def __init__(self, janela):
	    self.caixa=Frame(janela)
	    self.caixa.grid()
	    self.en=Entry(self.caixa)
	    self.en.grid(row=0, column=0)
	    self.en2=Entry(self.caixa)
	    self.en2.grid(row=0, column=1, state=DISABLED)
	    self.en2['state'] = 'readonly'
	    self.b=Button(self.caixa, text='ok', command=self.entrar)
	    self.b.grid(row=1)

  def entrar(self):
	    self.en.insert(0, self.en2.get())

root=Tk()
novo(root)
root.mainloop()
#state "enabled": must be disabled, normal, or readonly

PS: na verdade quero usar para buscar itens de um banco de dados com a Entry1 e enviar o resultado da pesquisa para a Entry2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.