August 24th, 2004, 02:47 AM
newb to python: snippets/tutorials
ok, I am a newb to programming in Python, the only other language I've mastered was Basic/A-Basic, I started learning C++ but gave up at a pretty early stage.
I am currently working on developing a Network-based chat program, merely to get the systems interacting, and reading each other's data.
I was able to do this in A-Basic, and was able to get it to work pretty nicely, if anyone has any snippets of code, or if anyone can quickly write out a short tutorial on working with files and such, it would be a great help - I am currently studying many online tutorials/books about python, so I should be ok... i hope...
For a quick summary as to how mah A-Basic version worked, here I go:
(running Mac OSX.3) I simply connected to another computer on mah personal network, this brings up a folder of the connected computer, (not sure how if would work on other computer setups). In this folder I had, precreated, a folder, 'System' and within it a folder for each registered screen name that could be used. Everytime a message was sent to a user, it would check if the folder for that user existed, then send the message within a text file to said folder. Obviously, the receiving computer would see this, read it, and post it on that users screen.
That's bassically how it would work, any form of help would be VERY much appreciated. Also, feel free to e-mail me, or even message meh on AIM, I'm online just about all the time. ^^
August 24th, 2004, 01:19 PM
okay, I was thinking about it, and for simplicity's sake, I hafta ask this question...
can python, while getting an input, also multi-task, and check for existing files? if not, im gonna need to know how to tell when a key has been pressed, if anyone can answer these questions, please do. ^^
August 25th, 2004, 02:35 AM
Yes python can multi-task - That is what the threading module is all about.
I recommend reviewing the module documentation that is supplied with Python - you will find a lot of useful stuff in there for your project.
August 25th, 2004, 02:38 AM
Thanx, Ill look into using other modules, I've already got the os mod in there, I'm looking for anything else that might be helpful I pretty much solved mah problem, now its just, figuring out the best way to relay between multiple computers using python...
My code is working great for multiple networked Macs, but otherwise, its fully lacking in the whole internet department >.<
Last edited by exaHunter49; August 25th, 2004 at 02:54 AM.
August 25th, 2004, 03:20 AM
okay, I looked into the threading module, however, the only tutorials or documents that I found that were easy to understand - I have a VERY low interest in long reads lol - werent that good at getting the point accross. If anyone can show meh a simple example or something; I only need to have 2 functions done at the same time, once I get this over with, the only other thing would be to connect to another computer, but I'll figure that out on mah own.
August 25th, 2004, 03:30 AM
Try searching this forum for "threading"
While you are at it try searching for "chat" or "IRC", there have been many posts on messaging in this forum.
Last edited by Grim Archon; August 25th, 2004 at 03:33 AM.