rstk 0.3.0

A Rust binding for the Tk graphics toolkit. Tk is suitable for creating simple GUI programs or interactive graphical displays. This library supports a large portion of the Tk API, in a generally rust-like style.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
//! Functions and definitions applying to all widgets or specific sub-classes
//! of widgets.
//!

use std::fmt;

use super::canvas;
use crate::chart::plotchart;
use super::font;
use super::image;
use super::wish;

/// Struct holding information from a bound event,
/// returned as a parameter to the bound closure.
#[derive(Clone, Debug)]
pub struct TkEvent {
    /// x-coordinate relative to current widget
    pub x: i64,
    /// y-coordinate relative to current widget
    pub y: i64,
    /// x-coordinate relative to screen
    pub root_x: i64,
    /// y-coordinate relative to screen
    pub root_y: i64,
    /// vertical screen distance, e.g. for a drag event
    pub height: i64,
    /// horizontal screen distance, e.g. for a drag event
    pub width: i64,
    /// Numeric code representing key for current event
    pub key_code: u64,
    /// Symbol representing key for current event, e.g. "space", "e".
    pub key_symbol: String,
    /// Number of mouse button in current event: 1 for left, 3 for right, etc.
    pub mouse_button: u64,
}

/// Common trait for container widgets. Child widgets should implement the `id`
/// method. The remaining methods are standard Tk methods and convenient,
/// type-safe versions of them.
pub trait TkWidget {
    /// Returns the widget's id reference - used within tk
    fn id(&self) -> &str;

    /// Binds a command to this widget to call on given event pattern
    fn bind(&self, pattern: &str, command: impl Fn(TkEvent) + Send + 'static) {
        bind_to(&self.id(), pattern, command);
    }

    /// Retrieve the value of a configuration option
    /// as a string.
    ///
    /// * `option` - the option to read
    ///
    fn cget(&self, option: &str) -> String {
        let msg = format!("puts [{} cget -{}] ; flush stdout", self.id(), option);
        wish::ask_wish(&msg)
    }

    /// Used to change properties of a widget.
    /// This function can be used to directly configure
    /// the widget using an option-value string pair:
    ///
    /// * `option` - the option to change
    /// * `value` - the value to change it to
    ///
    fn configure(&self, option: &str, value: &str) {
        configure(&self.id(), option, value);
    }

    /// Destroys a widget and its children.
    fn destroy(&self) {
        let msg = format!("destroy {}", self.id());
        wish::tell_wish(&msg);
    }

    /// winfo retrieves information about widget.
    ///
    fn winfo(&self, option: &str) -> String {
        let msg = format!("winfo {} {}", option, self.id());
        wish::ask_wish(&msg)
    }

    // -- TODO should be here, or more specific?

    /// Makes this widget the focus window (e.g. for key presses)
    fn focus(&self) {
        let msg = format!("focus {}", self.id());
        wish::tell_wish(&msg);
    }

    // -- winfo functions

    /// Returns the widget x position in pixels, within its parent.
    fn position_x(&self) -> u64 {
        let msg = format!("winfo x {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Returns the widget y position in pixels, within its parent.
    fn position_y(&self) -> u64 {
        let msg = format!("winfo y {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Returns the widget height in pixels.
    fn widget_height(&self) -> u64 {
        let msg = format!("winfo height {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Returns the widget width in pixels.
    fn widget_width(&self) -> u64 {
        let msg = format!("winfo width {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Returns the position of the mouse on screen of widget as (x,y).
    fn mouse_position(&self) -> (i64, i64) {
        (self.mouse_x(), self.mouse_y())
    }

    /// Gives the x position of the mouse on screen of widget.
    fn mouse_x(&self) -> i64 {
        let msg = format!("winfo pointerx {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<i64>() {
            value
        } else {
            -1
        }
    }

    /// Gives the y position of the mouse on screen of widget.
    fn mouse_y(&self) -> i64 {
        let msg = format!("winfo pointery {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<i64>() {
            value
        } else {
            -1
        }
    }

    /// Height of screen of widget in pixels.
    fn screen_height(&self) -> u64 {
        let msg = format!("winfo screenheight {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Height of screen of widget in millimetres.
    fn screen_height_mm(&self) -> u64 {
        let msg = format!("winfo screenmmheight {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Width of screen of widget in pixels.
    fn screen_width(&self) -> u64 {
        let msg = format!("winfo screenwidth {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    /// Width of screen of widget in millimetres.
    fn screen_width_mm(&self) -> u64 {
        let msg = format!("winfo screenmmwidth {}", self.id());
        let result = wish::ask_wish(&msg);
        if let Ok(value) = result.parse::<u64>() {
            value
        } else {
            0
        }
    }

    // -- stacking order

    /// Lowers the widget in stacking order.
    fn lower(&self) {
        let msg = format!("lower {}", self.id());
        wish::tell_wish(&msg);
    }

    /// Raises the widget in stacking order.
    fn raise(&self) {
        let msg = format!("raise {}", self.id());
        wish::tell_wish(&msg);
    }

    // -- for widgets that can contain other widgets

    /// Sets property for a given column of the grid layout
    /// contained within this widget.
    fn grid_configure_column(&self, index: u64, option: &str, value: &str) {
        let msg = format!(
            "grid columnconfigure {} {} -{} {{{}}}",
            self.id(),
            index,
            option,
            value
        );
        wish::tell_wish(&msg);
    }

    /// Sets property for a given row of the grid layout
    /// contained within this widget.
    fn grid_configure_row(&self, index: u64, option: &str, value: &str) {
        let msg = format!(
            "grid rowconfigure {} {} -{} {{{}}}",
            self.id(),
            index,
            option,
            value
        );
        wish::tell_wish(&msg);
    }
}

/// A set of common functions used in all label, button and similar widgets.
///
/// * also see the Tk [manual](https://tcl.tk/man/tcl/TkCmd/ttk_widget.htm#M6)
///
/// Colours are specified as strings, by either:
///
/// * `name` - using one of the values in the tk [colours](https://tcl.tk/man/tcl8.6/TkCmd/colors.htm) list
/// * `rgb` - as a 6-digit hexadecimal value in form "#RRGGBB"
///
pub trait TkLabelOptions: TkWidget {
    /// Sets how to arrange the image relative to the text.
    fn compound(&self, value: Compound) {
        configure(&self.id(), "compound", &value.to_string());
    }

    /// Sets the font to use for text.
    fn font(&self, definition: &font::TkFont) {
        configure(&self.id(), "font", &definition.to_string());
    }

    /// Sets the foreground (text) colour.
    fn foreground(&self, colour: &str) {
        configure(&self.id(), "foreground", colour);
    }

    /// Sets an image to display on the widget.
    fn image(&self, image: &image::TkImage) {
        configure(&self.id(), "image", &image.id);
    }

    /// Sets space around the widget. Takes an array of up to four values, 
    /// specifying the number of pixels on the different sides:
    ///
    /// * \[all]
    /// * [left-right top-bottom]
    /// * [left top-bottom right]
    /// * [left top right bottom]
    fn padding(&self, values: &[u64]) {
        padding(&self.id(), values);
    }

    /// Sets the text label for the widget.
    fn text(&self, value: &str) {
        configure(&self.id(), "text", value);
    }

    /// Underlines the character at the given index position.
    fn underline(&self, index: u64) {
        configure(&self.id(), "underline", &index.to_string());
    }

    /// Sets the width of the widget, in characters
    fn width(&self, value: i64) {
        let msg = format!("{} configure -width {{{}}}", self.id(), value);
        wish::tell_wish(&msg);
    }
}

// --------------------------------------------------------------------------
// Enums to type-check values

/// Defines position of a displayed item within some bounds.
#[derive(Clone, Debug, PartialEq)]
pub enum Anchor {
    N,
    NE,
    E,
    SE,
    S,
    SW,
    W,
    NW,
    Center,
    Centre,
}

impl fmt::Display for Anchor {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Anchor::N => "n",
            Anchor::NE => "ne",
            Anchor::E => "e",
            Anchor::SE => "se",
            Anchor::S => "s",
            Anchor::SW => "sw",
            Anchor::W => "w",
            Anchor::NW => "nw",
            Anchor::Center | Anchor::Centre => "center",
        };
        write!(f, "{}", &value)
    }
}

/// Arrangement of image relative to text in a
/// label-like widget.
///
/// So `Bottom` places the image below its text, etc.
///
#[derive(Clone, Debug, PartialEq)]
pub enum Compound {
    Bottom,
    Center,
    Centre,
    /// Show only the image
    Image,
    Left,
    /// Shows image if present, otherwise the text
    None,
    Right,
    /// Show only the text
    Text,
    Top,
}

impl fmt::Display for Compound {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Compound::Bottom => "bottom",
            Compound::Center | Compound::Centre => "center",
            Compound::Image => "image",
            Compound::Left => "left",
            Compound::None => "none",
            Compound::Right => "right",
            Compound::Text => "text",
            Compound::Top => "top",
        };
        write!(f, "{}", &value)
    }
}

/// Type of message-box dialog.
#[derive(Clone, Debug, PartialEq)]
pub enum DialogType {
    AbortRetryIgnore,
    Ok,
    OkCancel,
    RetryCancel,
    YesNo,
    YesNoCancel,
}

impl fmt::Display for DialogType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            DialogType::AbortRetryIgnore => "abortretryignore",
            DialogType::Ok => "ok",
            DialogType::OkCancel => "okcancel",
            DialogType::RetryCancel => "retrycancel",
            DialogType::YesNo => "yesno",
            DialogType::YesNoCancel => "yesnocancel",
        };
        write!(f, "{}", &value)
    }
}

/// Type of icon to use in message-box dialog.
#[derive(Clone, Debug, PartialEq)]
pub enum IconImage {
    Error,
    Information,
    Question,
    Warning,
}

impl fmt::Display for IconImage {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            IconImage::Error => "error",
            IconImage::Information => "info",
            IconImage::Question => "question",
            IconImage::Warning => "warning",
        };
        write!(f, "{}", &value)
    }
}

/// Arrangement of text
#[derive(Clone, Debug, PartialEq)]
pub enum Justify {
    Center,
    Centre,
    Left,
    Right,
}

impl fmt::Display for Justify {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Justify::Left => "left",
            Justify::Center | Justify::Centre => "center",
            Justify::Right => "right",
        };
        write!(f, "{}", &value)
    }
}

/// Defines orientation of widget.
#[derive(Clone, Debug, PartialEq)]
pub enum Orientation {
    Horizontal,
    Vertical,
}

impl fmt::Display for Orientation {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Orientation::Horizontal => "horizontal",
            Orientation::Vertical => "vertical",
        };
        write!(f, "{}", &value)
    }
}

/// Defines fill property for pack layouts: whether 
/// to expand in the x or y or both directions.
#[derive(Clone, Debug, PartialEq)]
pub enum PackFill {
    Both,
    None,
    X,
    Y
}

impl fmt::Display for PackFill {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            PackFill::Both => "both",
            PackFill::None => "none",
            PackFill::X => "x",
            PackFill::Y => "y",
        };
        write!(f, "{}", &value)
    }
}

