pub struct Tk<Inst: TkInstance> { /* private fields */ }Expand description
Tk instance.
Implementations§
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn pack<Opts>( &self, paths_opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkPackOpt> + IntoHomoTuple<OptPair>,
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn grid<Opts>( &self, paths_opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkGridOpt> + IntoHomoTuple<OptPair>,
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn place<Opts>( &self, paths_opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkPlaceOpt> + IntoHomoTuple<OptPair>,
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn app_name(&self) -> InterpResult<String>
pub fn set_app_name(&self, new_name: &str) -> InterpResult<String>
pub fn busy(&self, widget: Widget<Inst>) -> InterpResult<()>
pub fn busy_hold<Opts>( &self, widget: Widget<Inst>, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkBusyHoldOpt> + IntoHomoTuple<OptPair>,
pub fn busy_cget<Opt>( &self, widget: Widget<Inst>, _name_fn: fn(_: Obj) -> Opt ) -> InterpResult<Obj>where Opt: TkOption + Into<TkBusyHoldOpt>,
pub fn busy_configure<Opts>( &self, widget: Widget<Inst>, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkBusyHoldOpt> + IntoHomoTuple<OptPair>,
pub fn busy_forget(&self, widgets: &[Widget<Inst>]) -> InterpResult<()>
pub fn busy_current( &self ) -> Result<Vec<Widget<Inst>>, Enum3<InterpError, NotList, WidgetNotFound>>
pub fn busy_current_of_pattern( &self, pattern: &str ) -> Result<Vec<Widget<Inst>>, Enum3<InterpError, NotList, WidgetNotFound>>
pub fn busy_status(&self, widget: Widget<Inst>) -> InterpResult<bool>
pub fn caret( &self, widget: Widget<Inst> ) -> Result<TkCaret, Enum2<DeError, InterpError>>
pub fn set_caret<Opts>( &self, widget: Widget<Inst>, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkCaretOpt> + IntoHomoTuple<OptPair>,
pub fn inactive(&self) -> InterpResult<c_longlong>
pub fn inactive_reset(&self) -> InterpResult<c_longlong>
pub fn fontchooser_configure<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkFontChooserOpt> + IntoHomoTuple<OptPair>,
pub fn fontchooser_show(&self) -> InterpResult<()>
pub fn fontchooser_hide(&self) -> InterpResult<()>
pub fn scaling(&self) -> InterpResult<c_double>
pub fn set_scaling(&self, number: c_double) -> InterpResult<()>
pub fn has_used_input_methods(&self) -> InterpResult<bool>
pub fn use_input_methods(&self, should_use: bool) -> InterpResult<()>
pub fn windowing_system( &self ) -> Result<TkWindowingSystem, Enum2<DeError, InterpError>>
pub fn choose_color<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<String>where Opts: IntoHomoTuple<TkChooseColorOpt> + IntoHomoTuple<OptPair>,
pub fn choose_directory<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<PathBuf>where Opts: IntoHomoTuple<TkChooseDirectoryOpt> + IntoHomoTuple<OptPair>,
pub fn focus_next(&self, widget: Widget<Inst>) -> InterpResult<Widget<Inst>>
pub fn focus_prev(&self, widget: Widget<Inst>) -> InterpResult<Widget<Inst>>
pub fn focus_follows_mouse(&self) -> InterpResult<()>
pub fn get_open_file<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<Option<PathBuf>>where Opts: IntoHomoTuple<TkGetOpenFileOpt> + IntoHomoTuple<OptPair>,
pub fn get_save_file<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<Option<PathBuf>>where Opts: IntoHomoTuple<TkGetOpenFileOpt> + IntoHomoTuple<OptPair>,
pub fn message_box<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<String>where Opts: IntoHomoTuple<TkMessageBoxOpt> + IntoHomoTuple<OptPair>,
pub fn popup( &self, menu: TkMenu<Inst>, x: c_int, y: c_int, entry: Option<c_int> ) -> InterpResult<()>
pub fn set_palette_background( &self, background: impl Into<Obj> ) -> InterpResult<()>
pub fn set_palette<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkSetPaletteOpt> + IntoHomoTuple<OptPair>,
pub fn wait_variable(&self, name: &str) -> InterpResult<()>
pub fn wait_visibility(&self, widget: &Widget<Inst>) -> InterpResult<()>
pub fn wait_window(&self, widget: &Widget<Inst>) -> InterpResult<()>
sourcepub fn destroy<Widgets, Tag>(&self, widgets: Widgets) -> InterpResult<()>where
Widgets: IntoHomoTuple<Obj> + NonZeroLen<Tag>,
<Widgets as IntoHomoTuple<Obj>>::Output: Into<Obj>,
pub fn destroy<Widgets, Tag>(&self, widgets: Widgets) -> InterpResult<()>where Widgets: IntoHomoTuple<Obj> + NonZeroLen<Tag>, <Widgets as IntoHomoTuple<Obj>>::Output: Into<Obj>,
This command deletes the windows given by the window arguments, plus all of their descendants. If a window “.” is deleted then all windows will be destroyed and the application will (normally) exit. The windows are destroyed in order, and if an error occurs in destroying a window the command aborts without destroying the remaining windows. No error is returned if window does not exist.
Examples
use tcl::*;
use tk::*;
use tk::cmd::*;
let tk = make_tk!()?;
let root = tk.root();
root.add_widgets( -label( "lb" -text("Some label") ))?;
assert!( tk.winfo_exists( ".lb" )? );
tk.destroy(( ".lb", ))?;
assert!( !tk.winfo_exists( ".lb" )? );
let lb2 = root.add_label( "lb2" -text("Another label") )?;
assert!( tk.winfo_exists( ".lb2" )? );
tk.destroy(( lb2, ))?;
assert!( !tk.winfo_exists( ".lb2" )? );
pub fn grab_current(&self) -> InterpResult<Widget<Inst>>
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn option_add( &self, pattern: impl Into<Obj>, value: impl Into<Obj> ) -> InterpResult<()>
pub fn option_add_with_priority( &self, pattern: impl Into<Obj>, value: impl Into<Obj>, priority: impl Into<Obj> ) -> InterpResult<()>
pub fn option_clear(&self) -> InterpResult<()>
pub fn option_get( &self, window: impl Into<Obj>, name: impl Into<Obj>, class: impl Into<Obj> ) -> InterpResult<Obj>
pub fn option_readfile(&self, filename: impl AsRef<Path>) -> InterpResult<()>
pub fn option_readfile_with_priority( &self, filename: impl AsRef<Path>, priority: impl Into<Obj> ) -> InterpResult<()>
source§impl<TK: TkInstance> Tk<TK>
impl<TK: TkInstance> Tk<TK>
pub fn new_ttk_style( &self, name: &str, base_style: Option<TtkStyle<TK>> ) -> TtkStyle<TK>
pub fn element(&self, name: &str) -> TtkElement<TK>
pub fn element_create( &self, element_name: &str, type_: &str, args: Option<Obj> ) -> InterpResult<TtkElement<TK>>
pub fn element_names(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
pub fn theme_create<Opts>( &self, name_parent_settings: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<TtkTheme<TK>>where Opts: IntoHomoTuple<TkThemeCreateOpt> + IntoHomoTuple<OptPair>,
pub fn theme_names(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
pub fn theme_in_use(&self) -> InterpResult<TtkTheme<TK>>
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn bind( &self, tag: TkBindTag<'_, Inst>, sequence: impl Into<TkEventSeq>, script: impl Into<Obj> ) -> InterpResult<()>
pub fn bind_more( &self, tag: TkBindTag<'_, Inst>, sequence: impl Into<TkEventSeq>, script: impl Into<Obj> ) -> InterpResult<()>
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
sourcepub fn event_add(
&self,
virtual_event: TkEvent,
sequences: Vec<TkEventSeq>
) -> InterpResult<()>
pub fn event_add( &self, virtual_event: TkEvent, sequences: Vec<TkEventSeq> ) -> InterpResult<()>
Associates the virtual event virtual with the physical event sequence(s) given by the sequence arguments, so that the virtual event will trigger whenever any one of the sequences occurs. Virtual may be any string value and sequence may have any of the values allowed for the sequence argument to the bind command. If virtual is already defined, the new physical event sequences add to the existing sequences for the event.
sourcepub fn event_delete(
&self,
virtual_event: TkEvent,
sequences: Option<Vec<TkEventSeq>>
) -> InterpResult<()>
pub fn event_delete( &self, virtual_event: TkEvent, sequences: Option<Vec<TkEventSeq>> ) -> InterpResult<()>
Deletes each of the sequences from those associated with the virtual event given by virtual. Virtual may be any string value and sequence may have any of the values allowed for the sequence argument to the bind command. Any sequences not currently associated with virtual are ignored. If no sequence argument is provided, all physical event sequences are removed for virtual, so that the virtual event will not trigger anymore.
sourcepub fn event_info(&self) -> Result<Vec<TkEvent>, Enum2<InterpError, NotList>>
pub fn event_info(&self) -> Result<Vec<TkEvent>, Enum2<InterpError, NotList>>
Returns a list of all the virtual events that are currently defined.
sourcepub fn event_info_sequences_of(
&self,
virtual_event: TkEvent
) -> Result<Vec<TkEventSeq>, Enum2<InterpError, NotList>>
pub fn event_info_sequences_of( &self, virtual_event: TkEvent ) -> Result<Vec<TkEventSeq>, Enum2<InterpError, NotList>>
Returns a list whose elements are the physical event sequences currently defined for the given virtual event; if the virtual event is not defined then an empty string is returned.
Note that virtual events that are not bound to physical event sequences are not returned.
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn image_create_bitmap<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<Bitmap<Inst>>where Opts: IntoHomoTuple<TkBitmapOpt> + IntoHomoTuple<OptPair>,
pub fn image_create_photo<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<Photo<Inst>>where Opts: IntoHomoTuple<TkPhotoOpt> + IntoHomoTuple<OptPair>,
pub fn image_delete(&self, image: Obj) -> InterpResult<()>
pub fn image_names(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
pub fn image_types(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
pub fn winfo_atom(&self, name: &str) -> InterpResult<c_longlong>
pub fn winfo_atomname(&self, id: c_longlong) -> InterpResult<String>
pub fn winfo_containing( &self, root_x: c_int, root_y: c_int ) -> InterpResult<String>
pub fn winfo_exists(&self, name: &str) -> InterpResult<bool>
sourcepub fn winfo_interps(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
pub fn winfo_interps(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
Returns a list whose members are the names of all Tcl interpreters (e.g. all Tk-based applications) currently registered for the main window.
pub fn winfo_pathname(&self, id: c_ulong) -> InterpResult<String>
source§impl<Inst: TkInstance> Tk<Inst>
impl<Inst: TkInstance> Tk<Inst>
sourcepub fn font_actual<'a, Opt, Opts>(
&self,
font: Font<'a, Opts>,
_option: Opt,
ch: Option<char>
) -> InterpResult<Obj>where
Opt: TkOption + Into<TkFontOpt>,
Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_actual<'a, Opt, Opts>( &self, font: Font<'a, Opts>, _option: Opt, ch: Option<char> ) -> InterpResult<Obj>where Opt: TkOption + Into<TkFontOpt>, Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
Returns the value of the actual attribute that are obtained when font is used on the main window’s display; the actual attribute obtained may differ from the attribute requested due to platform-dependent limitations, such as the availability of font families and point sizes. If the char argument is supplied, the font attribute returned will be those of the specific font used to render that character, which will be different from the base font if the base font does not contain the given character.
sourcepub fn font_actual_get_all<'a, Opts>(
&self,
font: Font<'a, Opts>
) -> InterpResult<Obj>where
Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_actual_get_all<'a, Opts>( &self, font: Font<'a, Opts> ) -> InterpResult<Obj>where Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
Returns a list of all the atual attributes and their values that are obtained when font is used on the main window’s display; the actual attributes obtained may differ from the attributes requested due to platform-dependent limitations, such as the availability of font families and point sizes. If the char argument is supplied, the font attributes returned will be those of the specific font used to render that character, which will be different from the base font if the base font does not contain the given character.
pub fn font_configure<Opts>( &self, fontname: &str, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<()>where Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_configure_get<Opt>( &self, fontname: &str, _opt: Opt ) -> InterpResult<Obj>where Opt: TkOption + Into<TkFontOpt>,
pub fn font_configure_get_all( &self, fontname: &str ) -> Result<Vec<OptPair>, Enum3<InterpError, NotList, NotSeqOf<OptPair>>>
pub fn font_create<Opts>( &self, fontname: &str, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<Obj>where Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_create_with_auto_name<Opts>( &self, opts: impl Into<PathOptsWidgets<Opts, ()>> ) -> InterpResult<Obj>where Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_delete(&self, names: &[Obj]) -> InterpResult<()>
pub fn font_families(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
pub fn font_measure<'a, Opts>( &self, font: Font<'a, Opts>, text: impl Into<String> ) -> InterpResult<c_longlong>where Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_metrics<'a, Opt, Opts>( &self, font: Font<'a, Opts>, _opt: Opt ) -> InterpResult<Obj>where Opt: TkOption + Into<TkFontOpt>, Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
pub fn font_metrics_get_all<'a, Opts>( &self, font: Font<'a, Opts> ) -> Result<Vec<OptPair>, Enum3<InterpError, NotList, NotSeqOf<OptPair>>>where Opts: IntoHomoTuple<TkFontOpt> + IntoHomoTuple<OptPair>,
sourcepub fn font_names(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
pub fn font_names(&self) -> Result<Vec<String>, Enum2<InterpError, NotList>>
The return value is a list of all the named fonts that are currently defined.
Examples
use tcl::*;
use tk::*;
use tk::cmd::*;
let tk = make_tk!()?;
let font_names = tk.font_names().unwrap();
assert!( font_names.len() > 0 );
source§impl<Inst> Tk<Inst>where
Inst: 'static + Copy + Clone,
impl<Inst> Tk<Inst>where Inst: 'static + Copy + Clone,
sourcepub fn new(
inst: Inst
) -> Result<Tk<Inst>, Enum3<InterpError, NullInterp, TclInitError>>
pub fn new( inst: Inst ) -> Result<Tk<Inst>, Enum3<InterpError, NullInterp, TclInitError>>
Creates a new instance of Tk.
The recommended invocation is Tk::new(||{}).
Note: the inst is assigned at COMPILE TIME.
If your program needs multiple tk instances, make sure they can be assigned different inst at compile time.