Baniboy 3 Report post Posted April 3, 2010 (edited) 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 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. 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, ). 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 thePython.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 April 3, 2010 by Baniboy (see edit history) Share this post Link to post Share on other sites
mahesh2k 0 Report post Posted April 3, 2010 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. Share this post Link to post Share on other sites
truefusion 3 Report post Posted April 3, 2010 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. Share this post Link to post Share on other sites
Baniboy 3 Report post Posted April 4, 2010 (edited) 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... 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! Edited October 3, 2016 by OpaQue (see edit history) Share this post Link to post Share on other sites
truefusion 3 Report post Posted April 4, 2010 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. 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. Share this post Link to post Share on other sites
networker 0 Report post Posted April 5, 2010 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 toincrease your functionality. The class capability of Java and Python is what makes them unlimited. Share this post Link to post Share on other sites
truefusion 3 Report post Posted April 5, 2010 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. Share this post Link to post Share on other sites
Baniboy 3 Report post Posted April 5, 2010 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... 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. Share this post Link to post Share on other sites
truefusion 3 Report post Posted April 5, 2010 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++.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.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. Share this post Link to post Share on other sites
mahesh2k 0 Report post Posted April 5, 2010 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. Share this post Link to post Share on other sites
k_nitin_r 8 Report post Posted May 4, 2010 Hi!@BaniboyLinux-based phones are pretty neat because they are open and there's a lot more that you can do with them when compared to other types of devices. Apple locks down most of its phones and mobile devices so I'm pretty sure that the iPhone 2G that I have right now is the last purchase that I would be making from them unless they come up with something truly revolutionary and amazing that would blow my socks off.Qt is a library that you would use when programming in C, so comparing Qt to C isn't really appropriate (Qt... cutie... the cutie always wins over all else because she turns out to be the one that survives through all else at the end of the movie in the fact of earthquakes, zombie attacks, mutantation-inducing viruses, and stuff of the sort). It is like comparing the engine to the automobile when saying that they are both really powerful when in fact one fits within the other. Python is definitely so much easier to develop with because of the fact that it is a scripting language and you can get away without having to concern yourself with things like memory management and type declarations. Python has another unique feature - you do not use brackets to define blocks, such as functions and control structure statements, but rather you would be using indentations. That's right, you would indent all of the statements within a function to indicate that they belong to the function. It's a case of convention over configuration and there's really not much to learning it since you're pretty much indenting your code already when following coding conventions.BTW, I'm not really sure of what you mean when you say that two squared is zero, because my Y2K-compatible brain and my trusty calculator would both agree that it is four. Perhaps I need an upgrade - new brain and a new calculator. Are you running Ubuntu 10.04? Ubuntu was released quite recently so if they haven't included Python 2.6.5 yet, I would look for any updates that Ubuntu provides from its package repository. Using the repositories ensures that the automatic update checks for the latest versions instead of having to stay signed onto mailing lists or watching RSS feeds to stay informed. In either case, it is just a minor version update so you do not really have to concern yourself with sticking to the latest version - it is probably just a bug fix or something minor that will not stop you from achieving what you want to do and should not affect development in any way, unless the bug that they've fixed is relevant to something that you want to do.Learning Java is one of the best things that you can do because when you do start developing programs with Java, you can write a piece of code once and can expect it to run on all kinds of devices, or at least that's the theory that holds good in most cases and as with all other things in the world, there are exceptions. Java does tend to consume a lot of memory but since memory is cheap, it isn't something that we need to worry about. When running Java on a mobile device, the virtual machine (or runtime) takes care of memory management in a more aggressive manner, so yet again you don't really have to make any changes to your code but instead the device manufacturer has things tweaked to run perfectly on the mobile device. I had a Nokia Communication 9210i and that could literally run the compiled Java bytecode (.class files) without requiring any packaging. That was so cool, because I could just write a piece of code, compile it, copy it onto a memory card or hook up the phone to the serial port and get the file across, and use the file manager to execute the Java code just as I would execute any other piece of code through Windows explorer. Java is also used to build enterprise applications and right now, I see just two platforms that are making it really big and those are the Java platform and the Microsoft .NET platform. Other scripting languages, such as PHP and Python, are quite popular but in terms of performance, they do lag a bit and are more CPU-intensive than their Java and .NET equivalents. I still do use PHP for my development because I'm not expecting to build a web based application that attracts thousands of users within the first couple of months, but I'm not saying that it is impossible. If such a load does exist, I would probably do whatever I can through caching while building a Java or .NET based version of the web application. Share this post Link to post Share on other sites
roger112 0 Report post Posted May 5, 2010 Thanks man for the info.I have been trying to learn how to program on my own for the past six months..I have read a few books on programming especially PHP and Java.I now know how to do PHP but Java has been the stumbling block. Its not one of my biggest passions I have to say...mainly because its soo freakin strict! lol!! Well my thinking is that if I can grasp the basics, I can then apply them across other languages, especially web programming, which is my biggest passion and I'm starting a web design business anyway.My biggest question is, should i persevere with Java or try out Python? I'm passionate about open source software anyways...can someone help? Share this post Link to post Share on other sites
truefusion 3 Report post Posted May 5, 2010 My biggest question is, should i persevere with Java or try out Python?If you are planning on making a living from this some day, then i would say go with Java. If you are just planning on sticking to personal projects, then i would suggest Python. Personally, i would always pick Python over Java, but you can't always have it your way out in the world. Share this post Link to post Share on other sites
k_nitin_r 8 Report post Posted May 6, 2010 Hi!@TrueFusionI believe Java and Python are just as popular, except that Java is more popular for enterprise computing projects while Python is more popular for web development and scripting projects. We rarely hear about enterprise service and messaging buses for PHP and Python, though interfaces for Python and PHP do exist, but they are commonly associated with Java. Sure, Java may be more of a memory hog, but it does ensure that the system is able to run across multiple platforms without modification and maintains binary compatibility, which is more than what we can say for most other development platforms including the Microsoft .NET platform. There are, however, disadvantages of using Java. You can't really match the development speed that you get when working with PHP or the Microsoft .NET platform and you don't really get the cool development tools that Microsoft has to offer. Sure, we have Eclipse and NetBeans but Microsoft commercially builds and licenses Microsoft Visual Studio and the Team Foundation server while providing express versions of Visual Studio for free. Share this post Link to post Share on other sites