/// Defines side property for pack layouts: whether 
/// widget is packed against top, bottom, left or right.
#[derive(Clone, Debug, PartialEq)]
pub enum PackSide {
    Bottom,
    Left,
    Right,
    Top,
}

impl fmt::Display for PackSide {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            PackSide::Bottom => "bottom",
            PackSide::Left => "left",
            PackSide::Right => "right",
            PackSide::Top => "top",
        };
        write!(f, "{}", &value)
    }
}

/// Defines mode of progressbar.
#[derive(Clone, Debug, PartialEq)]
pub enum ProgressMode {
    Determinate,
    Indeterminate,
}

impl fmt::Display for ProgressMode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            ProgressMode::Determinate => "determinate",
            ProgressMode::Indeterminate => "indeterminate",
        };
        write!(f, "{}", &value)
    }
}

/// Defines shape of border around widget.
#[derive(Clone, Debug, PartialEq)]
pub enum Relief {
    Flat,
    Groove,
    Raised,
    Ridge,
    Solid,
    Sunken,
}

impl fmt::Display for Relief {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Relief::Flat => "flat",
            Relief::Groove => "groove",
            Relief::Raised => "raised",
            Relief::Ridge => "ridge",
            Relief::Solid => "solid",
            Relief::Sunken => "sunken",
        };
        write!(f, "{}", &value)
    }
}

/// Defines mode of selection.
///
/// Note: rstk diverges from the Tk terminology:
///
/// * 'Single' is equivalent to Tk's "browse"
/// * 'Multiple' is equivalent to Tk's "extended"
///
/// (Tk's "single" and "multiple" options are now rarely used (see
/// [manual](https://www.tcl-lang.org/man/tcl8.6/TkCmd/listbox.htm#M56)).)
///
#[derive(Clone, Debug, PartialEq)]
pub enum Selection {
    Multiple,
    Single,
    None,
}

impl fmt::Display for Selection {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Selection::Multiple => "extended",
            Selection::None => "none",
            Selection::Single => "browse",
        };
        write!(f, "{}", &value)
    }
}

/// Specifies which sides of its container a widget 'sticks' to,
/// especially when it is resized.
#[derive(Clone, Debug, PartialEq)]
pub enum Sticky {
    N,
    NE,
    NES,
    NEW,
    NESW,
    NS,
    NSW,
    NW,
    E,
    ES,
    ESW,
    EW,
    S,
    SW,
    W,
    None,
}

impl fmt::Display for Sticky {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Sticky::N => "n",
            Sticky::NE => "ne",
            Sticky::NES => "nes",
            Sticky::NEW => "new",
            Sticky::NESW => "nesw",
            Sticky::NS => "ns",
            Sticky::NSW => "nsw",
            Sticky::NW => "nw",
            Sticky::E => "e",
            Sticky::ES => "es",
            Sticky::EW => "ew",
            Sticky::ESW => "esw",
            Sticky::S => "s",
            Sticky::SW => "sw",
            Sticky::W => "w",
            Sticky::None => "",
        };
        write!(f, "{}", &value)
    }
}

