python newt under win32

2005-01-23 Thread Gabriel B.
Anyone has any info if there's something similar to Newt  lib for win32?

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


add indexes on the fly to lists

2005-01-24 Thread Gabriel B.
I wanted to make a list index work as the index of the data in the
database. something like

database:
idx
item_description
item_value

being imported to my program as:
x[idx][0]= item_description
x[idx][1]= item_value

the problem is that there will be some hundred items and possible the
idx wil vary from 1 to 600 (it's not linear as items got deleted the
idx should not be reused)

will it still be an easy solution or just a waste of resources (having
a 600-sized list for 100 elements)

I'm very new to python and apreciate any hints on that.

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


is this use of lists normal?

2005-01-24 Thread Gabriel B.
I just sent an email asking for hints on how to import data into a
python program

As i said earlier i'm really new to python and besides being
confortable with the syntax, i'm not sure if i'm on the right track
with the logic

I'm asking for hints again here at the list because i think i'm
already into premature optimization...

My object model ended up as

DataStorageObj
|-itemsIndex (list, could very well be a set...)
|  |-[0] = 0
|  |-[1] = 1
|  |-[2] = 5
|  '-[3] = 6
'-Items (list)
   |-[0] = ['cat food', '12,20']
   |-[1] = ['dog food', 8,00']
   |-[2] = ['dead parrot', '25,00']
   '-[3] = ['friendly white bunny', '12,25']

the list itemsindex has the DB index of the data, and the list items
has the data.
So if i want something like "SELECT * FROM items WHERE idx=5" i'd use
in my program
self.items[ self.itemsIndex.index(5) ] 
i reccon that's not much nice to use when you're gona do /inserts/ but
my program will just read the entire data and never change it.

Was i better with dictionaries? the tutorial didn't gave me a good
impression on them for custom data...
Tupples? the tutorial mentions one of it's uses 'employee records from
a database' but unfortunatly don't go for it...

i think the 'ideal' data model should be something like
({'id': 0, 'desc': 'dog food', 'price': '12,20'}, ...)
But i have no idea how i'd find some item by the ID within it withouy
using some loops

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


tk global bindings

2005-01-29 Thread Gabriel B.
I'm starting to write a POS application UI's module.

There's no mouse, just a bunch of global shortcuts.

the problem is that TK doesn't have global shortcuts! Is there a
work-around or i will have to attach 80 or so bindings for every input
element?

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


naive doc question

2005-01-29 Thread Gabriel B.
Is it just me that can't find a full reference in the docs?

I wanted a list of all the methods of dict for example... where can i find it?

Thanks, and sorry if this question is just dumb, i really can't find it
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-08 Thread Gabriel B.
> > users.  For example, from their FAQ, it seems that no precompiled
> > binaries will be provided.  Support for comercial compilers will not be
> > built in, only for gcc (through Cygwin?).
> 
> Isn't this just the same thing with a different spin. There was always
> an available distribution for linux for non-commercial use. Windows was
> always the problem. You still can't use it for windows without knowing
> how to compile the thing on windows.

Well, if it's GPLed, can't i simply compile it and distribute a GPLed
.DLL with the source code for everyone?
-- 
http://mail.python.org/mailman/listinfo/python-list


trolltech comitment (was:Big development in the GUI realm)

2005-02-08 Thread Gabriel B.
On Mon, 07 Feb 2005 20:56:44 -0800, Courageous <[EMAIL PROTECTED]> wrote:
> Follow the copyright holder's wishes.
> 
> That's fair. After all, it's free, so they're doing you a damn
> big favor.

I'm terrible sorry to extend this topic even furter, but it's silly,
not to say dull to think like that.

in the first place, it's not that they're doing charity. they have
plans. if they release Qt under GPL for non-comercial use, it's
because they want to increase the user base and so be able to earn
money with the comercial fee later.

And if i'm going to write software for it, when there's plenty of
alternative that actualy works flawless under windows, why should i
stick with an option that i don't even know to wich extends i can use
the damn thing? What it they revoke this license? what it windows
longhorn has a non-backwardcompatible GDI API and a newer version of
Qt must be used, and that newer version does not have a gpl version?

If i'm going to commit to something, i like to know the lengths the
other side gona commit also.

What you said was like "Hey! it's free food! who cares if it's
rotten?" sorry, but it's just too homer simpson for me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-08 Thread Gabriel B.
> >>Considering the fact that the Qt DLL exist by themselves, that the
> >>version used is the one provided by Qt, and that the EXE uses a
> >>standard, open way to communicate with it, the above does seem to say
> >>this use would be valid.
> >>
> >>
> >
> >http://www.gnu.org/licenses/gpl-faq.html#MereAggregation
> >
> >"/.../ If modules are designed to run linked together in a shared address
> >space, that almost surely means combining them into one program.
> >
> >By contrast, pipes, sockets and command-line arguments are
> >communication mechanisms normally used between two separate
> >programs. So when they are used for communication, the modules
> >normally are separate programs. But if the semantics of the
> >communication are intimate enough, exchanging complex internal
> >data structures, that too could be a basis to consider the two parts
> >as combined into a larger program."
> >
> >

This is odd. They claim it's a GPL'ed version, but it's a trolltech
license that forces you to release your code under gpl even tought
their's not!

I'm not against a company getting it's share with their product.
that's what motivated them in the first place. but DONT LIE! don't
call it gpl when it's not.

Gpl make it very explicity it deals with the program as a whole, in
the meaning of a executable code. What they're trying to achive here
is that, by adding this paragraph, they will cover the "dll use" under
the gpl.

By that cover-all definition they came up, i can't use Internet
Explorer to see a site hosted with a gpl'ed server! i can't even use a
BSD program to grep a file!

anyway... it will only mater when people with money cares. I already
have 3 choices.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-08 Thread Gabriel B.
> However, imagine simple situation:
> 1. I write proprietary program with open plugin api. I even make the api
> itself public domain. Program works by itself, does not contain any
> GPL-ed code.

No need to continue. You write something that uses a plugin, Eolas
sues you. Don't have to mind about trolltech
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tk global bindings

2005-02-08 Thread Gabriel B.
> Oh and you of course __must__ look at the (recently updated!) New Mexico
> Tech tkinter document at:
> http://infohost.nmt.edu/tcc/help/pubs/tkinter.pdf
> 
> See page 75 and follwing for more info on keyboard bindings...

Thanks, i was looking down that doc because the first thing i looked
into it was the pack method and it talked about the grid only

...i'm still using "practical programing in Tcl and Tk" for my tk needs :)

thanks again,
Gabriel
-- 
http://mail.python.org/mailman/listinfo/python-list


tcl/tk naming scheme vs python's

2005-02-08 Thread Gabriel B.
I got my self writting nested objects to hold Tk references, then i
realizes that i was working in python and not tcl, so i switched to
flat vars... and in no time i was using more then 7 words separated by
captalization in the names... i was able to rethink my scheme to use
5... no less.

i'm i exagerating or do you people also comes to this some times?
The other choice i think i had was to use semantic names instead of
semantic and hierarchical ones.

Gabriel

PS: i resisted the force of make an example using
ButtonSpamSpamSpamSpamSpamEggsSpam
-- 
http://mail.python.org/mailman/listinfo/python-list


tk resource file for geometry?

2005-02-12 Thread Gabriel B.
i'm using almost every widget property from my pyTk programs in the
form of resources, like:
  self.tk.option_add ( "*InputClass*background", "White" )

In the widget creation i have only the Class and the Command
attribute, but i'm having to add some tk options to the geometry
method, in the case, pack. Is there a way to overcome this?

For example, every single Frame i pack i use
  self.pack(fill='both', expand=1)
I'd love to have something like:
  self.tk.option_add ( "*Frame*fill", 'both' )
  self.tk.option_add ( "*Frame*expand", 'yes' )

Is there anything like it?

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


Why Tk treat F10, F11, F12 diferently from F1...F9?

2005-02-12 Thread Gabriel B.
This is completely odd to me...

# Bind F1...F12 to <>
self.tk.event_add( '<>', # keys used to switch between the tabs 

'','','','','',

'','','','','',
'',''
)

self.master.bind_all('<>', self.__functionKeysPressed )

def __functionKeysPressed(self, event):
print event.keysym


Now, i run the program and press from F1 to F12, and i get:
F1
F2
F3
F4
F5
F6
F7
F8
F9
L1
L2


F10 simply does nothing!
F11 prints L1
F12 prints L2

The only place google takes is not very elucidating :)
http://64.233.161.104/search?q=cache:t2CnLTHob0sJ:stuff.mit.edu/afs/sipb/project/tcl/linuxbin/dpwish+tk+bind+F12%7CF11+L1%7CL2&hl=fr

Anyone has any ideia why is that?
I surely didn't mind about this if it wasn't for F10 showing nothing.
I get the return code just to use the same function (and same biding)
for the 12 buttons since i can't pass arguments to the Command option
in tk. ...And i'm already considering adding a L1 and L2 check instead
of F11 and F12 and a 'empty' check for the F10... But that would be
plain ugly.

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


Re: Why Tk treat F10, F11, F12 diferently from F1...F9?

2005-02-12 Thread Gabriel B.
On Sat, 12 Feb 2005 19:44:25 -0600, Jeff Epler <[EMAIL PROTECTED]> wrote:
> The reason that F10 does nothing is because there is already a binding
> on all for . [...]
> If you want to get rid of this binding, you would do it with something
> like
> w.bind_all("", "")
> for some widget w.

That was it. thanks.

For the record: 
The virtual bidings with <> doesn't work. You have to manually
specify the . Seems like a bugged behaviour to me. Or at least,
just very odd and intuitive.


> I don't know why you see the "L1" and "L2" keysyms.  I don't on my
> system (Fedora Core 2)

i'm on windowsXP (what makes the F10 biding by "default" even more
weird). Well, for now using the keysym_num will be more safe since i'm
still getting they correct.
-- 
http://mail.python.org/mailman/listinfo/python-list


