@@ -567,10 +567,10 @@ BaseWidget
567
567
.. method :: getdouble(s)
568
568
.. method :: getboolean(s)
569
569
570
- Convert a :class: `_tkinter.Tcl_Obj ` or a Tcl string
571
- representation to the corresponding Python type;
572
- also accepts a compatible Python type in which case
573
- it is a no-op. Raises :class: `ValueError ` if the conversion fails.
570
+ Convert a :class: `_tkinter.Tcl_Obj `, a Tcl string
571
+ representation or a compatible Python type
572
+ to the corresponding Python type.
573
+ Raises :class: `ValueError ` if the conversion fails.
574
574
575
575
?Internal, deprecated (it's unused by other code)? The corresponding
576
576
:class: `_tkinter.tkapp ` methods should be used instead.
@@ -611,7 +611,73 @@ BaseWidget
611
611
Return ``None `` instead of empty string if there's no result.
612
612
613
613
614
- .. method :: after(ms, func)
614
+ .. method :: after(ms, func=None, *args)
615
+ .. method :: after_idle(func, *args)
616
+ .. method :: after_cancel(id)
617
+ .. method :: bell(displayof=0)
618
+ .. method :: clipboard_get(**kw)
619
+ .. method :: clipboard_clear(**kw)
620
+ .. method :: clipboard_append(string, **kw)
621
+ .. method :: grab_current(self)
622
+ .. method :: grab_release(self)
623
+ .. method :: grab_set(self)
624
+ .. method :: grab_set_global(self)
625
+ .. method :: grab_status(self)
626
+ .. method :: option_add(pattern, value, priority = None)
627
+ .. method :: option_clear(self)
628
+ .. method :: option_get(name, className)
629
+ .. method :: option_readfile(fileName, priority = None)
630
+ .. method :: selection_clear(**kw)
631
+ .. method :: selection_get(**kw)
632
+ .. method :: selection_handle(command, **kw)
633
+ .. method :: selection_own(**kw)
634
+ .. method :: selection_own_get(**kw)
635
+ .. method :: send(interp, cmd, *args)
636
+ .. method :: lower(belowThis=None)
637
+ .. method :: tkraise(aboveThis=None)
638
+ .. method :: lift(aboveThis=None)
639
+ .. method :: winfo_atom(name, displayof=0)
640
+ .. method :: winfo_atomname(id, displayof=0)
641
+ .. method :: winfo_cells()
642
+ .. method :: winfo_children()
643
+ .. method :: winfo_class()
644
+ .. method :: w
10000
info_colormapfull()
645
+ .. method :: winfo_containing(rootX, rootY, displayof=0)
646
+ .. method :: winfo_depth()
647
+ .. method :: winfo_exists()
648
+ .. method :: winfo_fpixels(number)
649
+ .. method :: winfo_geometry()
650
+ .. method :: winfo_height()
651
+ .. method :: winfo_id()
652
+ .. method :: winfo_interps(displayof=0)
653
+ .. method :: winfo_ismapped()
654
+ .. method :: winfo_manager()
655
+ .. method :: winfo_name()
656
+ .. method :: winfo_parent()
657
+ .. method :: winfo_pathname(id, displayof=0)
658
+ .. method :: winfo_pixels(number)
659
+ .. method :: winfo_pointerx()
660
+ .. method :: winfo_pointerxy()
661
+ .. method :: winfo_pointery()
662
+ .. method :: winfo_reqheight()
663
+ .. method :: winfo_reqwidth()
664
+ .. method :: winfo_rgb(color)
665
+ .. method :: winfo_rootx()
666
+ .. method :: winfo_rooty()
667
+ .. method :: winfo_screen()
668
+ .. method :: winfo_screencells()
669
+ .. method :: winfo_screendepth()
670
+ .. method :: winfo_screenheight()
671
+ .. method :: winfo_screenmmheight()
672
+
673
+ See `winfo <https://www.tcl.tk/man/tcl8.6/TkCmd/winfo.htm >`_.
674
+ The below only lists Tkinter-specific semantics.
675
+
676
+ * :meth: `winfo_atom ` returns an integer instead of a string.
677
+ * :meth: `winfo_atom ` None
678
+
679
+
680
+
615
681
616
682
Pack
617
683
Place
@@ -730,9 +796,32 @@ Common semantics
730
796
Python-Tcl type conversion
731
797
^^^^^^^^^^^^^^^^^^^^^^^^^^
732
798
733
- All Tkinter calls that map to Tcl commands convert
734
- their arguments from Python types to corresponding Tcl types,
735
- and convert the result back.
799
+ In Tcl, on script level, `everything is a string <https://wiki.tcl.tk/3018 >`_
800
+ and internally represented as a `Tcl_Obj <https://www.tcl.tk/man/tcl8.6/TclLib/Object.htm >`_.
801
+ Due to this, every discernible Tcl value has a string representation.
802
+ If a Tcl command expects a different type (even a compound one)
803
+
804
+ However, on C API level, a ``Tcl_Obj `` can be initialized directly from
805
+ all sorts of different C types, and Tkinter uses this when passing Python
806
+ objects to Tcl calls -- to avoid any inaccuracies
807
+ (e.g. when passing floating-point numbers)
808
+ and discrepancies between :func: `str ` and Tcl string representations.
809
+
810
+ :class: `bool `, :class: `str `, :class: `bytes ` and :class: `float ` are
811
+ converted by the corresponding `Tcl_New*Obj <https://www.tcl.tk/man/tcl8.6/TclLib/contents.htm >`_.
812
+ For integer, different APIs are tried until one can accomodate the value.
813
+ Lists and tuples are `converted <https://www.tcl.tk/man/tcl8.6/TclLib/ListObj.htm >`_
814
+ to a Tcl `list <https://www.tcl.tk/man/tcl8.6/TclCmd/list.htm >`_.
815
+ :class: `str`s with wide Unicode characters would produce a :class:`TclError ` if
816
+ the Tcl build doesn't support them. A :class: `_tkinter.Tcl_Obj ` gives the
817
+ wrapped object, naturally.
818
+
819
+ For other objects, their :func: `str ` is processed.
820
+
821
+ For the return value, the reverse conversion is done.
822
+ `Tcl_Obj->typePtr <https://www.tcl.tk/man/tcl/TclLib/Object.htm#M6> `
823
+ is used to detemine the type, so e.g. if a command is declared to return
824
+ 0 or 1, it will not be converted to ``bool ``.
736
825
737
826
738
827
0 commit comments