#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    La Canada, CA
    Posts
    4
    Rep Power
    0

    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. ^^
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    La Canada, CA
    Posts
    4
    Rep Power
    0

    Real question-ness...


    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. ^^
  4. #3
  5. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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.

    grim
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    La Canada, CA
    Posts
    4
    Rep Power
    0

    Thanx


    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 03:54 AM. Reason: realization...
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    La Canada, CA
    Posts
    4
    Rep Power
    0

    Final Question(s)


    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.
  10. #6
  11. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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.

    grim
    Last edited by Grim Archon; August 25th, 2004 at 04:33 AM.

IMN logo majestic logo threadwatch logo seochat tools logo