How to do this?

2005-07-30 Thread flyaflya
the codes as follow: class Base: def fun(self): print "base_fun" def fun2(self): print "base_fun2" class Foo: def __init__(self, base): self.__base = base def fun3(self): print "foo_fun3" b = Base() foo = Foo(b) my aim is:when "foo.fun3()" be called,it run as usu

[pygame]how to copy a surface to an other surface with alpha value?

2005-07-26 Thread flyaflya
I want to join some surfaces to a new big surface with alpha cannel, I want the new surface has same pixels(inclue r,g,b and alpha value) as the pixels on the source surfaces. my code as follow: surf = pygame.Surface((200,200)) surf.blit(surf1, (0,0)) surf.blit(surf2, (0,100)) . but these co

how to startup the default web browser to open a url?

2005-06-12 Thread flyaflya
I want to startup the default web browser(ie...) to open a url, "execl" can open a process, but when the process exit, the other process will exit too, has any why to deal this problem? -- http://mail.python.org/mailman/listinfo/python-list

maybe a bug in python

2005-06-05 Thread flyaflya
>>> a = {1: ("a")} >>> a[1] 'a' why not ('a')? when >>> a = {1: ((("a")))} >>> a[1] 'a' the result is 'a' too,not ((("a"))).but when use["a"] or ("a","b"),the tuple is longer than 1, it's no problem. -- [http://www.flyaflya.com/] -- http://mail.python.org/mailman/listinfo/python-li

Re: a newbie question about debug

2005-05-31 Thread flyaflya
flyaflya wrote: > I use pdb.set_trace() to debug code.the Debugger Commands "enable" and > "disable" need argumet -- "breakpoint number",but I can't find any > information about it,so how to can i get the breakpoint number? I think > "disabl

a newbie question about debug

2005-05-30 Thread flyaflya
I use pdb.set_trace() to debug code.the Debugger Commands "enable" and "disable" need argumet -- "breakpoint number",but I can't find any information about it,so how to can i get the breakpoint number? I think "disable","enable" are very useful commands... -- http://mail.python.org/mailman/lis

how to convert string to list or tuple

2005-05-26 Thread flyaflya
a = "(1,2,3)" I want convert a to tuple:(1,2,3),but tuple(a) return ('(', '1', ',', '2', ',', '3', ')') not (1,2,3) -- http://mail.python.org/mailman/listinfo/python-list

abut COM using PythonCOM

2005-05-16 Thread flyaflya
I know using ActivePython can make a COM easily,but I wander how to distribute the COM,normal COM can be installed by "regsvr32", but how to install this COM? and can the code be compiled by py2exe? -- http://mail.python.org/mailman/listinfo/python-list

Can get reference of a part of a list?

2005-05-12 Thread flyaflya
I want make a 2-D array from a list,all elements is references of list's,like this: a = [1,2,3,4] b = [ [1,2], [3,4] ] when change any elements of a, the elements of b will change too, so I can use some function for list to change b. c/c++ can work in this way,I think let b[0] = a[0:2], b[1] = a

Re: why this happend using model random?

2005-05-10 Thread flyaflya
flyaflya wrote: > Robert Kern wrote: > >> flyaflya wrote: >> >>> from random import * >>> >>> col = [0 for i in range(10)] >>> a = [col for i in range(10)] >> >> >> >> This is the problem. The list "a&quo

Re: why this happend using model random?

2005-05-10 Thread flyaflya
Robert Kern wrote: > flyaflya wrote: > >> from random import * >> >> col = [0 for i in range(10)] >> a = [col for i in range(10)] > > > This is the problem. The list "a" now has ten references to the same > object "col". They are

why this happend using model random?

2005-05-10 Thread flyaflya
from random import * col = [0 for i in range(10)] a = [col for i in range(10)] seed() for i in range(10): for j in range(10): a[i][j] = randint(0, 100) print a the result is: [[78, 65, 35, 5, 68, 60, 1, 51, 81, 70], [78, 65, 35, 5, 68, 60, 1, 51, 81, 70], [78, 65, 35, 5, 68, 60,

how to make a LAN game using python?

2005-05-06 Thread flyaflya
I want make a desktop game suports LAN connect, but pygame has nothing about network.How to let pygame suport LAN connect? have you some examples or articles about LAN connect? -- http://mail.python.org/mailman/listinfo/python-list