白草遥遥 2022-05-13 18:05 采纳率: 100%
浏览 86
已结题

manim无法绘制正方形

问题遇到的现象和发生背景

刚安装好manim,全程按照https://docs.manim.org.cn/安装,然后试了一下官方文档的入门教程的代码,结果一试就出问题了

问题相关代码
from manimlib import *

class SquareToCircle(Scene):
    def construct(self):
        square= Square()
        square.set_fill(RED)
        square.rotate(PI / 4)
        self.add(square)
运行结果

运行结果就是那个方形一直不显示,但是我画圆形的时候是没有问题的,也是add(cirle)
全程的提示信息:

[18:11:00] INFO     Using the default configuration file, which you can modify in `c:\users\cbice\manim\manimlib\default_config.yml`             config.py:316           
INFO     If you want to create a local configuration file, you can create a file named `custom_config.yml`, or run `manimgl --config` config.py:317           
WARNING  You may be using Windows platform and have not specified the path of `temporary_storage`, which may cause OSError. So it is  config.py:283                    recommended to specify the `temporary_storage` in the config file (.yml)
INFO     Tips: You are now in the interactive mode. Now you can use the keyboard and the mouse to interact with the scene. Just press  scene.py:141                    `command + q` or `esc` if you want to quit.

(process:18884): GLib-GIO-WARNING **: 18:11:01.083: Unexpectedly, UWP app `DellInc.DellSupportAssistforPCs_3.10.7.0_x64__htrsf667h5kn2' (AUMId `DellInc.DellSupportAssistforPCs_htrsf667h5kn2!App') supports 1 extensions but has no verbs

(process:20448): GLib-GIO-WARNING **: 18:11:02.867: Unexpectedly, UWP app `DellInc.DellSupportAssistforPCs_3.10.7.0_x64__htrsf667h5kn2' (AUMId `DellInc.DellSupportAssistforPCs_htrsf667h5kn2!App') supports 1 extensions but has no verbs

我的写法和文档里的一模一样,但是就是运行不了。求解答T-T

  • 写回答

2条回答 默认 最新

  • hyh123a 全栈领域新星创作者 2022-05-13 18:39
    关注

    Python版本是多少

    不知道你的代码具体是什么

    我这边操作了下:

    from manimlib import *
    
    class SquareToCircle(Scene):
        def construct(self):
    
            circle = Circle()
            circle.set_fill(BLUE, opacity=0.5)
            circle.set_stroke(BLUE_E, width=4)
            square = Square()
            square.set_fill(RED)
            square.rotate(PI / 4)
            self.add(square)
            self.play(ShowCreation(square))
            self.wait()
            self.play(ReplacementTransform(square, square))
            self.wait()
    

    正常的输出了一个旋转45度的正方形
    你看下你是否忘记修改这行代码为

    self.play(ReplacementTransform(square, square))
    

    demo里面是

    self.play(ReplacementTransform(square, circle))
    你如果画正方形的话自己把这个换一下。
    上面是我测试的代码
    
    你可以试下是否正常。
    
    ---
    如有问题及时沟通
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 5月26日
  • 已采纳回答 5月18日
  • 修改了问题 5月13日
  • 修改了问题 5月13日
  • 展开全部

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题