| | |
ToolTip box
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 |
accessdenied address advanced aliased apax avogadro bash beginner c++ code console convert coordinates corners csv cturtle curves data def development dynamic edit enter event examples excel file function generator gui halp hints http ideas images input ip itunes jaunty java launcher leftmouse linux list lists loan maze microsoft module mouse movingimageswithpygame newb obexftp opensource output parameters path programming projects py2exe pygame pyglet pygtk pyopengl pyqt python random raw_input read redirect remote return reverse rubyconf silverlight simple sqlite ssh string sudokusolver sum syntax terminal time tkinter tooltip tricks tutorial ubuntu unicode urllib urllib2 variable ventrilo web-scrape whileloop wikipedia wordgame wxpython xlwt




