gpt4 book ai didi

python - PyQt 相当于 tkinter 的 Canvas 是什么?

转载 作者:太空宇宙 更新时间:2023-11-03 11:25:39 24 4
gpt4 key购买 nike

我最近决定尝试从 tkinter 切换到 PyQt,但我无法弄清楚如何使用 tkinter 做我能做的事情 的 Canvas 小部件。

谷歌搜索后,它似乎是 QPainterQPixMap 或它们的某种组合。 Qt 中似乎也有一个名为 canvas 的东西,但我认为这不是我要找的东西。

谁能解释一下我应该使用什么在屏幕上绘制线条和形状,并为我提供有关如何使用它的好教程?

谢谢

最佳答案

我想你在这里需要的是QPainter类,引用自 PyQt Sourceforge 文档:

The QPainter class performs low-level painting on widgets and other paint devices.

QPainter provides highly optimized functions to do most of the drawing GUI programs require. It can draw everything from simple lines to complex shapes like pies and chords. It can also draw aligned text and pixmaps. Normally, it draws in a "natural" coordinate system, but it can also do view and world transformation. QPainter can operate on any object that inherits the QPaintDevice class.

关于python - PyQt 相当于 tkinter 的 Canvas 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34519639/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com