如何为多个对象设置相同的参数/选项?
我开始学习如何使用Manin并发现以下问题。
假设我希望我的视频中使用font =“ Calibri”
和font_size = 72
。
然后,我必须编写以下代码:
Text("Text 1",font="Calibri",font_size=72)
之后,如果我想再次使用相同的文本样式,我必须再次编写函数的参数/选项text()
:
Text("Text 2",font="Calibri",font_size=72)
所以我的问题是,是否可以使用text()
的参数/选项定义变量,以便我每次都要复制和粘贴它们?
像这样的事情:
options={font="Calibri",font_size=72}
Text("Text 1",options)
Text("Text 2",options)
这简直就是事情。
I started to learn how to use manin and found the following problem.
Suppose that I want the text in my video with font="Calibri"
and font_size=72
.
Then I have to write the following code:
Text("Text 1",font="Calibri",font_size=72)
After that, if I want to use the same style of text again, I have to write again the parameters/options of the function Text()
:
Text("Text 2",font="Calibri",font_size=72)
So my question is, is it possible to define a variable with the parameters/options for Text()
so I won't have to copy and paste them every time?
Something like this:
options={font="Calibri",font_size=72}
Text("Text 1",options)
Text("Text 2",options)
that would simply things.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我弄清楚了!我只需要
def
一个函数:然后witte
“ text 1”
and“ text 2”
与相同的形式我只使用代码I figured it out! I just have to
def
a function:Then to writte
"Text 1"
and"Text 2"
with the same formate I just use the code