Code Point
July 31, 2010, 10:56:06 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Geshi Sintax Hilighting Mod Installed. Tens of languages available.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: how to tie my button command to a keyboard button??  (Read 2010 times)
fuston05
Jr. Member
*

Karma: 0
Offline Offline

Posts: 14


« on: February 08, 2008, 09:14:38 PM »

this is wat ive got:


#!/usr/bin/python

from Tkinter import *

def get():
    global pic
    global tem
   
    imp = ent.get()
    if imp == 'clear':
        can.delete(tem)
    else:
        pic = PhotoImage(file = imp)
        tem = can.create_image(250,200,image = pic)
        ent.delete(0,END)


   

   

root = Tk()
root.geometry('600x600+270+50')

lab = Label(root, text = 'name of the picture', font = ("helvatica", 25))
ent = Entry(root, bg = 'white', font = ('helvatica', 25))
button = Button(root, text = 'enter', width = 10, height = 2, command = get)
can = Canvas(root, width = '500', height = '400', bg = 'white')





ent.focus()
lab.pack(pady = 10)
ent.pack(pady = 10)
button.pack(anchor = E)
can.pack()



root.mainloop()


on my button i have to hit the button to "enter"
i want to tie that button to my "enter key" on keyboard, so that i can 'also' just hit my "enter key" to push my "enter button"
i have no idea how todo that?Huh
« Last Edit: February 08, 2008, 09:52:26 PM by fuston05 » Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!