By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

Python and XForms: existing implementations?

P: n/a
Does anyone know of any existing Python implementations of an XForms viewer?

Christian

Jul 18 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"Christian Wilcox" <cw*****@etcconnect.com> writes:
Does anyone know of any existing Python implementations of an XForms
viewer?


What environment does it have to work in?

Does it have to be cross-platform? Does it have to be in pure Python,
or just useable from Python? Does it have to integrate with a
particular GUI framework, or with MS OLE? Does it have to be open
source? etc.

(BTW, you might want to disambiguate this: XForms is both an XML
standard and an old GUI toolkit -- I assume you mean the former)
John
Jul 18 '05 #2

P: n/a
Hey folks,

I'm new to Python and programming in general and I'm having a blast. I
was curious if it was possible to use Windows.Forms; I'm interesting in
porting a C++ program a friend wrote for me to Python and would like to
use a similar GUI (its fairly simple). I've noticed ActiveState has a
..NET plugin for Python...

http://www.activestate.com/Products/Visual_Python/?_x=1

....but I'm not sure that is what I am looking for and I'm stuck with
Borland C# Builder Personal Edition anyway for financial reasons.

One thing that threw me for a loop was that when I used ActivePython
(ActiveStates Python IDE, I like it so far) to run a script I wrote, it
gives me a Windows.Forms input box when I call raw_input as opposed to
the regular console input message you get in the basic interactive
window that comes with a standalone Pythin installation. What's going on
there? Can I harness that a little more?

Shane Brennan
Jul 18 '05 #3

P: n/a
Shane,

You can access all the Windows common dialogs (forms?)
Python by using Win32 extensions. Specifically using
pywin.mfc dialog and win32ui modules. Here is an example
that I "hacked" from Demos directory. If this is
something you want to study more see Mark Hammond's
excellent Python Programming on Win32 book.

HTH,
Larry Bates
Syscon, Inc.

#
# Progress bar control example
#
# PyCProgressCtrl encapsulates the MFC CProgressCtrl class. To use it,
# you:
#
# - Create the control with win32ui.CreateProgressCtrl()
# - Create the control window with PyCProgressCtrl.CreateWindow()
# - Initialize the range if you want it to be other than (0, 100) using
# PyCProgressCtrl.SetRange()
# - Either:
# - Set the step size with PyCProgressCtrl.SetStep(), and
# - Increment using PyCProgressCtrl.StepIt()
# or:
# - Set the amount completed using PyCProgressCtrl.SetPos()
#
# Example and progress bar code courtesy of KDL Technologies, Ltd., Hong
Kong SAR, China.
#

from pywin.mfc import dialog
import win32ui
import win32con
import time

def MakeDlgTemplate():
style = (win32con.DS_MODALFRAME |
win32con.WS_POPUP |
win32con.WS_VISIBLE |
win32con.WS_CAPTION |
win32con.WS_SYSMENU |
win32con.DS_SETFONT)
cs = (win32con.WS_CHILD |
win32con.WS_VISIBLE)

w = 215
h = 36

dlg = [["Progress bar",
(0, 0, w, h),
style,
None,
(8, "MS Sans Serif")],
]
return dlg

class TestDialog(dialog.Dialog):
def OnInitDialog(self):
rc = dialog.Dialog.OnInitDialog(self)
self.pbar = win32ui.CreateProgressCtrl()
self.pbar.CreateWindow (win32con.WS_CHILD |
win32con.WS_VISIBLE,
(10, 10, 310, 24),
self, 1001)
return rc

def demo():
d = TestDialog (MakeDlgTemplate())
d.CreateWindow ()
for i in xrange(100):
d.pbar.SetPos(i)
time.sleep(0.1)

d.OnCancel()

if __name__=='__main__':
demo()

# $Header: /home/cvsroot/PyWin32/Pythonwin/pywin/Demos/progressbar.py,v 1.1
1999/09/01 23:33:35 mhammond Exp $

"Shane" <s.*******@cox.net> wrote in message
news:sT******************@nwrddc03.gnilink.net...
Hey folks,

I'm new to Python and programming in general and I'm having a blast. I
was curious if it was possible to use Windows.Forms; I'm interesting in
porting a C++ program a friend wrote for me to Python and would like to
use a similar GUI (its fairly simple). I've noticed ActiveState has a
.NET plugin for Python...

http://www.activestate.com/Products/Visual_Python/?_x=1

...but I'm not sure that is what I am looking for and I'm stuck with
Borland C# Builder Personal Edition anyway for financial reasons.

One thing that threw me for a loop was that when I used ActivePython
(ActiveStates Python IDE, I like it so far) to run a script I wrote, it
gives me a Windows.Forms input box when I call raw_input as opposed to
the regular console input message you get in the basic interactive
window that comes with a standalone Pythin installation. What's going on
there? Can I harness that a little more?

Shane Brennan

Jul 18 '05 #4

P: n/a
Thanks Larry, that was what I was hoping to hear. And thanks for the
book suggestion; I'll be sure to look it up!

Shane Brennan
Larry Bates wrote:
Shane,

You can access all the Windows common dialogs (forms?)
Python by using Win32 extensions. Specifically using
pywin.mfc dialog and win32ui modules. Here is an example
that I "hacked" from Demos directory. If this is
something you want to study more see Mark Hammond's
excellent Python Programming on Win32 book.

HTH,
Larry Bates
Syscon, Inc.

#
# Progress bar control example
#
# PyCProgressCtrl encapsulates the MFC CProgressCtrl class. To use it,
# you:
#
# - Create the control with win32ui.CreateProgressCtrl()
# - Create the control window with PyCProgressCtrl.CreateWindow()
# - Initialize the range if you want it to be other than (0, 100) using
# PyCProgressCtrl.SetRange()
# - Either:
# - Set the step size with PyCProgressCtrl.SetStep(), and
# - Increment using PyCProgressCtrl.StepIt()
# or:
# - Set the amount completed using PyCProgressCtrl.SetPos()
#
# Example and progress bar code courtesy of KDL Technologies, Ltd., Hong
Kong SAR, China.
#

from pywin.mfc import dialog
import win32ui
import win32con
import time

def MakeDlgTemplate():
style = (win32con.DS_MODALFRAME |
win32con.WS_POPUP |
win32con.WS_VISIBLE |
win32con.WS_CAPTION |
win32con.WS_SYSMENU |
win32con.DS_SETFONT)
cs = (win32con.WS_CHILD |
win32con.WS_VISIBLE)

w = 215
h = 36

dlg = [["Progress bar",
(0, 0, w, h),
style,
None,
(8, "MS Sans Serif")],
]
return dlg

class TestDialog(dialog.Dialog):
def OnInitDialog(self):
rc = dialog.Dialog.OnInitDialog(self)
self.pbar = win32ui.CreateProgressCtrl()
self.pbar.CreateWindow (win32con.WS_CHILD |
win32con.WS_VISIBLE,
(10, 10, 310, 24),
self, 1001)
return rc

def demo():
d = TestDialog (MakeDlgTemplate())
d.CreateWindow ()
for i in xrange(100):
d.pbar.SetPos(i)
time.sleep(0.1)

d.OnCancel()

if __name__=='__main__':
demo()

# $Header: /home/cvsroot/PyWin32/Pythonwin/pywin/Demos/progressbar.py,v 1.1
1999/09/01 23:33:35 mhammond Exp $

"Shane" <s.*******@cox.net> wrote in message
news:sT******************@nwrddc03.gnilink.net...
Hey folks,

I'm new to Python and programming in general and I'm having a blast. I
was curious if it was possible to use Windows.Forms; I'm interesting in
porting a C++ program a friend wrote for me to Python and would like to
use a similar GUI (its fairly simple). I've noticed ActiveState has a
.NET plugin for Python...

http://www.activestate.com/Products/Visual_Python/?_x=1

...but I'm not sure that is what I am looking for and I'm stuck with
Borland C# Builder Personal Edition anyway for financial reasons.

One thing that threw me for a loop was that when I used ActivePython
(ActiveStates Python IDE, I like it so far) to run a script I wrote, it
gives me a Windows.Forms input box when I call raw_input as opposed to
the regular console input message you get in the basic interactive
window that comes with a standalone Pythin installation. What's going on
there? Can I harness that a little more?

Shane Brennan


Jul 18 '05 #5

P: n/a
"Larry Bates" <lb****@swamisoft.com> wrote:

You can access all the Windows common dialogs (forms?)
Python by using Win32 extensions.


His specific question was about Windows.Forms, which is a .NET class in the
Common Language Runtime. Hooking that is not as easy as popping into the
common dialogs.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #6

P: n/a
You can script .net from python.
Have a look at:

http://zope.org/Members/Brian/PythonNet/

Marijan
Jul 18 '05 #7

P: n/a
Tim Roberts wrote:
"Larry Bates" <lb****@swamisoft.com> wrote:
You can access all the Windows common dialogs (forms?)
Python by using Win32 extensions.

His specific question was about Windows.Forms, which is a .NET class in the
Common Language Runtime. Hooking that is not as easy as popping into the
common dialogs.


Sorry Tim, I first learned programming with C# so when I said
Windows.Forms I meant any generic Windows form, and especially common
dialogs. My mistake! I'm glad I made though since Marijan Tadin pointed
out that python .NET link that I wasn't aware of (see his reply). Thanks
again...

Shane Brennan
Jul 18 '05 #8

P: n/a
Shane <s.*******@cox.net> wrote:

Sorry Tim, I first learned programming with C# so when I said
Windows.Forms I meant any generic Windows form, and especially common
dialogs. My mistake! I'm glad I made though since Marijan Tadin pointed
out that python .NET link that I wasn't aware of (see his reply). Thanks
again...


Interesting that this newsgroup is able to answer not only the question you
ASKED, but the question you MEANT to ask...
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #9

P: n/a
Python, the first "divination" programming-language ?

Jul 18 '05 #10

P: n/a
Tim Roberts wrote:
Shane <s.*******@cox.net> wrote:
Sorry Tim, I first learned programming with C# so when I said
Windows.Forms I meant any generic Windows form, and especially common
dialogs. My mistake! I'm glad I made though since Marijan Tadin pointed
out that python .NET link that I wasn't aware of (see his reply). Thanks
again...


Interesting that this newsgroup is able to answer not only the question you
ASKED, but the question you MEANT to ask...


It's the time machine again. Marijan noticed in 2006 that Shane
had founded a very successful startup company based on using Python
to provide continuing support for legacy technologies that had been
abandoned by the original vendor. Their "Safe-T-Net for .NET" (tm)
product alone was generating millions in annual revenue.

Using the third-generation Google "I Feel Really Lucky" link,
Marijan discovered Shane's original question and gave him the
answer to the question he should have asked in the first place.
This will have had been going to have resulted in a huge increase
in the share price for Marijan's stock portfolio, allowing him
to retire in comfort to the Cayman's at the age of twenty-two...

-Peter
Jul 18 '05 #11

P: n/a
May I get some clarification regarding some terminology please?
Specifically, the sentences:

"You can access all the Windows common dialogs (forms?) Python by
using Win32 extensions. Specifically using pywin.mfc dialog and
win32ui modules."

My questions are:
1) is a combo box control something that is part of the set of stuff
that is referred to as 'all the Windows common dialogs'?
2) if so, is there any sample code available in which a combo box
control is 'hacked' (Mr. Bates' term, not mine) from pywin.mfc dialog
and win32ui modules? if so, where can I find this sample code?

"Larry Bates" <lb****@swamisoft.com> wrote in message news:<PI********************@comcast.com>...
Shane,

You can access all the Windows common dialogs (forms?)
Python by using Win32 extensions. Specifically using
pywin.mfc dialog and win32ui modules. Here is an example
that I "hacked" from Demos directory. If this is
something you want to study more see Mark Hammond's
excellent Python Programming on Win32 book.

HTH,
Larry Bates
Syscon, Inc.

#
# Progress bar control example
#
# PyCProgressCtrl encapsulates the MFC CProgressCtrl class. To use it,
# you:
#
# - Create the control with win32ui.CreateProgressCtrl()
# - Create the control window with PyCProgressCtrl.CreateWindow()
# - Initialize the range if you want it to be other than (0, 100) using
# PyCProgressCtrl.SetRange()
# - Either:
# - Set the step size with PyCProgressCtrl.SetStep(), and
# - Increment using PyCProgressCtrl.StepIt()
# or:
# - Set the amount completed using PyCProgressCtrl.SetPos()
#
# Example and progress bar code courtesy of KDL Technologies, Ltd., Hong
Kong SAR, China.
#

from pywin.mfc import dialog
import win32ui
import win32con
import time

def MakeDlgTemplate():
style = (win32con.DS_MODALFRAME |
win32con.WS_POPUP |
win32con.WS_VISIBLE |
win32con.WS_CAPTION |
win32con.WS_SYSMENU |
win32con.DS_SETFONT)
cs = (win32con.WS_CHILD |
win32con.WS_VISIBLE)

w = 215
h = 36

dlg = [["Progress bar",
(0, 0, w, h),
style,
None,
(8, "MS Sans Serif")],
]
return dlg

class TestDialog(dialog.Dialog):
def OnInitDialog(self):
rc = dialog.Dialog.OnInitDialog(self)
self.pbar = win32ui.CreateProgressCtrl()
self.pbar.CreateWindow (win32con.WS_CHILD |
win32con.WS_VISIBLE,
(10, 10, 310, 24),
self, 1001)
return rc

def demo():
d = TestDialog (MakeDlgTemplate())
d.CreateWindow ()
for i in xrange(100):
d.pbar.SetPos(i)
time.sleep(0.1)

d.OnCancel()

if __name__=='__main__':
demo()

# $Header: /home/cvsroot/PyWin32/Pythonwin/pywin/Demos/progressbar.py,v 1.1
1999/09/01 23:33:35 mhammond Exp $

"Shane" <s.*******@cox.net> wrote in message
news:sT******************@nwrddc03.gnilink.net...
Hey folks,

I'm new to Python and programming in general and I'm having a blast. I
was curious if it was possible to use Windows.Forms; I'm interesting in
porting a C++ program a friend wrote for me to Python and would like to
use a similar GUI (its fairly simple). I've noticed ActiveState has a
.NET plugin for Python...

http://www.activestate.com/Products/Visual_Python/?_x=1

...but I'm not sure that is what I am looking for and I'm stuck with
Borland C# Builder Personal Edition anyway for financial reasons.

One thing that threw me for a loop was that when I used ActivePython
(ActiveStates Python IDE, I like it so far) to run a script I wrote, it
gives me a Windows.Forms input box when I call raw_input as opposed to
the regular console input message you get in the basic interactive
window that comes with a standalone Pythin installation. What's going on
there? Can I harness that a little more?

Shane Brennan

Jul 18 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.