Part 1a

Create a Simple GUI


You need to have LinuxCNC 2.5 installed to have the GladeVCP additions HAL Python and VCP Actions in Glade.

I have Glade 3.6.7 installed and Python 2.6.5 so these versions or anything newer should work.

Glade Project

  1. Run Glade3 and the first screen you will see is the Project Preferences. For now you can just accept the defaults.

  2. Now you have an empty project. Press F1 to bring up the help menu then select Getting Started. Notice what each section of the Glade3 Interface is called.

    First thing we need is a window so from the Palette > Toplevels click on the window and save as

    Your project should look like this now.

  3. From the Palette > Containers click on the vertical box, then click in the window and change the number to four in the pop up.

    Your project should look like this now.

  4. Now we will add a Menu Bar to the top section of the vertical box from the Containers, a Tool Bar to the second section, a Notebook to the third section, and a Status Bar to the fourth section from the Controls and Display section. Notice how the tool bar disappeared from view… we will address that in a bit.

    Your project should look like this now.

  5. The first thing we will do is make the thing quit without complaining. Click on the menu bar then click on the Editor on the tool bar. This opens up the Edit Menu Bar window. Click on the Hierarchy tab and click on imagemenuitem5. Change the Name: to gtk_quit and close that window.

  6. Double click on the File menu item on the center screen and click on Quit to select it in the tree. In the Signals tab of the Properties dialog under GtkMenuItem in the Handler column click on the <Type here> next to the activate Signal. From the drop down box select on_gtk_quit_activate then press Enter. If you don’t press the Enter key your selection will not take.

    Your project should look like this now.

  7. Next we need to create a signal from the main window if someone clicks on the X in the corner to close the window. Click on window1 in the Inspector then the Signals tab and then GtkObject and for the handler select on_window1_destroy and don’t forget to press the Enter key!

    Your project should look like this now.

  8. Now for some GladeVCP magic. If you followed the manual correctly you will two extra groups on the left of Glade, HAL Python and VCP Actions. In the VCP Actions find VCP ToggleAction ESTOP and click on that. This will add the vcp_toggleaction_estop1 to the Action part of the tree. In the General tab click on Stock Icon: and pick Stop.

    Your project should look like this now.

  9. Find toolbar1 on the tree and click on it then click on the Editor on the button bar. Go to the Hierarchy tab and click on Add. Change the button Type: to Toggle. Pick hal_toggleaction_estop1 from the list for Related Action: Next select Use Action Appearance: to Yes and our icon will show up on the tool bar. Close that window.

  10. Just so the tabs show up plop a GtkLabel into each one before you quit.

    Your project should look like this now.


Ok, that’s it for the Glade part of this tutorial. Save your Glade3 file if you have not saved it yet as to an empty directory and don’t forget to type in the .glade extension as it is not automagiclly added.