User interfaces in console (dialog like)

2005-06-23 Thread Negroup
Hi all.

I need to provide to my users a graphical interface to be used from
os' command line.
Initially I thought something equivalent to Unix dialog, and googling
around I have found Python Dialog
(http://pythondialog.sourceforge.net/). This would be the perfect
solution for me if it could be cross platform. However, it doesn't
work on Windows, just on Linux/Unix.

Do you guys know an alternative that fits my needings without moving
from Python?

Thanks,
-ng
-- 
http://mail.python.org/mailman/listinfo/python-list


Add methods to string objects.

2005-06-30 Thread Negroup
Hi all.
I'm writing a simple Python module containing functions to process
strings in various ways. Actually it works importing the module that
contains the function I'm interested in, and calling
my_module.my_function('mystring').

I was just asking if it is possible to "extend" string objects'
behaviour so that it becomes possible to invoke something like
'anystring'.my_method().

1) does the latter approach bring some advantages?
2) how is it possible to achieve this goal? 

Any pointer will be appreciated, thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Create datetime instance using a tuple.

2005-07-06 Thread Negroup
Hi, all.
I would like to know if it is possible to create a datetime instance
using a tuple instead of single values.

I mean:
>>> from datetime import datetime
>>> t = (1, 2, 3)
>>> dt = datetime(t)
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: function takes at least 3 arguments (1 given)

(class datetime(year, month, day[, hour[, minute[, second[,
microsecond[, tzinfo])

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Create datetime instance using a tuple.

2005-07-07 Thread Negroup
> 
> Use:
> dt =3D datetime(*t)
> 

Thanks for the quick reply. 
I can't find any doc about '*' used in this context. Have you some url
or suggestion for which terms search in Google?
-- 
http://mail.python.org/mailman/listinfo/python-list


Basic questions about packages/modules.

2005-06-10 Thread Negroup
Hi, first of all sorry for boring you with a such simple request. I'm
using Python since few days, and I like it even if I'm not yet in
confidence. I'd like to organize my programs in hierarchical
structures, thus I thought that packages could be the solution,
however I have some difficulties understanding their utilization (even
after reading chapter 6 of the tutorial, about modules).

Now an example (silly) to clarify my doubts:

This is the structure:
main.py
importers/
__init__.py (empty)
importer1.py
config/
__init__.py (empty)
parameters.py

main.py
===
from importers import importer1
print importer1.display()

importers/importer1.py
==
from config import parameters
def display():
return '-' * parameters.counter

config/parameters.py

counter = 5


All works fine when I run "python main.py", while I get an error
trying to run "python importers/importer1.py":

Traceback (most recent call last):
  File "importers/importer1.py", line 1, in ?
from config import parameters
ImportError: No module named config

Can you explain why does that happen? It prevents me to test
importer1.py alone.

TIA,
negroup
-- 
http://mail.python.org/mailman/listinfo/python-list