/// The kinds of activity state for a widget, e.g. if it is currently
/// available to use or disabled.
#[derive(Clone, Debug, PartialEq)]
pub enum State {
    /// Used, e.g., for buttons, to highlight when a mouse pointer is over them.
    Active,
    /// Used to prevent user-interaction with a widget.
    Disabled,
    /// The usual state of a widget, permitting user interactions.
    Normal,
    /// State cannot be changed, for those widgets with editable state.
    Readonly,
}

impl fmt::Display for State {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            State::Active => "active",
            State::Disabled => "disabled",
            State::Normal => "normal",
            State::Readonly => "readonly",
        };
        write!(f, "{}", &value)
    }
}

/// Types of word wrapping.
#[derive(Clone, Debug, PartialEq)]
pub enum Wrapping {
    Char,
    None,
    Word,
}

impl fmt::Display for Wrapping {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let value = match self {
            Wrapping::Char => "char",
            Wrapping::None => "none",
            Wrapping::Word => "word",
        };
        write!(f, "{}", &value)
    }
}

// --------------------------------------------------------------------------
// Internal functions for within crate use

pub(super) fn bind_to(tag: &str, pattern: &str, command: impl Fn(TkEvent) + Send + 'static) {
    // tag+pattern used as identifier, as multiple commands can be bound to each entity
    let tag_pattern = format!("{}{}", tag, pattern); // TODO ? remove ':' ?
    wish::add_callback1_event(&tag_pattern, wish::mk_callback1_event(command));
    let msg = format!(
        "bind {} {} {{ puts cb1e:{}:%x:%y:%X:%Y:%h:%w:%k:%K:%b ; flush stdout }}",
        tag, pattern, tag_pattern
    );
    wish::tell_wish(&msg);
}

pub(super) fn configure(wid: &str, option: &str, value: &str) {
    let msg = format!("{} configure -{} {{{}}}", wid, option, value);
    wish::tell_wish(&msg);
}

pub(super) fn padding(wid: &str, values: &[u64]) {
    let mut value_str = String::new();
    for i in values.iter() {
        value_str.push_str(&i.to_string());
        value_str.push(' ');
    }
    configure(wid, "padding", &value_str);
}

pub(super) fn strings_list(values: &[&str]) -> String {
    let mut values_str = String::new();

    for value in values {
        values_str.push_str(&format!("{} ", value));
    }

    values_str
}

pub(super) fn str_list(values: &[f64]) -> String {
    let mut values_str = String::new();

    for value in values {
        values_str.push_str(&format!("{} ", value));
    }

    values_str
}

pub(super) fn str_list_lists<M: AsRef<[R]>, R: AsRef<[f64]>>(values: M) -> String {
    let mut values_str = String::new();

    for vs in values.as_ref() {
        values_str.push_str("{");
        values_str.push_str(&str_list(vs.as_ref()));
        values_str.push_str("} ");
    }

    values_str
}

// --------------------------------------------------------------------------

/// Triggers given command after 'time' milliseconds.
pub fn after(time: u64, command: impl Fn() + Send + 'static) {
    wish::next_wid(".");
    let name = format!("after{}", wish::current_id()); 
    wish::add_callback0(&name, wish::mk_callback0(command));
    let msg = format!("after {} {{ puts clicked-{} ; flush stdout }}",
                      time, name);
    wish::tell_wish(&msg);
}

/// Binds command for event pattern to _all_ widgets.
pub fn bind(pattern: &str, command: impl Fn(TkEvent) + Send + 'static) {
    bind_to("all", pattern, command);
}

/// Sets colour map (for xy_plots).
pub fn colour_map(map: plotchart::ColourMap) {
    let msg = format!("::Plotchart::colorMap {}", map);
    wish::tell_wish(&msg);
}

/// Copies contents of one or more plots onto another canvas widget.
pub fn plot_pack(canvas: &canvas::TkCanvas, 
                 direction: plotchart::PlotDirection,
                 charts: &[&impl plotchart::TkPlotchart]) {
    let mut charts_str = String::new();
    for chart in charts {
        charts_str.push_str(&format!("${} ", chart.id()));
    }

    let msg = format!("::Plotchart::plotpack {} {} {}",
                      &canvas.id, direction, charts_str);
    wish::tell_wish(&msg);
}

/// Checks what the current OS system is: see
/// Tk [manual](https://www.tcl-lang.org/man/tcl8.6/TkCmd/tk.htm#M12).
///
/// Returns one of x11, win32, aqua
pub fn windowing_system() -> String {
    wish::ask_wish("tk windowingsystem")
}