简体   繁体   中英

Tkinter ~ Is Drawing a Canvas to GUI possible using .grid()?

在此处输入图像描述

Is it possible to draw lines such as the following with the Tkinter .grid() system? Every tutorial that talks about canvas drawing uses .pack() exclusively.

There are no answers for using canvas with .grid() when you search online.

I have tried using canvas with .grid() but my GUI got completely messed up and no lines were drawn.

Is it actually possible to use canvas with .grid() ?

You use neither grid nor pack for drawing items on a canvas. The canvas has the following methods for drawing:

  • create_arc
  • create_bitmap
  • create_image
  • create_line
  • create_oval
  • create_polygon
  • create_rectangle
  • create_text
  • create_window

If you're not actually asking about drawing figures on canvas, but on adding the canvas to a window with pack or grid , you can use either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM