Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 21st, 2005, 11:22 PM   #11
Clotters
Programmer
 
Join Date: May 2005
Posts: 60
Rep Power: 4 Clotters is on a distinguished road
Can' thank you guys, enough .


I'm going to finish chapter five of the http://www.ibiblio.org/obp/thinkCSpy/index.htm tutorial today, and I'm finding things quite interesting.

I'm picking most things up, but am having some major difficulties with creating my own functions .

Aside from that, and some of the more complex mathmatical functions (like sin), which I can't ever see myself needing to know anyway ... I'm grasping things.

Once again ... thanks guys.
Clotters is offline   Reply With Quote
Old May 22nd, 2005, 2:50 AM   #12
jonaskoelker
Newbie
 
Join Date: May 2005
Location: Denmark
Posts: 13
Rep Power: 0 jonaskoelker is on a distinguished road
Send a message via ICQ to jonaskoelker Send a message via AIM to jonaskoelker Send a message via MSN to jonaskoelker Send a message via Yahoo to jonaskoelker
creating your own functions 2-seconds howto:
def hello(): print 'hello, world'

also, note that all py2exe does is pack together the python.exe, your script and all dependencies. So yes, they have to download the interpreter, but they don't know it
__________________
now go away or I shall taunt you a second time :D
jonaskoelker is offline   Reply With Quote
Old May 22nd, 2005, 4:59 PM   #13
Clotters
Programmer
 
Join Date: May 2005
Posts: 60
Rep Power: 4 Clotters is on a distinguished road
I understand how to simply create functions, it's when something like this is used ...

def printTwice(python):
print 'python, python'

is used and then I make another intstruction like this ...

printTwice('programming'*4):

shouldn't the result look something like this ...

programming, programming, programming, programming, programming, programming, programming, programming

instead errors just occur .

Anyway it's not a HUGE issue, I can just take the extra minute to create a seperate function from scracth ... and besdies I can't imagine using it too frequently.
Clotters is offline   Reply With Quote
Old May 22nd, 2005, 5:50 PM   #14
andy_m
Newbie
 
Join Date: Feb 2005
Posts: 8
Rep Power: 0 andy_m is on a distinguished road
Works for me!
def printTwice(python): print python, python

>>> printTwice("programming "*4)
proramming proramming proramming proramming  proramming proramming proramming proramming
andy_m is offline   Reply With Quote
Old May 22nd, 2005, 6:14 PM   #15
Clotters
Programmer
 
Join Date: May 2005
Posts: 60
Rep Power: 4 Clotters is on a distinguished road
Cool, well I'm going to continue to explore Python, but I'll also branch off into trying to go back to VB6 aswell as from what I've been told it would be much easier to create something using VB.

I will continue with Python though ... from what I understand the more programming languages you can grasp the better.
Clotters is offline   Reply With Quote
Old May 22nd, 2005, 7:06 PM   #16
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

If you can muddle through VB6 then Python should be a breeze!
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old May 23rd, 2005, 10:03 AM   #17
jonaskoelker
Newbie
 
Join Date: May 2005
Location: Denmark
Posts: 13
Rep Power: 0 jonaskoelker is on a distinguished road
Send a message via ICQ to jonaskoelker Send a message via AIM to jonaskoelker Send a message via MSN to jonaskoelker Send a message via Yahoo to jonaskoelker
Quote:
Cool, well I'm going to continue to explore Python, but I'll also branch off into trying to go back to VB6 aswell as from what I've been told it would be much easier to create something using VB.
I would recommend against this, for two reasons:
(1) portability -- say you say vendor lock-in?
(2) support -- I think ms are laying off all vb6 and going all .net;
also, the last time I looked at vb, it was kludgy and will teach you bad programming habits.

Quote:
I will continue with Python though ... from what I understand the more programming languages you can grasp the better.
yes, the more programming languages you can understand, the better. But even more important: the more programming paradigms (key ideas) you can understand, the better. Know/learn object-oriented by heart (it's the current medium-to-long-lifetime buzzword), and understand procedural and functional programming.

hth --Jonas
__________________
now go away or I shall taunt you a second time :D
jonaskoelker is offline   Reply With Quote
Old May 23rd, 2005, 10:31 AM   #18
Clotters
Programmer
 
Join Date: May 2005
Posts: 60
Rep Power: 4 Clotters is on a distinguished road
Do you seriously think Python wold be best for my game?

The reason I was changing my mind was because ...

A) I couldn't find anywhere to create objects and controls, on VB6, it's a breeze, and a game like mine would need tons.

B) After browsing through somestuff I couldn't see anywhere that a 2D engine could be made.

I mean, if these things can dfinately be done, I might reconsider Python and you make a good point about VB.Net being prefered over VB6.
Clotters is offline   Reply With Quote
Old May 23rd, 2005, 10:57 AM   #19
jonaskoelker
Newbie
 
Join Date: May 2005
Location: Denmark
Posts: 13
Rep Power: 0 jonaskoelker is on a distinguished road
Send a message via ICQ to jonaskoelker Send a message via AIM to jonaskoelker Send a message via MSN to jonaskoelker Send a message via Yahoo to jonaskoelker
A)
objects are simple to create

class foo:
  pass # put your class definition here

def somefun():
  myobj = foo()
  myobj.x = 0.5
  myobj.name = 'foo'

exactly what do you mean by `controls'? widget-like things part of the ui?

b)
assuming `somestuff' means `some stuff': which stuff? Did you look at pygame? Be warned: game development isn't easy, but it is rewarding.

else: what is `somestuff'? I tried googling for it, but the links looking most promising turned out to hang/drop/dangle.
__________________
now go away or I shall taunt you a second time :D
jonaskoelker is offline   Reply With Quote
Old May 23rd, 2005, 7:33 PM   #20
al1986
Newbie
 
Join Date: Feb 2005
Posts: 24
Rep Power: 0 al1986 is on a distinguished road
I've not actually got around to reading it yet, but IIRC Game Development With Python (Sean Riley) details creating a 2D game engine using PyOpenGL.
al1986 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC