How can I create an event in the IronPython?

May 22, 2010 at 3:51 PM
Edited May 22, 2010 at 3:54 PM
I want to add a click event to the Button in the IronPython. Partial code is:

import clr
clr.AddReference("System","System.Windows")

import System
from System.Windows.Controls import *

def SetCanvas(canvas):
    btnMoveX = Button()
    btnMoveX.Content = "Move X Steps"
    btnMoveX.Height = 45
    btnMoveX.Width = 150
    canvas.Children.Add(btnMoveX)
    btnMoveX.Click += btnMoveX_Click

There is anyone to tell me how can I create a click event in my code?

Thanks,
-zeyoo
May 22, 2010 at 7:15 PM
Zeyoo,

That will work as long as you have a method defined for the handler:

def btnMoveX_Click(sender, eventArgs):
# do something ...

~Jimmy

On May 22, 2010, at 10:51 AM, "zeyoo" <notifications@codeplex.com> wrote:

From: zeyoo

I want to add a click event to the Button in the IronPython. Partial code is:

import clr
clr.AddReference("System","System.Windows")
import System
from System.Windows.Controls import *
def SetCanvas(canvas):
btnMoveX = Button()
btnMoveX.Content = "Move X Steps"
btnMoveX.Height = 45
btnMoveX.Width = 150
canvas.Children.Add(btnMoveX)
<font color="red">btnMoveX.Click += btnMoveX_Click
</font>
There is anyone to tell me how can I create a click event in my code?

Thanks,
-zeyoo
May 23, 2010 at 2:17 PM
Thanks, Jimmy. It's OK.


2010/5/23 jimmysch <notifications@codeplex.com>

From: jimmysch

Zeyoo,

That will work as long as you have a method defined for the handler:

def btnMoveX_Click(sender, eventArgs):
# do something ...

~Jimmy

On May 22, 2010, at 10:51 AM, "zeyoo" <notifications@codeplex.com> wrote:

From: zeyoo

I want to add a click event to the Button in the IronPython. Partial code is:

import clr
clr.AddReference("System","System.Windows")
import System
from System.Windows.Controls import *
def SetCanvas(canvas):
btnMoveX = Button()
btnMoveX.Content = "Move X Steps"
btnMoveX.Height = 45
btnMoveX.Width = 150
canvas.Children.Add(btnMoveX)
<font color="red">btnMoveX.Click += btnMoveX_Click
</font>
There is anyone to tell me how can I create a click event in my code?

Thanks,
-zeyoo

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




--
Thanks,
-ZhiYue Sun