So you think PythonCard is old? Here's new wine in an old bottle.

J

John Henry

For serveral years, I have been looking for a way to migrate away from
desktop GUI/client-server programming onto the browser based network
computing model of programming. Unfortunately, up until recently,
browser based programs are very limited - due to the limitation of
HTML itself. Eventhough PythonCard hasn't keep up with the latest
widgets in wxpython, the programs so created still works a lot better
- until now.

If you look at programs at some of the major sites these days - like
Google calendar, Netflix, blockbuster, and so forth - you would
undoubtedly notice that the quality of the programs are pretty much at
par with the desktop programs we use everyday. Since the curious mind
wanted to know how these programs are done, I started investigating
and found out that what a difference a few years have made to
Javascript - the once much hated beast of the Internet age - and
during my search for perfection, I found Qooxdoo (http://
qooxdoo.org/).

Qooxdoo is a Javascript toolkit that sits on top of Ajax. Take a look
at some of the *impressive* widgets
at http://demo.qooxdoo.org/current/showcase/#Form.

So, what's that got to do with Pythoncard? Read on.

After trying for a few days learning Qooxdoo, my head really really
hurts. Getting too old to learn this stuff, I was mumbling.

Then I looked some more. I found QxTransformer (http://
sites.google.com/a/qxtransformer.org/qxtransformer/Home) which is a
XSLT toolkit that creats XML code that invoke qooxdoo.

So, what's that got to do with Pythoncard? Read on.

After trying for a few days learning QxTransformer, my head really
really hurts. Getting too old to learn
this stuff, I was mumbling.

I want Pythoncard.

Damn Pythoncard! Once you got hooked, everything else looks
impossibly complicated and unproductive.

But then I looked closer. It turns out the XML file created by
QxTransformer is *very* similar in structure when compared to the
resource files used in PythonCard. Since there are no GUI builders
for QxTransformer, and I can't affort to buy the one for Qooxdoo
(Java! Yuk!), I decided to roll up my sleeves, took the Pythoncard's
Layout Manager and modified it and created my own "Poor Man's Qooxdoo
GUI Layout Designer".

The result? See the partially completed application at:

http://test.powersystemadvisors.com/

and the same application running from the desktop:

http://test.powersystemadvisors.com/desktopHelloWorld.jpg

It shouldn't be long before I can fill in the gaps and have the GUI
builder maps the rest of the Pythoncard widgets to Qooxdoo widgets.
Once I've done that, I can have the same application running from the
desktop, or from the browser. And it shouldn't take more than minutes
to create such applications.

Welcome to the modernized world of Pythoncard!!!
 
A

Aahz

But then I looked closer. It turns out the XML file created by
QxTransformer is *very* similar in structure when compared to the
resource files used in PythonCard. Since there are no GUI builders
for QxTransformer, and I can't affort to buy the one for Qooxdoo
(Java! Yuk!), I decided to roll up my sleeves, took the Pythoncard's
Layout Manager and modified it and created my own "Poor Man's Qooxdoo
GUI Layout Designer".

Cute! When you have working code, please do upload to PyPI.
 
J

John Henry

Cute! When you have working code, please do upload to PyPI.

So far, I have the following widgets working:

window, button, checkbox, static text, static box, list, combobox,
spinner, radio button group

Shouldn't be long before the following works:

static line, image, image button, choice.
 
C

castironpi

So far, I have the following widgets working:

window, button, checkbox, static text, static box, list, combobox,
spinner, radio button group

Shouldn't be long before the following works:

static line, image, image button, choice.- Hide quoted text -

- Show quoted text -

Should static text GUI class support the operations of a string?
 
J

John Henry

So far, I have the following widgets working:

window, button, checkbox, static text, static box, list, combobox,
spinner, radio button group

Shouldn't be long before the following works:

static line, image, image button, choice.- Hide quoted text -

- Show quoted text -

All of the above works!

TextFields next.
 
R

Ron Stephens

John,

This is very interesting! Please do make this available. I love
PythonCard, but I am doing mainly web programming these days.

I will mention this on my next podcast. Can you do a slider?

Ron Stephens
Python411 www.awaretek.com/python/index.html
 
F

Fred Pacquier

John Henry said:
Welcome to the modernized world of Pythoncard!!!

Hey, that's really neat !

I remember dabbling in Pythoncard in the early days, some years ago, it was
a very interesting project. I gave it up eventually, partly because it
seemed somewhat abandoned (I see it's still stuck in 2006 ?), but mostly
because the wxPython dependency was either unavailable or too hefty for the
sort of machines I was interested in using it on (a Sharp Zaurus then, now
Nokia Internet tablets). Since then I've been doing web apps instead,
hosted and used on the devices themselves.

So using Pythoncard as a designer for web apps, of course that rings a
bell...

Do you have any idea of the computing requirements of Qooxdoo and
QxTransformer, compared to a native Pythoncard app ? I wonder if your stuff
would run acceptably on today's mobile platforms (the Nokias have a Firefox
derivative that is reasonably competent at javascript), and would give it a
try if it's not too arcane.

Do keep us posted !

TIA,
fp
 
J

John Henry

John,

This is very interesting! Please do make this available. I love
PythonCard, but I am doing mainly web programming these days.

I will mention this on my next podcast. Can you do a slider?

Ron Stephens
Python411www.awaretek.com/python/index.html

Not sure if Qooxdoo supports slider yet. I have to ask.
 
J

John Henry

Hey, that's really neat !

I remember dabbling in Pythoncard in the early days, some years ago, it was
a very interesting project. I gave it up eventually, partly because it
seemed somewhat abandoned (I see it's still stuck in 2006 ?), but mostly
because the wxPython dependency was either unavailable or too hefty for the
sort of machines I was interested in using it on (a Sharp Zaurus then, now
Nokia Internet tablets). Since then I've been doing web apps instead,
hosted and used on the devices themselves.

So using Pythoncard as a designer for web apps, of course that rings a
bell...

Do you have any idea of the computing requirements of Qooxdoo and
QxTransformer, compared to a native Pythoncard app ? I wonder if your stuff
would run acceptably on today's mobile platforms (the Nokias have a Firefox
derivative that is reasonably competent at javascript), and would give it a
try if it's not too arcane.

Do keep us posted !

TIA,
fp

The performance of Qooxdoo is quite amazing - for a Javascript based
web application. Don't know about cell-phones though. You can try
their showcase web site I cited earlier.

Yes, who would have throught we don't have to give up on Pythoncard?
 
F

Fred Pacquier

John Henry said:
The performance of Qooxdoo is quite amazing - for a Javascript based
web application. Don't know about cell-phones though. You can try
their showcase web site I cited earlier.

Just for the record, Nokia Internet tablets (770, N800, N810) are the only
things made by Nokia that are not cell-phones... They're ARM machines with
a 800x480 4" screen, Wifi, Bluetooth, and Linux. And Python, pyGTK and
Pygame. Probably pyQt next as they just bought Trolltech. But no wxPython.

I was not speaking of running just the client part in the device's browser,
either - but the full Monty (haha) with the web server and the application
engine, python, middleware and all. I'm doing it right now using a full-
blown framework (web2py), so it's not unreasonable. There's no Ajax in
there though, so I'm wondering what kind of impact those tools you mention
would have, server side.
Yes, who would have throught we don't have to give up on Pythoncard?

Proof of superior vision, architecture and design, all that time ago...
 
P

Panyasan

Hi,

I am one of the two developers working on the xml-to-javascript
converter (qxtransformer) John has mentioned and we are thrilled that
our project has found a use in the PythonCard community.

However, we have a problem getting PythonCard to work on our Macs (Mac
OS 10.5 Leopard). We should probably be asking this on the PythonCard
help list, but since the list seems to be somewhat deserted (very few
posts) and John is active here and people seem to be using PythonCard,
maybe someone has an idea. It might be very simple and stupid - I have
never worked with python before.

I am using
- PythonCard 0.8.2 release on Leopard, which is copied by setup.py to /
Library/Python/2.5/site-packages
- John's layoutEditor package, (http://qxtransformer.googlegroups.com/
web/layoutEditor.zip)

PythonCard email list says that Leopard and PythonCard 0.8.2 seem to
like each other generally:

http://sourceforge.net/mailarchive/[email protected]&forum_name=pythoncard-users

and I can get the examples working. However, when I start John's
modified layoutEditor.py, I get an empty window and the following
error is thrown:

no resource file for /Users/bibliograph/Programme/PythonCard/tools/
layoutEditor/multipropertyEditor
Traceback (most recent call last):
File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/
Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-
unicode/wx/_core.py", line 14095, in <lambda>
File "/Library/Python/2.5/site-packages/PythonCard/tools/
layoutEditor/layoutEditor.py", line 153, in on_initialize
self.propertyEditorWindow = model.childWindow(self,
PropertyEditor)
File "/Library/Python/2.5/site-packages/PythonCard/model.py", line
213, in childWindow
rsrc = resource.ResourceFile(filename).getResource()
File "/Library/Python/2.5/site-packages/PythonCard/resource.py",
line 45, in __init__
self.dictionary = util.readAndEvalFile(rsrcFileName)
File "/Library/Python/2.5/site-packages/PythonCard/util.py", line
39, in readAndEvalFile
f = open(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

there is a file PythonCard/tools/layoutEditor/modules/
multipropertyEditor.rsrc.py

When I resize the window, I get the following errors

Tue Apr 29 10:48:08 noname Python[40440] <Error>: CGContextConcatCTM:
invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>: CGContextSaveGState:
invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>: doClip: invalid
context
Tue Apr 29 10:48:08 noname Python[40440] <Error>: CGContextSaveGState:
invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>:
CGContextSetBlendMode: invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>:
CGContextSetShouldAntialias: invalid context
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/PythonCard/model.py", line
884, in _dispatch
handler(background, aWxEvent)
File "/Library/Python/2.5/site-packages/PythonCard/tools/
layoutEditor/layoutEditor.py", line 560, in on_size
self.createDC()
File "/Library/Python/2.5/site-packages/PythonCard/tools/
layoutEditor/layoutEditor.py", line 556, in createDC
dc.SetLogicalFunction(wx.INVERT)
File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/
Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-
unicode/wx/_gdi.py", line 4079, in SetLogicalFunction
wx._core.PyAssertionError: C++ assertion "status == noErr" failed
at ../src/mac/carbon/graphics.cpp(1324) in EnsureIsValid(): Cannot
nest wxDCs on the same window

Thanks for any pointers,

Christian
 
J

John Henry

Hi,

I am one of the two developers working on the xml-to-javascript
converter (qxtransformer) John has mentioned and we are thrilled that
our project has found a use in the PythonCard community.

However, we have a problem getting PythonCard to work on our Macs (Mac
OS 10.5 Leopard). We should probably be asking this on the PythonCard
help list, but since the list seems to be somewhat deserted (very few
posts) and John is active here and people seem to be using PythonCard,
maybe someone has an idea. It might be very simple and stupid - I have
never worked with python before.

I am using
- PythonCard 0.8.2 release on Leopard, which is copied by setup.py to /
Library/Python/2.5/site-packages
- John's layoutEditor package, (http://qxtransformer.googlegroups.com/
web/layoutEditor.zip)

PythonCard email list says that Leopard and PythonCard 0.8.2 seem to
like each other generally:

http://sourceforge.net/mailarchive/forum.php?thread_name=EE5213D5-A00...

and I can get the examples working. However, when I start John's
modified layoutEditor.py, I get an empty window and the following
error is thrown:

no resource file for /Users/bibliograph/Programme/PythonCard/tools/
layoutEditor/multipropertyEditor
Traceback (most recent call last):
File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/
Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-
unicode/wx/_core.py", line 14095, in <lambda>
File "/Library/Python/2.5/site-packages/PythonCard/tools/
layoutEditor/layoutEditor.py", line 153, in on_initialize
self.propertyEditorWindow = model.childWindow(self,
PropertyEditor)
File "/Library/Python/2.5/site-packages/PythonCard/model.py", line
213, in childWindow
rsrc = resource.ResourceFile(filename).getResource()
File "/Library/Python/2.5/site-packages/PythonCard/resource.py",
line 45, in __init__
self.dictionary = util.readAndEvalFile(rsrcFileName)
File "/Library/Python/2.5/site-packages/PythonCard/util.py", line
39, in readAndEvalFile
f = open(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

there is a file PythonCard/tools/layoutEditor/modules/
multipropertyEditor.rsrc.py

When I resize the window, I get the following errors

Tue Apr 29 10:48:08 noname Python[40440] <Error>: CGContextConcatCTM:
invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>: CGContextSaveGState:
invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>: doClip: invalid
context
Tue Apr 29 10:48:08 noname Python[40440] <Error>: CGContextSaveGState:
invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>:
CGContextSetBlendMode: invalid context
Tue Apr 29 10:48:08 noname Python[40440] <Error>:
CGContextSetShouldAntialias: invalid context
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/PythonCard/model.py", line
884, in _dispatch
handler(background, aWxEvent)
File "/Library/Python/2.5/site-packages/PythonCard/tools/
layoutEditor/layoutEditor.py", line 560, in on_size
self.createDC()
File "/Library/Python/2.5/site-packages/PythonCard/tools/
layoutEditor/layoutEditor.py", line 556, in createDC
dc.SetLogicalFunction(wx.INVERT)
File "/BinaryCache/wxWidgets/wxWidgets-11~57/Root/System/Library/
Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-
unicode/wx/_gdi.py", line 4079, in SetLogicalFunction
wx._core.PyAssertionError: C++ assertion "status == noErr" failed
at ../src/mac/carbon/graphics.cpp(1324) in EnsureIsValid(): Cannot
nest wxDCs on the same window

Thanks for any pointers,

Christian

Christian,

It appears you're missing a file. Where did you placed my program? I
see that there are two places being mentioned:
 
P

Panyasan

Christian,

It appears you're missing a file. Where did you placed my program? I
see that there are two places being mentioned:

I unzipped the folder you uploaded and placed it in the PythonCard/
tools folder. I get the same error if I try to start the default
resourceEditor.py or layoutEditor.py scripts, so it does not seem to
have to do with your modifications.
When I copy multipropertyEditor.rsrc.py files from PythodCard/tools/
resourceEditor/modules folder to PythodCard/tools/resourceEditor/, it
will throw the error about a different file - might this be some kind
of PATH error?

C.
 
J

John Henry

I unzipped the folder you uploaded and placed it in the PythonCard/
tools folder. I get the same error if I try to start the default
resourceEditor.py or layoutEditor.py scripts, so it does not seem to
have to do with your modifications.
When I copy multipropertyEditor.rsrc.py files from PythodCard/tools/
resourceEditor/modules folder to PythodCard/tools/resourceEditor/, it
will throw the error about a different file - might this be some kind
of PATH error?

C.

It certainly looks like it's not finding a file. Not knowing Mac or
Linux, I don't know how files are searched.

There are a whole bunch of test programs that comes with Pythoncard.
Do they work? (Not all of them will work - some requires a database)
 
P

Panyasan

There are a whole bunch of test programs that comes with Pythoncard.
Do they work? (Not all of them will work - some requires a database)

Yes, the examples work. Just the resourceEditor.py and the
layoutEditor.py in the distributed version and your modified
layoutEditor.py don't.
 
P

Panyasan

Yes, the examples work. Just the resourceEditor.py and the
layoutEditor.py in the distributed version and your modified
layoutEditor.py don't.

Ok, here is how it works for me: copy all the *.rsrc.py from the
modules subdirectory to the parent directory. This works for the
standard resourceEditor folder and your custom layoutEditor folder.
What the heck. Now I can deal with more productive things...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top