DevExpress.v17.1 라이브러리에서 XtraForm을 확장하는 C#에서 만든 양식의 사용자 지정 생성자에 문제가 있습니다.pythonnet을 사용하여 사용자 지정 폼의 생성자
protected BaseForm()
{
InitializeComponent();
}
및
protected BaseForm(IClient client)
{
InitializeComponent();
... many code
}
IClient 인터페이스는
: 그것은 두 개의 생성자가 있습니다. 이 양식에는 많은 종속성이 있으며 모든 종속성이 라이브러리에 컴파일됩니다. 나는이 양식을 확장하고 코드 인스턴스를 만들려고 할 때 는 :class TestApp(BaseForm):
def __init__(self):
self.Text = "Hello World From Python"
self.components = System.ComponentModel.Container()
self.AutoScaleBaseSize = Size(5, 13)
self.ClientSize = Size(392, 117)
h = WinForms.SystemInformation.CaptionHeight
self.MinimumSize = Size(392, (117 + h))
# Create the button
self.button = WinForms.Button()
self.button.Location = Point(160, 64)
self.button.Size = Size(150, 20)
self.button.TabIndex = 2
self.button.Text = "Click Me!"
# Register the event handler
self.button.Click += self.button_Click
# Create the text box
self.textbox = WinForms.TextBox()
self.textbox.Text = "Hello World"
self.textbox.TabIndex = 1
self.textbox.Size = Size(126, 40)
self.textbox.Location = Point(160, 24)
# Add the controls to the form
self.AcceptButton = self.button
self.Controls.Add(self.button)
self.Controls.Add(self.textbox)
def button_Click(self, sender, args):
"""Button click event handler"""
print ("Click")
WinForms.MessageBox.Show("Please do not press this button again.")
def run(self):
WinForms.Application.Run(self)
def Dispose(self):
self.components.Dispose()
WinForms.Form.Dispose(self)
실행 초기화 코드 :
Traceback (most recent call last):
File "C:/Users/v.khvorostianyi/PycharmProjects/CSharp/Test.py", line 141, in <module>
main()
File "C:/Users/v.khvorostianyi/PycharmProjects/CSharp/Test.py", line 85, in main
form = TestApp()
TypeError: no constructor matches given arguments
파이썬 = 3.6.2 :
def main():
form = TestApp()
form.run()
form.Dispose()
if __name__ == '__main__':
main()
나는 오류가 , pythonnet = 2.3.0
. NET = 4.6.1
Pro 자동화 된 테스트가 필요합니다.이 양식은 업무 프로세스에 필요합니다. 왜 그런 오류가 있습니까?
파이썬에서 TestApp 클래스 (BaseForm) MEEN. 도와 주셔서 감사합니다. –