Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

I've Entered Into The Programming World...


13 replies to this topic

#1 Baniboy

    Advocatus Diaboli

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 878 posts
  • Gender:Male
  • Location:/root
  • Interests:Everything...
  • myCENT:37.47

Posted 03 April 2010 - 09:58 AM

Hi guys. So, until now, all I've been using when it comes to programming langueages is PHP. I got a new phone and I want to program apps for it. The phone I'm using is a Nokia N900. The platform is Maemo 5 (Linux-based) and I have basically two choices when it comes to making apps for it; Python or 'PyMaemo' and Qt. I heard Qt is as hard as C, and I also read that Python takes less time to write than C or Qt. So I've taken up Python, mostly because I know PHP and I don't like declaring variables before using them :P Lazy me... First I plan to learn the 'regular' Python and then after hopefully gaining enough knowledge move onto the Maemo platform.

So, I hope I didn't bore the hell out of you people with that little story of my dreams. :P
Anyway, I'm reading the documentation at the official python website and I'm on page 1 in the last section now. So far I've found it somewhat easy to follow, tho some terms still are a bit unclear to me. Spent about 3 hours learning and trying out stuff and sometimes guessing things a bit ahead based on my knowledge of PHP (though still haven't figured out why 22 returns zero, :D). I haven't coded a script yet, because the documentation I've been reading so far only teaches about the terminal interpreter and stuff like that. The coding part will come later, I guess. I also found that I can use the Python interpreter in the X-terminal on my phone as well, though I find it a bit awkward to type terminal commands on a small keyboard. I'll setup SSH later when I'm developing for the phone, I think.

What I found kinda weird is that there's a 2.6.4 Python version installed on my Ubuntu system, and the latest stable version (2.6.5) is already released on the python website. So I'm not sure if I should wait until the Ubuntu repositories are updated or download the release from the Python.org website. It says it's a source tarball for Linux so I guess I'll have to compile it. So, if I have to compile it, do I have to uninstall the current repo version of Python that I have installed? Even more stupid is that my phone has an even older version, 2.5.4, installed. Argh...

Another 'problem' is that they're teaching us Java in school. And I don't like it. Takes too much time to make it do something, and I can do the same thing in Python much faster. So far I've also heard that Java programs consume a lot of memory and power. To me it just seems that Java is a trend that they're shoving down people's throats. I'm not an expert or anything, but I only see the advantage of cross-platform made easier and web applications when it comes to Java vs. C/C##. I just wish someone came up with a good development platform and stop the Java madness on non-web applications. Qt is nice, and I think I'll try to learn that later after I've got to know Python and Java. With Qt I can also develop for Symbian and OS X instead of only developing for MeeGo and Maemo 5.

I'm also asking for advice regarding what languages I should learn and maybe some advantages of the more complicated programming languages (I know it's a matter of taste, but anyway, just do it). What makes separately creating variables so much better anyway? Or were the Java developers a little crazy with all that caffeine in their veins? ;)


Being a newbie, I would appreciate if you could give me a simple (but logical) task I could do with Python to have something else than simple tut example-duplication to do for a while.
Thanks for the replies in advance.

Edited by Baniboy, 03 April 2010 - 10:01 AM.


#2 mahesh2k

    Trap Double Mocha Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,347 posts
  • Gender:Male
  • Location:Valley of Darkness
  • myCENT:27.17
  • Spam Patrol

Posted 03 April 2010 - 11:11 AM

If you like C++ then QT is one god choice or you can move with java. C# is also cross platform and is deplyed on many platforms where there is java. So you can try that as well. All i can tell you is participate in stackoverflow discussions. They're quite good at giving advice and i learned a lot of deal from there. mix of management, programmers and hobbyist is there so you'll find many people helping you for the python. There are few sarcastic, wanna-bes, bashers and negative type of users so just ignore them cause they just suck up lot of time if you give them too much attention. Even search about "python" on search of stackoverflow will give you lots of good questions and advice.

Find some good projects and pick language that can do the job, get to work.

#3 truefusion

    Coincidence is non-sequitur, therefore everything has a reason for its existence (except if they are eternal).

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 3,216 posts
  • Gender:Male
  • Location:No, not there. Not there either. Yes, you'll never figure it out.
  • Interests:God, Christianity.
  • myCENT:86.16

Posted 03 April 2010 - 02:11 PM

Qt is easy to learn, i use it for all of my GUI programs. It is written in C++ and it is object-oriented. I find it a whole lot easier to work with, especially when compared to the Windows API or GTK. PyMaemo seems to be based off of PyGTK. While PyGTK is easier to work than with GTK in C, it is still a bit annoying. You'll understand why if you try to program complex things with it. Your knowledge in PHP will certainly help you learn Python a lot quicker. I skimmed through most of the Python documentation and quit at chapter 4 and just started coding from there, using intuition as my guide. Recommending you something to program or script up is most of the time not practical (normally do to conflict of interests), so i won't bother. And you don't have to worry about upgrading to the latest version of Python. Python is pretty good at maintaining backwards compatibility, the exception being mostly on the Python modules and Python version 3.

While Qt support for Java (Qt Jambi) has been dropped since, i think, version 4.5 of Qt, you could probably still get a copy of it if you decide to (or are "forced to") work with Java. Nokia is the current owner of Qt, so your Nokia phone may or may not already have Qt installed, but you may (should) be able to get PyQt working on it. If you require any help in Qt, i could provide some help and some old PyQt scripts i did a long time ago. I mostly use Qt with C++ now-a-days, but the API is pretty much the same across different languages.

#4 Baniboy

    Advocatus Diaboli

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 878 posts
  • Gender:Male
  • Location:/root
  • Interests:Everything...
  • myCENT:37.47

Posted 04 April 2010 - 09:26 PM

View Postmahesh2k, on Apr 3 2010, 02:11 PM, said:

If you like C++ then QT is one god choice or you can move with java. C# is also cross platform and is deplyed on many platforms where there is java. So you can try that as well. All i can tell you is participate in stackoverflow discussions. They're quite good at giving advice and i learned a lot of deal from there. mix of management, programmers and hobbyist is there so you'll find many people helping you for the python. There are few sarcastic, wanna-bes, bashers and negative type of users so just ignore them cause they just suck up lot of time if you give them too much attention. Even search about "python" on search of stackoverflow will give you lots of good questions and advice.

Find some good projects and pick language that can do the job, get to work. 

I know C is cross-platform. I just meant like it doesn't run on a cross-platform runtime that acts the same way. Like Qt platform is cross-platform so your software acts the same in all operating systems, although Qt isn't about one language like Java. I could be horribly wrong with everything in the last sentence tho... I will definately check out stackoverflow, thanks for the advice. I don't have a lot of previous programming experience, so I'm just starting with an easy one. I'll try to learn C++ and Qt after Python before I go to university. Although I'll be reading physics and not computer science, probably. Just tired of being such a programming newbie all the time. All you pro-programmers here showing off your scripts and what-not ;) I don't want to stop at PHP...

View Posttruefusion, on Apr 3 2010, 05:11 PM, said:

Qt is easy to learn, i use it for all of my GUI programs. It is written in C++ and it is object-oriented. I find it a whole lot easier to work with, especially when compared to the Windows API or GTK. PyMaemo seems to be based off of PyGTK. While PyGTK is easier to work than with GTK in C, it is still a bit annoying. You'll understand why if you try to program complex things with it. Your knowledge in PHP will certainly help you learn Python a lot quicker. I skimmed through most of the Python documentation and quit at chapter 4 and just started coding from there, using intuition as my guide. Recommending you something to program or script up is most of the time not practical (normally do to conflict of interests), so i won't bother. And you don't have to worry about upgrading to the latest version of Python. Python is pretty good at maintaining backwards compatibility, the exception being mostly on the Python modules and Python version 3.

While Qt support for Java (Qt Jambi) has been dropped since, i think, version 4.5 of Qt, you could probably still get a copy of it if you decide to (or are "forced to") work with Java. Nokia is the current owner of Qt, so your Nokia phone may or may not already have Qt installed, but you may (should) be able to get PyQt working on it. If you require any help in Qt, i could provide some help and some old PyQt scripts i did a long time ago. I mostly use Qt with C++ now-a-days, but the API is pretty much the same across different languages.
PyMaemo is said to be an effort to bring Python libraries to the Maemo 5 platform (on their site). Basically it seems to be a Python distribution for Maemo. I found nothing relating to PyGTK in their FAQ.
PyGTK and Qt and PyQt (these terms are killing me) are available on my phone from what I can tell by looking at the repositories' development section.

Is Python any good for creating GUI apps? Or is it convenient just to script with it and leave the complex stuff to the complex languages. At some point I want to create applications that don't just run in the terminal. Is it bad compared to C/C++ for GUI applications? And should I learn C++ before moving to Qt or start with PyQt after learning Python?

Thanks for helping you both! :P

Edited by Baniboy, 04 April 2010 - 09:30 PM.


#5 truefusion

    Coincidence is non-sequitur, therefore everything has a reason for its existence (except if they are eternal).

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 3,216 posts
  • Gender:Male
  • Location:No, not there. Not there either. Yes, you'll never figure it out.
  • Interests:God, Christianity.
  • myCENT:86.16

Posted 04 April 2010 - 10:12 PM

View PostBaniboy, on Apr 4 2010, 05:26 PM, said:

PyMaemo is said to be an effort to bring Python libraries to the Maemo 5 platform (on their site). Basically it seems to be a Python distribution for Maemo. I found nothing relating to PyGTK in their FAQ.
PyGTK and Qt and PyQt (these terms are killing me) are available on my phone from what I can tell by looking at the repositories' development section.
Perhaps i'm misinterpreting this page then—never used anything related to Maemo, so... But that is good that your phone has all those fun things to work with.

View PostBaniboy, on Apr 4 2010, 05:26 PM, said:

Is Python any good for creating GUI apps? Or is it convenient just to script with it and leave the complex stuff to the complex languages. At some point I want to create applications that don't just run in the terminal. Is it bad compared to C/C++ for GUI applications? And should I learn C++ before moving to Qt or start with PyQt after learning Python?
Python on its own cannot do GUI programming. That's where PyQT, PyGTK, wxPython, et cetera, come in, allowing Python to be a decent scripting language for GUI programming (the GNOME desktop environment makes significant use of Python). Unless you require (really) low-level functionality, then you won't need to dive into more complex languages. Programming in Python will always be easier than programming in C or C++, regardless of it being a GUI program. While learning C or C++ may introduce you into other interesting things that you would normally not need to keep in mind when dealing with scripting languages, i would recommend learning Python first and then diving into GUI modules for Python (specifically PyQt). Then you can decide whether you should learn something like C++ (though by this time you may be too interested in Python to care for other languages).

Oh, and since you know some PHP, you might find this helpful.

#6 networker

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 661 posts
  • Gender:Male
  • myCENT:35.34

Posted 05 April 2010 - 03:33 AM

View Posttruefusion, on Apr 4 2010, 10:12 PM, said:

Python on its own cannot do GUI programming. That's where PyQT, PyGTK, wxPython, et cetera, come in, allowing Python to be a decent scripting language for GUI programming (the GNOME desktop environment makes significant use of Python).

That doesn't make any sense. That's like saying that with with Java on it's own,you can't do GUI programming.
That's the whole purpose of classes(for instance, Java swing for Java GUI, Tkinter for python GUI), you import them to
increase your functionality.
The class capability of Java and Python is what makes them unlimited.

#7 truefusion

    Coincidence is non-sequitur, therefore everything has a reason for its existence (except if they are eternal).

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 3,216 posts
  • Gender:Male
  • Location:No, not there. Not there either. Yes, you'll never figure it out.
  • Interests:God, Christianity.
  • myCENT:86.16

Posted 05 April 2010 - 05:29 AM

View Postnetworker, on Apr 4 2010, 11:33 PM, said:

That doesn't make any sense. That's like saying that with with Java on it's own,you can't do GUI programming.
That's the whole purpose of classes(for instance, Java swing for Java GUI, Tkinter for python GUI), you import them to
increase your functionality.
The class capability of Java and Python is what makes them unlimited.
Make a class in Python that makes a window (i.e. a non-console program) with only the base (core) Python package, then upload the source code, if you feel it is possible.

What do you think these GUI modules make use of? PyQt won't work without the Qt/C++ libraries; PyGTK won't work without the GTK C libraries; et cetera.

Comparing Python with Java doesn't seem proper, though. I don't use Java, nor have i ever made anything—let alone attempted to make anything—in Java, but doesn't Java provide its own GUI utilites? If not, then it is the same with what i said about Python.

#8 Baniboy

    Advocatus Diaboli

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 878 posts
  • Gender:Male
  • Location:/root
  • Interests:Everything...
  • myCENT:37.47

Posted 05 April 2010 - 09:51 AM

View Posttruefusion, on Apr 5 2010, 01:12 AM, said:

1. Perhaps i'm misinterpreting this page then—never used anything related to Maemo, so... But that is good that your phone has all those fun things to work with.

2. Python on its own cannot do GUI programming. That's where PyQT, PyGTK, wxPython, et cetera, come in, allowing Python to be a decent scripting language for GUI programming (the GNOME desktop environment makes significant use of Python).

3. Unless you require (really) low-level functionality, then you won't need to dive into more complex languages. Programming in Python will always be easier than programming in C or C++, regardless of it being a GUI program. While learning C or C++ may introduce you into other interesting things that you would normally not need to keep in mind when dealing with scripting languages, i would recommend learning Python first and then diving into GUI modules for Python (specifically PyQt). Then you can decide whether you should learn something like C++ (though by this time you may be too interested in Python to care for other languages).

Oh, and since you know some PHP, you might find this helpful.

1. I am no expert but they kind of seem to include that in the package (PyGTK). Like into the python distribution. So I guess if I have to do a GUI app I either have to use PyGTK in PyMaemo or PyQt. Yea it's fun to have all those things to work with but currently it's like putting a monkey in front of a computer. I don't know how to... :P

2. Oh, thanks for clearing that out. ;)

3. So I'll try to develop some useless apps/scripts with Python first as I don't know what kind of project I would like to work on. Then move to C++ when I have a goal. After a small research of programs made by PyQt I noticed the list wasn't as "impressive" compared to C++ Qt. Speaking of C/C++, what's the difference between them? Like is C++ and upgrade of C like XHTML-HTML? Do I have to learn C before C++ or should I just go ahead with C++ when I want to?

Thanks for the link, I even learned something about PHP there (I didn't remember endif... lol. Always used else break for that). Some of the stuff I haven't yet learned so I don't know what the code meant y in Python. But it's helpful, thanks.

Btw, have you tried PHP-Qt? Just read a little about it. Kinda cool but I fear may be ineffective compared to other languages in Qt as it is a server-side scripting language. They say they have an easy way for making GUIs (Qt Designer), tho.

Thanks for helping.

#9 truefusion

    Coincidence is non-sequitur, therefore everything has a reason for its existence (except if they are eternal).

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 3,216 posts
  • Gender:Male
  • Location:No, not there. Not there either. Yes, you'll never figure it out.
  • Interests:God, Christianity.
  • myCENT:86.16

Posted 05 April 2010 - 02:01 PM

View PostBaniboy, on Apr 5 2010, 05:51 AM, said:

So I'll try to develop some useless apps/scripts with Python first as I don't know what kind of project I would like to work on. Then move to C++ when I have a goal. After a small research of programs made by PyQt I noticed the list wasn't as "impressive" compared to C++ Qt. Speaking of C/C++, what's the difference between them? Like is C++ and upgrade of C like XHTML-HTML? Do I have to learn C before C++ or should I just go ahead with C++ when I want to?
Yeah, most Qt development is done in C++, and some people use PyQt to start their Qt projects in to later convert them into C++ code, but much of what is done in C++ concerning Qt can be done in Python too.

C++ used to be called "C with objects," it was what introduced object-oriented programming into C. However, since then C++ has grown a lot and has introduced other new things that are not found in C, but all C code is legal C++ code. It is not recommended to first learn C so that you may dive into C++. C is its own beast (;)) and you may pick up habits from C that may not be required or may be counter-productive if used in C++.

View PostBaniboy, on Apr 5 2010, 05:51 AM, said:

Thanks for the link, I even learned something about PHP there (I didn't remember endif... lol. Always used else break for that). Some of the stuff I haven't yet learned so I don't know what the code meant y in Python. But it's helpful, thanks.
No problem.

View PostBaniboy, on Apr 5 2010, 05:51 AM, said:

Btw, have you tried PHP-Qt? Just read a little about it. Kinda cool but I fear may be ineffective compared to other languages in Qt as it is a server-side scripting language. They say they have an easy way for making GUIs (Qt Designer), tho.
I have tried PHP-Qt, yes. I believe KDE took over the project a while back, but i am uncertain of its current development. Back when i tried it out, PHP-Qt was too immature (not complete) to be able to do everything i could as with PyQt or C++ (or as the Qt documentation showed). It may be more complete now, but i haven't bothered to check. The nice part about it, though, was that i could practically copy and paste some C++ code, remove the type declarations, add $ where needed, et cetera, into the PHP code and it would run fine, insofar as all the functions and classes were supported. By the way, PHP 5 is what is better suited for desktop development. PHP 5 is what introduced more common object-oriented programming features, which is what allowed PHP to be suitable for desktop application programming.

Qt Designer is a drag-and-drop GUI editor which generates UI files (which are really just XML files) to be used by any language that supports Qt. The same UI file can be used for PyQt, C++, Qt for Ruby, et cetera. You can also have your Qt program make use of different UI files which would be loaded dynamically by your program. (For GTK a similar editor, but not as complex, is available known as Glade.) To understand how to design in Qt Designer, you'll have to understand how the Qt layout system works, otherwise you may find yourself inputting absolute coordinates that would have otherwise been taken care of by the layout system. I use Qt Designer most of the time (since it is a whole lot easier and faster than typing out all of that code by hand), unless i require a more complex GUI.

#10 mahesh2k

    Trap Double Mocha Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,347 posts
  • Gender:Male
  • Location:Valley of Darkness
  • myCENT:27.17
  • Spam Patrol

Posted 05 April 2010 - 09:51 PM

So far i tried using Wxpython and i must say under windows development wxpython sucks. I'm not sure why but it has lot of isssues. I found wxwidgets(C++) much better than this python fork. wish it gets it's own open source GUI IDE like visual studio. wxwidgets is one thing you can learn other than if you don't want QT's license and other BS stuff.

Oh wxwdigets is cross platform and works with mobile platforms as well. There are some forks of it like wxpython and some commercial language forks. Wxwidgets has it's limits and you'll hit on walls more than QT. QT is having less steep learning curve than wxwidgets. It has GUI designer, help file and lots of tutorials to learn from in comparison to wxwidgets.
I'm also interested in GUI development using Python. I figured out working with some 3rd party libs and py2exe is one hell of tool you need to use for making python scripts into executable. Keep this thread alive maybe i'll learn from this as well.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users