Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

newbie question: what diff. between Debug>Run without debugger (Ctrl+F5) and Python>Run without debugger (Ctrl+Shift+W)

$
0
0

hi..

i am new in ironpython. specialy using with sharpdevelop.

I am creating simple windows apps. using python and .NET framework 4.0.

after windows form created, i just want run test. using Debug>Run without debugger (Ctrl+F5), and it seem ok, no error. and I can see the windows form.

but when i want run using Python>Run without debugger (Ctrl+Shift+W) ..i got error msg. 'No module named Drawing' .

so.. what diff. between Debug>Run without debugger (Ctrl+F5) and Python>Run without debugger (Ctrl+Shift+W)?

 

after i read ironpython book, i found something i need add some code.

here default code from sharpdevelop python:

import System.Drawing
import System.Windows.Forms

from System.Drawing import *
from System.Windows.Forms import *

class MainForm(Form):
    def __init__(self):
        self.InitializeComponent()
    
    def InitializeComponent(self):
        
        # MainForm
        
        self.Name = "MainForm"
        self.Text = "dee"

 

and here.. added some line code:

import sys
import clr

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

import System.Drawing
import System.Windows.Forms

from System.Drawing import *
from System.Windows.Forms import *

class MainForm(Form):
    def __init__(self):
        self.InitializeComponent()
    
    def InitializeComponent(self):
        
        # MainForm
        
        self.Name = "MainForm"
        self.Text = "dee"

test=MainForm()
Application.Run(test)

 

with this source code..i can run both ..Debug>Run without debugger (Ctrl+F5) and Python>Run without debugger (Ctrl+Shift+W)..

but I have new problem. at Design Tab, I cant see or add/edit visual design, got error msg:

"" Failed to load designer. Check the source code for syntax errors and check if all references are available.

ICSharpCode.FormsDesigner.FormsDesignerLoadException: ICSharpCode.PythonBinding.PythonComponentWalkerException: Could not find type ''. Are you missing an assembly reference?
   at ICSharpCode.PythonBinding.PythonComponentWalker.ThrowCouldNotFindTypeException(MemberExpression memberExpression)
   at ICSharpCode.PythonBinding.PythonComponentWalker.Walk(AssignmentStatement node)
   at IronPython.Compiler.Ast.AssignmentStatement.Walk(PythonWalker walker)
   at IronPython.Compiler.Ast.SuiteStatement.Walk(PythonWalker walker)
   at IronPython.Compiler.Ast.PythonAst.Walk(PythonWalker walker)
   at ICSharpCode.PythonBinding.PythonComponentWalker.CreateComponent(String pythonCode)
   at ICSharpCode.Scripting.ScriptingDesignerLoader.CreateComponents()
   at ICSharpCode.Scripting.ScriptingDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
   at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)


   at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadDesigner()
   at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadAndDisplayDesigner()
   at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadInternal(OpenedFile file, Stream stream)
   at ICSharpCode.SharpDevelop.Gui.AbstractViewContentHandlingLoadErrors.Load(OpenedFile file, Stream stream) ""

 

but the interesting here is, if I turn off the ' test=MainForm() ' line ...i can see or edit the design tab..

so what happen here? how to make this work both at code and design tab.?

 

thanks.

prie.

 

 


Viewing all articles
Browse latest Browse all 1764

Trending Articles