Text in a canvas

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • v2rocketboy
    New Member
    • Apr 2010
    • 5

    Text in a canvas

    Hi i was wondering, is it possible to display text in a widget? i need to print a grid with a whole lot of numbers on a display and i was wondering if i can print such a thing in a canvas?
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Yes. From Tkinter Reference, New Mexico Tech Computer Center:
    "You can place any Tkinter widget onto a canvas by using a canvas window object. A window is a rectangular area that can hold one Tkinter widget. The widget must be the child of the same top-level window as the canvas, or the child of some widget located in the same top-level window."

    To place multiple widgets in one canvas window object, add a Frame to the canvas window and add the widgets to the Frame.

    Adding the canvas window:
    Code:
    id = C.create_window ( x, y, option, ... )

    Comment

    • v2rocketboy
      New Member
      • Apr 2010
      • 5

      #3
      sorry i pressed post by mistake reply is below

      Comment

      • v2rocketboy
        New Member
        • Apr 2010
        • 5

        #4
        Ive put in that code im just not sure how to add a widget to the window, it has to be text.
        frm.window = frm.board.creat e_window ( 0, 500)

        any query, is it also possible to track the location of the widget in x,y coordinates? By this i mean with the mouse hovering it could give me perhaps the location of it

        Comment

        Working...