Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
This project provides safe and easy to use API bindings to Tcl/Tk commands.
Features
- Friendly API for both Rustaceans and Tk programers.
Quickstart
A quick glance
use *;
use *;
Another glance
use *;
use *;
The naming conventions in translating Tk commands to Rust bindings
-
Prefix Tk widget constructors with
add_
and put parentheses around option values.The Tk command to add a widget looks like
Constructor path -options_and_values
, e.g.label .lb -text "lorem ipsum" -width 50 -height 20
The equivalent Rust statement is as follows.
let lb = root.add_label( /*".lb"*/ -text("lorem ipsum") -width(50) -height(20) )?;
-
Converts Tcl's imperative style to Rust's object style
The Tk command is in the form of "verb noun options", e.g.
pack .lb -fill both
The equivalent Rust statement is in th form of "object method options", as follows.
lb.pack( -fill("both") )?; // use pack(()) without any option.
-
Converts Tk's space-separated commands to Rust's underscore-separated function names.
Tk commands are space-separated, e.g.
tk fontchooser show
The equivalent Rust statement is as follows.
tk.fontchooser_show()?;
Users can look into the Tk command reference and find the "fontchooser" page then search "show".
-
Distinguish between set and get via the
set_
prefix.In Tk, it is common to distinguish set and get by providing or omitting the value argument, e.g.
wm title window "Lorem ipsum"
means to set the window's title to "Lorem ipsum", whilewm title window
means to get the windows' title.The equivalent Rust statements are as follows.
window.set_wm_title( "Lorem ipsum" )?; window.wm_title()?;
Documents
License
Under Apache License 2.0 or MIT License, at your will.