The very first thing I want to say is, "I'm not an expert when it comes to ANYTHING Linux. This includes Python and/or glade and/or Gtk widgets, etc. So, when you see something in this series of tutorials (Yes, I'm going to be subjecting you to a series of these things) that doesn't quite pass the "smell test", that's your signal to say something.
On the plus side, I've been a programmer of one sort or another since about 1977 (yep, I qualify for the gray-haired crowd) and I've used (and forgotten) more languages than I care to remember (hmmm forgotten .... not wanting to remember .... hmmm .... maybe I'm onto something there). Granted, some of these languages are not worth much and didn't get a lot of exposure.
Question: Anyone remember the "Forth" language (reference -- > https://en.wikipedia.org/wiki/Forth_%28 ... anguage%29) Yep, I spent way too much time playing with that one.
Back on Topic: What I'm proposing to present in this series are little code snippets that demonstrate some feature or capability that I'm trying to figure out. The code being the results of "successfully" finding at least one way to get things done.
No tutorial intro would be complete without a long, long, long list of references. Sorry to disappoint. But here are some I've found useful so far:
- http://blog.borovsak.si/2009/09/glade3- ... ction.html
- http://python-gtk-3-tutorial.readthedoc ... index.html
- http://learnpythonthehardway.org/book/ (yes, he has a book to sell, but there's some good info there)
- http://www.micahcarrick.com/gtk-glade-t ... art-1.html - Dated, has some errors, but the concepts are good to understand
- I guess the first thing that needs to be done is to make sure you have everything you're going to need. This link (http://forums.solydxk.nl/viewtopic.php?f=12&t=3604) outlines what packages I first installed. Most (many?) are not going to be needed but, so far, everything I've tried has worked ... including compiling my own copy of the glade package (just for fun!).
- In addition to that, I've also installed
- Display a window
- Get data from an entry field
- Write data to an entry field
- Do a bit of error trapping (exception handling)
- Shutdown the window and terminate the hosting Python process - yes, I found many way to fail at this!
- http://www.overclock.net/t/342279/tutor ... pplication
- https://www.youtube.com/playlist?list=P ... ature=plcp
To supplement those tutorials, I've included here the two files I created (following the tutorials as best I can). The value I've added is that this will work with Gtk+-3 and with glade 3.16.1 (from the repos, remember ). I've also removed the errors from the code and added comments to help explain what each set of lines is doing.
To use the example (code files at the bottom of the post):
- Download the tar file
- Move/copy the file to a good working location
- Open it with the archive software of your choice or use the command
Code: Select all
tar xfj Adder.tar.bz2
- Type the command
Code: Select all
If all goes as planned, the application should start up looking something like this: And, when you enter invalid info and click the "Add" button, you should get something like this: Coming in Python/Glade Tutorial:Part 2 - ComboBoxes, How to create them, populate them, use them. And, Part 2 will be the starting point for a future episode!
- Part 1 - An Intro, Data entry, exception handling --> http://forums.solydxk.nl/viewtopic.php?f=9&t=3776