Creating Windows Forms Applications


>■ Creating a form design without using the Visual Designer Building a Windows Forms application Using events and delegates in IronPython

Most of the applications you've worked with in the book so far rely on a character-mode interface. Of course, character-mode is just fine when you're dealing with utilities or example applications, but most users want a GUI. The idea of typing commands at the command prompt is so foreign to most of today's users that you'd never get them all trained to use your application.

Fortunately, you can create a number of graphical application types using IronPython. Unfortunately, many of the graphical programming tools available to Python developers won't work with IronPython because IronPython lacks support for C-style libraries. This is a situation where you really do need Windows Forms support to provide what the user needs in the way of an application.

The problem for the IronPython developer is that IronPython isn't integrated into Visual Studio. Consequently, you won't have Visual Designer support in a pure IronPython environment. (Chapters 16 and 17 show how to overcome this problem by using either C# or Visual Basic.NET to produce the user interface.) This chapter discusses some ways in which you can produce a great interface without using the Visual Designer.

A graphical interface naturally implies writing code that responds to events (handlers) and providing the code required to produce an event (delegates). When the user clicks a button, something needs to happen in your application. This chapter addresses the requirements for working with both handlers and delegates. You'll discover the techniques used to create event handlers that act just like those created in other languages.

The final section of this chapter puts everything you've discovered into practice. You'll build a Windows Forms application. The application isn't designed to do anything too complex — the main purpose of the example is to show you how to put all of the component parts together so that you end up with a working application. You'll discover how to perform more complex processing as the book progresses.

Was this article helpful?

+7 -7


  • huriyyah
    How to make a pytohn program with windows form?
    2 years ago

Post a comment