Create application on linux

Make Apps for Linux

Desktop and mobile Linux users have a healthy appetite for new software. Linux app stores and repositories lack applications compared to their proprietary counterparts.

Technical enthusiasts are encouraged to direct their passion and creativity towards creating fresh apps for Linux users.

Too often they fall into the trap of creating more Linux distributions. We don’t need more Linux distributions. Stop making Linux distributions, make applications instead.

Why create more applications

Scratch an Itch

Ever had an idea for an application you personally need? You may find others have a similar desire for your application idea. Scratch that itch.

Broaden the ecosystem

New applications can inspire new developers on Linux. Building applications in the open allows developers even newer than yourself to learn and get started. Help build the next Linux app generation.

Be creative

Developing applications is a naturally creative endeavour. The sense of fulfilment gained when completing a project can be very rewarding. Exercise that half of your brain.

Collaborate

Building applications fosters communities. Linux communities often want to help developers succeed. Make something people want, and build a group of fans and contributors around it.

Learn new skills

Developing applications is a sought-after skill. There are many free training resources to help you learn to develop software. Level up your rГ©sumГ©!

Earn a wage

Build popular paid applications and services. It’s a myth that Linux users don’t support developers financially. Use this as an opportunity to create a new source of income for yourself.

Target all the Linux distributions

Unlike other platforms, Linux is a very diverse target. There are hundreds of Linux distributions, some more popular than others. Once published though, applications can generally work everywhere.

There are well documented software packaging and distribution systems which enable developers to get their applications into the hands of users.

Each developer framework and Linux distribution will have their own recommended route to users. When you’re ready to share your creation, the development documentation will signpost their suggested packaging guides.

Where to start

GNOME

The GNOME project builds the popular GNOME Shell desktop, and enables development based around Gjs and Gtk. Popular programming languages may be used with Gtk, including Python, C, C++, Rust, and even Javascript.

KDE Frameworks

KDE produces the widely-used Plasma desktop and the tools and frameworks to create applications. The KDE Frameworks have enabled the development of many diverse desktop applications. KDE Frameworks primarily leverage the Qt toolkit and C++ programming language.

elementary OS

elementary OS is a fast, open, and privacy-respecting replacement for Windows and macOS. The developers have built a desktop and ecosystem in which developers build applications. Their developer guide recommends Vala and Gtk for application development.

Electron

Electron enables developers to build cross-platform desktop apps with JavaScript, HTML, and CSS. Electron developers can leverage the vast library of node modules to build their own applications on web technologies.

Ubuntu Touch

Ubuntu Touch is an open source operating system designed to run on a variety of devices from phones to tablets and PCs. Native Ubuntu Touch applications are made using QML or HTML with their behavior defined in JavaScript, C++, Python, Rust or Go.

Читайте также:  Драйвера для ноутбука lenovo z570 windows 10

Developer opinion

We need to ensure a thriving app ecosystem to bring Linux to the masses. Our dream of an open desktop, accessible to all can only be achieved by enabling everyone to develop for Linux.

Neil McGovern

To make Linux the operating system we all want, we need great apps. Join us, you will find the tools to create everything you ever imagined!

Aleix Pol

There’s a unique opportunity with desktop Linux to not only build great apps, but to help shape platform APIs and influence the overall direction of the desktop you’re publishing on.

Daniel ForГ©

Working on Linux apps is a completely different experience from developing for a closed ecosystem. Though we’re technically competitors, in the end, we’re all collaborating on the same bigger vision.

Jan Sprinz

Sharing Your Creation

AppCenter

Publish and monetize your app on AppCenter, the open, pay-what-you-want app store and build service for indie developers. Publish without disrupting your workflow—the AppCenter Dashboard integrates with GitHub for releases and issue tracking.

AppImage

Distribute your desktop Linux application in the AppImage format and win users running all common Linux distributions. Package once and run everywhere. Reach users on all major desktop distributions.

Flatpak

Flatpak is a framework for distributing desktop applications on Linux. It has been created by developers who have a long history of working on the Linux desktop, and is run as an independent open source project.

Open Build Service

The openSUSE Build Service is the public instance of the Open Build Service (OBS) used for development of the openSUSE distribution and to offer packages from same source for Fedora, Debian, Ubuntu, SUSE Linux Enterprise and other distributions.

Snapcraft

Snapcraft is a powerful and easy to use command line tool for building snaps. Snaps are app packages for desktop, cloud and IoT that are easy to install, secure, cross-platform and dependency-free.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Источник

How to Create GUI Applications Under Linux Desktop Using PyGObject – Part 1

Creating applications on Linux can be done using different ways, but there are a limited ways of doing, so using the simplest and the most functional programming languages and libraries, that’s why we’re going to have a quick look about creating applications under the Linux desktop using the GTK+ library with Python programming language which is called “PyGObject”.

PyGObject uses the GObject Introspection to create binding for programming languages like Python, PyGObject is the next generation from PyGTK, you can say that PyGObject = Python + GTK3.

Create GUI Applications in Linux – Part 1

Today, we’re going to start a series about creating GUI (Graphical User Interface) applications under the Linux desktop using GTK+ library and PyGobject language, the series will cover the following topics:

About Python

First of all, you must have some basic knowledge in Python; Python is a very modern and easy to use programming language. It’s one of the most famous programming languages in the world, using Python, you will be able to create many great applications & tools. You may take some free courses like those at codeacademy.com or you may read some books about Python at:

About GTK+

GTK+ is an open-source cross-platform toolkit to create graphical user interfaces for desktop applications, it was first started in 1998 as a GUI toolkit for the GIMP, later, it was used in many other applications and soon became one of the most famous libraries to create GUIs. GTK+ is released under the LGPL license.

Creating GUI Applications Under Linux

There are 2 ways for creating the applications using GTK+ & Python:

  1. Writing the graphical interface using code only.
  2. Designing the graphical interface using the “Glade” program; which is RAD tool to design GTK+ interfaces easily, Glade generates the GUI as a XML file which can be used with any programming language to build the GUI, after exporting the GUI’s XML file, we’ll be able to link the XML file with our program to do the jobs we want.
Читайте также:  Windows x86 sp3 rus

We’ll explain both ways in short.

The Code-Only Way

Writing the GUI using code only can be little bit hard for noob programmer’s and very time-wasting, but using it, we can create very functional GUIs for our programs, more than those we create using some tools like Glade.

Let’s take the following example.

Copy the above code, paste it in a “test.py” file and set 755 permission on the test.py file and run the file later using “./test.py”, that’s what you will get.

Hello World Script

By clicking the button, you see the “Hello, World!” sentence printed out in the terminal:

Test Python Script

Let me explain the code in detailed explanation.

  1. #!/usr/bin/python: The default path for the Python interpreter (version 2.7 in most cases), this line must be the first line in every Python file.
  2. # -*- coding: utf-8 -*-: Here we set the default coding for the file, UTF-8 is the best if you want to support non-English languages, leave it like that.
  3. from gi.repository import Gtk: Here we are importing the GTK 3 library to use it in our program.
  4. Class ourwindow(Gtk.Window): Here we are creating a new class, which is called “ourwindow”, we are also setting the class object type to a “Gtk.Window”.
  5. def __init__(self): Nothing new, we’re defining the main window components here.
  6. Gtk.Window.__init__(self, title=”My Hello World Program”): We’re using this line to set the “My Hello World Program” title to “ourwindow” window, you may change the title if you like.
  7. Gtk.Window.set_default_size(self, 400,325): I don’t think that this line need explanation, here we’re setting the default width and height for our window.
  8. Gtk.Window.set_position(self, Gtk.WindowPosition.CENTER): Using this line, we’ll be able to set the default position for the window, in this case, we set it to the center using the “Gtk.WindowPosition.CENTER” parameter, if you want, you can change it to “Gtk.WindowPosition.MOUSE” to open the window on the mouse pointer position.
  9. button1 = Gtk.Button(“Hello, World!”): We created a new Gtk.Button, and we called it “button1”, the default text for the button is “Hello, World!”, you may create any Gtk widget if you want.
  10. button1.connect(“clicked”, self.whenbutton1_clicked): Here we’re linking the “clicked” signal with the “whenbutton1_clicked” action, so that when the button is clicked, the “whenbutton1_clicked” action is activated.
  11. self.add(button1): If we want our Gtk widgets to appear, we have to add them to the default window, this simple line adds the “button1” widget to the window, it’s very necessary to do this.
  12. def whenbutton1_clicked(self, button): Now we’re defining the “whenbutton1_clicked” action here, we’re defining what’s going to happen when the “button1” widget is clicked, the “(self, button)” parameter is important in order to specific the signal parent object type.
  13. print “Hello, World!”: I don’t have to explain more here.
  14. window = ourwindow(): We have to create a new global variable and set it to ourwindow() class so that we can call it later using the GTK+ library.
  15. window.connect(“delete-event”, Gtk.main_quit): Now we’re connecting the “delete-event” signal with the “Gtk.main_quit” action, this is important in order to delete all the widgets after we close our program window automatically.
  16. window.show_all(): Showing the window.
  17. Gtk.main(): Running the Gtk library.

That’s it, easy isn’t? And very functional if we want to create some large applications. For more information about creating GTK+ interfaces using the code-only way, you may visit the official documentation website at:

The Glade Designer Way

Like I said in the beginning of the article, Glade is a very easy tool to create the interfaces we need for our programs, it’s very famous among developers and many great applications interfaces were created using it. This way is called “Rapid applications development”.

Читайте также:  Функции ввода вывода windows

You have to install Glade in order to start using it, on Debian/Ubuntu/Mint run:

On RedHat/Fedora/CentOS, run:

After you download and install the program, and after you run it, you will see the available Gtk widgets on the left, click on the “window” widget in order to create a new window.

Create New Widget

You will notice that a new empty window is created.

New Window Widget

You can now add some widgets to it, on the left toolbar, click on the “button” widget, and click on the empty window in order to add the button to the window.

Add Widget

You will notice that the button ID is “button1”, now refer to the Signals tab in the right toolbar, and search for the “clicked” signal and enter “button1_clicked” under it.

Button Properties Signals Tab

Now that we’ve created our GUI, let’s export it. Click on the “File” menu and choose “Save”, save the file in your home directory in the name “myprogram.glade” and exit.

Export Widget File

Now, create a new “test.py” file, and enter the following code inside it.

Save the file, give it 755 permissions like before, and run it using “./test.py”, and that’s what you will get.

Hello World Window

Click on the button, and you will notice that the “Hello, World!” sentence is printed in the terminal.

Now let’s explain the new things:

  1. class Handler: Here we’re creating a class called “Handler” which will include the the definitions for the actions & signals, we create for the GUI.
  2. builder = Gtk.Builder(): We created a new global variable called “builder” which is a Gtk.Builder widget, this is important in order to import the .glade file.
  3. builder.add_from_file(“myprogram.glade”): Here we’re importing the “myprogram.glade” file to use it as a default GUI for our program.
  4. builder.connect_signals(Handler()): This line connects the .glade file with the handler class, so that the actions and signals that we define under the “Handler” class work fine when we run the program.
  5. ournewbutton = builder.get_object(“button1”): Now we’re importing the “button1” object from the .glade file, we’re also passing it to the global variable “ournewbutton” to use it later in our program.
  6. ournewbutton.set_label(“Hello, World!”): We used the “set.label” method to set the default button text to the “Hello, World!” sentence.
  7. window = builder.get_object(“window1”): Here we called the “window1” object from the .glade file in order to show it later in the program.

And that’s it! You have successfully created your first program under Linux!

Of course there are a lot more complicated things to do in order to create a real application that does something, that’s why I recommend you to take a look into the GTK+ documentation and GObject API at:

Have you developed any application before under the Linux desktop? What programming language and tools have used to do it? What do you think about creating applications using Python & GTK 3?

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Оцените статью