tkinter modifying multiple widgets with one scrollbar

2006-06-23 Thread spohle
hi

how can i modify multiple widgets with one scrollbar ?

thanks in advance

sven

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


import structures

2007-04-30 Thread spohle
hi,

i have written a small project for myself all in seperate classes and
each of the classes lives in a seperate file. now i am looking for an
import structure something like import wx, and then have access to all
my classes just like wx.Button or wx.BoxSizer etc.

as of now i have a __init__.py file in the directory with:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

but i still have to import each class by it's own. im really looking
for something like import wx
and then get all my access right away under this new namespace.

thank you in advance

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


Re: import structures

2007-04-30 Thread spohle
On Apr 30, 8:00 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
> On Apr 30, 9:56 am, spohle <[EMAIL PROTECTED]> wrote:
>
>
>
> > hi,
>
> > i have written a small project for myself all in seperate classes and
> > each of the classes lives in a seperate file. now i am looking for an
> > import structure something like import wx, and then have access to all
> > my classes just like wx.Button or wx.BoxSizer etc.
>
> > as of now i have a __init__.py file in the directory with:
> > from pkgutil import extend_path
> > __path__ = extend_path(__path__, __name__)
>
> > but i still have to import each class by it's own. im really looking
> > for something like import wx
> > and then get all my access right away under this new namespace.
>
> > thank you in advance
>
> If it really is a small project, consider just putting all the classes
> into a single module, say spohlePkg.py.  Then your users would import
> this module using "import spohlePkg", and would access the classes as
> "spohlePkg.ClassA", "spohlePkg.ClassB", etc.
>
> -- Paul

yeah i had that, but my classes grew really fast and i decided to
split them up. but you're right that in one file that would solve my
problem. still hoping to find a way for the seperate files.

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


Re: import structures

2007-04-30 Thread spohle
On Apr 30, 8:16 am, "Hamilton, William " <[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > From: [EMAIL PROTECTED]
> [mailto:python-
> > [EMAIL PROTECTED] On Behalf Of spohle
> > Sent: Monday, April 30, 2007 10:03 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: import structures
>
> > On Apr 30, 8:00 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
> > > On Apr 30, 9:56 am, spohle <[EMAIL PROTECTED]> wrote:
>
> > > > hi,
>
> > > > i have written a small project for myself all in seperate classes
> and
> > > > each of the classes lives in a seperate file. now i am looking for
> an
> > > > import structure something like import wx, and then have access to
> all
> > > > my classes just like wx.Button or wx.BoxSizer etc.
>
> > > > as of now i have a __init__.py file in the directory with:
> > > > from pkgutil import extend_path
> > > > __path__ = extend_path(__path__, __name__)
>
> > > > but i still have to import each class by it's own. im really
> looking
> > > > for something like import wx
> > > > and then get all my access right away under this new namespace.
>
> > > > thank you in advance
>
> > > If it really is a small project, consider just putting all the
> classes
> > > into a single module, say spohlePkg.py.  Then your users would
> import
> > > this module using "import spohlePkg", and would access the classes
> as
> > > "spohlePkg.ClassA", "spohlePkg.ClassB", etc.
>
> > > -- Paul
>
> > yeah i had that, but my classes grew really fast and i decided to
> > split them up. but you're right that in one file that would solve my
> > problem. still hoping to find a way for the seperate files.
>
> If you've got modules a, b, and c, you can create a wrapper module d
> that imports from each of those.
>
> from a import *
> from b import *
> from c import *
>
> Then, import d and use it as the module name.  So if a had a SomeThing
> class, you could do this:
>
> import d
> x = d.SomeThing()
>
> ---
> -Bill Hamilton


that doesn't seem to work for me. the from a import * will only give
me a not d.a

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


formatting strings to have the same width

2007-03-17 Thread spohle
hi,

i got random strings and wanna attach a " |  " at the end. now if i
print them i want the | to always be underneath each other. example
code:

foo = ["aaa", "1232"]
for each in foo:

print foo[0].center(10, " ") + " | "
foo2 = "1232"
print foo2.center(10, " ") + " | "

even though i define a constant width on the strings the | don't show
up underneath each other.
any ideas ?

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


Re: formatting strings to have the same width

2007-03-17 Thread spohle
sorry the code should read:

foo = ["aaa", "1232"]
for each in foo:
print each.center(10, " ") + " | "

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


calling class instances and their methods

2007-03-26 Thread spohle
hi,

i created an instance of a my own class which has methods and all. now
i get an outside function called, which is unfortunatly not aware of
the instace at all (i don't control how this outside function is
called). but i would like to get access back to my instance and it's
methods.

is there any clean way of doing this ?

thanks in advance

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


writing my own extension

2007-04-10 Thread spohle
hi,

i use a lot the enumerate in my scripts and got really interested in
possibly writing my own enumerate as an extension, for which i would
want to extend it to be able to pass a start and step attribute.

can anyone point me on my way with good examples for that and how to
write extensions ?

thank you in advance

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


MAC Laptop right click/drag mouse button TKinter

2006-05-22 Thread spohle
hi,

i programmed a small app with TK and use TK. some of the functions are
called with events like rightDrag and rightClick on an item on the
canvas. that works fine on a pc. on my mac laptop i only have the one
button, so im used to use CTRL+ Mouse Button. that doesn't work with
TK.

any ideas how to get around that problems ?

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


sort a dictionary by keys in specific order

2006-05-26 Thread spohle
hi i have a normal dictionary with key and value pairs. now i wanna
sort by the keys BUT in a specific order i determine in a list !? any
ideas

dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'}

list = [key2, key3, key1]

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


Re: sort a dictionary by keys in specific order

2006-05-26 Thread spohle
how do i get the result back into the dictionary ?

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


Re: sort a dictionary by keys in specific order

2006-05-26 Thread spohle
i write the dict out to a file, not with file methods but rather with
an inhouse python code. unfortunatly the order plays a big role for
that.

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