Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Python winforms字体中使用自定义构造函数?_C#_Python_Winforms_Python.net - Fatal编程技术网

C# 如何在Python winforms字体中使用自定义构造函数?

C# 如何在Python winforms字体中使用自定义构造函数?,c#,python,winforms,python.net,C#,Python,Winforms,Python.net,我正在使用pythonnet在python上尝试简单的winform应用程序。 但我不能把这件事做对 import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System.Drawing") from System.Windows.Forms import Application, Form, Label from System.Drawing import Size, Point, Font text =

我正在使用pythonnet在python上尝试简单的winform应用程序。 但我不能把这件事做对

import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")

from System.Windows.Forms import Application, Form, Label
from System.Drawing import Size, Point, Font


text = """some large text"""


class IForm(Form):

    def __init__(self):

        self.Text = "You know I'm No Good"

        font = Font("Serif", 10)

        lyrics = Label()
        lyrics.Parent = self
        lyrics.Text = text
        lyrics.Font = font
        lyrics.Location = Point(10, 10)
        lyrics.Size = Size(290, 290)

        self.CenterToScreen()


Application.Run(IForm())
字体=字体(“衬线”,10)

TypeError:没有与给定参数匹配的构造函数

是否需要任何特殊规定?

尝试
字体(“Serif”,10.0)
-接受浮点数,但不接受整数。pythonnet中不支持隐式转换