DB Schema

2005-02-18 Thread Gabriel B.
I started to use dbschema.com but it has some big flaws (mainly
regarding keys and mysql) and besides it's being in java (wich i don't
like to code at all) it's closed source.

I'm considering starting a new GPL one in python, so, i ask if you
people already know a project like that.

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


simple input that can understand special keys?

2005-02-26 Thread Gabriel B.
i'm writting an application that will use Tinker in a newer future.
Now it's console only. I simply ommit some data on the display,
print() some other and go on. The problem is that i can't test the
actions tiggered by special keys, like Page Up/Down or the F1...12

Right now i'm using raw_input() since even the Tk version will have
only one input place, and for debuging i'm literally writting pageup,
pagedow and the F's. But i want to put it in test while i write the
GUI.

is there any hope for me? I wanted to stay only with the console for
now. And it's windows by the way :)

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


Re: workaround for generating gui tools

2005-04-11 Thread Gabriel B.
On Apr 10, 2005 11:08 PM, Bengt Richter <[EMAIL PROTECTED]> wrote:
> On Sat, 9 Apr 2005 19:22:16 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> open('mywidget_v2.txt','w').write(repr(mywidget.textview)

How about a pickle hook?

You'd just unpack the pickle data, and end up with a pointer to a
frame(?) containing all the goods, then just .pack() it into whatever
you want.
-- 
http://mail.python.org/mailman/listinfo/python-list


warning for google api users

2006-02-21 Thread Gabriel B.
the google webservices (aka google API) is not even close for any kind
of real use yet

if you search for the same term 10 times, you get 3 mixed totals. 2
mixed result order. and one or two "502 bad gateway"

i did an extensive match agains the API and the regular search
service. the most average set of results:

results 1-10; total: 373000
results 11-20; total: 151000
results 21-30; total: 151000
results 31-40; total: 373000
results 41-50; total: 373000
results 51-60; total: 373000
results 61-70; total: 151000
( 502 bad gateway. retry)
results 71-80; total: 373000
results 81-90; total: 151000
( 502 bad gateway. retry)
results 91-100; total: 373000

on the regular google search, total:  2,050,000 (for every page, of
course)

besides that, the first and third result on the regular google search,
does not apear in the 100 results from the API in this query, but this
is not average, more like 1 chance in 10 :-/

So, no matter how much google insists that this parrot is sleeping,
it's simply dead.


now, what i presume that is happening, is that they have a dozen of
machine pools, and each one has a broken snapshot of the production
index (probably they have some process to import the index and or it
explode in some point or they simply kill it after some time). and
they obviously don't run that process very often.

Now... anyone has some implementation of pygoogle.py that scraps the
regular html service instead of using SOAP? :)

Gabriel B.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to send an email with non-ascii characters in Python

2006-02-25 Thread Gabriel B.
2006/2/25, Sybren Stuvel <[EMAIL PROTECTED]>:
> Lad enlightened us with:
> > Body='Rídících Márinka a Školák Kája
> > Marík'.decode('utf8').encode('windows-1250')# I use the text written
> > in my editor with utf-8 coding, so first I decode and then encode to
> > windows-1250

what does a string became when it's decoded?

I mean, it must be encoded in something, right?
-- 
http://mail.python.org/mailman/listinfo/python-list


scope acting weird

2005-05-01 Thread Gabriel B.
i have the following code:

Ui.py:
import Tkinter as Tk
import UiMainScreen

UiMainScreen.py:
class UiMainScreen( Tk.Frame ):


and i get the following error:
  File "UiMainScreen.py", line 1, in ?
class UiMainScreen(Tk.Frame):
NameError: name 'Tk' is not defined

isn't Tk supposed to be imported globaly?
And If i import Tkinter again inside every other file, will it be
really imported several times and be independent in each file or the
python interpreter just use the subsequent imports to know where to
propagate stuff?

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