Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet171/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   167   168   169   170   171   172   173   174   ...   453
156

CHAPTER 8
Creating WindoWs Forms appliCations
# Configure btnFireEvent
self.btnFireEvent = System.Windows.Forms.Button()
self.btnFireEvent.Text = “&Fire Event”
self.btnFireEvent.Location = System.Drawing.Point(263, 13)
# Configure btnQuit
self.btnQuit = System.Windows.Forms.Button()
self.btnQuit.Text = “&Quit”
self.btnQuit.Location = System.Drawing.Point(263, 43)
# Add the controls to the form.
self.Controls.Add(self.btnFireEvent)
self.Controls.Add(self.btnQuit)
It’s generally a good practice to keep the event, form, and operational code 
separate. Doing so will make the application easier to debug later. This example 
actually uses three separate files, even though it’s a very simple example. Make 
sure you follow this principle when creating events of your own.
As you can see, this form is a very simple version of
the other forms used so far in this chapter. All it does
is provide access to two buttons: one to fire the event
and the other to close the form. Figure 8-9 shows the
output from this code.
Running the Code
It’s time to try out the new event and its associated test 
form. Listing 8-7 shows the code required for this part of 
the example.
lISTINg 8-7: 
 Testing the event class
# Set up the path to the .NET Framework. 
import sys
sys.path.append(‘C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727’)
# Make clr accessible.
import clr
# Add any required references.
clr.AddReference(‘System.Windows.Forms.DLL’)
FIguRE 8-9: 
A simple form used to test the 
custom event and associated handler.
lISTINg 8-6 
(continued)
548592c08.indd 156
2/24/10 12:48:12 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   167   168   169   170   171   172   173   174   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish