import clr
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import Application, Button, Form
#A. create a blank form
form = Form()
form.Text = 'Hello World'#B. Create a button to add to the form
#B.1 Define what button will do when clicked
def onClick(sender, eventArgs):form.Text = 'Thanks for clicking at ' + time.asctime()
print time.asctime()
#B.2 Create new button and tell what function to call when clicked
button = Button(Text="Please click")
button.Click += onClick
#B.3 Add button to form
#add button to form
form.Controls.Add(button)
#C. show the form
form.ShowDialog()
2 comments:
Hey,
Thank you for sharing script.
Unfortunately this script is not working in webplayer. Can you please help us with the modification that will help run this script in webplayer as well?
Thanks,
Aditya
Aditya, Check out this other post:
Post a Comment