[Tutor] win32api win32gui help
Looking for a good simple remedial course on getting my python script to talk to a Windows program. The author of the windows program has documented the api here: http://www.logger32.net/help/Logger32/Using%20the%20Logger32%20External%20Interface.htm I'm struggling to understand how to implement the messages with win32api/ gui... I've taken a stab at it here with my goal being that I just want to 'register' with the program and receive the response from it. So far I'm still scratching my head over this... I get a response for 'hwnd' but have not been able to get any confirmation that RegisterMessage, PostMessage and GetMessage are working, configured properly or...what... Running this all in WIN7 with ActivePython 2.6.6... import win32api import win32gui hwnd = win32gui.FindWindowEx(0, 0, 0, Logger32) print hwnd= , hwnd message = win32api.RegisterWindowMessage(Logger32 3) win32api.PostMessage(hwnd,message,1,9) test = win32gui.GetMessage(hwnd,0,0) print GetMessage: , test Thanks -Joe KA3NAM ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Opening C++ binary files
I have some binary files created by a program written in C++... Anyone have any experience with this and willing to share? ACSII test is easy, but not sure how the rest is encoded -Joe ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Class understanding
Hi all... Have been attempting to understand classes... Been getting along without them for a while now and feel it's time to jump in What I want to do it start a log with the logging module... I have this working without classes, but want to try... Here is a snippet of the code that I am hacking on: class logger(): import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)-12s - %(levelname)-8s - %(message)s', #format='%(asctime)s %(levelname)s %(message)s', filename='T2Notify.log', filemode='a') logging_output = logging.getLogger('logging_output.core') print Log set up def write2log(log_info): logging_output.info(log started) print written to log return() logger() logger.write2log(log_info) What I want to do it be able to set up the log, but have something outside the class be able to write log updates to write2log under the logger class... the logger.write2log() is not working :)... Any ideas, encouragement, or pointers to good docs would be helpful... I've done a lot of searching via Google on classes, and it's all confusing to me... -Joe ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Processing rows from CSV
Doing this a lot in my daily activities... your example For row in reader: If row['foo'] == 'something' : do this etc. 'row' will return a row within 'reader'... You can then pick through the headers like foo and see what is there... I have some compare scripts that do exactly what you are doing... Iterate by row, then by column comparing the data in each field. They mostly compare everything as a string. If I need to float something in a known data set, I just specifically pull that data out and change it... There are probably more efficient ways of doing it, but it only takes the script about 15 seconds to do its thing, so what is saving another second or two? :) On Tue, Nov 17, 2009 at 12:57 PM, m...@doctors.net.uk wrote: Dear Tutors, A rather general question, I'm afraid. I have found myself writing some python code to handle some CSV data, using the csv. DictReader that generates a dict for each row with the key as the column heading and the value in the file as the item. Most operations involve code of the form: (Apologies for incorrect caps) For row in reader: If row['foo'] == 'something' : do this etc. Typically I'm checking some form of consistency, or adding an element to the row based on something in the row. I know about the existence of awk/ sed etc. Which could do some of this, but I ran into some problems with date manipulation, etc that they don't seem to handle very well. I wanted to ask if anyone knew of anything similar, as I'm worried about re-inventing the wheel. One option would be to use (e.g.) sqlite and then use select/ insert commands, but personally I'd much rather write conditions in python than sql. My other question was about how I do this more efficiently: I don't want to read the whole thing into memory at once, but (AFAIK) csv.DictReader doesn't support something like readline() to deliver it one at a time. Any comments gratefully received. Matt Sent from my BlackBerry® wireless device ___ Tutor maillist - tu...@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Boolean math question
Anyone know of a good explanation of either how to perform boolean math in Python? What I am trying to do is AND two numbers together: e = 51 AND 15 00110011 0011 In this case the result should be e = 3... Ideas? -Joe ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor