View Single Post
electroaudio's Avatar
Posts: 381 | Thanked: 336 times | Joined on Jan 2011 @ Stockholm, Sweden
#18
Originally Posted by som3a View Post
i think these GUI called on some how themes !
i was thinking that it made by QT/QML ,,

can any one gimme a simple definition for QT/QML
i kinda confused right now , is these QT/QML are self independent programming language , or it count on other languages ?
QT is the graphical toolkit that KDE is built upon while GTK is the toolkit for Gnome, they are *not* programming languages in themselves.
They provide a framework with functions to call from programs to make and control windows, buttons and a lot of other gui elements.
Both of them are just #includes in your programminglanguage of choice, and you can choose whichever toolkit you like.
...And maybe even mix them in the same program??

Here is a explanation of QML http://en.wikipedia.org/wiki/QML
But in short, it is just a special version of javascript with QT functions built into it.

Some codingexamples for QT and GTK in Python

Hello world written in Python with QT.
Code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Here we provide the necessary imports.
# The basic GUI widgets are located in QtGui module. 
import sys
from PyQt4.QtGui import *
 
# Every PyQt4 application must create an application object.
# The application object is located in the QtGui module.
a = QApplication(sys.argv)
 
# The QWidget widget is the base class of all user interface objects in PyQt4.
# We provide the default constructor for QWidget. The default constructor has no parent.
# A widget with no parent is called a window. 
w = QWidget()
 
w.resize(320, 240)  # The resize() method resizes the widget.
w.setWindowTitle("Hello, World!")  # Here we set the title for our window.
w.show()  # The show() method displays the widget on the screen.
 
sys.exit(a.exec_())  # Finally, we enter the mainloop of the application.
And the same helloworld program with GTK
Code:
import gtk
 
def create_window():
    window = gtk.Window()
    window.set_default_size(200, 200)
    window.connect('destroy', gtk.main_quit)
 
    label = gtk.Label('Hello World')
    window.add(label)
 
    label.show()
    window.show()
 
create_window()
gtk.main()
__________________
Deskypplet , a desktop for N900 *RIP*

Last edited by electroaudio; 2012-08-14 at 10:25.
 

The Following 2 Users Say Thank You to electroaudio For This Useful Post: