Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
cursor text in tcl/expect

Posted by skumar003 (skumar003), 12 February 2003
Wahtis the syntax for implementing the display text once the mouse is over a button or toolbar.

I am looking for the button option. The book I have does not mention anything about it.

Posted by admin (Graham Ellis), 13 February 2003
You're probably looking for a bind command rather than an option to the button command.   Events ("happenings" if you like) can be set in three ways
1. Those which are automatically provided - for example, the changing of the colour of a button when you move over it
2. Those which are set by the component commands, using options such as -command and -textvariable.
3. The less predictable requirements, such as changing the text on one component when you move over another, which are typically set with a bind.

The following program puts up two buttons and a label.   When you move over the upper button, it switches text on the label on and off (and when you press the button, the text toggles between two possible values ...)

Code:
#!/usr/bin/wish

proc flip {} {
       global state feelings
       set state [expr 1 - $state]
       set word [lindex "Marmite Bovril" $state]
       set feelings [lindex "Yummmm!!!!!  {!!\ Yuk\ !!}" $state]
       .tog configure -text $word
       .feed config -text $feelings
       }

# Tcl/Tk - Event demo

wm geometry . 300x200

set state 0
set feelings "Yummmm!!!!!"

button .demo -text done -command exit
button .tog -text Marmite -command flip
label .feed -text " " -font 12x24 -padx 10 -pady 10

bind .tog <Enter> {.feed config -text $feelings}
bind .tog <Leave> {.feed config -text " "}
pack .tog .feed .demo -fill both -expand true


Posted by skumar003 (skumar003), 13 February 2003
Thank you. This helps.

The text is shown when the cursor moves over a button on th eframe. Can we do it. Can we do it in the form of a bubble?

Eg:
Like the message" move forward one page" when we move the mouse over forward in the browser netscape?

[b][/b]

Posted by admin (Graham Ellis), 13 February 2003
Pop ups can be created as toplevel widgets in Tk ... I suggest you start by having a look through any manuals you have on Tk, which probably have a lot of charts and diagrams to help you, and then ask further if they leave any questions unanswered.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho