471,330 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Can i have "OnMouseEnter" in the menu?

Elias Alhanatis
Hello everybody ,
I have the following piece of code ( please dont pay any attention to the Greek... :-) ) , and i would like to know if there is a way to make the menu under each MenuButton appear only by entering its space with the mouse ( and thus saving some million clicks from the users....). I think i've seen this kind of thing elsewhere but i cannot remember exactly.

Thanks in advance!!!!!!

Elias

Expand|Select|Wrap|Line Numbers
  1. # -*- coding: cp1253 -*-
  2. from Tkinter import *
  3.  
  4.  
  5. def MeFr():
  6.     mefr=Frame(root,height="0.8c",width="30c",bg="cyan")
  7.     mefr.grid()
  8.  
  9. # Το μενού "Αρχεία":
  10.  
  11.     ArxiaBut=Menubutton(mefr, text=u"Αρχεία", relief=RAISED, activebackground="blue" ,activeforeground="white")
  12.     ArxiaBut.menu=Menu(ArxiaBut,tearoff=0)
  13.     Arxia=[u"1. Αποθήκη",
  14.            u"2. Πελάτες",
  15.            u"3. Προμηθευτές",
  16.            u"4. Πωλητές",
  17.            u"5. Λογαριασμοί",
  18.            u"6. Ταμείο - Συνάλλαγμα"]
  19.     for text in Arxia:
  20.         ArxiaBut.menu.add_command(label=text)
  21.     for sep in [1,5]:
  22.         ArxiaBut.menu.insert_separator(sep)
  23.     ArxiaBut.grid(row=0,column=0,sticky=W)
  24.     ArxiaBut['menu']=ArxiaBut.menu
  25.  
  26.  
  27. # Το μενού "Κινήσεις":
  28.  
  29.     KiniseisBut=Menubutton(mefr, text="Edit", relief=RAISED, activebackground="blue", activeforeground="white")
  30.     KiniseisBut.menu=Menu(KiniseisBut,tearoff=0)
  31.     kiniseis=[u"1.  Πωλήσεις",
  32.               u"2.  Αγορές",
  33.               u"3.  Παραγωγή Ετοίμων",
  34.               u"4.  Παρακολούθηση Παραγωγής",
  35.               u"5.  Ενδοδιακίνηση μεταξύ Αποθηκών",
  36.               u"6.  Εισπράξεις από πελάτες",
  37.               u"7.  Πληρωμές σε Προμηθευτές",
  38.               u"8.  Κινήσεις Λογαριασμών",
  39.               u"9.  Επιταγές - Γραμμάτια",
  40.               u"10. Πιστωτικές Κάρτες",
  41.               u"11. Μαζικές Κινήσεις",
  42.               u"12. Διάφορες Κινήσεις Αποθήκης"]
  43.     for text in kiniseis:
  44.         KiniseisBut.menu.add_command(label=text)
  45.     for sep in [5,8,11,13]:
  46.         KiniseisBut.menu.insert_separator(sep)
  47.     KiniseisBut.grid(row=0,column=1,sticky=W)
  48.     KiniseisBut['menu']=KiniseisBut.menu
  49.  
  50.  
  51.  
  52.  
  53. root=Tk()
  54. MeFr()
  55. mainloop()
Sep 23 '07 #1
0 998

Post your reply

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.