Malcolm Greene wrote:

> Ed/Paul,
> 
> If one is developing Python/Dabo applications, how do you program for OS
> specific issues like:
> 
> - screen size and color resolution
> - desktop space available for application (single/multi-monitor setups)
> - system metrics (default colors, sounds, fonts, etc)


You basically don't deal with it. You let the platform/user set it how 
they want. If you have multi-monitor, for instance, there's nothing in 
Python/Dabo or your code to limit that. IOW, we don't dictate what the 
user's setup needs to be. The apps are fully native on the given platform.


> - interface to clipboard
> - printer properties and control
> - available memory and ability to control max memory usage like
> sys(3050)


Dabo hasn't wrapped these, but there are wx functions available to set 
them. Not sure about limiting memory, actually.

> - pointing device properties and events (mouse wheel events)


dabo.dEvents.MouseWheel event, among a whole host of other mouse events.

> - common dialogs (file, folder, color, font, messagebox, etc)


dabo.ui.getFile(), getFolder(), getColor(), getFont()
dabo.ui.dMessageBox class
dabo.ui.stop(), info(), areYouSure() convenience functions.

> - path related information


Available in varying ways. What do you mean specifically?

> - OS event binding


You'd have to write code to a specific platform using ctypes. I've never 
needed this.

> - timer events, system date/time values


Available.

> - keyboard events


dabo.dEvents.KeyPress, KeyUp, KeyDown, KeyChar

> - access to environment variables (SET <var>=<value>)

import os
os.environ is a dict of name:value pairs.

> - network card mac address

A quick search doesn't yield something platform-portable. On Windows, 
you could parse the output of ipconfig /all. On Mac, Linux, the output 
of ifconfig.


> - guid generation

dabo.lib.getRandomUUID()

> - name and path of running executable (and is it already running)

import sys
executable = sys.argv[0]

Finding out if it is already running - various ways. Who cares?


> - list of drives and drive properties (size, free space)

Use the windows api functions for that.

> - access to command line parameters


args = sys.argv[1:]

Or use the built-in option parser.

> - font discovery


dabo.ui.getSystemFonts()

> - number and type of CPUs

Unsure.

> - OS version info

import platform
platform.platform()

> - starting, enumerating/monitoring, and stopping other processes/tasks
> - returning application exit codes
> - currently logged in user
> - system power status (battery info, etc)
> - pipes, shared memory, mutexes
> - audio, video output
> - scanner based input


Python is a programming language, and as such it has available to it all 
that the platform offers. Lots of this stuff is very platform-specific, 
while some python provides in platform-portable ways.

I don't think you'll get stuck not being able to get at this stuff, 
though. If you can get at it with Windows API calls from VFP, you can 
get at it with the same API calls from Python.

Paul

-- 
http://paulmcnett.com


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to