| | |
ToolTip box
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Python Syntax (Toggle Plain Text)
from Tkinter import * root = Tk() tipwindow = None # Creates a tooptip box for a widget. def createToolTip( widget, text ): def enter( event ): global tipwindow x = y = 0 if tipwindow or not text: return x, y, cx, cy = widget.bbox( "insert" ) x += widget.winfo_rootx() + 27 y += widget.winfo_rooty() + 27 # Creates a toplevel window tipwindow = tw = Toplevel( widget ) # Leaves only the label and removes the app window tw.wm_overrideredirect( 1 ) tw.wm_geometry( "+%d+%d" % ( x, y ) ) label = Label( tw, text = text, justify = LEFT, background = "#ffffe0", relief = SOLID, borderwidth = 1, font = ( "tahoma", "8", "normal" ) ) label.pack( ipadx = 1 ) def close( event ): global tipwindow tw = tipwindow tipwindow = None if tw: tw.destroy() widget.bind( "<Enter>", enter ) widget.bind( "<Leave>", close ) b = Button( root, text = "Mouse over" ); b.pack() createToolTip( b, "Mouse is over the button" ) mainloop()
I searched for the tooltip box in the forum and couldn't find a Python version for it. So here's what I am using. P.S I found it in google somewhere :)
| Thread Tools | Search this Thread |
Tag cloud for python, tooltip
abrupt accessdenied advanced advice ajax anti arax array backend bash beginner bluetooth book c++ calculator calling class code console curved cx-freeze dictionary digital django dynamic editing embed examples excel file ftp function google gui halp hints homework iframe infosec input java keyboard keycontrol launcher leftmouse library line linux list lists loop microphone mysqldb numbers output prime program programming projects push py2exe pygame pygtk python random recursion recursive remote ruby script server shebang skinning slicenotation smtp software source sprite string strip sudokusolver syntax table tennis text threading tkinter tlapse tricks tutorial ubuntu unicode url urllib urllib2 variable voip wikipedia write wxpython




