How to write GUI and event separately in wxPython??

2007-07-30 Thread Jia Lu
HI all I am making an application with wxpython. But I got a problem when I want to change the display string according to process status. I passed the frame to the processing function and use the frame.txtobj to change displaying strings. I found it is a bad method to do that. Can any one

Can string be callable as a method ?

2007-05-28 Thread Jia Lu
', 'random']] But how can I call them from that list?? Thank you. Jia Lu -- http://mail.python.org/mailman/listinfo/python-list

How to do this in python with regular expressions

2007-05-25 Thread Jia Lu
Hi all I'm trying to parsing html with re module. html = TABLE BORDER=1 cellspacing=0 cellpadding=2 TR TH nowrapDATA1/THTH nowrapDATA2/HTTH nowrapDATA3/ HTTHDATA4/TH /TR TRTDDATA5/TDTDDATA6/TDTDDATA7/TDTDDATA8/TD/TR /TABLE I want to get DATA1-8 from that string.(DATA maybe not english

Many-to-many pattern possiable?

2007-05-19 Thread Jia Lu
Hi all I see dict type can do 1-to-1 pattern, But is there any method to do 1-to-many, many-to-1 and many-to-many pattern ? What about using some Serialized objects? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Why canNOT import from a local directory ?

2007-05-18 Thread Jia Lu
Hi all I created a folder named *lib* and put a py file *lib.py* in it. In the upper folder I created a py file as: CODE import lib.lib def main(): __doc__ lib.lib.test() # if __name__ == __main__: main() But I got an error :

Re: Why canNOT import from a local directory ?

2007-05-18 Thread Jia Lu
You need to define a file __init__.py in your newly created lib directory. Thank you very much :) -- http://mail.python.org/mailman/listinfo/python-list

Flat DB seeking speed

2007-04-21 Thread Jia Lu
, pickle(cPickle), shelve, marshal Any advice? Thank you. Jia Lu -- http://mail.python.org/mailman/listinfo/python-list

Combinate 2 lists to a dict ?

2007-04-18 Thread Jia Lu
Hi all. I have 2 lists, a = [1,2,3] b = [ooo,aaa,ppp] What is the fastest way to make a dict like {1:ooo,2:aaa, 3:ppp} ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Combinate 2 lists to a dict ?

2007-04-18 Thread Jia Lu
Hi all. I have 2 lists, a = [1,2,3] b = [ooo,aaa,ppp] What is the fastest way to make a dict like {1:ooo,2:aaa, 3:ppp} ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with algorithm

2007-04-13 Thread Jia Lu
this? Thanx Jia LU -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with algorithm

2007-04-13 Thread Jia Lu
If you just expand the length to five million* or so, one of those strings will contain all the works of Shakespeare. Oops, you have this formula in math? Actually I want to scan a range of network for some certain files. -- http://mail.python.org/mailman/listinfo/python-list

File DB instead of real database?

2007-04-13 Thread Jia Lu
Hello all I donot want to use a real DB like MySQL ... But I need something to save about more than 1000 articles. Is there any good ways? Thanx Jia Lu -- http://mail.python.org/mailman/listinfo/python-list

Problem with algorithm

2007-04-12 Thread Jia Lu
Hi all. I want to create a large list like: ~ Is there any good algorithm to do this? Thanx Jia Lu -- http://mail.python.org/mailman/listinfo/python-list

Can anyone explain a part of a telnet client code to me..

2007-02-10 Thread Jia Lu
Hello I have a program that can telnet to a host. But I cannot understand from [for c in data] part, can anyone explain it to me? Thank you very much. [CODE] import sys, posix, time from socket import * BUFSIZE = 1024 # Telnet protocol characters IAC = chr(255) # Interpret as command

Can I import a file without file extension .py?

2007-01-31 Thread Jia Lu
Hi all I wonder if I can import a file with other file extensions ? Can I do that only with python? Thank you Jia Lu -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I import a file without file extension .py?

2007-01-31 Thread Jia Lu
def make_module_from_file(module_name, file_name): Make a new module object from the code in specified file from types import ModuleType module = ModuleType(module_name) module_file = open(file_name, 'r') exec module_file in module.__dict__

Re: Q: Why Python is bad for web from the point of URLs?

2007-01-24 Thread Jia Lu
But you can do capsulation to them. On 1月24日, 午後7:50, techtonik [EMAIL PROTECTED] wrote: A: Because you need three modules to parse, edit and reassemble query string. urlparse, cgi and urllib -- http://mail.python.org/mailman/listinfo/python-list

Is there any python-twisted tutorial or texts?

2006-12-18 Thread Jia Lu
Hi all I want to study twisted of python . But I donot know how to start. Any suggistions? Thank you -- http://mail.python.org/mailman/listinfo/python-list

How to use MySQL without MySQLdb module

2006-12-06 Thread Jia Lu
Hi all. I am using a hosting space with python cgi. But this host haven't got MySQLdb installed. Is there any methods to connect to Mysql without MySQLdb. Or any other DB methods with original python release? Thanx -- http://mail.python.org/mailman/listinfo/python-list

How to turn AUTOCOMMIT ON with cx_Oracle

2006-12-01 Thread Jia Lu
Hi all. I use cx_Oracle to connect to an Oracle9i DB. And I want to turn on AUTOCOMMIT function. I see that cur.execute(SET AUTOCOMMIT ON) cannot work. Is there any method to do that ?? Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to turn AUTOCOMMIT ON with cx_Oracle

2006-12-01 Thread Jia Lu
Paul McGuire のメッセージ: AUTOCOMMIT is a dangerous crutch, beware. Ok for single record updates, but if you need to update 2 records in synch, AUTOCOMMIT leaves you open to hard-to-debug bugs (will work ok in development under light load, then fail intermittently with concurrent users). Thanx.

Re: wxFrame don't have Bind attribute ??

2006-11-17 Thread Jia Lu
Franz Steinhaeusler wrote: Is it really an instance of wx.Frame? What do you get, if you make a print self statement? sovled it I think it is an installation problem. I used yum on FC6 to install wxPython 2.6 But after that I got that error. Now I uninstalled them and did an installation of

Re: ANN: wxPython 2.7.2.0

2006-11-08 Thread Jia Lu
Robin Dunn wrote: Announcing -- Thanx. But I found wxPy's release speed is too fast that we nearly cannot catch up with it :) -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__ function problem

2006-11-07 Thread Jia Lu
In Python, the real constructor is called __new__, Carl Banks But the code below won't invoke __new__: [CODE] class Test: def __new__(self, value): print __new__,value def __init__(self,value): print __init__,value x = Test(testing) [/CODE] --

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread Jia Lu
Steve Holden のメッセージ: Perhaps you could show us the code that's failing, the code is : code #!/usr/bin/python -tt __author__ = Jia Lu [EMAIL PROTECTED] __verstion__ = 1.0.0 import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, MyFrame, size=(300,300

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread Jia Lu
Frank Millman のメッセージ: This works perfectly for me, using wxPython 2.6.3.2, on both Linux and Windows. What platform are you using? Yes this works OK for me too on my FedoraCore 5, but cannot work on my FedoraCore 6... -- http://mail.python.org/mailman/listinfo/python-list

wxPython changed ??

2006-10-29 Thread Jia Lu
Hi all. I'm using wxPython 2.6.3.2-2 on FC 6. I wrote a demo used 'self.Bind(xx)' but I got an error says: MyFrame instance has no attribute 'Bind' I did that when I used FC 5 and it worked. Is new wxPy changed about the Bind method?? thanx --

Re: How to access file last modified dates on each file in a directory

2006-10-29 Thread Jia Lu
[EMAIL PROTECTED] wrote: Greetings, I am attempting to view all files in a directory and if those files have not been modified within the last couple days I will remove them. In order to do this I need to look at the file date modied and check the date. I know how to look at each file name

[wxPython] wxFrame don't have Bind attribute ??

2006-10-29 Thread Jia Lu
Hi all I am using wxPy 2.6.3.2-2, But when run an application with self.Bind , I got an error that there is no Bind. How can I fix it. thanx -- http://mail.python.org/mailman/listinfo/python-list

Why I cannot Exit python shell ??

2006-10-22 Thread Jia Lu
Hi all. After using python shell (IDLE) for a while, I typed commands below to exit . But error ocurred. raise SystemExit Traceback (most recent call last): File pyshell#10, line 1, in module raise SystemExit SystemExit sys.exit(0) Traceback (most recent call last): File

How to convert this list to string?

2006-10-18 Thread Jia Lu
Hi all I have a list like: list [1, 2, 3] list[1:] [2, 3] I want to get a string 2 3 str(list[1:]) '[2, 3]' How can I do that ? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert this list to string?

2006-10-18 Thread Jia Lu
Thank you very much. I memoed all you views. :) -- http://mail.python.org/mailman/listinfo/python-list

Cannot import a module from a variable

2006-10-15 Thread Jia Lu
Hi all: I try to do things below: import sys for i in sys.modules.keys(): import i Traceback (most recent call last): File pyshell#67, line 2, in module import i ImportError: No module named i But it seems that import donot know what is i ? why? Thanks/ --

Re: A curses-game I need help with.

2006-10-10 Thread Jia Lu
try: import curses except ImportError: print Missing the Curses-library. print Please install the curses-library correctly. SystemExit ~ Does this work ? Maybe *raise SystemExit* ?? --

[curses] Instead of window.refresh() or window.redrawwin() ?

2006-10-09 Thread Jia,Lu
Hi all. I wrote a program to get key press and echo to the screen at once. But I found I must use refresh() to let it show in the screen. Is there a method which can show charactors at once without refresh() ?? Thanks -- http://mail.python.org/mailman/listinfo/python-list

[Linux] Detect a key press

2006-10-05 Thread Jia,Lu
Hi all I write a program to detect key press,but , why there is a *space* before the character I typed.?? #!/usr/bin/env python import sys import tty import termios i = sys.stdin.fileno() o = sys.stdout.fileno() backup = termios.tcgetattr(i) def loop(): while 1: ch =

How to get keyboard event in Linux console?

2006-10-03 Thread Jia,Lu
Hi all, I want to deal keyboard event in Linux console. Example: I Create a deamon at background and when I press F1 key then print Hello at Console. Can python do it? with which module? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

[Q]An error with my module in C

2006-10-02 Thread Jia,Lu
hello,all. I wrote a module in C as below, BUT msg() method cannot work allright. #include stdio.h #include python2.4/Python.h static PyObject *Roka_msg(PyObject *self,PyObject *args) { printf(Roka Python lib. Version 1.0\n); } static PyObject *Roka_func(PyObject *self,PyObject