# Tutorial - Third Program

### KXmlGuiWindow

In this tutorial, we'll take another step towards building a more useful (if still simple) application. Most graphical programs include things like menus, toolbars and statusbars. This tutorial will move us in the direction of being able to provide those things.

Once again, we've made a few simple changes to the previous program. The first is in the class we've subclassed to create our main window. In fact all of the changes take place in class MainWindow

    class MainWindow (KXmlGuiWindow):
        def __init__ (self):
            KXmlGuiWindow.__init__ (self)

            textArea =  KTextEdit ();
            self.setCentralWidget(textArea);
            self.setupGUI()

Note first that MainWindow now inherits KXmlGuiMainWindow, not KMainWindow as in the previous tutorial. Correspondingly, we also change the initialization call.

We've also added a KTextEdit, which is a simple text editor widget, and made it the main (central) widget in our program.

Lastly, we've made a call to setupGUI (). To see what effect this has, run the program. You'll find it now has a menubar and statusbar. From the Help menu, you can select About KXmlGuiWindow and see what effect KAboutData has.

KXmlGuiWindow manages the machinery necessary to provide menus, toolbars and a statusbar. In this case, KDE gave us some simple menus, but probably not exactly what we need for our application. The next step looks at using KAction and KStandardAction to tailor the user interface to what we want.

#### Acknowledgement

This tutorial is based on the original KDE KXmlGuiWindow tutorial found on Techbase.