Professional IronPython


Using IronPython Constructively



Download 20,35 Mb.
Pdf ko'rish
bet133/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   129   130   131   132   133   134   135   136   ...   453
Using IronPython Constructively
 

 
115
The problem occurs with the second part of the example. The process is relatively straightforward. The 
TestIDLE
class contains a method called 
ShowAbout()

ShowAbout()
creates a window and then dis-
plays the IDLE About dialog box in it. The code then destroys the window it created and ends.
When you try to run this example using IronPython by typing IPY IDLETest.py at the command 
prompt and pressing Enter, the first message you see says that IronPython knows nothing about a 
Tkinter
module, which provides access to the windowing environment provided by 
Tk
. You can 
read all about 
Tkinter
at 
http://www.pythonware.com/library/tkinter/introduction/
. The 
bottom line is that 
Tkinter
is a windowing environment that many Python developers use, so you’re 
going to run into it when working with IronPython.
At this point, you notice that IronPython does indeed include support for 
Tkinter
in the
\Program Files\IronPython 2.6\Lib\lib-tk
folder. So you add this directory to your 
IRONPYTHONPATH environment variable by typing 
Set IRONPYTHONPATH=%IRONPYTHONPATH
%;C:\Program Files\IronPython 2.6\Lib\lib-tk
and pressing Enter. This command adds the 
required directory to your application environment, so you type 
IPY IDLETest.py
again and press 
Enter. Now you see an error message, “ImportError: No module named _tkinter.”
Unfortunately, you’ll never find a 
_tkinter
module in the IronPython folders. You’ll find it in the
\Python26\DLLs
directory as 
_tkinter.pyd
and in the 
\Python26\libs
directory as 
_tkinter 
.lib
. The alarms should be going off in your head at this moment. Python implements 
Tkinter
as a 
C library, which means that IronPython doesn’t support it, despite the fact that IronPython includes 
the required 
Tkinter.py
file. The point of this whole exercise is that you’re going to run into some 
very popular Python features that simply won’t work in IronPython because they require C support 
(despite the fact that it appears that IronPython does support it). Your only choice (in most cases) is 
to avoid using the module or rely on straight Python instead. Happily, some developers are working 
on the 
Tkinter
problem. You can read about one such solution at 
http://www.voidspace.org 
.uk/ironpython/cpython_extensions.shtml
.
Whenever you have a question about IronPython support for a particular 
Python feature, check the not-supported-module-list at 
http://ironpython 
.codeplex.com/wikipage?title=List of Standard Library components 
not included in the MSI
.

Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   129   130   131   132   133   134   135   136   ...   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