5 4912
On Tue, 24 Aug 2004 20:24:00 +0200, Thomas Heller <th*****@python .net>
wrote: You've missed venster http://venster.sf.net/
Oops :-) It's still alpha and documentation barely exists, so I guess
PythonWin/pywin32 looks like a better choice.
I think pywin32 has what you need, the makepy utility displays such a progress dialog when creating python wrappers for large typelibraries.
OK, I'll check it out. It seems like pywin32 is meant for C++
developers who are already proficient with MFC, and the only
documentation is pretty much the scripts that comes with the software,
but I'll try to figure it out and extract what I need.
Thank you
Fred.
Here's a class for Windows progress bar:
#
# Progress bar control example
#
# PyCProgressCtrl encapsulates the MFC CProgressCtrl class. To use it,
# you:
#
# - Create the control with win32ui.CreateP rogressCtrl()
# - 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_MO DALFRAME |
win32con.WS_POP UP |
win32con.WS_VIS IBLE |
win32con.WS_CAP TION |
win32con.WS_SYS MENU |
win32con.DS_SET FONT)
cs = (win32con.WS_CH ILD |
win32con.WS_VIS IBLE)
w = 215
h = 36
dlg = [["Progress bar",
(0, 0, w, h),
style,
None,
(8, "MS Sans Serif")],
]
return dlg
class TestDialog(dial og.Dialog):
def OnInitDialog(se lf):
rc = dialog.Dialog.O nInitDialog(sel f)
self.pbar = win32ui.CreateP rogressCtrl()
self.pbar.Creat eWindow (win32con.WS_CH ILD |
win32con.WS_VIS IBLE,
(10, 10, 310, 24),
self, 1001)
return rc
def demo():
d = TestDialog (MakeDlgTemplat e())
d.CreateWindow ()
for i in xrange(100):
d.pbar.SetPos(i )
time.sleep(0.1)
d.OnCancel()
if __name__=='__ma in__':
demo()
Here's some code for a file dialog box that I stripped from
an application that asks user to select an export file
from TimePilot payroll application (the files are always
called TimePilot.mdb):
import win32ui
import win32con
#---------------------------------------------------------------------------
----
# Display a file dialog box that allows the user to browse to the
TimePilot.mdb
# file that they wish to export.
#---------------------------------------------------------------------------
----
timepilotdatapa th="C:\TimePilo t"
f=win32ui.Creat eFileDialog(1, None, "TimePilot.mdb" , 0,
'TimePilot databases|TimeP ilot.mdb||')
f.SetOFNInitial Dir(timepilotda tapath)
f.SetOFNTitle(" Timepilot Extracted Data")
result=f.DoModa l()
if result == win32con.IDCANC EL:
emsg="Cancel button pressed during TimePilot.mdb file selection,
aborting"
sys.exit(emsg)
mdb_path=f.GetP athName()
HTH,
Larry Bates
Syscon, Inc.
"Fred" <no****@nowhere .com> wrote in message
news:bp******** *************** *********@4ax.c om... Hi,
I'd like to turn a command-line script into a Windows GUI app using the native widgets so as to reduce the size of the binary (ie. no QT, wxWidgets, et al.)
I came up with the following list of tools to access the Win32 API:
- PythonWin (MFC) http://www.python.org/windows/pythonwin/ - ctypes http://starship.python.net/crew/theller/ctypes/ - EasyDialogs for Windows http://www.averdevelopment.com/python/EasyDialogs.html - DynWin http://www.nightmare.com/~rushing/dynwin/ - sdk32 - Partial Python wrap of the Win32 Platform SDK http://www.object-craft.com.au/projects/sdk32/
Does someone have a sample on how to display an OK/Cancel dialog with a label + progress bar? Should I look at other tools?
Thank you Fred.
On Tue, 24 Aug 2004 20:49:29 +0200, Fred <no****@nowhere .com> wrote: OK, I'll check it out. It seems like pywin32 is meant for C++ developers who are already proficient with MFC, and the only documentatio n is pretty much the scripts that comes with the software, but I'll try to figure it out and extract what I need.
After comparing the scripts under \Demo, here's how to display a basic
dialog in Windows with PythonWin/PyWin32, with a label, and two
pushbuttons, OK/Cancel. When you click on OK, the text of the label
changes, and the OK button is disabled:
from pywin.mfc import dialog
import win32con
dlgStatic = 130
dlgButton = 128
class Mydialog(dialog .Dialog):
def OnInitDialog(se lf):
rc = dialog.Dialog.O nInitDialog(sel f)
return rc
def OnOK(self):
label=self.GetD lgItem(dlgStati c)
label.SetWindow Text("Text changed")
button=self.Get DlgItem(win32co n.IDOK)
button.EnableWi ndow(0)
def OnCancel(self):
self.Cancel = 1
self._obj_.OnCa ncel()
style = (win32con.DS_MO DALFRAME |
win32con.WS_POP UP |
win32con.WS_VIS IBLE |
win32con.WS_CAP TION |
win32con.WS_SYS MENU |
win32con.DS_SET FONT)
cs = win32con.WS_CHI LD | win32con.WS_VIS IBLE
s = win32con.WS_TAB STOP | cs
w = 184
h = 40
dlg = [["PyWin32",( 0, 0, w, h), style, None, (8, "MS Sans
Serif")],]
dlg.append([dlgStatic, "Click on OK", dlgStatic, (7, 5, 69, 9), cs |
win32con.SS_LEF T])
dlg.append([dlgButton, "OK", win32con.IDOK, (7, 20, 50, 14), s |
win32con.BS_DEF PUSHBUTTON])
s = win32con.BS_PUS HBUTTON | s
dlg.append([dlgButton, "Cancel", win32con.IDCANC EL, (124, 20, 50, 14),
s])
d = Mydialog(dlg)
d.DoModal()
My .15E/.20$
Fred.
On Tue, 24 Aug 2004 15:04:38 -0500, "Larry Bates"
<lb****@swamiso ft.com> wrote:
(snip)
Thx Larry :-)
Fred. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew |
last post by:
I get a Null Reference Exception if I close a non-modal dialog (that is, a
form opened with Show()) when a selection is made from a ComboBox. The error
message refers to Unsafe Native Methods, but the code is 100% managed. The
exception is not thrown if the dialog was modal (opened with ShowDialog()) or
if the selection is made from, say, a ListBox.
I have included a simple example below.
I am using C#.NET 2003, Standard Edition.
|
by: pswulius |
last post by:
Hey everyone,
for reasons I can't explain quickly, I'm developing a completely custom
OK/OK_CANCEL dialog, though I think many people would benifit from this
knowledge. I basically need to re-invent the wheel and provide a
simple API like:
Result result = CustomDialog.Show( Mode.OK_CANCEL, aMessage );
The problem that I'm not sure how to solve is the blocking aspect that
|
by: Dave |
last post by:
Hi,
Is there anyway to mimic forms authentication's loginUrl
and RedirectFromLoginPage functionality using Windows
authentication?
We are developing intranet sites using basic
authentication and we want to always redirect a user to a
default 'splash' or welcome page that is set to anonymous
if they are not logged in. This page would have
|
by: Microsoft |
last post by:
Hi,
I have Visual Basic .net 2003 (Standard Edition) & SQL Server 2000 Developer Edition. When trying to create a connection in the server explorer from the .net IDE I get a number of problems;
a.. Under the "Connection" tab, under "1. Select or enter a server name:" when I either select the drop down box or click the refresh button I get an error dialog saying "Error enumerating data servers. Enumerator reports Unspecified error'". The...
|
by: Hal Vaughan |
last post by:
I have a problem with port forwarding and I have been working on it for over
2 weeks with no luck. I have found C programs that almost work and Java
programs that almost work, but nothing that does what I need. I've even
tried writing a port forwarder in Java and found problems that nobody seems
to have the answer to in forums. I need to make it work essentially the
same on both Windows and Linux.
There is one program, in C, that...
| |
by: JT |
last post by:
Hi,
I've just realized that I'm not as smart as I thought I was. I have no
problem creating Windows apps, class libraries, using windows
references, etc. But, I absolutely cannot create and use a web service
and Windows application pair in VS 2005, even following the walkthrough
in Help. There are differences in some of the steps they outline that
I assume are due to an old example and I am using VS 2005. On my
latest attempt I...
|
by: garyusenet |
last post by:
This is the first time i've worked with openfile dialog.
I'm getting a couple of errors with my very basic code.
Can someone point out the errors in what i've done please.
==========================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
|
by: Lars Uffmann |
last post by:
Does anyone have a good suggestion?
I am currently using Eclipse Europa with the C-Development Toolkit (plus
gnu-toolchain under cygwin) and the Widestudio Native Application
Builder plugin.
While I am surprised I actually got this configured and running, it has
some things that I do not like too much - especially a couple of bugs
(build tools vanishing from the builder settings upon switching between
projects, for example). And then...
|
by: Curtis Rutland |
last post by:
Building A Silverlight (2.0) Multi-File Uploader
All source code is C#. VB.NET source is coming soon.
Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and Silverlight 2.0. To get these tools please visit this page
Get Started : The Official Microsoft Silverlight Site
and follow Step 1.
Occasionally you find the need to have users upload multiple files at once. You could use multiple FileUpload...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |