C# 如何在Python winforms字体中使用自定义构造函数?
我正在使用pythonnet在python上尝试简单的winform应用程序。 但我不能把这件事做对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 =
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中不支持隐式转换