[Tutor] (no subject)

2005-08-25 Thread Jorge Louis de Castro
Hi, What is the best way to split a unicode string in its characters? Specifically, having this unicode chinese string u'\u8C01\u4ECA\u5929\u7A7F\u4EC0\u4E48 I want to either split all its characters: [\u8C01,\u4ECA,\u5929,\u7A7F,\u4EC0,\u4E48] or insert a space between each character: \u8C01

[Tutor] cPickle usage

2005-08-25 Thread Jorge Louis de Castro
Hi, [Sorry for the repost, there was a typo previously] I think I may have misinterpreted the syntax of cPickle. I have dumped data onto a file using: output = codecs.open(".\\"+self.filename, "ab") cPickle.dump(self.terms, output) cPickle.dump(self.username, output) cPickle.dump(self.age, outp

[Tutor] (no subject)

2005-08-25 Thread Jorge Louis de Castro
Hi, I think I may have misinterpreted the syntax of cPickle. I have dumped data onto a file using: output = codecs.open(".\\"+self.filename, "ab") cPickle.dump(self.terms, output) cPickle.dump(self.username, output) cPickle.dump(self.age, output) cPickle.dump(self.gender, output) cPickle.dump(se

Re: [Tutor] Thread deamon

2005-08-22 Thread Jorge Louis de Castro
Ok, better question. Are these two equivalent: def run_server(socket): ... 1) thread = Thread(target=run_server, args=(server,)) #thread.setDaemon(True) thread.start() 2) server.listen(1) thread.start_new_thread(run_server,(server,)) So that I can uncomment the setDaemon() method? chrs j

[Tutor] Thread deamon

2005-08-22 Thread Jorge Louis de Castro
Hi, Anyone knows how to setDaemon(True) or pass it as an argument to start_new_thread() with the code snippet below? server.listen(1) thread.start_new_thread(run_server,(server,)) Otherwise the thread stops running when I close the telnet client (even using Unix's & operator for background ru

Re: [Tutor] PinYin support on Entry widgets

2005-08-21 Thread Jorge Louis de Castro
Ignore this one, works as expected (coffee needed, you see). j. >From: "Jorge Louis De Castro" <[EMAIL PROTECTED]> >Reply-To: Jorge Louis De Castro <[EMAIL PROTECTED]> >To: >Subject: [Tutor] PinYin support on Entry widgets >Date: Sun, 21 Aug 2005 10:43:14

[Tutor] PinYin support on Entry widgets

2005-08-21 Thread Jorge Louis De Castro
Hello,   Is it possible to have the Entry widgets behave like everything else on Windows when you change the language settings? When I change my settings from English to Chinese all Wins' textboxes and forms allow inserting of chinese characters. It does not work like that with Tkinter widg

[Tutor] String formatting

2005-08-20 Thread Jorge Louis De Castro
Hi,   I'm slighty confused with python's string formatting operators.   Why is it that this prints as a string:   channel, info = server.accept() print "Connection from", info   And this doesn't?   channel, info = server.accept() print "Connection from %s" % info   Also, anyone knows how do

Re: [Tutor] i18n on Entry widgets

2005-08-17 Thread Jorge Louis de Castro
me. Chrs j. From: Kent Johnson <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: tutor@python.org Subject: Re: [Tutor] i18n on Entry widgets Date: Wed, 17 Aug 2005 13:27:24 -0400 Jorge Louis de Castro wrote: Hi, How do I set the encoding of a string? I'm reading a string on a Entry w

[Tutor] i18n on Entry widgets

2005-08-17 Thread Jorge Louis de Castro
Hi, How do I set the encoding of a string? I'm reading a string on a Entry widget and it may use accents and other special characters from languages other than English. When I send the string read through a socket the socket is automatically closed. Is there a way to encode any special characte

Re: [Tutor] Event handler for optionmenu

2005-08-15 Thread Jorge Louis de Castro
x, mode) # HOW TO ACCESS THE VAR VALUE HERE?? #varValue = root.getvar(name) #print varValue print "Client Started" try: conn=StartWin() conn.initialize() root=Tkclient() thread.start_new_thread(listen_server, (client, root)) root.startWindow() e

[Tutor] Event handler for optionmenu

2005-08-15 Thread Jorge Louis De Castro
Hi,   I have an optionmenu widget that works just fine except that  can't find docs to get hold of events as they happen, kinda like the command=XYZ of other widgets like buttons.   The code I'm using for the option menu is the following:   OPTIONS = ["en","pt","es","it","fr","de"]self.start

[Tutor] Python hosting again

2005-08-11 Thread Jorge Louis De Castro
  Hello,   I'm interested in writing with my own Python implementation of a Jabber IM server and client. Anyone knows where I could host my Python Jabber IM server for a reasonable monlthy fee? It doesn't need to be a top-notch place since my goal is to test something else, not the scalabili

Re: [Tutor] Tkinter Menus

2005-08-09 Thread Jorge Louis de Castro
kinter Menus >Date: Tue, 09 Aug 2005 07:39:35 -0400 > >Jorge Louis De Castro wrote: > > Hello, > > > > I'm having this issue with Tkinter. I have a frame with all my buttons, > > checkboxes et al, and all is working fine. I want to add menus and added

Re: [Tutor] Tkinter Menus

2005-08-09 Thread Jorge Louis de Castro
Ah, sorry. Here is the definition of fCanvas: class LogAnalyzerGUI(Frame): def __init__(self, parent=0): Frame.__init__(self, parent) self.type = 2 self.terms = 0 self.master.title('XML Analyzer') self.buildUI() def buildUI(self): fCanvas = Frame(self) Label(fCanva

[Tutor] Tkinter Menus

2005-08-09 Thread Jorge Louis De Castro
Hello, I'm having this issue with Tkinter. I have a frame with all my buttons, checkboxes et al, and all is working fine. I want to add menus and added the following to my frame (fCanvas) code: # create a toplevel menu menu = Menu(fCanvas) fCanvas.config(menu=menu) # create a pu

Re: [Tutor] Color text in Text widget

2005-08-01 Thread Jorge Louis de Castro
I found a way to do it but I'm not sure it is the cleanest. Maybe someone else on this list can offer a better solution. I use the text's configuration to define tags that I apply to sections of the text. For example: txtBox = Text(self, width=80, height=20) # configuration for red txtBox.tag_c

Re: [Tutor] Send attachment

2005-08-01 Thread Jorge Louis De Castro
rtfile('foo.eml')   I think it's neat, it does what I want in an elegant way, and it keeps me from mixing languages and all that jazz.   chrs j.   - Original Message - From: Liam Clarke To: Jorge Louis De Castro Cc: tutor@python.org Sent: Friday, Ju

Re: [Tutor] single executable

2005-07-31 Thread Jorge Louis de Castro
ho off$\r$\n' StrCpy $2 $TEMP 2 FileWrite $1 '$2$\r$\n' FileWrite $1 'cd $PLUGINSDIR$\r$\n' FileWrite $1 '${exe}$\r$\n' FileClose $1 nsExec::Exec $0 Delete $0 SectionEnd >From: [EMAIL PROTECTED] >To: "tutor@python.org"

[Tutor] single executable

2005-07-31 Thread Jorge Louis De Castro
Hi all, I wrote a few small applications, couple hundred of lines each and one of them playing around with tkinter. Now py2exe leaves 10 or so files of all sorts and one executable to "distribute", and cx freeze isn't much better. Furthermore, my 15KB code becomes a whopping 8Meg distributa

[Tutor] single executable

2005-07-31 Thread Jorge Louis De Castro
Hi all, I wrote a few small applications, couple hundred of lines each and one of them playing around with tkinter. Now py2exe leaves 10 or so files of all sorts and one executable to "distribute", and cx freeze isn't much better. Furthermore, my 15KB code becomes a whopping 8Meg distributa

[Tutor] single executable

2005-07-31 Thread Jorge Louis De Castro
Hi all, I wrote a few small applications, couple hundred of lines each and one of them playing around with tkinter. Now py2exe leaves 10 or so files of all sorts and one executable to "distribute", and cx freeze isn't much better. Isn't it possible to create a single, bundled windows execut

[Tutor] return values from function

2005-07-30 Thread Jorge Louis De Castro
Hi all, I have the following code to traverse a directory structure from a given path: import os, fnmatch, re folders = [] r = re.compile(r'file_filter') # msn_username is passed by the user def browse(junk, dirpath, namelist): for name in namelist: if r.search(name): folders.append

[Tutor] Quickest way to find a folder on windows

2005-07-26 Thread Jorge Louis De Castro
Hi all,   What is the quickest way to find/search a folder on windows? Specifically, I want to find the 'My Documents' folder on different machines but since this one lies in different user-specific folders (the user account on XP) I'm being forced to traverse the whole drive looking for it

[Tutor] Efficient word count

2005-07-21 Thread Jorge Louis De Castro
Hi there,   I was wondering, and maybe this is because I come from a different programming language background, but is a word count using len(list) after a string.split, efficient if there are many words? Or should I write my own word count for large(ish) blocks of text (500-1000)?   Cheers j

[Tutor] Send attachment

2005-07-21 Thread Jorge Louis De Castro
Hello,   Any ideas how I can use Python and the Windows API to open a PC's mail client and send an attachment? The idea is saving some data onto a file and then invoke the email client (OE or Outlook or whatever is the default on the machine) with the recipient's address filled in and the fi

[Tutor] single file .exe

2005-07-20 Thread Jorge Louis De Castro
Hello,   Is there a way of creating a Windows exe from a py file that does not involve unzipping several files onto a folder? Does someone know of a program that wraps all the files needed into one single (non-installable) executable?   Cheers jorge ___

[Tutor] Learning Python with a Simple IM

2005-07-10 Thread Jorge Louis De Castro
Hello,   I am a Java Developer that wants to learn Python by doing. I am loving this initial vibe I'm getting out of Python. However, because I feel programmers of a certain languages bring with them certain vices when moving to other languages, I'd like to have feedback from seasoned Pytho