Closed
Description
Environment
- Pythonnet version: 2.3.0
- Python version: 3.4 64-bit
- Operating System: Ubuntu 14.04
Details
- I tried to run test program and got following:
GetPreferredSize
Traceback (most recent call last):
File "t.py", line 29, in
main()
File "t.py", line 24, in main
form = StatusWindow()
File "t.py", line 19, in init
self.Controls.Add(_StagesGroup())
NameError: name 'xyz' is not defined
As we see, function GetPrefferedSize() got called. But stack traceback shows error in line 19 that is wrong. Bacause error is in line 14.
- What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
python3 t.py
import clr, sys
import System.Windows.Forms as WinForms
import System.Drawing as Drawing
class _StagesGroup(WinForms.GroupBox):
__namespace__ = "System.Windows.Forms"
def __init__(self):
self.Text = "Stages"
self.AutoSize = True
def GetPreferredSize(self, proposedSize):
print ("GetPreferredSize")
retsz = WinForms.GroupBox.GetPreferredSize(self, proposedSize)
print("GetPreferredSize",xyz)
return retsz
class StatusWindow(WinForms.Form):
def __init__(self):
self.Controls.Add(_StagesGroup())
def run(self):
WinForms.Application.Run(self)
def main():
form = StatusWindow()
app = WinForms.Application
app.Run(form)
if __name__ == '__main__':
main()
So why the error place is incorrect in traceback?
Metadata
Metadata
Assignees
Labels
No labels